mirror of
https://github.com/craigerl/aprsd.git
synced 2024-12-22 01:20:59 -05:00
Added new webchat config section
This patch adds a new webchat config section to specify: web_ip (the ip address to listen on) web_port latitude (latitude to use for the GPS beacon button) longitude (long to use for the GPS beacon button)
This commit is contained in:
parent
8dd3b05bb1
commit
f922b3f97b
@ -24,7 +24,7 @@ TRANSPORT_SERIALKISS = "serialkiss"
|
||||
factory = None
|
||||
|
||||
|
||||
class Client:
|
||||
class Client(metaclass=trace.TraceWrapperMetaclass):
|
||||
"""Singleton client class that constructs the aprslib connection."""
|
||||
|
||||
_instance = None
|
||||
@ -86,7 +86,7 @@ class Client:
|
||||
pass
|
||||
|
||||
|
||||
class APRSISClient(Client):
|
||||
class APRSISClient(Client, metaclass=trace.TraceWrapperMetaclass):
|
||||
|
||||
_client = None
|
||||
|
||||
@ -135,7 +135,6 @@ class APRSISClient(Client):
|
||||
"""APRS lib already decodes this."""
|
||||
return core.Packet.factory(args[0])
|
||||
|
||||
@trace.trace
|
||||
def setup_connection(self):
|
||||
user = CONF.aprs_network.login
|
||||
password = CONF.aprs_network.password
|
||||
@ -172,7 +171,7 @@ class APRSISClient(Client):
|
||||
return aprs_client
|
||||
|
||||
|
||||
class KISSClient(Client):
|
||||
class KISSClient(Client, metaclass=trace.TraceWrapperMetaclass):
|
||||
|
||||
_client = None
|
||||
|
||||
@ -241,7 +240,6 @@ class KISSClient(Client):
|
||||
else:
|
||||
return packet
|
||||
|
||||
@trace.trace
|
||||
def setup_connection(self):
|
||||
self._client = kiss.KISS3Client()
|
||||
return self._client
|
||||
|
@ -427,8 +427,8 @@ def init_flask(loglevel, quiet):
|
||||
"--port",
|
||||
"port",
|
||||
show_default=True,
|
||||
default=80,
|
||||
help="Port to listen to web requests",
|
||||
default=None,
|
||||
help="Port to listen to web requests. This overrides the config.webchat.web_port setting.",
|
||||
)
|
||||
@click.pass_context
|
||||
@cli_helper.process_standard_options
|
||||
@ -450,6 +450,8 @@ def webchat(ctx, flush, port):
|
||||
CONF.log_opt_values(LOG, logging.DEBUG)
|
||||
user = CONF.admin.user
|
||||
users[user] = generate_password_hash(CONF.admin.password)
|
||||
if not port:
|
||||
port = CONF.webchat.web_port
|
||||
|
||||
# Initialize the client factory and create
|
||||
# The correct client object ready for use
|
||||
@ -488,7 +490,7 @@ def webchat(ctx, flush, port):
|
||||
# This is broken for now after removing cryptography
|
||||
# and pyopenssl
|
||||
# ssl_context="adhoc",
|
||||
host=CONF.admin.web_ip,
|
||||
host=CONF.webchat.web_ip,
|
||||
port=port,
|
||||
allow_unsafe_werkzeug=True,
|
||||
)
|
||||
|
@ -19,6 +19,10 @@ rpc_group = cfg.OptGroup(
|
||||
name="rpc_settings",
|
||||
title="RPC Settings for admin <--> web",
|
||||
)
|
||||
webchat_group = cfg.OptGroup(
|
||||
name="webchat",
|
||||
title="Settings specific to the webchat command",
|
||||
)
|
||||
|
||||
|
||||
aprsd_opts = [
|
||||
@ -163,6 +167,29 @@ enabled_plugins_opts = [
|
||||
),
|
||||
]
|
||||
|
||||
webchat_opts = [
|
||||
cfg.IPOpt(
|
||||
"web_ip",
|
||||
default="0.0.0.0",
|
||||
help="The ip address to listen on",
|
||||
),
|
||||
cfg.PortOpt(
|
||||
"web_port",
|
||||
default=8001,
|
||||
help="The port to listen on",
|
||||
),
|
||||
cfg.StrOpt(
|
||||
"latitude",
|
||||
default=None,
|
||||
help="Latitude for the GPS Beacon button. If not set, the button will not be enabled.",
|
||||
),
|
||||
cfg.StrOpt(
|
||||
"longitude",
|
||||
default=None,
|
||||
help="Longitude for the GPS Beacon button. If not set, the button will not be enabled.",
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
def register_opts(config):
|
||||
config.register_opts(aprsd_opts)
|
||||
@ -173,6 +200,8 @@ def register_opts(config):
|
||||
config.register_opts(watch_list_opts, group=watch_list_group)
|
||||
config.register_group(rpc_group)
|
||||
config.register_opts(rpc_opts, group=rpc_group)
|
||||
config.register_group(webchat_group)
|
||||
config.register_opts(webchat_opts, group=webchat_group)
|
||||
|
||||
|
||||
def list_opts():
|
||||
@ -181,4 +210,5 @@ def list_opts():
|
||||
admin_group.name: admin_opts,
|
||||
watch_list_group.name: watch_list_opts,
|
||||
rpc_group.name: rpc_opts,
|
||||
webchat_group.name: webchat_opts,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user