diff --git a/files/alembic.ini b/files/alembic.ini index 94c540bb1f..4e08741d45 100644 --- a/files/alembic.ini +++ b/files/alembic.ini @@ -35,7 +35,7 @@ script_location = /usr/share/securedrop-client/alembic # are written from script.py.mako # output_encoding = utf-8 -sqlalchemy.url = sqlite:////home/user/.securedrop_client/data/svs.sqlite +sqlalchemy.url = sqlite:////home/user/.securedrop_client/svs.sqlite # Logging configuration diff --git a/files/securedrop-client b/files/securedrop-client index f2ec96ecea..7f7e06c91d 100755 --- a/files/securedrop-client +++ b/files/securedrop-client @@ -1,13 +1,11 @@ #!/bin/sh -mkdir -p ~/.securedrop_client/logs -mkdir -p ~/.securedrop_client/data -chmod 0700 ~/.securedrop_client/logs -chmod 0700 ~/.securedrop_client/data +mkdir -p ~/.securedrop_client chmod 0700 ~/.securedrop_client cd /opt/venvs/securedrop-client + # Now let us try to run alembic first -./bin/alembic -c /etc/securedrop-client/alembic.ini upgrade head +./bin/alembic -c /usr/share/securedrop-client/alembic.ini upgrade head # Now execute the actual client -./bin/sd-client \ No newline at end of file +./bin/sd-client diff --git a/run.sh b/run.sh index 405d73d552..ae8024423a 100755 --- a/run.sh +++ b/run.sh @@ -16,20 +16,14 @@ while [ -n "$1" ]; do done SDC_HOME=${SDC_HOME:-$(mktemp -d)} -DB_HOME=$SDC_HOME/data -LOGS_HOME=$SDC_HOME/logs -export SDC_HOME DB_HOME LOGS_HOME +export SDC_HOME -mkdir -p $DB_HOME -mkdir -p $LOGS_HOME chmod 0700 $SDC_HOME -chmod 0700 $DB_HOME -chmod 0700 $LOGS_HOME echo "Running app with home directory: $SDC_HOME" # create the database for local testing -./createdb.py $DB_HOME +./createdb.py $SDC_HOME -exec python -m securedrop_client --sdc-home "$SDC_HOME" $@ +exec python -m securedrop_client --sdc-home "$SDC_HOME" --no-proxy $@ diff --git a/securedrop_client/app.py b/securedrop_client/app.py index e49b311a88..56a0a4a227 100644 --- a/securedrop_client/app.py +++ b/securedrop_client/app.py @@ -106,7 +106,7 @@ def arg_parser() -> ArgumentParser: help=('SecureDrop Client home directory for storing files and state. ' '(Default {})'.format(DEFAULT_SDC_HOME))) parser.add_argument( - '--proxy', action='store_true', + '--no-proxy', action='store_true', help='Use proxy AppVM name to connect to server.') return parser @@ -138,12 +138,12 @@ def start_app(args, qt_args) -> None: app.setWindowIcon(load_icon(gui.icon)) app.setStyleSheet(load_css('sdclient.css')) - engine = make_engine(os.path.join(args.sdc_home, "data")) + engine = make_engine(args.sdc_home) Session = sessionmaker(bind=engine) session = Session() client = Client("http://localhost:8081/", gui, session, - args.sdc_home, args.proxy) + args.sdc_home, not args.no_proxy) client.setup() configure_signal_handlers(app) @@ -155,15 +155,15 @@ def start_app(args, qt_args) -> None: def run() -> None: - config_file = "/etc/securedrop-client/client.ini" + config_file = "/usr/share/securedrop-client/client.ini" args, qt_args = arg_parser().parse_known_args() if args.sdc_home == expand_to_absolute(DEFAULT_SDC_HOME) and \ os.path.exists(config_file): # pragma: no cover config = configparser.ConfigParser() config.read(config_file) args.sdc_home = config["client"]["homedir"] - sdc_home = config["client"]["use_securedrop_proxy"] - args.proxy = expand_to_absolute(sdc_home) + use_proxy = config["client"].getboolean("use_securedrop_proxy") + args.no_proxy = not use_proxy # reinsert the program's name qt_args.insert(0, 'securedrop-client') start_app(args, qt_args) diff --git a/securedrop_client/logic.py b/securedrop_client/logic.py index 4d1fe9f877..deb6a5108b 100644 --- a/securedrop_client/logic.py +++ b/securedrop_client/logic.py @@ -86,7 +86,7 @@ class Client(QObject): finish_api_call = pyqtSignal() # Acknowledges reciept of an API call. def __init__(self, hostname, gui, session, - home: str, proxy: bool = False) -> None: + home: str, proxy: bool = True) -> None: """ The hostname, gui and session objects are used to coordinate with the various other layers of the application: the location of the SecureDrop