diff --git a/modules/installed/apps/apps.py b/modules/installed/apps/apps.py index d6ba9d662..2706110ce 100644 --- a/modules/installed/apps/apps.py +++ b/modules/installed/apps/apps.py @@ -68,7 +68,7 @@ some other websites business model.

main=""" """ form = Form(title="Configuration", - action="/apps/owncloud", + action=cfg.server_dir + "/apps/owncloud", name="configure_owncloud", message='') form.checkbox(_("Enable Owncloud"), name="owncloud_enable", id="owncloud_enable", checked=checkedinfo['enable']) diff --git a/modules/installed/first_boot.py b/modules/installed/first_boot.py index 6104d1a94..d257159aa 100644 --- a/modules/installed/first_boot.py +++ b/modules/installed/first_boot.py @@ -81,11 +81,11 @@ class FirstBoot(PagePlugin): ## Update state to 1 and head there with sqlite_db(cfg.store_file, table="firstboot", autocommit=True) as db: db['state']=1 - raise cherrypy.InternalRedirect('firstboot/state1') + raise cherrypy.InternalRedirect('state1') main = "

Welcome. It looks like this FreedomBox isn't set up yet. We'll need to ask you a just few questions to get started.

" form = Form(title="Welcome to Your FreedomBox!", - action="firstboot", + action="", # stay at firstboot name="whats_my_name", message=message) form.html("

For convenience, your FreedomBox needs a name. It should be something short that doesn't contain spaces or punctuation. 'Willard' would be a good name. 'Freestyle McFreedomBox!!!' would not.

") @@ -123,7 +123,7 @@ TODO: explain all this cert stuff to the user.

with sqlite_db(cfg.store_file, table="firstboot", autocommit=True) as db: db['state']=5 main = main + """ -

Welcome screen not completely implemented yet. Press continue to +

Welcome screen not completely implemented yet. Press continue to see the rest of the web interface.

" """ @@ -132,7 +132,7 @@ see the rest of the web interface.

" with sqlite_db(cfg.store_file, table="firstboot", autocommit=True) as db: db['state']=1 #TODO: switch to HTTPS - raise cherrypy.InternalRedirect('firstboot/state1') + raise cherrypy.InternalRedirect('state1') return self.fill_template(template="base", title=_("Installing the Certificate"), main=main, sidebar_right=_("""Getting Help

We've done our best to make your FreedomBox easy to use. If you have questions during setup, there are a few places to turn for help. TODO: add links to such help.

""")) diff --git a/modules/installed/lib/auth.py b/modules/installed/lib/auth.py index 7e6384d98..e75cedfdc 100644 --- a/modules/installed/lib/auth.py +++ b/modules/installed/lib/auth.py @@ -57,10 +57,10 @@ def check_auth(*args, **kwargs): # A condition is just a callable that returns true or false if not condition(): # Send old page as from_page parameter - raise cherrypy.HTTPRedirect("/auth/login?from_page=%s" % get_params) + raise cherrypy.HTTPRedirect(cfg.server_dir + "/auth/login?from_page=%s" % get_params) else: # Send old page as from_page parameter - raise cherrypy.HTTPRedirect("/auth/login?from_page=%s" % get_params) + raise cherrypy.HTTPRedirect(cfg.server_dir + "/auth/login?from_page=%s" % get_params) cherrypy.tools.auth = cherrypy.Tool('before_handler', check_auth) diff --git a/modules/installed/lib/auth_page.py b/modules/installed/lib/auth_page.py index 6525dc6dc..3f3574c6a 100644 --- a/modules/installed/lib/auth_page.py +++ b/modules/installed/lib/auth_page.py @@ -17,7 +17,7 @@ class AuthController(PagePlugin): """Called on logout""" def get_loginform(self, username, msg='', from_page="/"): - form = Form(title="Login", action="/auth/login", message=msg) + form = Form(title="Login", action=cfg.server_dir + "/auth/login", message=msg) form.text_input(name="from_page", value=from_page, type="hidden") form.text_input("Username", name="username", value=username) form.text_input("Passphrase", name="passphrase", type="password") @@ -36,7 +36,7 @@ class AuthController(PagePlugin): else: cherrypy.session[cfg.session_key] = cherrypy.request.login = username self.on_login(username) - raise cherrypy.HTTPRedirect(from_page or "/") + raise cherrypy.HTTPRedirect(from_page or (cfg.server_dir + "/")) @cherrypy.expose def logout(self, from_page="/"): @@ -46,4 +46,4 @@ class AuthController(PagePlugin): if username: cherrypy.request.login = None self.on_logout(username) - raise cherrypy.HTTPRedirect(from_page or "/") + raise cherrypy.HTTPRedirect(from_page or (cfg.server_dir + "/")) diff --git a/modules/installed/router/router.py b/modules/installed/router/router.py index 6c21fea76..278309f7b 100644 --- a/modules/installed/router/router.py +++ b/modules/installed/router/router.py @@ -23,7 +23,7 @@ class router(PagePlugin): reflect that we've moved down into the submenu hierarchy. Otherwise, it's hard to know which menu portion to make active or expand or contract.""" - raise cherrypy.HTTPRedirect('/router/setup') + raise cherrypy.HTTPRedirect(cfg.server_dir + '/router/setup') @cherrypy.expose @require() @@ -138,7 +138,7 @@ class wan(FormPlugin, PagePlugin): exec("if not '%(k)s' in kwargs: store['%(k)s'] = kwargs['%(k)s'] = %(c)s" % {'k':k, 'c':c}) form = Form(title="WAN Connection", - action="/router/setup/wan/index", + action=cfg.server_dir + "/router/setup/wan/index", name="wan_connection_form", message=message) form.dropdown('Connection Type', vals=["DHCP", "Static IP"], id="connect_type", onchange="hideshow_static()") diff --git a/modules/installed/services/xmpp.py b/modules/installed/services/xmpp.py index 6140cf1c5..8881a2bd0 100644 --- a/modules/installed/services/xmpp.py +++ b/modules/installed/services/xmpp.py @@ -43,7 +43,7 @@ class xmpp(PagePlugin): main = "

XMPP Server Configuration

" form = Form(title="Configuration", - action="/services/xmpp", + action=cfg.server_dir + "/services/xmpp", name="configure_xmpp", message='') form.checkbox(_("Allow In-Band Registration"), name="xmpp_inband_enable", @@ -66,7 +66,7 @@ class register(FormPlugin, PagePlugin): def main(self, username='', message=None, *args, **kwargs): form = Form(title="Register XMPP Account", - action="/services/xmpp/register/index", + action=cfg.server_dir + "/services/xmpp/register/index", name="register_xmpp_form", message=message) form.text_input(_("Username"), name="username", value=username) diff --git a/modules/installed/sharing/sharing.py b/modules/installed/sharing/sharing.py index 7617c577a..3a0de623b 100644 --- a/modules/installed/sharing/sharing.py +++ b/modules/installed/sharing/sharing.py @@ -19,7 +19,7 @@ class Sharing(PagePlugin): reflect that we've moved down into the submenu hierarchy. Otherwise, it's hard to know which menu portion to make active or expand or contract.""" - raise cherrypy.HTTPRedirect('/sharing/files') + raise cherrypy.HTTPRedirect(cfg.server_dir + '/sharing/files') @cherrypy.expose @require() diff --git a/modules/installed/system/config.py b/modules/installed/system/config.py index 916c4b43a..159811f69 100644 --- a/modules/installed/system/config.py +++ b/modules/installed/system/config.py @@ -112,7 +112,7 @@ class general(FormPlugin, PagePlugin): ## And now, the form. form = Form(title=_("General Config"), - action="/sys/config/general/index", + action=cfg.server_dir + "/sys/config/general/index", name="config_general_form", message=message ) form.html(self.help()) diff --git a/modules/installed/system/expert_mode.py b/modules/installed/system/expert_mode.py index e69e08bcf..dd6f11b49 100644 --- a/modules/installed/system/expert_mode.py +++ b/modules/installed/system/expert_mode.py @@ -47,7 +47,7 @@ class experts(FormPlugin, PagePlugin): expert = cfg.users.expert() cfg.log("Expert mode is %s" % expert) form = Form(title=_("Expert Mode"), - action="/sys/config/experts", + action=cfg.server_dir + "/sys/config/experts", name="expert_mode_form", message=message ) form.html(self.help()) diff --git a/modules/installed/system/users.py b/modules/installed/system/users.py index 1d358e4fa..23e2470cd 100644 --- a/modules/installed/system/users.py +++ b/modules/installed/system/users.py @@ -33,7 +33,7 @@ class add(FormPlugin, PagePlugin): def main(self, username='', name='', email='', message=None, *args, **kwargs): form = Form(title="Add User", - action="/sys/users/add/index", + action=cfg.server_dir + "/sys/users/add/index", onsubmit="return md5ify('add_user_form', 'password')", name="add_user_form", message=message) @@ -80,7 +80,7 @@ class edit(FormPlugin, PagePlugin): def main(self, msg=''): users = cfg.users.get_all() - add_form = Form(title=_("Edit or Delete User"), action="/sys/users/edit", message=msg) + add_form = Form(title=_("Edit or Delete User"), action=cfg.server_dir + "/sys/users/edit", message=msg) add_form.html('Delete
') for uname in users: user = User(uname[1]) diff --git a/modules/installed/system/wan.py b/modules/installed/system/wan.py index 394f67d6e..55ce1ec1b 100644 --- a/modules/installed/system/wan.py +++ b/modules/installed/system/wan.py @@ -57,7 +57,7 @@ class wan(FormPlugin, PagePlugin): exec("if not '%(k)s' in kwargs: store['%(k)s'] = kwargs['%(k)s'] = %(c)s" % {'k':k, 'c':c}) form = Form(title=_("Accessing the %s" % cfg.box_name), - action="/sys/config/wan", + action=cfg.server_dir + "/sys/config/wan", name="admin_wan_form", message=message ) form.html(self.help())