mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
pagekite: Fix issue with setting port
- When the current configuration does not contain a port and we try to set the port for the frontend server, it fails. This patch fixes that. - Minor styling and spelling fixes. - Make sure that if port is not set for frontend, it will be set on saving the form.
This commit is contained in:
parent
aad69deb6e
commit
670be77b9a
@ -53,7 +53,7 @@ def parse_arguments():
|
|||||||
subparsers.add_parser('stop-and-disable', help='Disable PageKite service')
|
subparsers.add_parser('stop-and-disable', help='Disable PageKite service')
|
||||||
subparsers.add_parser('restart', help='Restart PageKite service')
|
subparsers.add_parser('restart', help='Restart PageKite service')
|
||||||
subparsers.add_parser('is-disabled',
|
subparsers.add_parser('is-disabled',
|
||||||
help=('Wether PageKite is disabled in the file '
|
help=('Whether PageKite is disabled in the file '
|
||||||
'/etc/pagekite.d/10_accounts.rc'))
|
'/etc/pagekite.d/10_accounts.rc'))
|
||||||
|
|
||||||
# Frontend
|
# Frontend
|
||||||
|
|||||||
@ -94,7 +94,7 @@ def get_pagekite_config():
|
|||||||
# To enable PageKite two things are necessary:
|
# To enable PageKite two things are necessary:
|
||||||
# 1) pagekite not being disabled in /etc/pagekite.d/10_account.rc
|
# 1) pagekite not being disabled in /etc/pagekite.d/10_account.rc
|
||||||
# 2) the pagekite service running
|
# 2) the pagekite service running
|
||||||
is_disabled = run(['is-disabled']).strip()=='true'
|
is_disabled = (run(['is-disabled']).strip() == 'true')
|
||||||
service_running = action_utils.service_is_running('pagekite')
|
service_running = action_utils.service_is_running('pagekite')
|
||||||
status['enabled'] = service_running and not is_disabled
|
status['enabled'] = service_running and not is_disabled
|
||||||
|
|
||||||
@ -102,16 +102,20 @@ def get_pagekite_config():
|
|||||||
status.update(get_kite_details())
|
status.update(get_kite_details())
|
||||||
|
|
||||||
# PageKite frontend server
|
# PageKite frontend server
|
||||||
server = run(['get-frontend'])
|
server = run(['get-frontend']).strip()
|
||||||
# Frontend-Entries are only considered valid if there's a ':' in them
|
|
||||||
# otherwise, pagekite refuses to work, and we only set values with ':'.
|
# Frontend entries are only considered valid if there's a ':' in
|
||||||
|
# them otherwise, pagekite refuses to work, and we only set values
|
||||||
|
# with ':'.
|
||||||
if ':' in server:
|
if ':' in server:
|
||||||
server_domain, server_port = server.strip().split(':')
|
server_domain, server_port = server.split(':')
|
||||||
status['server_domain'] = server_domain
|
status['server_domain'] = server_domain
|
||||||
status['server_port'] = server_port
|
status['server_port'] = int(server_port)
|
||||||
else:
|
else:
|
||||||
# no valid entry exists, default to port 80
|
status['server_domain'] = server
|
||||||
status['server_port'] = 80
|
# No valid entry exists, default to port 80. Hack: Return
|
||||||
|
# string instead of int to force setting port on save
|
||||||
|
status['server_port'] = '80'
|
||||||
|
|
||||||
return status
|
return status
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user