mirror of
https://github.com/craigerl/aprsd.git
synced 2025-09-02 05:07:53 -04: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
|
factory = None
|
||||||
|
|
||||||
|
|
||||||
class Client:
|
class Client(metaclass=trace.TraceWrapperMetaclass):
|
||||||
"""Singleton client class that constructs the aprslib connection."""
|
"""Singleton client class that constructs the aprslib connection."""
|
||||||
|
|
||||||
_instance = None
|
_instance = None
|
||||||
@ -86,7 +86,7 @@ class Client:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class APRSISClient(Client):
|
class APRSISClient(Client, metaclass=trace.TraceWrapperMetaclass):
|
||||||
|
|
||||||
_client = None
|
_client = None
|
||||||
|
|
||||||
@ -135,7 +135,6 @@ class APRSISClient(Client):
|
|||||||
"""APRS lib already decodes this."""
|
"""APRS lib already decodes this."""
|
||||||
return core.Packet.factory(args[0])
|
return core.Packet.factory(args[0])
|
||||||
|
|
||||||
@trace.trace
|
|
||||||
def setup_connection(self):
|
def setup_connection(self):
|
||||||
user = CONF.aprs_network.login
|
user = CONF.aprs_network.login
|
||||||
password = CONF.aprs_network.password
|
password = CONF.aprs_network.password
|
||||||
@ -172,7 +171,7 @@ class APRSISClient(Client):
|
|||||||
return aprs_client
|
return aprs_client
|
||||||
|
|
||||||
|
|
||||||
class KISSClient(Client):
|
class KISSClient(Client, metaclass=trace.TraceWrapperMetaclass):
|
||||||
|
|
||||||
_client = None
|
_client = None
|
||||||
|
|
||||||
@ -241,7 +240,6 @@ class KISSClient(Client):
|
|||||||
else:
|
else:
|
||||||
return packet
|
return packet
|
||||||
|
|
||||||
@trace.trace
|
|
||||||
def setup_connection(self):
|
def setup_connection(self):
|
||||||
self._client = kiss.KISS3Client()
|
self._client = kiss.KISS3Client()
|
||||||
return self._client
|
return self._client
|
||||||
|
@ -427,8 +427,8 @@ def init_flask(loglevel, quiet):
|
|||||||
"--port",
|
"--port",
|
||||||
"port",
|
"port",
|
||||||
show_default=True,
|
show_default=True,
|
||||||
default=80,
|
default=None,
|
||||||
help="Port to listen to web requests",
|
help="Port to listen to web requests. This overrides the config.webchat.web_port setting.",
|
||||||
)
|
)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
@cli_helper.process_standard_options
|
@cli_helper.process_standard_options
|
||||||
@ -450,6 +450,8 @@ def webchat(ctx, flush, port):
|
|||||||
CONF.log_opt_values(LOG, logging.DEBUG)
|
CONF.log_opt_values(LOG, logging.DEBUG)
|
||||||
user = CONF.admin.user
|
user = CONF.admin.user
|
||||||
users[user] = generate_password_hash(CONF.admin.password)
|
users[user] = generate_password_hash(CONF.admin.password)
|
||||||
|
if not port:
|
||||||
|
port = CONF.webchat.web_port
|
||||||
|
|
||||||
# Initialize the client factory and create
|
# Initialize the client factory and create
|
||||||
# The correct client object ready for use
|
# The correct client object ready for use
|
||||||
@ -488,7 +490,7 @@ def webchat(ctx, flush, port):
|
|||||||
# This is broken for now after removing cryptography
|
# This is broken for now after removing cryptography
|
||||||
# and pyopenssl
|
# and pyopenssl
|
||||||
# ssl_context="adhoc",
|
# ssl_context="adhoc",
|
||||||
host=CONF.admin.web_ip,
|
host=CONF.webchat.web_ip,
|
||||||
port=port,
|
port=port,
|
||||||
allow_unsafe_werkzeug=True,
|
allow_unsafe_werkzeug=True,
|
||||||
)
|
)
|
||||||
|
@ -19,6 +19,10 @@ rpc_group = cfg.OptGroup(
|
|||||||
name="rpc_settings",
|
name="rpc_settings",
|
||||||
title="RPC Settings for admin <--> web",
|
title="RPC Settings for admin <--> web",
|
||||||
)
|
)
|
||||||
|
webchat_group = cfg.OptGroup(
|
||||||
|
name="webchat",
|
||||||
|
title="Settings specific to the webchat command",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
aprsd_opts = [
|
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):
|
def register_opts(config):
|
||||||
config.register_opts(aprsd_opts)
|
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_opts(watch_list_opts, group=watch_list_group)
|
||||||
config.register_group(rpc_group)
|
config.register_group(rpc_group)
|
||||||
config.register_opts(rpc_opts, 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():
|
def list_opts():
|
||||||
@ -181,4 +210,5 @@ def list_opts():
|
|||||||
admin_group.name: admin_opts,
|
admin_group.name: admin_opts,
|
||||||
watch_list_group.name: watch_list_opts,
|
watch_list_group.name: watch_list_opts,
|
||||||
rpc_group.name: rpc_opts,
|
rpc_group.name: rpc_opts,
|
||||||
|
webchat_group.name: webchat_opts,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user