From 2c4160e9d7cd6a560c838065c3756d9d9e307ae6 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Thu, 11 Mar 2021 09:40:06 +0800 Subject: [PATCH] 1.2.7 --- docs/meshtastic/index.html | 35 ++++++++++++++++++++++++++++++++--- setup.py | 2 +- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/docs/meshtastic/index.html b/docs/meshtastic/index.html index 7943728..7b0601c 100644 --- a/docs/meshtastic/index.html +++ b/docs/meshtastic/index.html @@ -478,7 +478,16 @@ class MeshInterface: # URLs are of the form https://www.meshtastic.org/d/#{base64_channel_set} # Split on '/#' to find the base64 encoded channel settings splitURL = url.split("/#") - decodedURL = base64.urlsafe_b64decode(splitURL[-1]) + b64 = splitURL[-1] + + # We normally strip padding to make for a shorter URL, but the python parser doesn't like + # that. So add back any missing padding + # per https://stackoverflow.com/a/9807138 + missing_padding = len(b64) % 4 + if missing_padding: + b64 += '='* (4 - missing_padding) + + decodedURL = base64.urlsafe_b64decode(b64) channelSet = apponly_pb2.ChannelSet() channelSet.ParseFromString(decodedURL) @@ -862,6 +871,7 @@ class StreamInterface(MeshInterface): # Start the reader thread after superclass constructor completes init if connectNow: self.connect() + self.waitForConfig() def connect(self): """Connect to our radio @@ -1609,7 +1619,16 @@ noProto – If True, don't try to run our protocol on the link - just be a d # URLs are of the form https://www.meshtastic.org/d/#{base64_channel_set} # Split on '/#' to find the base64 encoded channel settings splitURL = url.split("/#") - decodedURL = base64.urlsafe_b64decode(splitURL[-1]) + b64 = splitURL[-1] + + # We normally strip padding to make for a shorter URL, but the python parser doesn't like + # that. So add back any missing padding + # per https://stackoverflow.com/a/9807138 + missing_padding = len(b64) % 4 + if missing_padding: + b64 += '='* (4 - missing_padding) + + decodedURL = base64.urlsafe_b64decode(b64) channelSet = apponly_pb2.ChannelSet() channelSet.ParseFromString(decodedURL) @@ -2215,7 +2234,16 @@ wantResponse – True if you want the service on the other side to send an a # URLs are of the form https://www.meshtastic.org/d/#{base64_channel_set} # Split on '/#' to find the base64 encoded channel settings splitURL = url.split("/#") - decodedURL = base64.urlsafe_b64decode(splitURL[-1]) + b64 = splitURL[-1] + + # We normally strip padding to make for a shorter URL, but the python parser doesn't like + # that. So add back any missing padding + # per https://stackoverflow.com/a/9807138 + missing_padding = len(b64) % 4 + if missing_padding: + b64 += '='* (4 - missing_padding) + + decodedURL = base64.urlsafe_b64decode(b64) channelSet = apponly_pb2.ChannelSet() channelSet.ParseFromString(decodedURL) @@ -2452,6 +2480,7 @@ debugOut {stream} – If a stream is provided, any debug serial output from # Start the reader thread after superclass constructor completes init if connectNow: self.connect() + self.waitForConfig() def connect(self): """Connect to our radio diff --git a/setup.py b/setup.py index 240e14e..449f27c 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ with open("README.md", "r") as fh: # This call to setup() does all the work setup( name="meshtastic", - version="1.2.6", + version="1.2.7", description="Python API & client shell for talking to Meshtastic devices", long_description=long_description, long_description_content_type="text/markdown",