Commit Graph

334 Commits

Author SHA1 Message Date
Craig Lamparter 96c8422990 backout my patch that broke tox, trying to push to craiger-test branch 2021-01-08 09:24:51 -08:00
Hemna e83ee31310 Fixed failures caused by last commit
This patch fixes test failures caused by last commit.
2021-01-08 10:57:34 -05:00
Craig Lamparter 99c5867162 don't tell radio emails were sent, ack is enuf 2021-01-07 16:22:45 -08:00
Hemna 25d948b0ee Updated README to include development env
This patch shows how to setup a development environment.

Please use the steps as laid out and install the pre-commit
hooks to ensure the code is clean prior to commit.
2021-01-06 20:03:25 -05:00
Hemna 75f610d971 Added pre-commit hooks
This patch adds pre-commit hook support to ensure
code passes basic checks prior to allowing a commit.
2021-01-06 17:54:50 -05:00
Hemna 8bd8b95b35 Update Changelog for v1.5.0 2020-12-30 09:29:01 -05:00
Walter A. Boring IV 40ab7a7a94
Merge pull request #26 from craigerl/threads
Threads
2020-12-30 09:23:17 -05:00
Hemna af0d4491c3 Added QueryPlugin resend all delayed msgs or Flush
This patch also updates the QueryPlugin to allow the configured user
to immediately resend all Delayed messages!

This patch updates the QueryPlugin to allow the configured user
to immediately Flush/delete all messages!
2020-12-30 09:12:38 -05:00
Hemna 28f3daf6d0 Added QueryPlugin
Query Plugin looks for ^/?.* and currently only responds with
the list of pending messages in the MsgTrack queue.
2020-12-30 08:15:49 -05:00
Hemna 2659a0b3b9 Added support to save/load MsgTrack on exit/start
This patch added saving of the MsgTrack list of messages at aprsd exit.
The will be loaded at startup unless you pass in the --flush option.
2020-12-30 07:41:34 -05:00
Hemna 2e90c0bdbb Creation of MsgTrack object and other stuff
This patch adds the new MsgTrack object replacing the
global ack_dict.  the ack_dict was not thread safe.
the new MsgTrack is a singleton object that keeps track of
all outbound TextMessage objects.  When a TextMessage.send() is called
it is added to the MsgTrack object, and when an ack is received for that
message, the message is removed from the MsgTrack object.

TODO:  Add an automatic mechanism for saving the messages in MsgTrack
so that when CTRL-C is called to exit aprsd server, then the MsgTrack
state is saved to storage.   When aprsd server is started up again, add
the option to try and reload state of MsgTrack.

This patch also reworked the email thread into an APRSDThread object
that can exit gracefully with CTRL-C.

NOTE: Don't call sleep() with a long time (greater than 5 seconds), as
it causes a delay in exiting aprsd until the last sleep() finishes.
Since aprsd has so many threads now for processing incoming messages and
outgoing messages, we need to coordinate all thread operations so that
they don't block the exiting of the app.
2020-12-29 10:40:38 -05:00
Hemna 9d3ede6e71 Added FortunePlugin unit test
this patch adds te FortunePlugin unit tests.
2020-12-25 18:13:52 -05:00
Hemna 171703ac1a Added some plugin unit tests
This patch adds some real unit tests for the following plugins
PingPlugin
TimePlugin
VersionPlugin
2020-12-25 16:54:46 -05:00
Hemna f65707cb8c reworked threading
This patch reworks the threading code for processing
messages.   This patch also extends the aprslib IS class
to allow us to stop processing the consumer packets when
someone hits CTRL-C correctly.  Alloing the app to exit.
2020-12-24 13:40:59 -05:00
Hemna 9768003c2a Reworked messaging lib
This patch updates the messaging lib to use Message Objects
for each message type (text, ack) that know how to send
themselves with the same interface.
2020-12-23 13:12:04 -05:00
Hemna 1d898ea20f Refactored the main process_packet method
This patch refactored the process_packet method
and adjusted the logic for determining if we got
a message to filter on.  We now look at the format
to make a determination.  Also isolated the processing
of message packets, ack packets and mic-e packets into
their own functions.
2020-12-21 11:59:58 -05:00
Hemna 8161719697 Update README with version 1.1.0 related info
This patch adds more detailed information about the aprsd app, and
plugins.
2020-12-20 21:19:43 -05:00
Hemna b2609548f2 Added fix for an unknown packet type
If we get a packet that doesn't have a message in it, nor an ack,
we don't know what to do with it, so log it and then stop processing it.
2020-12-20 20:28:56 -05:00
Walter A. Boring IV e68d3f92e1
Merge pull request #25 from johng42/patch-1
Update .gitignore
2020-12-20 19:17:06 -05:00
Hemna 18b269a39d Ensure fortune is installed
This patch uses python3's shutil to find the path
to fortune app, which can be very different depending on
the host OS that aprsd is running on.
2020-12-20 19:04:33 -05:00
Hemna c39fddef67 Updated docker-compose
This patch update the docker-compose file to use the
host system's $HOME/.config/aprsd directory as the container's
config directory by default.
2020-12-20 16:46:19 -05:00
Hemna 6d2160c7b7 Added Changelog
The changelog is generated by pbr automatically when you run

python setup.py sdist bdist_wheel

So when you are ready for a new release, run
python setup.py sdist bdist_wheel

git add Changelog && git commit -m "Updated ChangeLog for version XXXX"

git tag -a vXXXX -m "Release version XXX"

git push origin --tags

Then release to pypi

twine check dist/*
twine upload dist/*
2020-12-20 16:41:24 -05:00
Hemna d3ee1b78bc Fixed issue when RX ack
This patch ensures that after we get an ACK, then proessing of the ack
message is complete and we don't try and send the ack through plugin
filtering.

Created send_ack_direct for the send-message command.

Also added logic to the send-message command to ensure we wait for an
ack from the command sent to APRSD and we also wait for a response
message and send an ack to that response before we exit.
2020-12-20 16:35:23 -05:00
Hemna 0992ab8176 Updated the aprsd-slack-plugin required version
this patch updates the docker-compose file to use
the 1.0.2 or > version of aprsd-slack-plugin
2020-12-20 15:29:16 -05:00
Hemna 6a61765eba Updated README.rst
This patch updates the README.rst with sample help and output from
various commands
2020-12-20 12:36:47 -05:00
Hemna 3261710bf8 Fixed send-message with email command and others
This patch fixes a minor issue with the new send-message command
You now should use nargs to send the email command because it includes
a - as the start.  click assumed that any -<foo>  looks ike an argument.
So call aprsd with

aprsd send-command <callsign> -- -wb sendmap

This patch also adds -h as a help option for aprsd to make it simpler to
type.

This patch adds the VersionPlugin so you can remotely request the
version of aprsd that's running.
2020-12-20 12:21:30 -05:00
John a566990a2f
Update .gitignore
I want to add some tests but before that I want git to ignore the venv folder and all the Idea (Pycharm) settings that get created in the home folder by default.
2020-12-19 17:25:27 -08:00
Craig Lamparter 923e1a7c3d
Merge pull request #23 from craigerl/aprslib
Major refactor
2020-12-19 14:00:01 -08:00
Hemna fa51f8fdf2 Big patch
This commit adds the new send-message command for sending messages.
This also redoes the logging of sent/rx'd packets to a single method
which is syncrhonized, so we don't get intermixed log messages for
packets.

Also adds email address validation during startup, and
optionally disables the validation via a command line switch.  without
email validation for production running aprsd, emails sent can turn up
garbage and cause issues when those emails are received by aprsd
message processing as invalid content.
2020-12-19 16:35:53 -05:00
Hemna 08c73a17d1 Major refactor
This branch refactors the majority of main.py out into individual
modules to compartmentalize the code.  Migrated all email related
features unti email.py, sending of messages into messaging.py

Also refactored all of the socket code to use aprslib for all APRS-IS
communication as well as message/packet processing.

Moved the email command into it's own Plugin.
2020-12-18 16:21:35 -05:00
Walter A. Boring IV 79d2139fe1
Merge pull request #24 from craigerl/docker_alpine
Updated the Dockerfile to use alpine
2020-12-17 10:22:22 -05:00
Hemna b5fb248b46 Updated the Dockerfile to use alpine
The ubuntu images were running about 533MB in size, so
I refactored the Dockerfiles to use alpine linux, and they run
about 130MB.
2020-12-17 10:16:58 -05:00
Walter A. Boring IV 3002ac2e89
Merge pull request #22 from craigerl/fix_email
Fix unknown characterset emails
2020-12-15 18:05:28 -05:00
Hemna 96bae795a5 Fix unknown characterset emails
Some emails that had an unknown character set.  when that happens
we can't decode the body of the message properly, so the default body
string was being used, and was attempting to be decoded.  Only byte
strings can be decoded, so the default string is now labeled as a byte
encoding.
2020-12-15 17:59:17 -05:00
Walter A. Boring IV b4526f3a0e
Merge pull request #21 from craigerl/readme
Readme
2020-12-15 12:09:31 -05:00
Hemna 8a6273867c Updated loggin timestamp to include []
Added timestamp inside of [] for easier parsing
2020-12-15 11:10:46 -05:00
Hemna 21253ff6e7 Updated README with a TOC
This patch updates the README.rst to include an index table at the top
as well as a section describing building and using the docker container
2020-12-15 10:51:02 -05:00
Walter A. Boring IV 57fe08758f
Merge pull request #19 from craigerl/docker
Updates for building containers
2020-12-15 10:35:13 -05:00
Hemna 861fde6f83 Updates for building containers
This patch updates the Dockerfile for building the official container
image and includes the ability to load external pypi modules as plugins
at container startup.
2020-12-15 10:32:53 -05:00
Walter A. Boring IV ba61178b14
Merge pull request #18 from craigerl/plugin_fix
Don't use the dirname for the plugin path search
2020-12-15 09:36:38 -05:00
Hemna 63079a817d Don't use the dirname for the plugin path search 2020-12-15 09:30:10 -05:00
Walter A. Boring IV ec140995c2
Merge pull request #17 from craigerl/fix_plugin
Reworked Plugin loading
2020-12-15 07:53:56 -05:00
Hemna 1385f5ee27 Reworked Plugin loading
This patch reworked the loading of plugins.  Python2 is dead.
Previously was using the imp module to easily load the plugins from
a separate directory, which is a bit of a pita.  Found a python3 lib
that takes care of the difference between py3.3, 3.4 and 3.5+ module
loading called "thesmuggler"
2020-12-15 07:50:10 -05:00
Hemna 3ffa4165f0 Updated README with development information 2020-12-14 16:06:07 -05:00
Hemna eba093b62a Fixed an issue with weather plugin
Weather plugin had an invalid call to rstrip()
2020-12-14 14:18:12 -05:00
Hemna e1edbe6c62 Rewrote the README.md to README.rst
This patch rewrote the README.md file to an README.rst
so that pypi might be able to consume it.
2020-12-14 11:35:10 -05:00
Craig Lamparter 28363d0814
Merge pull request #16 from hemna/plugins_fix
Fixed the usage string after plugins introduced
2020-12-13 20:31:18 -08:00
Hemna 2873e35f14 Fixed the usage string after plugins introduced
This patch fixes the Usage string for a call message
that isn't matched by any plugin.

Plugin object now must impleent a 'command_name' attribute
that is the usage string for that plugin.
2020-12-13 21:51:39 -05:00
Craig Lamparter ccad85a8bf
Merge pull request #15 from hemna/plugins
Created plugin.py for Command Plugins
2020-12-13 18:06:35 -08:00
Hemna d09a66006b Created plugin.py for Command Plugins
This patch adds the new APRSD Command Plugin architecture.
All Comand plugins must implement the same object API, which includes
plugin object is subclass of APRSDPluginBase
version attribute
command_regex attribute
command method

When an APRS command is detected, then the regex is run against
the command.  If the command_regex matches, then the plugin's
command() method will be called.   If the command() method returns
a string, then that string is sent as a reply to the APRS caller.

A new aprs.yml config section is added to support selecting
which plugins to enable.

If you want all plugins enabled, then omit "enabled_plugins" entirely
from the aprs section of the config.

To load custom plugins:
1) create a directory with an __init__.py file
2) Add a plugin.py file that contains your plugin

Look at the exmaples directory for an example plugin.
2020-12-13 20:57:30 -05:00