Skip to content

Commit

Permalink
Dev (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
kx1t authored Apr 26, 2024
2 parents 5c1f9eb + ba5c295 commit 97df2e8
Show file tree
Hide file tree
Showing 41 changed files with 375 additions and 215 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"python.analysis.extraPaths": [
"./rootfs/usr/lib/python3/dist-packages"
]
}
4 changes: 2 additions & 2 deletions ATTRIBUTION.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Planefence, and its associated programs, data, tools, documentation, and example code, is
Copyright (C) 2020 - 2022 by Ramon F. Kolb, KX1T.
Copyright (C) 2020 - 2024 by Ramon F. Kolb, KX1T.
KX1T can be reached via email at k x 1 t (at) a m s a t d o t org
or via snail mail at PO Box 11, Belmont, MA 02478, USA.

This file contains attributions and license terms of software, databases, and other items that were used in the creation and operation of Planefence and Plane-Alert. We are sincerely grateful to all who contributed.
If you think that we included parts of your software but we didn't attribute you properly, please contact us and we will add attribution.

- dump1090.socket30003 is used under the GNU GENERAL PUBLIC LICENSE, version 3. This program is (C) by Ted Sluis (@tedsluis), and a slightly modified fork can be found at https://github.com/kx1t/dump1090.socket30003. Any modification to dump1090.socket30003 are Copyright by their respective owners
- dump1090.socket30003 is used under the GNU GENERAL PUBLIC LICENSE, version 3. This program is (C) by Ted Sluis (@tedsluis), and a slightly modified fork can be found at https://github.com/sdr-enthusiasts/dump1090.socket30003. Any modification to dump1090.socket30003 are Copyright by their respective owners

- Maps are generated thanks to OpenStreetMap. OpenStreetMap® is open data, licensed under the Open Data Commons Open Database License (ODbL) by the OpenStreetMap Foundation (OSMF). "© OpenStreetMap contributors". More information, including license terms, can be found here: https://www.openstreetmap.org/copyright

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ RUN set -x && \
# Do this here while we still have git installed:
git config --global advice.detachedHead false && \
branch="##main##" && \
echo "${branch//#/}_($(git ls-remote https://github.com/kx1t/docker-planefence refs/heads/${branch//#/} | awk '{ print substr($1,1,7)}'))_$(date +%y-%m-%d-%T%Z)" > /root/.buildtime && \
echo "${branch//#/}_($(git ls-remote https://github.com/sdr-enthusiasts/docker-planefence refs/heads/${branch//#/} | awk '{ print substr($1,1,7)}'))_$(date +%y-%m-%d-%T%Z)" > /root/.buildtime && \
cp -f /root/.buildtime /.VERSION && \
# Clean up
echo Uninstalling $TEMP_PACKAGES && \
Expand Down
41 changes: 28 additions & 13 deletions README-Mastodon.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
- [Prerequisites](#prerequisites)
- [Signing up for a Mastodon Account and creating an Application](#signing-up-for-a-mastodon-account-and-creating-an-application)
- [Configuring Planefence to use Mastodon](#configuring-planefence-to-use-mastodon)
- [Automatic verification checkmark of your Mastodon account](#automatic-verification-checkmark-of-your-mastodon-account)
- [Troubleshooting Mastodon verified links](#troubleshooting-mastodon-verified-links)
- [Summary of License Terms](#summary-of-license-terms)


This utility enables sending Mastodon posts of new events. Ever since Twitter started to restrict posting about locations of aircraft, are encouraging people to post to Mastodon,

There are two major parts to install this. Each of these parts is described below.
Expand All @@ -20,29 +21,27 @@ This is part of the [sdr-enthusiasts/docker-planefence] docker container. Nothin

## Signing up for a Mastodon Account and creating an Application

Mastodon is a distributed social media service. This means, that you have your choice of Mastodon servers to create and maintain your account on. Any of them will work (as long as they allow bots), but we recommend joining this one. It's the one where many of us post results of our SDR and radio reception endeavors: https://airwaves.social/
Mastodon is a distributed social media service. This means, that you have your choice of Mastodon servers to create and maintain your account on. Any of them will work (as long as they allow bots), but we recommend joining this one. It's the one where many of us post results of our SDR and radio reception endeavors: <https://airwaves.social/>

Once you have an account, please do the following:

- Sign in to Mastodon and go to the home page, for example: https://airwaves.social/home
- Sign in to Mastodon and go to the home page, for example: <https://airwaves.social/home>
- Click `Preferences` on the bottom right of the page
<img src="https://user-images.githubusercontent.com/15090643/208437930-ee33596d-5015-4283-923c-12913552f6db.png"/>
![image](https://user-images.githubusercontent.com/15090643/208437930-ee33596d-5015-4283-923c-12913552f6db.png)

- On the bottom left, click `</> Development`
<img src="https://user-images.githubusercontent.com/15090643/208438201-27c29fec-cad9-43fe-88f6-c4009961b162.png" width="50%" />
![image](https://user-images.githubusercontent.com/15090643/208438201-27c29fec-cad9-43fe-88f6-c4009961b162.png)

- Create a new Application by clicking the button, then:
- Give it a name (for example, "Planefence")
- Add a URL (if you don't have one, use something like "https://airwaves.social/@myhandle" (replace `myhandle` by your Mastodon handle))
- Add a URL (if you don't have one, use something like "<https://airwaves.social/@myhandle>" (replace `myhandle` by your Mastodon handle))
- Make sure that the following scopes are selected (important!!!): `read`, `write`, `follow`
- Press `Submit` at the bottom of the page
![image](https://user-images.githubusercontent.com/15090643/208438325-2f5dd1b7-ebd8-404e-8929-7bf5e7875037.png)

![image](https://user-images.githubusercontent.com/15090643/208438373-de1defdb-41ee-4528-a659-f2faa846733d.png)

- Open the Application and (important!!!) note the Access Token
![image](https://user-images.githubusercontent.com/15090643/208438462-b40cc847-f36c-4db7-bacb-54a68fae2cff.png)

![image](https://user-images.githubusercontent.com/15090643/208438987-3e1fd9c2-5ce9-46c0-92e9-20bb78f55a8c.png)

Note -- if you post lots of traffic to Mastodon, please consider adding an Automatic Post Deletion time of 1 week.
Expand All @@ -62,11 +61,27 @@ PF_MASTODON_VISIBILITY=unlisted
MASTODON_RETENTION_TIME=7
```

Replace by the applicable server name and access token.
If `PF_MASTODON` is not set to `ON`, then no PlaneFence Mastodon notifications will be sent.
If `PA_MASTODON` is not set to `ON`, then no Plane-Alert Mastodon notifications will be sent.
`Px_MASTODON_VISIBILITY` can be `public`, `unlisted`, or `private`
`MASTODON_RETENTION_TIME` is the retention time of any messages, in days (not yet enforced, future functionality)
- Replace the values with the applicable server name and access token.
- If `PF_MASTODON` is not set to `ON`, then no PlaneFence Mastodon notifications will be sent.
- If `PA_MASTODON` is not set to `ON`, then no Plane-Alert Mastodon notifications will be sent.
- `Px_MASTODON_VISIBILITY` can be `public` (visible in everyone's feed), `unlisted` (only visible on your profile page), or `private` (invisible to anyone except for you).

## Automatic verification checkmark of your Mastodon account

If you add a link to your public Planefence or Plane-Alert page in the Extra Fields section of your Public Profile on Mastodon, you will get automatic account verification (with a cool green checkmark) for your Mastodon account. Your Planefence and Plane-Alert pages will automatically add a hidden verification link with the `rel="me"` element as described in the "Verification" tab of your Mastodon Profile Edit page.

![image](https://github.com/sdr-enthusiasts/docker-planefence/assets/15090643/4164a6c3-c029-4c8b-8d66-182181d2c70a)
![image](https://github.com/sdr-enthusiasts/docker-planefence/assets/15090643/99708e0b-71d1-4b47-9f01-0db56bc738ee)

### Troubleshooting Mastodon verified links

- If verification fails, please ensure that your Planefence and Plane-Alert webpages are reachable when you press "Save my profile" in Mastodon. This will kick off a new verification attempt.
- Another thing to check is that your reverse web proxy (if you use one) isn't too aggressive blocking Bots. Specifically, User Agents that start with `http.rb` should be allowed to pass. Here are a few examples of verification attempts (from the webproxy's `access.log`):

```text
66.94.123.74 - - [03/Feb/2024:21:00:24 -0500] "GET /planefence/ HTTP/1.1" 200 27716 "-" "http.rb/5.1.1 (Mastodon/4.2.1; +https://airwaves.social/)"
66.94.123.74 - - [03/Feb/2024:21:00:25 -0500] "GET /plane-alert/ HTTP/1.1" 200 524687 "-" "http.rb/5.1.1 (Mastodon/4.2.1; +https://airwave.social/)"
```

## Summary of License Terms

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ In the `docker-compose.yml` file, you should configure the following:
- OPTIONAL: If you configured Twitter support before, `sudo nano /opt/adsb/planefence/config/.twurlrc`. You can add your back-up TWURLRC file here, if you want.
- OPTIONAL: Configure tweets to be sent. For details, see these instructions: [README](README-planetweet.md)
- OPTIONAL: `sudo nano /opt/adsb/planefence/config/plane-alert-db.txt`. This is the list of tracking aircraft of Plane-Alert. It is prefilled with the planes of a number of "interesting" political players. Feel free to add your own, delete what you don't want to see, etc. Just follow the same format.
- OPTIONAL: If you have multiple containers running on different web port, and you would like to consolidate them all under a single host name, then you should consider installing a "reverse web proxy". This can be done quickly and easily - see instructions [here](https://github.com/kx1t/docker-planefence/README-nginx-rev-proxy.md).
- OPTIONAL: If you have a soundcard and microphone, adding NoiseCapt is as easy as hooking up the hardware and running another container. You can add this to your existing `docker-compose.yml` file, or run it on a different machine on the same subnet. Instructions are [here](https://github.com/kx1t/docker-noisecapt/).
- OPTIONAL for Plane-Alert: You can add custom fields, that (again optionally) are displayed on the Plane-Alert list. See [this discussion](https://github.com/kx1t/docker-planefence/issues/38) on how to do that.
- OPTIONAL: If you have multiple containers running on different web port, and you would like to consolidate them all under a single host name, then you should consider installing a "reverse web proxy". This can be done quickly and easily - see instructions [here](https://github.com/sdr-enthusiasts/docker-planefence/README-nginx-rev-proxy.md).
- OPTIONAL: If you have a soundcard and microphone, adding NoiseCapt is as easy as hooking up the hardware and running another container. You can add this to your existing `docker-compose.yml` file, or run it on a different machine on the same subnet. Instructions are [here](https://github.com/sdr-enthusiasts/docker-noisecapt/).
- OPTIONAL for Plane-Alert: You can add custom fields, that (again optionally) are displayed on the Plane-Alert list. See [this discussion](https://github.com/sdr-enthusiasts/docker-planefence/issues/38) on how to do that.
- OPTIONAL: The website will apply background pictures if you provide them. Save your .jpg pictures as `/opt/adsb/planefence/config/pf_background.jpg` for Planefence and `/opt/adsb/planefence/config/pa_background.jpg` for Plane-Alert. (You may have to restart the container or do `touch /opt/adsb/planefence/config/planefence.config` in order for these backgrounds to become effective.)
- OPTIONAL: Add images of tar1090 to your Tweets in Planefence and Plane-Alert. In order to enable this, simply add the `screenshot` section to your `Docker-compose.yml` file as per the example in this repo's [`docker-compose.yml`](https://github.com/sdr-enthusiasts/docker-planefence/blob/main/docker-compose.yml) file. Note - to simplify configuration, Planefence assumes that the hostname of the screenshotting image is called `screenshot` and that it's reachable under that name from the Planefence container stack.
- OPTIONAL: Show [OpenAIP](http://map.openaip.net) overlay on Planefence web page heatmap. Enable this by setting the option `PF_OPENAIP_LAYER=ON` in `/opt/adsb/planefence/config/planefence.config`
Expand Down
4 changes: 2 additions & 2 deletions rootfs/etc/s6-overlay/scripts/50-get-openskydb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/command/with-contenv bash
#shellcheck shell=bash disable=SC1091,SC2174
# -----------------------------------------------------------------------------------
# Copyright 2020-2022 Ramon F. Kolb - licensed under the terms and conditions
# Copyright 2020-2024 Ramon F. Kolb - licensed under the terms and conditions
# of GPLv3. The terms and conditions of this license are included with the Github
# distribution of this package, and are also available here:
# https://github.com/kx1t/docker-planefence/
# https://github.com/sdr-enthusiasts/docker-planefence/
#
# This package may incorporate other software and license terms.
# -----------------------------------------------------------------------------------
Expand Down
9 changes: 5 additions & 4 deletions rootfs/etc/s6-overlay/scripts/60-check-mastodon
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ APPNAME="$(hostname)/check-mastodon"
# Copyright 2020-2022 Ramon F. Kolb - licensed under the terms and conditions
# of GPLv3. The terms and conditions of this license are included with the Github
# distribution of this package, and are also available here:
# https://github.com/kx1t/planefence4docker/
# https://github.com/sdr-enthusiasts/planefence4docker/
#
# This package may incorporate other software and license terms.
# -----------------------------------------------------------------------------------
Expand All @@ -26,10 +26,11 @@ else
# strip http:// https://
[[ "${MASTODON_SERVER:0:7}" == "http://" ]] && MASTODON_SERVER="${MASTODON_SERVER:7}" || true
[[ "${MASTODON_SERVER:0:8}" == "https://" ]] && MASTODON_SERVER="${MASTODON_SERVER:8}" || true
result="$(curl -sS -H "Authorization: Bearer $MASTODON_ACCESS_TOKEN" "https://${MASTODON_SERVER}/api/v1/apps/verify_credentials")"
if grep -vi "The access token is invalid" <<< "$result" >/dev/null 2>&1
result="$(curl -m 5 -sSL -H "Authorization: Bearer $MASTODON_ACCESS_TOKEN" "https://${MASTODON_SERVER}/api/v1/apps/verify_credentials")"
acct="$(curl -m 5 -sSL -H "Authorization: Bearer $MASTODON_ACCESS_TOKEN" "https://${MASTODON_SERVER}/api/v1/accounts/verify_credentials")"
if ! grep -iq "The access token is invalid\|<body class='error'>" <<< "$result" >/dev/null 2>&1
then
echo "[$(date)][$APPNAME] Mastodon configured correctly for application $(jq '.name' <<< "$result") / website $(jq '.website' <<< "$result")"
echo "[$(date)][$APPNAME] Mastodon configured correctly for @$MASTODON_SERVER@$(jq -r '.acct' <<< "$acct")'s application $(jq '.name' <<< "$result") / website $(jq '.website' <<< "$result")"
[[ "${PF_MASTODON,,}" == "on" ]] && echo "[$(date)][$APPNAME] Mastodon enabled for Planefence" || echo "[$(date)][$APPNAME] Mastodon disabled for Planefence"
[[ "${PA_MASTODON,,}" == "on" ]] && echo "[$(date)][$APPNAME] Mastodon enabled for Plane-Alert" || echo "[$(date)][$APPNAME] Mastodon disabled for Plane-Alert"
else
Expand Down
4 changes: 2 additions & 2 deletions rootfs/etc/s6-overlay/scripts/cleanup
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ APPNAME="$(hostname)/cleanup"
[[ "$LOGLEVEL" != "ERROR" ]] && echo "[$APPNAME][$(date)] Cleanup started as an s6 service" || true

# -----------------------------------------------------------------------------------
# Copyright 2020, 2021 Ramon F. Kolb - licensed under the terms and conditions
# Copyright 2020-2024 Ramon F. Kolb - licensed under the terms and conditions
# of GPLv3. The terms and conditions of this license are included with the Github
# distribution of this package, and are also available here:
# https://github.com/kx1t/docker-planefence
# https://github.com/sdr-enthusiasts/docker-planefence
#
# -----------------------------------------------------------------------------------
# Feel free to make changes to the variables between these two lines. However, it is
Expand Down
4 changes: 2 additions & 2 deletions rootfs/etc/s6-overlay/scripts/get-pa-alertlist
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ APPNAME="$(hostname)/get-pa-alertlist"
[[ "$LOGLEVEL" != "ERROR" ]] && echo "[$APPNAME][$(date)] Get-PA-Alertlist started as an s6 service" || true

# -----------------------------------------------------------------------------------
# Copyright 2020, 2021 Ramon F. Kolb - licensed under the terms and conditions
# Copyright 2020-2024 Ramon F. Kolb - licensed under the terms and conditions
# of GPLv3. The terms and conditions of this license are included with the Github
# distribution of this package, and are also available here:
# https://github.com/kx1t/planefence4docker/
# https://github.com/sdr-enthusiasts/docker-planefence
#
# The package contains parts of, and modifications or derivatives to the following:
# Dump1090.Socket30003 by Ted Sluis: https://github.com/tedsluis/dump1090.socket30003
Expand Down
4 changes: 2 additions & 2 deletions rootfs/etc/s6-overlay/scripts/lighttpd
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ GROUP=www-data
[[ "$LOGLEVEL" != "ERROR" ]] && echo "[$APPNAME][$(date)] Lighttpd started as an s6 service" || true

# -----------------------------------------------------------------------------------
# Copyright 2020, 2021 Ramon F. Kolb - licensed under the terms and conditions
# Copyright 2020-2024 Ramon F. Kolb - licensed under the terms and conditions
# of GPLv3. The terms and conditions of this license are included with the Github
# distribution of this package, and are also available here:
# https://github.com/kx1t/docker-planefence
# https://github.com/sdr-enthusiasts/docker-planefence
#
# -----------------------------------------------------------------------------------
# Feel free to make changes to the variables between these two lines. However, it is
Expand Down
4 changes: 2 additions & 2 deletions rootfs/etc/s6-overlay/scripts/planefence
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ PLANEFENCEDIR=/usr/share/planefence
[[ "$LOGLEVEL" != "ERROR" ]] && echo "[$APPNAME][$(date)] PlaneFence started as an s6 service" || true
[[ "$LOGLEVEL" != "ERROR" ]] && echo "[$APPNAME][$(date)] PlaneFence build: $(grep 'PF_NAME' /usr/share/planefence/persist/planefence.config | awk -F '=' '{ print $2 }' | tr -dc '[:alnum:]')_bld_$([[ -f /usr/share/planefence/branch ]] && cat /usr/share/planefence/branch || cat /root/.buildtime)" || true
# -----------------------------------------------------------------------------------
# Copyright 2020, 2021 Ramon F. Kolb - licensed under the terms and conditions
# Copyright 2020-2024 Ramon F. Kolb - licensed under the terms and conditions
# of GPLv3. The terms and conditions of this license are included with the Github
# distribution of this package, and are also available here:
# https://github.com/kx1t/planefence4docker/
# https://github.com/sdr-enthusiasts/planefence4docker/
#
# The package contains parts of, and modifications or derivatives to the following:
# Dump1090.Socket30003 by Ted Sluis: https://github.com/tedsluis/dump1090.socket30003
Expand Down
4 changes: 2 additions & 2 deletions rootfs/etc/s6-overlay/scripts/socket30003
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ APPNAME="$(hostname)/socket30003"
[[ "$LOGLEVEL" != "ERROR" ]] && echo "[$APPNAME][$(date)] Socket30003 started as an s6 service" || true

# -----------------------------------------------------------------------------------
# Copyright 2020, 2021 Ramon F. Kolb - licensed under the terms and conditions
# Copyright 2020-2024 Ramon F. Kolb - licensed under the terms and conditions
# of GPLv3. The terms and conditions of this license are included with the Github
# distribution of this package, and are also available here:
# https://github.com/kx1t/planefence4docker/
# https://github.com/sdr-enthusiasts/planefence4docker/
#
# The package contains parts of, and modifications or derivatives to the following:
# Dump1090.Socket30003 by Ted Sluis: https://github.com/tedsluis/dump1090.socket30003
Expand Down
4 changes: 2 additions & 2 deletions rootfs/usr/lib/python3/dist-packages/pflib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Python3 module of utilities for Plane Fence and Plane Alert
#
# Copyright 2022 Ramon F. Kolb and @FerretWithASpork - licensed under the terms and conditions
# Copyright 2022-2024 Ramon F. Kolb and Justin DiPierro - licensed under the terms and conditions
# of GPLv3. The terms and conditions of this license are included with the Github
# distribution of this package, and are also available here:
# https://github.com/kx1t/planefence/
# https://github.com/sdr-enthusiasts/planefence/
#
# The package contains parts of, and modifications or derivatives to the following:
# Dump1090.Socket30003 by Ted Sluis: https://github.com/tedsluis/dump1090.socket30003
Expand Down
Loading

0 comments on commit 97df2e8

Please sign in to comment.