Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Docker image and work on Owntracks plugin #5

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# set base image (host OS)
FROM python:3.8
FROM python:3.9

# set the working directory in the container
WORKDIR /code
Expand Down
13 changes: 11 additions & 2 deletions plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,22 @@ def do_action(self, packet):
if option not in self.config:
self.logger.warning(f"Missing config: {option}")
return packet
tid_table = self.config["tid_table"]
#tid_table = self.config["tid_table"]
tid_table = {}
for tid_entry in self.config["tid_table"]: # We want to check for a key with an ! and convert to string
if "!" in tid_entry:
tid_table[str(int(tid_entry[1:], 16))] = self.config["tid_table"][tid_entry]
else:
tid_table[tid_entry] = self.config["tid_table"][tid_entry]

if not "from" in packet:
self.logger.warning("Missing from: field")
return packet

if not str(packet["from"]) in self.config["tid_table"]:
if packet["from"] < 0:
packet["from"] = packet["from"] +(1 << 32)

if not str(packet["from"]) in tid_table:
self.logger.warning(f"Sender not in tid_table: {packet}")
return packet

Expand Down