aprsd 3.3.4__py2.py3-none-any.whl → 3.4.0__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aprsd/client.py +133 -20
- aprsd/clients/aprsis.py +6 -3
- aprsd/clients/fake.py +1 -1
- aprsd/clients/kiss.py +1 -1
- aprsd/cmds/completion.py +13 -27
- aprsd/cmds/fetch_stats.py +53 -57
- aprsd/cmds/healthcheck.py +32 -30
- aprsd/cmds/list_plugins.py +2 -2
- aprsd/cmds/listen.py +33 -17
- aprsd/cmds/send_message.py +2 -2
- aprsd/cmds/server.py +26 -9
- aprsd/cmds/webchat.py +34 -29
- aprsd/conf/common.py +46 -31
- aprsd/log/log.py +28 -6
- aprsd/main.py +4 -17
- aprsd/packets/__init__.py +3 -2
- aprsd/packets/collector.py +56 -0
- aprsd/packets/core.py +456 -321
- aprsd/packets/log.py +143 -0
- aprsd/packets/packet_list.py +83 -66
- aprsd/packets/seen_list.py +30 -19
- aprsd/packets/tracker.py +60 -62
- aprsd/packets/watch_list.py +64 -38
- aprsd/plugin.py +41 -16
- aprsd/plugins/email.py +35 -7
- aprsd/plugins/time.py +3 -2
- aprsd/plugins/version.py +4 -5
- aprsd/plugins/weather.py +0 -1
- aprsd/stats/__init__.py +20 -0
- aprsd/stats/app.py +46 -0
- aprsd/stats/collector.py +38 -0
- aprsd/threads/__init__.py +3 -2
- aprsd/threads/aprsd.py +67 -36
- aprsd/threads/keep_alive.py +55 -49
- aprsd/threads/log_monitor.py +46 -0
- aprsd/threads/rx.py +43 -24
- aprsd/threads/stats.py +44 -0
- aprsd/threads/tx.py +36 -17
- aprsd/utils/__init__.py +12 -0
- aprsd/utils/counter.py +6 -3
- aprsd/utils/json.py +20 -0
- aprsd/utils/objectstore.py +22 -17
- aprsd/web/admin/static/css/prism.css +4 -189
- aprsd/web/admin/static/js/charts.js +9 -7
- aprsd/web/admin/static/js/echarts.js +71 -9
- aprsd/web/admin/static/js/main.js +47 -6
- aprsd/web/admin/static/js/prism.js +11 -2246
- aprsd/web/admin/templates/index.html +18 -7
- aprsd/web/chat/static/js/gps.js +3 -1
- aprsd/web/chat/static/js/main.js +4 -3
- aprsd/web/chat/static/js/send-message.js +5 -2
- aprsd/web/chat/templates/index.html +1 -0
- aprsd/wsgi.py +62 -127
- {aprsd-3.3.4.dist-info → aprsd-3.4.0.dist-info}/METADATA +14 -16
- {aprsd-3.3.4.dist-info → aprsd-3.4.0.dist-info}/RECORD +60 -63
- {aprsd-3.3.4.dist-info → aprsd-3.4.0.dist-info}/WHEEL +1 -1
- aprsd-3.4.0.dist-info/pbr.json +1 -0
- aprsd/plugins/query.py +0 -81
- aprsd/rpc/__init__.py +0 -14
- aprsd/rpc/client.py +0 -165
- aprsd/rpc/server.py +0 -99
- aprsd/stats.py +0 -266
- aprsd/web/admin/static/json-viewer/jquery.json-viewer.css +0 -57
- aprsd/web/admin/static/json-viewer/jquery.json-viewer.js +0 -158
- aprsd/web/chat/static/json-viewer/jquery.json-viewer.css +0 -57
- aprsd/web/chat/static/json-viewer/jquery.json-viewer.js +0 -158
- aprsd-3.3.4.dist-info/pbr.json +0 -1
- {aprsd-3.3.4.dist-info → aprsd-3.4.0.dist-info}/LICENSE +0 -0
- {aprsd-3.3.4.dist-info → aprsd-3.4.0.dist-info}/entry_points.txt +0 -0
- {aprsd-3.3.4.dist-info → aprsd-3.4.0.dist-info}/top_level.txt +0 -0
aprsd/cmds/healthcheck.py
CHANGED
@@ -13,11 +13,11 @@ from oslo_config import cfg
|
|
13
13
|
from rich.console import Console
|
14
14
|
|
15
15
|
import aprsd
|
16
|
-
from aprsd import cli_helper
|
16
|
+
from aprsd import cli_helper
|
17
17
|
from aprsd import conf # noqa
|
18
18
|
# local imports here
|
19
19
|
from aprsd.main import cli
|
20
|
-
from aprsd.
|
20
|
+
from aprsd.threads import stats as stats_threads
|
21
21
|
|
22
22
|
|
23
23
|
# setup the global logger
|
@@ -39,46 +39,48 @@ console = Console()
|
|
39
39
|
@cli_helper.process_standard_options
|
40
40
|
def healthcheck(ctx, timeout):
|
41
41
|
"""Check the health of the running aprsd server."""
|
42
|
-
|
43
|
-
|
44
|
-
LOG.error("Must enable rpc_settings.enabled to use healthcheck")
|
45
|
-
sys.exit(-1)
|
46
|
-
if not CONF.rpc_settings.ip:
|
47
|
-
LOG.error("Must enable rpc_settings.ip to use healthcheck")
|
48
|
-
sys.exit(-1)
|
49
|
-
if not CONF.rpc_settings.magic_word:
|
50
|
-
LOG.error("Must enable rpc_settings.magic_word to use healthcheck")
|
51
|
-
sys.exit(-1)
|
42
|
+
ver_str = f"APRSD HealthCheck version: {aprsd.__version__}"
|
43
|
+
console.log(ver_str)
|
52
44
|
|
53
|
-
with console.status(
|
45
|
+
with console.status(ver_str):
|
54
46
|
try:
|
55
|
-
|
56
|
-
|
47
|
+
stats_obj = stats_threads.StatsStore()
|
48
|
+
stats_obj.load()
|
49
|
+
stats = stats_obj.data
|
50
|
+
# console.print(stats)
|
57
51
|
except Exception as ex:
|
58
|
-
console.log(f"Failed to
|
52
|
+
console.log(f"Failed to load stats: '{ex}'")
|
59
53
|
sys.exit(-1)
|
60
54
|
else:
|
55
|
+
now = datetime.datetime.now()
|
61
56
|
if not stats:
|
62
57
|
console.log("No stats from aprsd")
|
63
58
|
sys.exit(-1)
|
64
|
-
email_thread_last_update = stats["email"]["thread_last_update"]
|
65
59
|
|
66
|
-
|
67
|
-
|
68
|
-
|
60
|
+
email_stats = stats.get("EmailStats")
|
61
|
+
if email_stats:
|
62
|
+
email_thread_last_update = email_stats["last_check_time"]
|
63
|
+
|
64
|
+
if email_thread_last_update != "never":
|
65
|
+
d = now - email_thread_last_update
|
66
|
+
max_timeout = {"hours": 0.0, "minutes": 5, "seconds": 0}
|
67
|
+
max_delta = datetime.timedelta(**max_timeout)
|
68
|
+
if d > max_delta:
|
69
|
+
console.log(f"Email thread is very old! {d}")
|
70
|
+
sys.exit(-1)
|
71
|
+
|
72
|
+
client_stats = stats.get("APRSClientStats")
|
73
|
+
if not client_stats:
|
74
|
+
console.log("No APRSClientStats")
|
75
|
+
sys.exit(-1)
|
76
|
+
else:
|
77
|
+
aprsis_last_update = client_stats["server_keepalive"]
|
78
|
+
d = now - aprsis_last_update
|
69
79
|
max_timeout = {"hours": 0.0, "minutes": 5, "seconds": 0}
|
70
80
|
max_delta = datetime.timedelta(**max_timeout)
|
71
81
|
if d > max_delta:
|
72
|
-
|
82
|
+
LOG.error(f"APRS-IS last update is very old! {d}")
|
73
83
|
sys.exit(-1)
|
74
84
|
|
75
|
-
|
76
|
-
delta = utils.parse_delta_str(aprsis_last_update)
|
77
|
-
d = datetime.timedelta(**delta)
|
78
|
-
max_timeout = {"hours": 0.0, "minutes": 5, "seconds": 0}
|
79
|
-
max_delta = datetime.timedelta(**max_timeout)
|
80
|
-
if d > max_delta:
|
81
|
-
LOG.error(f"APRS-IS last update is very old! {d}")
|
82
|
-
sys.exit(-1)
|
83
|
-
|
85
|
+
console.log("OK")
|
84
86
|
sys.exit(0)
|
aprsd/cmds/list_plugins.py
CHANGED
@@ -21,7 +21,7 @@ from aprsd import cli_helper
|
|
21
21
|
from aprsd import plugin as aprsd_plugin
|
22
22
|
from aprsd.main import cli
|
23
23
|
from aprsd.plugins import (
|
24
|
-
email, fortune, location, notify, ping,
|
24
|
+
email, fortune, location, notify, ping, time, version, weather,
|
25
25
|
)
|
26
26
|
|
27
27
|
|
@@ -122,7 +122,7 @@ def get_installed_extensions():
|
|
122
122
|
|
123
123
|
|
124
124
|
def show_built_in_plugins(console):
|
125
|
-
modules = [email, fortune, location, notify, ping,
|
125
|
+
modules = [email, fortune, location, notify, ping, time, version, weather]
|
126
126
|
plugins = []
|
127
127
|
|
128
128
|
for module in modules:
|
aprsd/cmds/listen.py
CHANGED
@@ -15,10 +15,14 @@ from rich.console import Console
|
|
15
15
|
|
16
16
|
# local imports here
|
17
17
|
import aprsd
|
18
|
-
from aprsd import cli_helper, client, packets, plugin,
|
18
|
+
from aprsd import cli_helper, client, packets, plugin, threads
|
19
19
|
from aprsd.main import cli
|
20
|
-
from aprsd.
|
21
|
-
from aprsd.
|
20
|
+
from aprsd.packets import collector as packet_collector
|
21
|
+
from aprsd.packets import log as packet_log
|
22
|
+
from aprsd.packets import seen_list
|
23
|
+
from aprsd.stats import collector
|
24
|
+
from aprsd.threads import keep_alive, rx
|
25
|
+
from aprsd.threads import stats as stats_thread
|
22
26
|
|
23
27
|
|
24
28
|
# setup the global logger
|
@@ -37,7 +41,7 @@ def signal_handler(sig, frame):
|
|
37
41
|
),
|
38
42
|
)
|
39
43
|
time.sleep(5)
|
40
|
-
LOG.info(
|
44
|
+
LOG.info(collector.Collector().collect())
|
41
45
|
|
42
46
|
|
43
47
|
class APRSDListenThread(rx.APRSDRXThread):
|
@@ -53,29 +57,33 @@ class APRSDListenThread(rx.APRSDRXThread):
|
|
53
57
|
filters = {
|
54
58
|
packets.Packet.__name__: packets.Packet,
|
55
59
|
packets.AckPacket.__name__: packets.AckPacket,
|
60
|
+
packets.BeaconPacket.__name__: packets.BeaconPacket,
|
56
61
|
packets.GPSPacket.__name__: packets.GPSPacket,
|
57
62
|
packets.MessagePacket.__name__: packets.MessagePacket,
|
58
63
|
packets.MicEPacket.__name__: packets.MicEPacket,
|
64
|
+
packets.ObjectPacket.__name__: packets.ObjectPacket,
|
65
|
+
packets.StatusPacket.__name__: packets.StatusPacket,
|
66
|
+
packets.ThirdPartyPacket.__name__: packets.ThirdPartyPacket,
|
59
67
|
packets.WeatherPacket.__name__: packets.WeatherPacket,
|
68
|
+
packets.UnknownPacket.__name__: packets.UnknownPacket,
|
60
69
|
}
|
61
70
|
|
62
71
|
if self.packet_filter:
|
63
72
|
filter_class = filters[self.packet_filter]
|
64
73
|
if isinstance(packet, filter_class):
|
65
|
-
|
74
|
+
packet_log.log(packet)
|
66
75
|
if self.plugin_manager:
|
67
76
|
# Don't do anything with the reply
|
68
77
|
# This is the listen only command.
|
69
78
|
self.plugin_manager.run(packet)
|
70
79
|
else:
|
80
|
+
packet_log.log(packet)
|
71
81
|
if self.plugin_manager:
|
72
82
|
# Don't do anything with the reply.
|
73
83
|
# This is the listen only command.
|
74
84
|
self.plugin_manager.run(packet)
|
75
|
-
else:
|
76
|
-
packet.log(header="RX")
|
77
85
|
|
78
|
-
|
86
|
+
packet_collector.PacketCollector().rx(packet)
|
79
87
|
|
80
88
|
|
81
89
|
@cli.command()
|
@@ -96,11 +104,16 @@ class APRSDListenThread(rx.APRSDRXThread):
|
|
96
104
|
"--packet-filter",
|
97
105
|
type=click.Choice(
|
98
106
|
[
|
99
|
-
packets.Packet.__name__,
|
100
107
|
packets.AckPacket.__name__,
|
108
|
+
packets.BeaconPacket.__name__,
|
101
109
|
packets.GPSPacket.__name__,
|
102
110
|
packets.MicEPacket.__name__,
|
103
111
|
packets.MessagePacket.__name__,
|
112
|
+
packets.ObjectPacket.__name__,
|
113
|
+
packets.RejectPacket.__name__,
|
114
|
+
packets.StatusPacket.__name__,
|
115
|
+
packets.ThirdPartyPacket.__name__,
|
116
|
+
packets.UnknownPacket.__name__,
|
104
117
|
packets.WeatherPacket.__name__,
|
105
118
|
],
|
106
119
|
case_sensitive=False,
|
@@ -159,6 +172,7 @@ def listen(
|
|
159
172
|
LOG.info(f"APRSD Listen Started version: {aprsd.__version__}")
|
160
173
|
|
161
174
|
CONF.log_opt_values(LOG, logging.DEBUG)
|
175
|
+
collector.Collector()
|
162
176
|
|
163
177
|
# Try and load saved MsgTrack list
|
164
178
|
LOG.debug("Loading saved MsgTrack object.")
|
@@ -179,12 +193,12 @@ def listen(
|
|
179
193
|
LOG.debug(f"Filter by '{filter}'")
|
180
194
|
aprs_client.set_filter(filter)
|
181
195
|
|
182
|
-
keepalive =
|
183
|
-
keepalive.start()
|
196
|
+
keepalive = keep_alive.KeepAliveThread()
|
197
|
+
# keepalive.start()
|
184
198
|
|
185
|
-
if CONF.
|
186
|
-
|
187
|
-
|
199
|
+
if not CONF.enable_seen_list:
|
200
|
+
# just deregister the class from the packet collector
|
201
|
+
packet_collector.PacketCollector().unregister(seen_list.SeenList)
|
188
202
|
|
189
203
|
pm = None
|
190
204
|
pm = plugin.PluginManager()
|
@@ -196,6 +210,8 @@ def listen(
|
|
196
210
|
"Not Loading any plugins use --load-plugins to load what's "
|
197
211
|
"defined in the config file.",
|
198
212
|
)
|
213
|
+
stats = stats_thread.APRSDStatsStoreThread()
|
214
|
+
stats.start()
|
199
215
|
|
200
216
|
LOG.debug("Create APRSDListenThread")
|
201
217
|
listen_thread = APRSDListenThread(
|
@@ -205,10 +221,10 @@ def listen(
|
|
205
221
|
)
|
206
222
|
LOG.debug("Start APRSDListenThread")
|
207
223
|
listen_thread.start()
|
224
|
+
|
225
|
+
keepalive.start()
|
208
226
|
LOG.debug("keepalive Join")
|
209
227
|
keepalive.join()
|
210
228
|
LOG.debug("listen_thread Join")
|
211
229
|
listen_thread.join()
|
212
|
-
|
213
|
-
if CONF.rpc_settings.enabled:
|
214
|
-
rpc.join()
|
230
|
+
stats.join()
|
aprsd/cmds/send_message.py
CHANGED
@@ -11,6 +11,7 @@ import aprsd
|
|
11
11
|
from aprsd import cli_helper, client, packets
|
12
12
|
from aprsd import conf # noqa : F401
|
13
13
|
from aprsd.main import cli
|
14
|
+
from aprsd.packets import collector
|
14
15
|
from aprsd.threads import tx
|
15
16
|
|
16
17
|
|
@@ -76,7 +77,6 @@ def send_message(
|
|
76
77
|
aprs_login = CONF.aprs_network.login
|
77
78
|
|
78
79
|
if not aprs_password:
|
79
|
-
LOG.warning(CONF.aprs_network.password)
|
80
80
|
if not CONF.aprs_network.password:
|
81
81
|
click.echo("Must set --aprs-password or APRS_PASSWORD")
|
82
82
|
ctx.exit(-1)
|
@@ -104,7 +104,7 @@ def send_message(
|
|
104
104
|
global got_ack, got_response
|
105
105
|
cl = client.factory.create()
|
106
106
|
packet = cl.decode_packet(packet)
|
107
|
-
|
107
|
+
collector.PacketCollector().rx(packet)
|
108
108
|
packet.log("RX")
|
109
109
|
# LOG.debug("Got packet back {}".format(packet))
|
110
110
|
if isinstance(packet, packets.AckPacket):
|
aprsd/cmds/server.py
CHANGED
@@ -10,8 +10,11 @@ from aprsd import cli_helper, client
|
|
10
10
|
from aprsd import main as aprsd_main
|
11
11
|
from aprsd import packets, plugin, threads, utils
|
12
12
|
from aprsd.main import cli
|
13
|
-
from aprsd.
|
14
|
-
from aprsd.
|
13
|
+
from aprsd.packets import collector as packet_collector
|
14
|
+
from aprsd.packets import seen_list
|
15
|
+
from aprsd.threads import keep_alive, log_monitor, registry, rx
|
16
|
+
from aprsd.threads import stats as stats_thread
|
17
|
+
from aprsd.threads import tx
|
15
18
|
|
16
19
|
|
17
20
|
CONF = cfg.CONF
|
@@ -47,6 +50,14 @@ def server(ctx, flush):
|
|
47
50
|
# Initialize the client factory and create
|
48
51
|
# The correct client object ready for use
|
49
52
|
client.ClientFactory.setup()
|
53
|
+
if not client.factory.is_client_enabled():
|
54
|
+
LOG.error("No Clients are enabled in config.")
|
55
|
+
sys.exit(-1)
|
56
|
+
|
57
|
+
# Creates the client object
|
58
|
+
LOG.info("Creating client connection")
|
59
|
+
aprs_client = client.factory.create()
|
60
|
+
LOG.info(aprs_client)
|
50
61
|
|
51
62
|
# Create the initial PM singleton and Register plugins
|
52
63
|
# We register plugins first here so we can register each
|
@@ -87,16 +98,25 @@ def server(ctx, flush):
|
|
87
98
|
packets.PacketTrack().flush()
|
88
99
|
packets.WatchList().flush()
|
89
100
|
packets.SeenList().flush()
|
101
|
+
packets.PacketList().flush()
|
90
102
|
else:
|
91
103
|
# Try and load saved MsgTrack list
|
92
104
|
LOG.debug("Loading saved MsgTrack object.")
|
93
105
|
packets.PacketTrack().load()
|
94
106
|
packets.WatchList().load()
|
95
107
|
packets.SeenList().load()
|
108
|
+
packets.PacketList().load()
|
96
109
|
|
97
|
-
keepalive =
|
110
|
+
keepalive = keep_alive.KeepAliveThread()
|
98
111
|
keepalive.start()
|
99
112
|
|
113
|
+
if not CONF.enable_seen_list:
|
114
|
+
# just deregister the class from the packet collector
|
115
|
+
packet_collector.PacketCollector().unregister(seen_list.SeenList)
|
116
|
+
|
117
|
+
stats_store_thread = stats_thread.APRSDStatsStoreThread()
|
118
|
+
stats_store_thread.start()
|
119
|
+
|
100
120
|
rx_thread = rx.APRSDPluginRXThread(
|
101
121
|
packet_queue=threads.packet_queue,
|
102
122
|
)
|
@@ -106,7 +126,6 @@ def server(ctx, flush):
|
|
106
126
|
rx_thread.start()
|
107
127
|
process_thread.start()
|
108
128
|
|
109
|
-
packets.PacketTrack().restart()
|
110
129
|
if CONF.enable_beacon:
|
111
130
|
LOG.info("Beacon Enabled. Starting Beacon thread.")
|
112
131
|
bcn_thread = tx.BeaconSendThread()
|
@@ -117,11 +136,9 @@ def server(ctx, flush):
|
|
117
136
|
registry_thread = registry.APRSRegistryThread()
|
118
137
|
registry_thread.start()
|
119
138
|
|
120
|
-
if CONF.
|
121
|
-
|
122
|
-
|
123
|
-
log_monitor = threads.log_monitor.LogMonitorThread()
|
124
|
-
log_monitor.start()
|
139
|
+
if CONF.admin.web_enabled:
|
140
|
+
log_monitor_thread = log_monitor.LogMonitorThread()
|
141
|
+
log_monitor_thread.start()
|
125
142
|
|
126
143
|
rx_thread.join()
|
127
144
|
process_thread.join()
|
aprsd/cmds/webchat.py
CHANGED
@@ -7,7 +7,6 @@ import sys
|
|
7
7
|
import threading
|
8
8
|
import time
|
9
9
|
|
10
|
-
from aprslib import util as aprslib_util
|
11
10
|
import click
|
12
11
|
import flask
|
13
12
|
from flask import request
|
@@ -22,15 +21,14 @@ import aprsd
|
|
22
21
|
from aprsd import (
|
23
22
|
cli_helper, client, packets, plugin_utils, stats, threads, utils,
|
24
23
|
)
|
25
|
-
from aprsd.log import log
|
26
24
|
from aprsd.main import cli
|
27
25
|
from aprsd.threads import aprsd as aprsd_threads
|
28
|
-
from aprsd.threads import rx, tx
|
26
|
+
from aprsd.threads import keep_alive, rx, tx
|
29
27
|
from aprsd.utils import trace
|
30
28
|
|
31
29
|
|
32
30
|
CONF = cfg.CONF
|
33
|
-
LOG = logging.getLogger(
|
31
|
+
LOG = logging.getLogger()
|
34
32
|
auth = HTTPBasicAuth()
|
35
33
|
users = {}
|
36
34
|
socketio = None
|
@@ -65,7 +63,7 @@ def signal_handler(sig, frame):
|
|
65
63
|
time.sleep(1.5)
|
66
64
|
# packets.WatchList().save()
|
67
65
|
# packets.SeenList().save()
|
68
|
-
LOG.info(stats.
|
66
|
+
LOG.info(stats.stats_collector.collect())
|
69
67
|
LOG.info("Telling flask to bail.")
|
70
68
|
signal.signal(signal.SIGTERM, sys.exit(0))
|
71
69
|
|
@@ -335,7 +333,6 @@ class WebChatProcessPacketThread(rx.APRSDProcessPacketThread):
|
|
335
333
|
|
336
334
|
def process_our_message_packet(self, packet: packets.MessagePacket):
|
337
335
|
global callsign_locations
|
338
|
-
LOG.info(f"process MessagePacket {repr(packet)}")
|
339
336
|
# ok lets see if we have the location for the
|
340
337
|
# person we just sent a message to.
|
341
338
|
from_call = packet.get("from_call").upper()
|
@@ -381,7 +378,7 @@ def _get_transport(stats):
|
|
381
378
|
transport = "aprs-is"
|
382
379
|
aprs_connection = (
|
383
380
|
"APRS-IS Server: <a href='http://status.aprs2.net' >"
|
384
|
-
"{}</a>".format(stats["
|
381
|
+
"{}</a>".format(stats["APRSClientStats"]["server_string"])
|
385
382
|
)
|
386
383
|
elif client.KISSClient.is_enabled():
|
387
384
|
transport = client.KISSClient.transport()
|
@@ -422,7 +419,7 @@ def index():
|
|
422
419
|
html_template = "index.html"
|
423
420
|
LOG.debug(f"Template {html_template}")
|
424
421
|
|
425
|
-
transport, aprs_connection = _get_transport(stats)
|
422
|
+
transport, aprs_connection = _get_transport(stats["stats"])
|
426
423
|
LOG.debug(f"transport {transport} aprs_connection {aprs_connection}")
|
427
424
|
|
428
425
|
stats["transport"] = transport
|
@@ -457,27 +454,28 @@ def send_message_status():
|
|
457
454
|
|
458
455
|
|
459
456
|
def _stats():
|
460
|
-
stats_obj = stats.APRSDStats()
|
461
457
|
now = datetime.datetime.now()
|
462
458
|
|
463
459
|
time_format = "%m-%d-%Y %H:%M:%S"
|
464
|
-
stats_dict =
|
460
|
+
stats_dict = stats.stats_collector.collect(serializable=True)
|
465
461
|
# Webchat doesnt need these
|
466
|
-
if "
|
467
|
-
del stats_dict["
|
468
|
-
if "
|
469
|
-
del stats_dict["
|
470
|
-
if "
|
471
|
-
del stats_dict["
|
472
|
-
|
473
|
-
|
474
|
-
|
462
|
+
if "WatchList" in stats_dict:
|
463
|
+
del stats_dict["WatchList"]
|
464
|
+
if "SeenList" in stats_dict:
|
465
|
+
del stats_dict["SeenList"]
|
466
|
+
if "APRSDThreadList" in stats_dict:
|
467
|
+
del stats_dict["APRSDThreadList"]
|
468
|
+
if "PacketList" in stats_dict:
|
469
|
+
del stats_dict["PacketList"]
|
470
|
+
if "EmailStats" in stats_dict:
|
471
|
+
del stats_dict["EmailStats"]
|
472
|
+
if "PluginManager" in stats_dict:
|
473
|
+
del stats_dict["PluginManager"]
|
475
474
|
|
476
475
|
result = {
|
477
476
|
"time": now.strftime(time_format),
|
478
477
|
"stats": stats_dict,
|
479
478
|
}
|
480
|
-
|
481
479
|
return result
|
482
480
|
|
483
481
|
|
@@ -541,18 +539,27 @@ class SendMessageNamespace(Namespace):
|
|
541
539
|
|
542
540
|
def on_gps(self, data):
|
543
541
|
LOG.debug(f"WS on_GPS: {data}")
|
544
|
-
lat =
|
545
|
-
long =
|
546
|
-
LOG.debug(f"Lat
|
547
|
-
LOG.debug(f"Long
|
542
|
+
lat = data["latitude"]
|
543
|
+
long = data["longitude"]
|
544
|
+
LOG.debug(f"Lat {lat}")
|
545
|
+
LOG.debug(f"Long {long}")
|
546
|
+
path = data.get("path", None)
|
547
|
+
if not path:
|
548
|
+
path = []
|
549
|
+
elif "," in path:
|
550
|
+
path_opts = path.split(",")
|
551
|
+
path = [x.strip() for x in path_opts]
|
552
|
+
else:
|
553
|
+
path = [path]
|
548
554
|
|
549
555
|
tx.send(
|
550
|
-
packets.
|
556
|
+
packets.BeaconPacket(
|
551
557
|
from_call=CONF.callsign,
|
552
558
|
to_call="APDW16",
|
553
559
|
latitude=lat,
|
554
560
|
longitude=long,
|
555
561
|
comment="APRSD WebChat Beacon",
|
562
|
+
path=path,
|
556
563
|
),
|
557
564
|
direct=True,
|
558
565
|
)
|
@@ -572,8 +579,6 @@ class SendMessageNamespace(Namespace):
|
|
572
579
|
def init_flask(loglevel, quiet):
|
573
580
|
global socketio, flask_app
|
574
581
|
|
575
|
-
log.setup_logging(loglevel, quiet)
|
576
|
-
|
577
582
|
socketio = SocketIO(
|
578
583
|
flask_app, logger=False, engineio_logger=False,
|
579
584
|
async_mode="threading",
|
@@ -624,7 +629,7 @@ def webchat(ctx, flush, port):
|
|
624
629
|
LOG.info(msg)
|
625
630
|
LOG.info(f"APRSD Started version: {aprsd.__version__}")
|
626
631
|
|
627
|
-
CONF.log_opt_values(
|
632
|
+
CONF.log_opt_values(logging.getLogger(), logging.DEBUG)
|
628
633
|
user = CONF.admin.user
|
629
634
|
users[user] = generate_password_hash(CONF.admin.password)
|
630
635
|
if not port:
|
@@ -647,7 +652,7 @@ def webchat(ctx, flush, port):
|
|
647
652
|
packets.WatchList()
|
648
653
|
packets.SeenList()
|
649
654
|
|
650
|
-
keepalive =
|
655
|
+
keepalive = keep_alive.KeepAliveThread()
|
651
656
|
LOG.info("Start KeepAliveThread")
|
652
657
|
keepalive.start()
|
653
658
|
|
aprsd/conf/common.py
CHANGED
@@ -15,10 +15,6 @@ watch_list_group = cfg.OptGroup(
|
|
15
15
|
name="watch_list",
|
16
16
|
title="Watch List settings",
|
17
17
|
)
|
18
|
-
rpc_group = cfg.OptGroup(
|
19
|
-
name="rpc_settings",
|
20
|
-
title="RPC Settings for admin <--> web",
|
21
|
-
)
|
22
18
|
webchat_group = cfg.OptGroup(
|
23
19
|
name="webchat",
|
24
20
|
title="Settings specific to the webchat command",
|
@@ -101,6 +97,45 @@ aprsd_opts = [
|
|
101
97
|
default=None,
|
102
98
|
help="Longitude for the GPS Beacon button. If not set, the button will not be enabled.",
|
103
99
|
),
|
100
|
+
cfg.StrOpt(
|
101
|
+
"log_packet_format",
|
102
|
+
choices=["compact", "multiline", "both"],
|
103
|
+
default="compact",
|
104
|
+
help="When logging packets 'compact' will use a single line formatted for each packet."
|
105
|
+
"'multiline' will use multiple lines for each packet and is the traditional format."
|
106
|
+
"both will log both compact and multiline.",
|
107
|
+
),
|
108
|
+
cfg.IntOpt(
|
109
|
+
"default_packet_send_count",
|
110
|
+
default=3,
|
111
|
+
help="The number of times to send a non ack packet before giving up.",
|
112
|
+
),
|
113
|
+
cfg.IntOpt(
|
114
|
+
"default_ack_send_count",
|
115
|
+
default=3,
|
116
|
+
help="The number of times to send an ack packet in response to recieving a packet.",
|
117
|
+
),
|
118
|
+
cfg.IntOpt(
|
119
|
+
"packet_list_maxlen",
|
120
|
+
default=100,
|
121
|
+
help="The maximum number of packets to store in the packet list.",
|
122
|
+
),
|
123
|
+
cfg.IntOpt(
|
124
|
+
"packet_list_stats_maxlen",
|
125
|
+
default=20,
|
126
|
+
help="The maximum number of packets to send in the stats dict for admin ui.",
|
127
|
+
),
|
128
|
+
cfg.BoolOpt(
|
129
|
+
"enable_seen_list",
|
130
|
+
default=True,
|
131
|
+
help="Enable the Callsign seen list tracking feature. This allows aprsd to keep track of "
|
132
|
+
"callsigns that have been seen and when they were last seen.",
|
133
|
+
),
|
134
|
+
cfg.BoolOpt(
|
135
|
+
"enable_packet_logging",
|
136
|
+
default=True,
|
137
|
+
help="Set this to False, to disable logging of packets to the log file.",
|
138
|
+
),
|
104
139
|
]
|
105
140
|
|
106
141
|
watch_list_opts = [
|
@@ -138,7 +173,7 @@ admin_opts = [
|
|
138
173
|
default=False,
|
139
174
|
help="Enable the Admin Web Interface",
|
140
175
|
),
|
141
|
-
cfg.
|
176
|
+
cfg.StrOpt(
|
142
177
|
"web_ip",
|
143
178
|
default="0.0.0.0",
|
144
179
|
help="The ip address to listen on",
|
@@ -161,28 +196,6 @@ admin_opts = [
|
|
161
196
|
),
|
162
197
|
]
|
163
198
|
|
164
|
-
rpc_opts = [
|
165
|
-
cfg.BoolOpt(
|
166
|
-
"enabled",
|
167
|
-
default=True,
|
168
|
-
help="Enable RPC calls",
|
169
|
-
),
|
170
|
-
cfg.StrOpt(
|
171
|
-
"ip",
|
172
|
-
default="localhost",
|
173
|
-
help="The ip address to listen on",
|
174
|
-
),
|
175
|
-
cfg.PortOpt(
|
176
|
-
"port",
|
177
|
-
default=18861,
|
178
|
-
help="The port to listen on",
|
179
|
-
),
|
180
|
-
cfg.StrOpt(
|
181
|
-
"magic_word",
|
182
|
-
default=APRSD_DEFAULT_MAGIC_WORD,
|
183
|
-
help="Magic word to authenticate requests between client/server",
|
184
|
-
),
|
185
|
-
]
|
186
199
|
|
187
200
|
enabled_plugins_opts = [
|
188
201
|
cfg.ListOpt(
|
@@ -205,7 +218,7 @@ enabled_plugins_opts = [
|
|
205
218
|
]
|
206
219
|
|
207
220
|
webchat_opts = [
|
208
|
-
cfg.
|
221
|
+
cfg.StrOpt(
|
209
222
|
"web_ip",
|
210
223
|
default="0.0.0.0",
|
211
224
|
help="The ip address to listen on",
|
@@ -225,6 +238,11 @@ webchat_opts = [
|
|
225
238
|
default=None,
|
226
239
|
help="Longitude for the GPS Beacon button. If not set, the button will not be enabled.",
|
227
240
|
),
|
241
|
+
cfg.BoolOpt(
|
242
|
+
"disable_url_request_logging",
|
243
|
+
default=False,
|
244
|
+
help="Disable the logging of url requests in the webchat command.",
|
245
|
+
),
|
228
246
|
]
|
229
247
|
|
230
248
|
registry_opts = [
|
@@ -268,8 +286,6 @@ def register_opts(config):
|
|
268
286
|
config.register_opts(admin_opts, group=admin_group)
|
269
287
|
config.register_group(watch_list_group)
|
270
288
|
config.register_opts(watch_list_opts, group=watch_list_group)
|
271
|
-
config.register_group(rpc_group)
|
272
|
-
config.register_opts(rpc_opts, group=rpc_group)
|
273
289
|
config.register_group(webchat_group)
|
274
290
|
config.register_opts(webchat_opts, group=webchat_group)
|
275
291
|
config.register_group(registry_group)
|
@@ -281,7 +297,6 @@ def list_opts():
|
|
281
297
|
"DEFAULT": (aprsd_opts + enabled_plugins_opts),
|
282
298
|
admin_group.name: admin_opts,
|
283
299
|
watch_list_group.name: watch_list_opts,
|
284
|
-
rpc_group.name: rpc_opts,
|
285
300
|
webchat_group.name: webchat_opts,
|
286
301
|
registry_group.name: registry_opts,
|
287
302
|
}
|