glennmckechnie / weewx-mastodon

An extension for WeeWX that posts selected weather details to your mastodon server of choice.
GNU General Public License v3.0
10 stars 0 forks source link

Mastodon.py User Agent #2

Open ChadOhman opened 2 months ago

ChadOhman commented 2 months ago

Hi there!

Thanks for your amazing work on this.

Question - is there a way to set the Mastodon.py User Agent? My instance requires it because misconfigured Mastodon.py has been abused in the past.

Thanks in advance!

glennmckechnie commented 2 months ago

I've created the useragent branch which includes the necessary code to add the User-Agent string for this application (hardcoded) into the request header.

https://github.com/glennmckechnie/weewx-mastodon/commit/687c80ccc395d1241c6d9e5dc6126068de74a933

The wxtoot.py file is the only change and it should be a drop in replacement for your existing bin/user/wxtoot.py file. Move your old one aside, fetch and drop this file in its place and restart weewx.

Let me know how it goes. When it works I'll include those changes into the main repo. It does work for me, or at least it doesn't break my uploads and doesn't upset my Mastodon instance. Whether it satisfies your needs only you and your server will know. :-)

Okay - I just realized. We are talking about the useragent string for the posting application (wxtoot.py), and not the version number of Mastodon.py being used - which I'd have thought was part of the headers anyway??

glennmckechnie commented 1 month ago

Did this solve the issue?