diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..64c1237c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "python.analysis.extraPaths": [ + "./rootfs/usr/lib/python3/dist-packages" + ] +} \ No newline at end of file diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index a33ee30d..0b79f6eb 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -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 diff --git a/Dockerfile b/Dockerfile index 84b95713..93743a5f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 && \ diff --git a/README-Mastodon.md b/README-Mastodon.md index 0cc3bb39..43390ecb 100644 --- a/README-Mastodon.md +++ b/README-Mastodon.md @@ -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. @@ -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: 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: - Click `Preferences` on the bottom right of the page - +![image](https://user-images.githubusercontent.com/15090643/208437930-ee33596d-5015-4283-923c-12913552f6db.png) - On the bottom left, click ` Development` - +![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 "" (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. @@ -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 diff --git a/README.md b/README.md index 354e220a..84dbb6f5 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/rootfs/etc/s6-overlay/scripts/50-get-openskydb b/rootfs/etc/s6-overlay/scripts/50-get-openskydb index ea18c6cf..6859fe07 100755 --- a/rootfs/etc/s6-overlay/scripts/50-get-openskydb +++ b/rootfs/etc/s6-overlay/scripts/50-get-openskydb @@ -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. # ----------------------------------------------------------------------------------- diff --git a/rootfs/etc/s6-overlay/scripts/60-check-mastodon b/rootfs/etc/s6-overlay/scripts/60-check-mastodon index 5ed0e58d..66db729a 100755 --- a/rootfs/etc/s6-overlay/scripts/60-check-mastodon +++ b/rootfs/etc/s6-overlay/scripts/60-check-mastodon @@ -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. # ----------------------------------------------------------------------------------- @@ -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\|" <<< "$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 diff --git a/rootfs/etc/s6-overlay/scripts/cleanup b/rootfs/etc/s6-overlay/scripts/cleanup index ff0c06c3..33055a65 100755 --- a/rootfs/etc/s6-overlay/scripts/cleanup +++ b/rootfs/etc/s6-overlay/scripts/cleanup @@ -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 diff --git a/rootfs/etc/s6-overlay/scripts/get-pa-alertlist b/rootfs/etc/s6-overlay/scripts/get-pa-alertlist index 99288d46..45de6460 100755 --- a/rootfs/etc/s6-overlay/scripts/get-pa-alertlist +++ b/rootfs/etc/s6-overlay/scripts/get-pa-alertlist @@ -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 diff --git a/rootfs/etc/s6-overlay/scripts/lighttpd b/rootfs/etc/s6-overlay/scripts/lighttpd index a72b6afe..fd10ad37 100755 --- a/rootfs/etc/s6-overlay/scripts/lighttpd +++ b/rootfs/etc/s6-overlay/scripts/lighttpd @@ -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 diff --git a/rootfs/etc/s6-overlay/scripts/planefence b/rootfs/etc/s6-overlay/scripts/planefence index fec32a71..ea4730c8 100755 --- a/rootfs/etc/s6-overlay/scripts/planefence +++ b/rootfs/etc/s6-overlay/scripts/planefence @@ -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 diff --git a/rootfs/etc/s6-overlay/scripts/socket30003 b/rootfs/etc/s6-overlay/scripts/socket30003 index bb229a94..c4fbfff9 100755 --- a/rootfs/etc/s6-overlay/scripts/socket30003 +++ b/rootfs/etc/s6-overlay/scripts/socket30003 @@ -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 diff --git a/rootfs/usr/lib/python3/dist-packages/pflib/__init__.py b/rootfs/usr/lib/python3/dist-packages/pflib/__init__.py index 3a7e982b..a18734bb 100644 --- a/rootfs/usr/lib/python3/dist-packages/pflib/__init__.py +++ b/rootfs/usr/lib/python3/dist-packages/pflib/__init__.py @@ -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 diff --git a/rootfs/usr/share/plane-alert/README.md b/rootfs/usr/share/plane-alert/README.md index e0486811..629db048 100644 --- a/rootfs/usr/share/plane-alert/README.md +++ b/rootfs/usr/share/plane-alert/README.md @@ -22,7 +22,7 @@ The `` is a full path to one of the log files from Socket30003 - often For full text, see the LICENSE file included with this repository. The following is a short summary of terms. In case of conflict between this text and the terms and conditions set forth in the LICENSE file, those in the LICENSE file shall take precedence. - Copyright (C) 2021 Ramon F. Kolb + Copyright (C) 2021-2024 Ramon F. Kolb This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/rootfs/usr/share/plane-alert/get-pa-alertlist.sh b/rootfs/usr/share/plane-alert/get-pa-alertlist.sh index 736ca7cf..bc909d89 100755 --- a/rootfs/usr/share/plane-alert/get-pa-alertlist.sh +++ b/rootfs/usr/share/plane-alert/get-pa-alertlist.sh @@ -3,10 +3,10 @@ APPNAME="$(hostname)/get-pa-alertlist" # ----------------------------------------------------------------------------------- -# 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/ # # This package may incorporate other software and license terms. # ----------------------------------------------------------------------------------- diff --git a/rootfs/usr/share/plane-alert/get-silhouettes.sh b/rootfs/usr/share/plane-alert/get-silhouettes.sh index 9e204445..4b90ad80 100755 --- a/rootfs/usr/share/plane-alert/get-silhouettes.sh +++ b/rootfs/usr/share/plane-alert/get-silhouettes.sh @@ -3,10 +3,10 @@ APPNAME="$(hostname)/get-silhouettes" # ----------------------------------------------------------------------------------- -# 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/ # # This package may incorporate other software and license terms. # ----------------------------------------------------------------------------------- diff --git a/rootfs/usr/share/plane-alert/html/index.html b/rootfs/usr/share/plane-alert/html/index.html index b7342302..e0bbc154 100644 --- a/rootfs/usr/share/plane-alert/html/index.html +++ b/rootfs/usr/share/plane-alert/html/index.html @@ -6,10 +6,10 @@ # are always welcome. Join me at the GitHub link shown below, or via email # at kx1t (at) amsat (dot) org. # -# Copyright 2021 Ramon F. Kolb - licensed under the terms and conditions +# Copyright 2021-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/plane-alert/ +# https://github.com/sdr-enthusiasts/plane-alert/ # # The package contains parts of, links to, and modifications or derivatives to the following: # Dump1090.Socket30003 by Ted Sluis: https://github.com/tedsluis/dump1090.socket30003 @@ -62,11 +62,11 @@

This website shows a list of aircraft of interest that were heard by diff --git a/rootfs/usr/share/plane-alert/pa_query.sh b/rootfs/usr/share/plane-alert/pa_query.sh index 8d9bc75b..93455e81 100755 --- a/rootfs/usr/share/plane-alert/pa_query.sh +++ b/rootfs/usr/share/plane-alert/pa_query.sh @@ -5,10 +5,10 @@ # Usage: pf_php.sh [hex=] [call=] [start=] [end=] file= # File argument is always required and at least 1 additional argument is required. # -# Copyright 2021 Ramon F. Kolb - licensed under the terms and conditions +# Copyright 2021-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/ # # Summary of License Terms # This program is free software: you can redistribute it and/or modify it under the terms of diff --git a/rootfs/usr/share/plane-alert/plane-alert.conf b/rootfs/usr/share/plane-alert/plane-alert.conf index b1e5b93d..d3d2f027 100644 --- a/rootfs/usr/share/plane-alert/plane-alert.conf +++ b/rootfs/usr/share/plane-alert/plane-alert.conf @@ -1,9 +1,9 @@ # PLANE-ALERT.CONF - user changeable variables for PLANE-ALERT.SH # -# Copyright 2021 Ramon F. Kolb - licensed under the terms and conditions +# Copyright 2021-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/plane-alert/ +# https://github.com/sdr-enthusiasts/plane-alert/ # # The package contains parts of, and modifications or derivatives to the following: # Dump1090.Socket30003 by Ted Sluis: https://github.com/tedsluis/dump1090.socket30003 @@ -43,8 +43,18 @@ OUTAPPDATE=true # # ----------------------------------------------------------------------------------- -# Flight link provided by... (not yet implemented - will use adsbexchange regardless of this parameter) - TRACKSERVICE="adsbexchange" +# Flight link to an tar1090-based service. Only the URL/location is needed. +# Examples inlude: +# globe.adsbexchange.com +# my.adsb.radar/tar1090 +# globe.airplanes.live +# et cetera + TRACKSERVICE=globe.adsbexchange.com +# +# ----------------------------------------------------------------------------------- +# Limits to the number of aircraft shown in a link in the list on the top of the plane-alert webpage +# Don't make this larger than 1000 as that will probably the user's browser + TRACKLIMIT=250 # # ----------------------------------------------------------------------------------- # Where to get the list of planes of interest. If you want to change this file, please ensure to keep the same format. @@ -134,12 +144,14 @@ set -a set +a # MASTODON parameters for MASTODON notifications as an alternative to Twitter: # MASTODON_SERVER contains the mastodon server name, for example "airwaves.social" -# MASTODON_ACCESS_TOKEN contains the mastodon access token needed for posting - MASTODON_SERVER= - MASTODON_ACCESS_TOKEN= - MASTODON_VISIBILITY=unlisted - MASTODON_MAXIMGS=1 - MASTODON_RETENTION_TIME= +# MASTODON_NAME contains the @ name of the Mastodon account + MASTODON_SERVER= + MASTODON_ACCESS_TOKEN= + MASTODON_VISIBILITY=unlisted + MASTODON_NAME= + MASTODON_MAXIMGS=1 + MASTODON_RETENTION_TIME= + ATTRIB="#adsb #planefence #planealert by kx1t - https://sdr-e.com/docker-planefence" # # AUTOREFRESH controls if the web page auto-refreshed. The refresh interval is the same as $PFINTERVAL. diff --git a/rootfs/usr/share/plane-alert/plane-alert.footer.html b/rootfs/usr/share/plane-alert/plane-alert.footer.html index 1027e03c..7b553d57 100644 --- a/rootfs/usr/share/plane-alert/plane-alert.footer.html +++ b/rootfs/usr/share/plane-alert/plane-alert.footer.html @@ -2,7 +2,7 @@ diff --git a/rootfs/usr/share/plane-alert/plane-alert.header.html b/rootfs/usr/share/plane-alert/plane-alert.header.html index 8c8330e9..41b3baed 100644 --- a/rootfs/usr/share/plane-alert/plane-alert.header.html +++ b/rootfs/usr/share/plane-alert/plane-alert.header.html @@ -6,10 +6,10 @@ # are always welcome. Join me at the GitHub link shown below, or via email # at kx1t (at) amsat (dot) org. # -# Copyright 2021-2023 Ramon F. Kolb - licensed under the terms and conditions +# Copyright 2021-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/plane-alert/ +# https://github.com/sdr-enthusiasts/plane-alert/ # # The package contains parts of, links to, and modifications or derivatives to the following: # Dump1090.Socket30003 by Ted Sluis: https://github.com/tedsluis/dump1090.socket30003 @@ -54,6 +54,7 @@ top: 0; } + ##MASTOHEADER## @@ -73,9 +74,11 @@

This website shows a list of aircraft of interest that were heard by Aircraft are listed in reverse chronological order. Click the header of a column to resort.
  • Note that for each aircraft, only the first observation of the day is listed. Additional flights, if any, can be seen on the Flight Map link.
  • Only aircraft that have been seen in the last ##HISTTIME## days will be displayed below. The CSV version contains the complete history. -
  • Click on the Transponder ID to see the aircraft history on ADSBExchange +
  • Click on the Transponder ID to see the aircraft history on ##TRACKSERVICE##
  • Click on the Tail number to see the flight history, potentially with routing information, on FlightAware + ##MEGALINK## ##PFLINK## + ##MASTODONLINK## diff --git a/rootfs/usr/share/plane-alert/plane-alert.sh b/rootfs/usr/share/plane-alert/plane-alert.sh index 26aeba26..38d634a4 100755 --- a/rootfs/usr/share/plane-alert/plane-alert.sh +++ b/rootfs/usr/share/plane-alert/plane-alert.sh @@ -5,10 +5,10 @@ # # Usage: ./plane-alert.sh # -# Copyright 2021-2023 Ramon F. Kolb - licensed under the terms and conditions +# Copyright 2021-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/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 @@ -66,7 +66,7 @@ APPNAME="$(hostname)/plane-alert" [[ "$SCREENSHOT_TIMEOUT" == "" ]] && SCREENSHOT_TIMEOUT=45 -[[ "$BASETIME" != "" ]] && echo "10a1. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: parse alert list into dictionary" || true +[[ -n "$BASETIME" ]] && echo "10a1. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: parse alert list into dictionary" || true # # Now let's start @@ -90,7 +90,7 @@ while IFS="" read -r line; do ((ALERT_ENTRIES=ALERT_ENTRIES+1)) done < "$PLANEFILE" -[[ "$BASETIME" != "" ]] && echo "10a2. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: check input for hex numbers on alert list" || true +[[ -n "$BASETIME" ]] && echo "10a2. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: check input for hex numbers on alert list" || true # Now search through the input file to see if we detect any planes in the alert list @@ -127,7 +127,7 @@ fi # Let's figure out if we also need to find SQUAWKS rm -f "$TMPDIR"/patmp touch "$TMPDIR"/patmp -if [[ "$SQUAWKS" != "" ]] +if [[ -n "$SQUAWKS" ]] then IFS="," read -ra sq <<< "$SQUAWKS" # add some zeros to the front, in case there are less than 4 chars @@ -189,7 +189,7 @@ cp -f "$OUTFILE" /tmp/pa-old.csv # 0=hex_ident,1=altitude(feet),2=latitude,3=longitude,4=date,5=time,6=angle,7=distance(kilometer),8=squawk,9=ground_speed(knotph),10=track,11=callsign # A0B674,750,42.29663,-71.00664,2021/03/17,16:43:52.598,122.36,30.2,0305,139,321,N145NE -[[ "$BASETIME" != "" ]] && echo "10b. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: start processing new data" || true +[[ -n "$BASETIME" ]] && echo "10b. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: start processing new data" || true while IFS= read -r line do @@ -199,7 +199,7 @@ do # Skip the line if it's out of range awk "BEGIN{ exit (${pa_record[7]} < $RANGE) }" && continue - PLANELINE="${ALERT_DICT["${pa_record[0]}"]}" + PLANELINE="${ALERT_DICT[${pa_record[0]}]}" IFS="," read -ra TAGLINE <<< "$PLANELINE" # Parse this into a single line with syntax ICAO,TailNr,Owner,PlaneDescription,date,time,lat,lon,callsign,adsbx_url,squawk @@ -234,7 +234,7 @@ do outrec+="${pa_record[11]/ */}," # callsign or flt nr (stripped spaces) epoch_sec="$(date -d"${pa_record[4]} ${pa_record[5]}" +%s)" - outrec+="https://globe.adsbexchange.com/?icao=${pa_record[0]}&showTrace=$(date -u -d@"${epoch_sec}" "+%Y-%m-%d")&zoom=$MAPZOOM&lat=${pa_record[2]}&lon=${pa_record[3]}×tamp=${epoch_sec}," # ICAO for insertion into ADSBExchange link + outrec+="https://$TRACKSERVICE/?icao=${pa_record[0]}&showTrace=$(date -u -d@"${epoch_sec}" "+%Y-%m-%d")&zoom=$MAPZOOM&lat=${pa_record[2]}&lon=${pa_record[3]}×tamp=${epoch_sec}," # ICAO for insertion into ADSBExchange link # only add squawk if its in the list x="" @@ -242,7 +242,7 @@ do do x+=$(awk "{if(\$1 ~ /${sq[i]}/){print}}" <<< "${pa_record[8]}") done - [[ "$x" != "" ]] && outrec+="${pa_record[8]}" # squawk + [[ -n "$x" ]] && outrec+="${pa_record[8]}" # squawk echo "$outrec" >> "$OUTFILE" # Append this line to $OUTWRITEFILE @@ -252,7 +252,7 @@ sort -t',' -k5,5 -k1,1 -k11,11 -u -o /tmp/pa-new.csv "$OUTFILE" # sort by fiel sort -t',' -k5,5 -k6,6 -o "$OUTFILE" /tmp/pa-new.csv # sort once more by date and time but keep all entries # the log files are now done, but we want to figure out what is new -[[ "$BASETIME" != "" ]] && echo "10c. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: done processing new data" || true +[[ -n "$BASETIME" ]] && echo "10c. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: done processing new data" || true # create some diff files rm -f /tmp/pa-diff.csv @@ -269,10 +269,10 @@ comm -23 <(sort < "$OUTFILE") <(sort < /tmp/pa-old.csv ) >/tmp/pa-diff.csv # Read the header - we will need it a few times later: # shellcheck disable=SC2001 -[[ "$ALERTHEADER" != "" ]] && IFS="," read -ra header <<< "$(sed 's/\#\$/$#/g' <<< "$ALERTHEADER")" || IFS="," read -ra header <<< "$(head -n1 "$PLANEFILE" | sed 's/\#\$/$#/g')" +[[ -n "$ALERTHEADER" ]] && IFS="," read -ra header <<< "$(sed 's/\#\$/$#/g' <<< "$ALERTHEADER")" || IFS="," read -ra header <<< "$(head -n1 "$PLANEFILE" | sed 's/\#\$/$#/g')" # if ALERTHEADER is set, then use that one instead of -[[ "$BASETIME" != "" ]] && echo "10d. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: start Tweet run" || true +[[ -n "$BASETIME" ]] && echo "10d. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: start Tweet run" || true # If there's any new alerts send them out if [[ "$(cat /tmp/pa-diff.csv | wc -l)" != "0" ]] @@ -287,7 +287,7 @@ then unset pa_record IFS=',' read -ra pa_record <<< "$line" - [[ "$BASETIME" != "" ]] && echo "10d1. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: processing ${pa_record[1]}" || true + [[ -n "$BASETIME" ]] && echo "10d1. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: processing ${pa_record[1]}" || true ICAO="${pa_record[0]}" @@ -318,7 +318,7 @@ then GOTSNAP="true" [[ ! -f "/usr/share/planefence/persist/planepix/${ICAO}.jpg" ]] && cp "$snapfile" "/usr/share/planefence/persist/planepix/${ICAO}.jpg" || true else - [[ "$link" != "" ]] && echo "[$(date)][$APPNAME] Failed attempt to get picture from $link" || true + [[ -n "$link" ]] && echo "[$(date)][$APPNAME] Failed attempt to get picture from $link" || true fi fi @@ -335,11 +335,11 @@ then [[ "${header[0]:0:1}" == "$" ]] && pa_record[0]="#${pa_record[0]}" # ICAO field - [[ "${header[1]:0:1}" == "$" ]] && [[ "${pa_record[1]}" != "" ]] && pa_record[1]="#${pa_record[1]//[[:space:]-]/}" # tail field - [[ "${header[2]:0:1}" == "$" ]] && [[ "${pa_record[2]}" != "" ]] && pa_record[2]="#${pa_record[2]//[[:space:]]/}" # owner field, stripped off spaces - [[ "${header[3]:0:1}" == "$" ]] && [[ "${pa_record[2]}" != "" ]] && pa_record[3]="#${pa_record[3]}" # equipment field - [[ "${header[1]:0:1}" == "$" ]] && [[ "${pa_record[8]}" != "" ]] && pa_record[8]="#${pa_record[8]//[[:space:]-]/}" # flight nr field (connected to tail header) - [[ "${pa_record[10]}" != "" ]] && pa_record[10]="#${pa_record[10]}" # # squawk + [[ "${header[1]:0:1}" == "$" ]] && [[ -n "${pa_record[1]}" ]] && pa_record[1]="#${pa_record[1]//[[:space:]-]/}" # tail field + [[ "${header[2]:0:1}" == "$" ]] && [[ -n "${pa_record[2]}" ]] && pa_record[2]="#${pa_record[2]//[[:space:]]/}" # owner field, stripped off spaces + [[ "${header[3]:0:1}" == "$" ]] && [[ -n "${pa_record[2]}" ]] && pa_record[3]="#${pa_record[3]}" # equipment field + [[ "${header[1]:0:1}" == "$" ]] && [[ -n "${pa_record[8]}" ]] && pa_record[8]="#${pa_record[8]//[[:space:]-]/}" # flight nr field (connected to tail header) + [[ -n "${pa_record[10]}" ]] && pa_record[10]="#${pa_record[10]}" # # squawk # First build the text of the tweet: reminder: # 0-ICAO,1-TailNr,2-Owner,3-PlaneDescription,4-date,5-time,6-lat,7-lon @@ -347,10 +347,11 @@ then TWITTEXT="#PlaneAlert " TWITTEXT+="ICAO: ${pa_record[0]} " - [[ "${pa_record[1]}" != "" ]] && TWITTEXT+="Tail: ${pa_record[1]} " - [[ "${pa_record[8]}" != "" ]] && TWITTEXT+="Flt: ${pa_record[8]} " - [[ "${pa_record[10]}" != "" ]] && TWITTEXT+="#Squawk: ${pa_record[10]}" - [[ "${pa_record[2]}" != "" ]] && TWITTEXT+="\nOwner: ${pa_record[2]//[&\']/_}" # trailing ']}" for vim broken syntax + [[ -n "${pa_record[1]}" ]] && TWITTEXT+="Tail: ${pa_record[1]} " + [[ -n "${pa_record[8]}" ]] && TWITTEXT+="Flt: ${pa_record[8]} " + [[ -n "${pa_record[10]}" ]] && TWITTEXT+="#Squawk: ${pa_record[10]}" + [[ "${pa_record[10]//#/}" == "7700 " ]] && TWITTEXT+=" #EMERGENCY!" + [[ -n "${pa_record[2]}" ]] && TWITTEXT+="\nOwner: ${pa_record[2]//[&\']/_}" # trailing ']}" for vim broken syntax TWITTEXT+="\nAircraft: ${pa_record[3]}\n" TWITTEXT+="${pa_record[4]} $(sed 's|/|\\/|g' <<< "${pa_record[5]}")\n" @@ -366,14 +367,16 @@ then if [[ "${tag:0:4}" == "http" ]] then TWITTEXT+="$(sed 's|/|\\/|g' <<< "$tag") " - elif [[ "$tag" != "" ]] + elif [[ -n "$tag" ]] then TWITTEXT+="#$(tr -dc '[:alnum:]' <<< "$tag") " fi fi done - TWITTEXT+="\n$(sed 's|/|\\/|g' <<< "${pa_record[9]}")" + TWITTEXT+="\n$(sed 's|/|\\/|g' <<< "${pa_record[9]//globe.adsbexchange.com/"$TRACKSERVICE"}")" + + TWITTEXT+="\n\n$ATTRIB" if [[ -n "$MASTODON_SERVER" ]] || [[ "$TWITTER" != "false" ]] then @@ -397,7 +400,7 @@ then # check if there are any images in the plane-alert-db field=() - readarray -td, field <<< "${ALERT_DICT["${pa_record[0]#\#}"]}" + readarray -td, field <<< "${ALERT_DICT[${pa_record[0]#\#}]}" for (( i=0 ; i<=20; i++ )) do @@ -480,7 +483,7 @@ then fi processedresult=$(echo "$rawresult" | jq '.errors[].message' 2>/dev/null || true) # parse the output through JQ and if there\'s an error, provide the text to $result - if [[ "$processedresult" != "" ]] + if [[ -n "$processedresult" ]] then echo "[$(date)][$APPNAME] Plane-alert Tweet error for ${pa_record[0]}: $rawresult" echo "[$(date)][$APPNAME] Diagnostics:" @@ -535,7 +538,7 @@ then fi processedresult=$(echo "$rawresult" | jq '.errors[].message' 2>/dev/null || true) # parse the output through JQ and if there's an error, provide the text to $result - if [[ "$processedresult" != "" ]] + if [[ -n "$processedresult" ]] then echo "[$(date)][$APPNAME] Plane-alert Tweet error for ${pa_record[0]}: $rawresult" echo "[$(date)][$APPNAME] Diagnostics:" @@ -551,7 +554,7 @@ then done < /tmp/pa-diff.csv fi -[[ "$BASETIME" != "" ]] && echo "10e. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: finished Tweet run, start building webpage" || true +[[ -n "$BASETIME" ]] && echo "10e. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: finished Tweet run, start building webpage" || true (( ERRORCOUNT > 0 )) && echo "[$(date)][$APPNAME] There were $ERRORCOUNT tweet errors." @@ -564,7 +567,7 @@ cp -f $PLANEALERTDIR/plane-alert.header.html "$TMPDIR"/plalert-index.tmp exec 3>> "$TMPDIR"/plalert-index.tmp SB="$(sed -n 's|^\s*SPORTSBADGER=\(.*\)|\1|p' /usr/share/planefence/persist/planefence.config)" -if [[ "$SB" != "" ]] +if [[ -n "$SB" ]] then cat <&3 @@ -591,7 +594,7 @@ fi # figure out if there are squawks: awk -F "," '$12 != "" {rc = 1} END {exit !rc}' "$OUTFILE" && sqx="true" || sqx="false" -[[ "$BASETIME" != "" ]] && echo "10e1. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: webpage - writing table headers" || true +[[ -n "$BASETIME" ]] && echo "10e1. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: webpage - writing table headers" || true # first add the fixed part of the header: cat <&3 @@ -621,7 +624,7 @@ do done echo "" >&3 -[[ "$BASETIME" != "" ]] && echo "10e2. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: webpage - writing table content" || true +[[ -n "$BASETIME" ]] && echo "10e2. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: webpage - writing table content" || true COUNTER=1 REFDATE=$(date -d "$HISTTIME days ago" '+%Y/%m/%d %H:%M:%S') @@ -632,7 +635,7 @@ IMGBASE="silhouettes/" while read -r line do IFS=',' read -ra pa_record <<< "$line" - if [[ "${pa_record[0]}" != "" ]] && [[ "${pa_record[4]} ${pa_record[5]}" > "$REFDATE" ]] + if [[ -n "${pa_record[0]}" ]] && [[ "${pa_record[4]} ${pa_record[5]}" > "$REFDATE" ]] then # prep-work for later use: PLANELINE="${ALERT_DICT["${pa_record[0]}"]}" @@ -650,7 +653,7 @@ do IMGURL="$IMGBASE" # If there's a squawk, use it to determine the image: - if [[ "${pa_record[10]}" != "" ]] + if [[ -n "${pa_record[10]}" ]] then if [[ -f /usr/share/planefence/html/plane-alert/$IMGURL${pa_record[10]}.bmp ]] then @@ -674,7 +677,7 @@ do fi fi - if [[ "${pa_record[10]}" != "" ]] + if [[ -n "${pa_record[10]}" ]] then # print Squawk @@ -711,7 +714,7 @@ do printf " %s%s%s\n" "
    " "$IMG" "
    " >&3 fi - printf "
    %s\n" "${pa_record[9]}" "${pa_record[0]}" >>"$TMPDIR"/plalert-index.tmp # column: ICAO + printf " %s\n" "${pa_record[9]//globe.adsbexchange.com/"$TRACKSERVICE"}" "${pa_record[0]}" >>"$TMPDIR"/plalert-index.tmp # column: ICAO printf " %s\n" "https://flightaware.com/live/modes/${pa_record[0]}/ident/${pa_record[1]}/redirect" "${pa_record[1]}" >>"$TMPDIR"/plalert-index.tmp # column: Tail # printf " %s%s%s\n" "" "${pa_record[0]}" "" >&3 # column: ICAO # printf " %s%s%s\n" "" "${pa_record[1]}" "" >&3 # column: Tail @@ -719,7 +722,7 @@ do printf " %s%s%s\n" "" "${pa_record[3]}" "" >&3 # column: Plane Type printf " %s%s%s\n" "" "${pa_record[4]} ${pa_record[5]}" "" >&3 # column: Date Time # printf " %s%s%s\n" "" "${pa_record[6]}N, ${pa_record[7]}E" "" >&3 # column: LatN, LonE - printf " %s%s%s\n" "" "${pa_record[6]}N, ${pa_record[7]}E" "" >&3 # column: LatN, LonE with link to adsbexchange + printf " %s%s%s\n" "" "${pa_record[6]}N, ${pa_record[7]}E" "" >&3 # column: LatN, LonE with link to adsbexchange printf " %s%s%s\n" "" "${pa_record[8]}" "" >&3 # column: Flight No [[ "$sqx" == "true" ]] && printf " %s%s%s\n" "" "${pa_record[10]}" "" >&3 # column: Squawk printf " %s%s%s\n" "" >&3 # column: ADSBX link @@ -743,12 +746,17 @@ do fi done <<< "$OUTSTRING" -[[ "$BASETIME" != "" ]] && echo "10e3. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: webpage - done writing table content" || true +[[ -n "$BASETIME" ]] && echo "10e3. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: webpage - done writing table content" || true cat $PLANEALERTDIR/plane-alert.footer.html >&3 +echo "" >&3 + +# Close the FD for $TMPDIR/plalert-index.tmp: +exec 3>&- # Now the basics have been written, we need to replace some of the variables in the template with real data: sed -i "s|##PA_MOTD##|$PA_MOTD|g" "$TMPDIR"/plalert-index.tmp +sed -i "s|##TRACKSERVICE##|$TRACKSERVICE|g" "$TMPDIR"/plalert-index.tmp sed -i "s|##NAME##|$NAME|g" "$TMPDIR"/plalert-index.tmp sed -i "s|##ADSBLINK##|$ADSBLINK|g" "$TMPDIR"/plalert-index.tmp sed -i "s|##LASTUPDATE##|$LASTUPDATE|g" "$TMPDIR"/plalert-index.tmp @@ -758,13 +766,21 @@ sed -i "s|##HISTTIME##|$HISTTIME|g" "$TMPDIR"/plalert-index.tmp sed -i "s|##BUILD##|$([[ -f /usr/share/planefence/branch ]] && cat /usr/share/planefence/branch || cat /root/.buildtime)|g" "$TMPDIR"/plalert-index.tmp sed -i "s|##VERSION##|$(sed -n 's/\(^\s*VERSION=\)\(.*\)/\2/p' /usr/share/planefence/planefence.conf)|g" "$TMPDIR"/plalert-index.tmp [[ "${AUTOREFRESH,,}" == "true" ]] && sed -i "s|##AUTOREFRESH##|meta http-equiv=\"refresh\" content=\"$(sed -n 's/\(^\s*PF_INTERVAL=\)\(.*\)/\2/p' /usr/share/planefence/persist/planefence.config)\"|g" "$TMPDIR"/plalert-index.tmp || sed -i "s|##AUTOREFRESH##|!-- no auto-refresh --|g" "$TMPDIR"/plalert-index.tmp -[[ "$PF_LINK" != "" ]] && sed -i "s|##PFLINK##|
  • Additionally, click here to visit PlaneFence: a list of aircraft heard that are within a short distance of the station.|g" "$TMPDIR"/plalert-index.tmp || sed -i "s|##PFLINK##||g" "$TMPDIR"/plalert-index.tmp - -echo "" >&3 - -# Close the FD for $TMPDIR/plalert-index.tmp: -exec 3>&- +[[ -n "$PF_LINK" ]] && sed -i "s|##PFLINK##|
  • Additionally, click here to visit PlaneFence: a list of aircraft heard that are within a short distance of the station.|g" "$TMPDIR"/plalert-index.tmp || sed -i "s|##PFLINK##||g" "$TMPDIR"/plalert-index.tmp +if [[ -n "$MASTODON_SERVER" && -n "$MASTODON_ACCESS_TOKEN" && -n "$MASTODON_NAME" ]]; then + sed -i "s|##MASTODONLINK##|
  • Get notified instantaneously of aircraft in range by following @$MASTODON_NAME on the $MASTODON_SERVER Mastodon Server|g" "$TMPDIR"/plalert-index.tmp + sed -i "s|##MASTOHEADER##||g" "$TMPDIR"/plalert-index.tmp +else + sed -i "s|##MASTODONLINK##||g" "$TMPDIR"/plalert-index.tmp + sed -i "s|##MASTOHEADER##||g" "$TMPDIR"/plalert-index.tmp +fi +if (( $(cat "$OUTFILE" | wc -l ) > 0 )); then + # shellcheck disable=SC2046 + sed -i "s|##MEGALINK##|
  • Click here for a map with the current locations of most recent $TRACKLIMIT unique aircraft|g" "$TMPDIR"/plalert-index.tmp +else + sed -i "s|##MEGALINK##||g" "$TMPDIR"/plalert-index.tmp +fi #Finally, put the temp index into its place: mv -f "$TMPDIR"/plalert-index.tmp "$WEBDIR"/index.html -[[ "$BASETIME" != "" ]] && echo "10f. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: done building webpage, finished Plane-Alert" || true +[[ -n "$BASETIME" ]] && echo "10f. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: done building webpage, finished Plane-Alert" || true diff --git a/rootfs/usr/share/plane-alert/send-discord-alert.py b/rootfs/usr/share/plane-alert/send-discord-alert.py index 13dfcde4..ed140bbe 100755 --- a/rootfs/usr/share/plane-alert/send-discord-alert.py +++ b/rootfs/usr/share/plane-alert/send-discord-alert.py @@ -4,10 +4,13 @@ # # Usage: ./send-discord-alert.py # -# Copyright 2022 Ramon F. Kolb - licensed under the terms and conditions +# Copyright 2022-2024 Ramon F. Kolb, kx1t +# Copyright 2022 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 @@ -98,6 +101,14 @@ def process_alert(config, plane): else: description += f"\nSeen near [**{location}**]({plane['adsbx_url']})" + # Replace adsbexchange link with whatever is configured: + try: + if config["PA_TRACKSERVICE"] != "": + description.replace("globe.adsbexchange.com",config["PA_TRACKSERVICE"]) + description.replace("ADSB Exchange",config["PA_TRACKSERVICE"]) + except: + pass + webhooks, embed = pf.discord.build(config["DISCORD_FEEDER_NAME"], config["PA_DISCORD_WEBHOOKS"], title, description, color=color) pf.attach_media(config, "PA", dbinfo, webhooks, embed) diff --git a/rootfs/usr/share/planefence/airlinename.sh b/rootfs/usr/share/planefence/airlinename.sh index 9c2fd879..a9bef740 100755 --- a/rootfs/usr/share/planefence/airlinename.sh +++ b/rootfs/usr/share/planefence/airlinename.sh @@ -17,13 +17,13 @@ # In the future, we may add lookups for other countries (UK, Germany, Australia) too if # there is a relatively easy API to access this data. # -# This package is part of https://github.com/kx1t/docker-planefence/ and may not work or have any +# This package is part of https://github.com/sdr-enthusiasts/docker-planefence/ and may not work or have any # value outside of this repository. # -# Copyright 2021 Ramon F. Kolb - licensed under the terms and conditions +# Copyright 2021-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/ # # Summary of License Terms # This program is free software: you can redistribute it and/or modify it under the terms of diff --git a/rootfs/usr/share/planefence/airlinename.sh.org b/rootfs/usr/share/planefence/airlinename.sh.org index 588acd23..73018f71 100755 --- a/rootfs/usr/share/planefence/airlinename.sh.org +++ b/rootfs/usr/share/planefence/airlinename.sh.org @@ -17,13 +17,13 @@ # In the future, we may add lookups for other countries (UK, Germany, Australia) too if # there is a relatively easy API to access this data. # -# This package is part of https://github.com/kx1t/docker-planefence/ and may not work or have any +# This package is part of https://github.com/sdr-enthusiasts/docker-planefence/ and may not work or have any # value outside of this repository. # -# Copyright 2021 Ramon F. Kolb - licensed under the terms and conditions +# Copyright 2021-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/ # # Summary of License Terms # This program is free software: you can redistribute it and/or modify it under the terms of diff --git a/rootfs/usr/share/planefence/config_tweeting.sh b/rootfs/usr/share/planefence/config_tweeting.sh index 32301e0d..862138a2 100755 --- a/rootfs/usr/share/planefence/config_tweeting.sh +++ b/rootfs/usr/share/planefence/config_tweeting.sh @@ -6,10 +6,10 @@ APPNAME="config_tweeting" echo "[$APPNAME][$(date)] Running config_tweeting" # ----------------------------------------------------------------------------------- -# 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 diff --git a/rootfs/usr/share/planefence/noise2fence.sh b/rootfs/usr/share/planefence/noise2fence.sh index 792e655d..82cd0d47 100755 --- a/rootfs/usr/share/planefence/noise2fence.sh +++ b/rootfs/usr/share/planefence/noise2fence.sh @@ -5,7 +5,7 @@ # 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/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 diff --git a/rootfs/usr/share/planefence/nominatim.sh b/rootfs/usr/share/planefence/nominatim.sh index 760b50a0..a80903aa 100755 --- a/rootfs/usr/share/planefence/nominatim.sh +++ b/rootfs/usr/share/planefence/nominatim.sh @@ -5,13 +5,13 @@ # Returns # # ----------------------------------------------------------------------------------- -# This package is part of https://github.com/kx1t/docker-planefence/ and may not work or have any +# This package is part of https://github.com/sdr-enthusiasts/docker-planefence/ and may not work or have any # value outside of this repository. # -# Copyright 2023 Ramon F. Kolb - licensed under the terms and conditions +# Copyright 2023-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/ # # Summary of License Terms # This program is free software: you can redistribute it and/or modify it under the terms of diff --git a/rootfs/usr/share/planefence/pf_notify.sh b/rootfs/usr/share/planefence/pf_notify.sh index 274baaf5..57e573c0 100755 --- a/rootfs/usr/share/planefence/pf_notify.sh +++ b/rootfs/usr/share/planefence/pf_notify.sh @@ -5,10 +5,10 @@ # This script is distributed as part of the PlaneFence package and is dependent # on that package for its execution. # -# Copyright 2020-2022 by Ramon F. Kolb (kx1t) - licensed under the terms and conditions +# Copyright 2020-2024 by Ramon F. Kolb (kx1t) - 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 # # The package contains parts of, and modifications or derivatives to the following: # - Dump1090.Socket30003 by Ted Sluis: https://github.com/tedsluis/dump1090.socket30003 diff --git a/rootfs/usr/share/planefence/pf_query.sh b/rootfs/usr/share/planefence/pf_query.sh index 4e1ed9bc..33e12f0e 100755 --- a/rootfs/usr/share/planefence/pf_query.sh +++ b/rootfs/usr/share/planefence/pf_query.sh @@ -5,10 +5,10 @@ # Usage: pf_php.sh [hex=] [call=] [start=] [end=] file= # File argument is always required and at least 1 additional argument is required. # -# Copyright 2021 Ramon F. Kolb - licensed under the terms and conditions +# Copyright 2021-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/ # # Summary of License Terms # This program is free software: you can redistribute it and/or modify it under the terms of diff --git a/rootfs/usr/share/planefence/planefence.conf b/rootfs/usr/share/planefence/planefence.conf index 0f35333e..f8f7972d 100644 --- a/rootfs/usr/share/planefence/planefence.conf +++ b/rootfs/usr/share/planefence/planefence.conf @@ -1,9 +1,9 @@ # PLANEFENCE.CONF - user changeable variables for PLANEFENCE.SH # -# Copyright 2020 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/planefence/ +# 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 @@ -103,7 +103,7 @@ # # ATTRIB contains the attribution line at the bottom of the tweet - ATTRIB="Planefence by kx1t - docker:kx1t/planefence" + ATTRIB="#adsb #planefence by kx1t - https://sdr-e.com/docker-planefence" # # PlaneHeat is an add-on that gets installed by default. It tracks a daily heatmap for planes that fly inside the @@ -353,9 +353,11 @@ set +a # MASTODON parameters for MASTODON notifications as an alternative to Twitter: # MASTODON_SERVER contains the mastodon server name, for example "airwaves.social" # MASTODON_ACCESS_TOKEN contains the mastodon access token needed for posting +# MASTODON_NAME contains the @ name of the Mastodon account MASTODON_SERVER= MASTODON_ACCESS_TOKEN= MASTODON_VISIBILITY=unlisted + MASTODON_NAME= # # --------------------------------------------------------------------- # NOTIFICATION_SERVER contains the address (hostname or IP address) to the Notification Server. @@ -367,9 +369,15 @@ set +a NOTIFICATION_SERVER=planefence-notifier PF_MOTD= - +# +# --------------------------------------------------------------------- +# TRACKSERVICE indicates which tar1090-style tracking interface should be used. Use only the hostname without http(s):// +# If left empty, it will default to globe.adsbexchange.com + TRACKSERVICE= +# +# --------------------------------------------------------------------- # Last, the version. Although you could change this, for tracking purposes, we'd like you to leave it to whatever the # official version number is. If you fork this software, we'd appreciate if you add on to the version number rather than # replace the entire number. That way, it's easy to understand from which version you forked. For example, VERSION=3.11-myfork-1.0 - VERSION=5.24-release + VERSION=5.25-dev diff --git a/rootfs/usr/share/planefence/planefence.sh b/rootfs/usr/share/planefence/planefence.sh index b9934fa2..02737b65 100755 --- a/rootfs/usr/share/planefence/planefence.sh +++ b/rootfs/usr/share/planefence/planefence.sh @@ -1,6 +1,6 @@ #!/command/with-contenv bash #shellcheck shell=bash -#shellcheck disable=SC2015,SC1091 +#shellcheck disable=SC2015,SC1091,SC2129 # # PLANEFENCE - a Bash shell script to render a HTML and CSV table with nearby aircraft # @@ -9,7 +9,7 @@ # 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/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 @@ -395,7 +395,7 @@ EOF printf " %s\n" "$((COUNTER++))" >&3 # table index number #printf " %s\n" "$(tr -dc '[[:print:]]' <<< "${NEWVALUES[6]}")" "${NEWVALUES[0]}" >&3 # ICAO # why check for non-printable characters, the file we process is trusted, if there are non-printable chars, fix the input file generation instead of this band-aid - printf " %s\n" "${NEWVALUES[6]}" "${NEWVALUES[0]}" >&3 # ICAO + printf " %s\n" "${NEWVALUES[6]//globe.adsbexchange.com/"$TRACKSERVICE"}" "${NEWVALUES[0]}" >&3 # ICAO printf " %s\n" "https://flightaware.com/live/modes/${NEWVALUES[0]}/ident/${CALLSIGN}/redirect" "${CALLSIGN}" >&3 # Flight number; strip "@" if there is any at the beginning of the record if [[ "$AIRLINECODES" != "" ]]; then if [[ "${CALLSIGN}" != "" ]] && [[ "${CALLSIGN}" != "link" ]]; then @@ -481,7 +481,7 @@ EOF if [[ "${NEWVALUES[1]::1}" == "@" ]]; then # Print "yes" and add a link if available if [[ "${NEWVALUES[-1]::13}" == "https://t.co/" ]]; then - printf " tweet\n" "$(tr -dc '[:print:]' <<< "${NEWVALUES[-1]}")" >&3 + printf " tweet\n" "$(tr -dc '[:print:]' <<< "${NEWVALUES[-1]}")" >&3 else printf " discord\n" >&3 fi @@ -761,7 +761,11 @@ then fi # rewrite LINESFILTERED to file -[[ -f /run/planefence/filtered-$FENCEDATE ]] && read -r i < "/run/planefence/filtered-$FENCEDATE" || i=0 +if [[ -f /run/planefence/filtered-$FENCEDATE ]]; then + read -r i < "/run/planefence/filtered-$FENCEDATE" +else + i=0 +fi echo $((LINESFILTERED + i)) > "/run/planefence/filtered-$FENCEDATE" # if IGNOREDUPES is ON then remove duplicates @@ -775,7 +779,11 @@ then mv -f /tmp/pf-out.tmp "$OUTFILECSV" fi # rewrite LINESFILTERED to file - if [[ -f /run/planefence/filtered-$FENCEDATE ]]; then read -r i < "/run/planefence/filtered-$FENCEDATE"; else i=0; fi + if [[ -f /run/planefence/filtered-$FENCEDATE ]]; then + read -r i < "/run/planefence/filtered-$FENCEDATE" + else + i=0 + fi echo $((LINESFILTERED + i)) > "/run/planefence/filtered-$FENCEDATE" fi @@ -829,7 +837,10 @@ fi [[ "$BASETIME" != "" ]] && echo "10. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- done getting NoiseCapt stuff, invoking plane-alert.sh" || true # If $PLANEALERT=on then lets call plane-alert to see if the new lines contain any planes of special interest: -[ "$PLANEALERT" == "ON" ] && ( LOG "Calling Plane-Alert as $PLALERTFILE $INFILETMP"; $PLALERTFILE "$INFILETMP"; ) +if [[ "$PLANEALERT" == "ON" ]]; then + LOG "Calling Plane-Alert as $PLALERTFILE $INFILETMP" + $PLALERTFILE "$INFILETMP" +fi # Next, we are going to print today's HTML file: # Note - all text between 'cat' and 'EOF' is HTML code: @@ -845,14 +856,14 @@ cat <"$OUTFILEHTMTMP" # are always welcome. Join me at the GitHub link shown below, or via email # at kx1t (at) amsat (dot) org. # -# Copyright 2020 - 2023 Ramon F. Kolb, kx1t - licensed under the terms and conditions +# Copyright 2020-2024 Ramon. Kolb, kx1t - 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/ # # The package contains contributions from several other packages, that may be licensed # under different terms. Attributions and our thanks can be found at -# https://github.com/kx1t/docker-planefence/blob/main/ATTRIBUTION.md, or at "/attribution.txt" +# https://github.com/sdr-enthusiasts/docker-planefence/blob/main/ATTRIBUTION.md, or at "/attribution.txt" # using the same base URL as you used to get to this web page. # # Summary of License Terms @@ -919,6 +930,7 @@ z-index: 100; top: 0; } +$(if [[ -n "$MASTODON_SERVER" ]] && [[ -n "$MASTODON_ACCESS_TOKEN" ]] && [[ -n "$MASTODON_NAME" ]]; then echo ""; fi) @@ -932,17 +944,19 @@ ${PF_MOTD}
    Executive Summary
      -
    • Last update: $(date +"%b %d, %Y %R:%S %Z") -
    • Maximum distance from ${LAT_VIS}°N, ${LON_VIS}°E: $DIST $DISTUNIT - -
    • Only aircraft below $(printf "%'.0d" "$MAXALT") $ALTUNIT are reported -
    • Data extracted from $(printf "%'.0d" "$TOTALLINES") ADS-B messages received since midnight today - +
    • Last update: $(date +"%b %d, %Y %R:%S %Z") +
    • Maximum distance from ${LAT_VIS}°N, ${LON_VIS}°E: $DIST $DISTUNIT +
    • Only aircraft below $(printf "%'.0d" "$MAXALT") $ALTUNIT are reported +
    • Data extracted from $(printf "%'.0d" $TOTALLINES) ADS-B messages received since midnight today EOF -[[ "$FUDGELOC" != "" ]] && printf "
    • Please note that the reported station coordinates and the center of the circle on the heatmap are rounded for privacy protection. They do not reflect the exact location of the station.\n" >> "$OUTFILEHTMTMP" - -[[ -f "/run/planefence/filtered-$FENCEDATE" ]] && [[ -f "$IGNORELIST" ]] && (( $(grep -c "^[^#;]" "$IGNORELIST") > 0 )) && printf "
    • %d entries were filtered out today because of an ignore list\n" "$(<"/run/planefence/filtered-$FENCEDATE")" >> "$OUTFILEHTMTMP" -[[ "$PA_LINK" != "" ]] && printf "
    • Additionally, click here to visit Plane Alert: a watchlist of aircraft in general range of the station.\n" "$PA_LINK" >> "$OUTFILEHTMTMP" +{ [[ -n "$FUDGELOC" ]] && printf "
    • Please note that the reported station coordinates and the center of the circle on the heatmap are rounded for privacy protection. They do not reflect the exact location of the station\n" + [[ -f "/run/planefence/filtered-$FENCEDATE" ]] && [[ -f "$IGNORELIST" ]] && (( $(grep -c "^[^#;]" "$IGNORELIST") > 0 )) && printf "
    • %d entries were filtered out today because of an ignore list\n" "$(Get notified instantaneously of aircraft in range by following @%s@%s on Mastodon" \ + "$MASTODON_SERVER" "$MASTODON_NAME" "$MASTODON_NAME" "$MASTODON_SERVER" + fi + [[ -n "$PA_LINK" ]] && printf "
    • Additionally, click here to visit Plane Alert: a watchlist of aircraft in general range of the station\n" "$PA_LINK" +} >> "$OUTFILEHTMTMP" # shellcheck disable=SC2129 cat <>"$OUTFILEHTMTMP" @@ -966,18 +980,19 @@ cat <>"$OUTFILEHTMTMP"
        EOF -printf "
      • Click on the Transponder ID to see the full flight information/history (from AdsbExchange)" "$LAT_VIS" "$LON_VIS" >> "$OUTFILEHTMTMP" -printf "
      • Click on the Flight Number to see the full flight information/history (from FlightAware)" >> "$OUTFILEHTMTMP" -printf "
      • Click on the Owner Information to see the FAA record for this plane (private, US registered planes only)" >> "$OUTFILEHTMTMP" -(( ALTCORR > 0 )) && printf "
      • Minimum altitude is the altitude above local ground level, which is %s %s MSL." "$ALTCORR" "$ALTUNIT" >> "$OUTFILEHTMTMP" || printf "
      • Minimum altitude is the altitude above sea level." >> "$OUTFILEHTMTMP" +{ printf "
      • Click on the Transponder ID to see the full flight information/history (from $TRACKSERVICE)" "$LAT_VIS" "$LON_VIS" + printf "
      • Click on the Flight Number to see the full flight information/history (from FlightAware)" + printf "
      • Click on the Owner Information to see the FAA record for this plane (private, US registered planes only)" + (( ALTCORR > 0 )) && printf "
      • Minimum altitude is the altitude above local ground level, which is %s %s MSL." "$ALTCORR" "$ALTUNIT" >> "$OUTFILEHTMTMP" || printf "
      • Minimum altitude is the altitude above sea level" -[[ "$PLANETWEET" != "" ]] && printf "
      • Click on the word "yes" in the Tweeted column to see the Tweet.\n
      • Note that tweets are issued after a slight delay\n" >> "$OUTFILEHTMTMP" -[[ "$PLANETWEET" != "" ]] && printf "
      • Get notified instantaneously of aircraft in range by following @%s on Twitter!\n" "$PLANETWEET" "$PLANETWEET" >> "$OUTFILEHTMTMP" -(( $(find "$TMPDIR"/noisecapt-spectro*.png -daystart -maxdepth 1 -mmin -1440 -print 2>/dev/null | wc -l ) > 0 )) && printf "
      • Click on the word "Spectrogram" to see the audio spectrogram of the noisiest period while the aircraft was in range\n" >> "$OUTFILEHTMTMP" -[[ "$PLANEALERT" == "ON" ]] && printf "
      • See a list of aircraft matching the station's Alert List here\n" >> "$OUTFILEHTMTMP" + [[ "$PLANETWEET" != "" ]] && printf "
      • Click on the word "yes" in the Tweeted column to see the Tweet.\n
      • Note that tweets are issued after a slight delay\n" + [[ "$PLANETWEET" != "" ]] && printf "
      • Get notified instantaneously of aircraft in range by following @%s on Twitter!\n" "$PLANETWEET" "$PLANETWEET" + (( $(find "$TMPDIR"/noisecapt-spectro*.png -daystart -maxdepth 1 -mmin -1440 -print 2>/dev/null | wc -l ) > 0 )) && printf "
      • Click on the word "Spectrogram" to see the audio spectrogram of the noisiest period while the aircraft was in range\n" + [[ "$PLANEALERT" == "ON" ]] && printf "
      • See a list of aircraft matching the station's Alert List here\n" -printf "
      • Press the header of any of the columns to sort by that column.\n" >> "$OUTFILEHTMTMP" -printf "
      " >> "$OUTFILEHTMTMP" + printf "
    • Press the header of any of the columns to sort by that column\n" + printf "
    \n" +} >> "$OUTFILEHTMTMP" [[ "$BASETIME" != "" ]] && echo "12. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- starting to write the PF table to the website" || true @@ -1070,7 +1085,7 @@ cat <>"$OUTFILEHTMTMP" diff --git a/rootfs/usr/share/planefence/planefence_notify.sh b/rootfs/usr/share/planefence/planefence_notify.sh index 92ec804b..a5ca475f 100755 --- a/rootfs/usr/share/planefence/planefence_notify.sh +++ b/rootfs/usr/share/planefence/planefence_notify.sh @@ -12,10 +12,10 @@ # This script is distributed as part of the PlaneFence package and is dependent # on that package for its execution. # -# Copyright 2020 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/planefence +# 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 @@ -64,11 +64,11 @@ PLANEFILE=/usr/share/planefence/persist/plane-alert-db.txt (( TWEET_MINTIME > 0 )) && MINTIME=$TWEET_MINTIME || MINTIME=100 # $ATTRIB contains the attribution line at the bottom of the tweet -[[ "x$ATTRIB" == "x" ]] && ATTRIB="#Planefence by kx1t - docker:kx1t/planefence" +[[ -z "$ATTRIB" ]] && ATTRIB="#adsb #planefence by kx1t - http://github.com/sdr-enthusiasts/docker-planefence" if [ "$SOCKETCONFIG" != "" ] then - case "$(grep "^distanceunit=" $SOCKETCONFIG |sed "s/distanceunit=//g")" in + case "$(grep "^distanceunit=" "$SOCKETCONFIG" |sed "s/distanceunit=//g")" in nauticalmile) DISTUNIT="nm" ;; @@ -87,7 +87,7 @@ fi ALTUNIT="ft" if [ "$SOCKETCONFIG" != "" ] then - case "$(grep "^altitudeunit=" $SOCKETCONFIG |sed "s/altitudeunit=//g")" in + case "$(grep "^altitudeunit=" "$SOCKETCONFIG" |sed "s/altitudeunit=//g")" in feet) ALTUNIT="ft" ;; @@ -130,7 +130,7 @@ getRoute() fi # Now get the results object from the API: - routeObj="$(curl -sL https://api.adsbdb.com/v0/callsign/$1)" + routeObj="$(curl -sL "https://api.adsbdb.com/v0/callsign/$1")" # Unknown Call -> return empty if [[ "$(jq '.response' <<< "$routeObj")" == "\"unknown callsign\"" ]] @@ -194,13 +194,13 @@ done if [ -f "$CSVFILE" ] then - while read CSVLINE + while read -r CSVLINE do - XX=$(echo -n $CSVLINE | tr -d '[:cntrl:]') + XX=$(echo -n "$CSVLINE" | tr -d '[:cntrl:]') CSVLINE=$XX unset RECORD # Read the line, but first clean it up as it appears to have a newline in it - IFS="," read -aRECORD <<< "$CSVLINE" + IFS="," read -raRECORD <<< "$CSVLINE" # LOG "${#RECORD[*]} records in the current line: (${RECORD[*]})" # $TIMEDIFF contains the difference in seconds between the current record and "now". # We want this to be at least $MINDIFF to avoid tweeting before all noise data is captured @@ -208,15 +208,17 @@ then # start time (not POST -> RECORD[2]) of the observation time [[ "$TWEET_BEHAVIOR" == "POST" ]] && TIMEDIFF=$(( $(date +%s) - $(date -d "${RECORD[3]}" +%s) )) || TIMEDIFF=$(( $(date +%s) - $(date -d "${RECORD[2]}" +%s) )) + # shellcheck disable=SC2126 + # shellcheck disable=SC2094 if [[ "${RECORD[1]:0:1}" != "@" ]] && [[ $TIMEDIFF -gt $MINTIME ]] && [[ ( "$(grep "${RECORD[0]},@${RECORD[1]}" "$CSVFILE" | wc -l)" == "0" ) || "$TWEETEVERY" == "true" ]] # ^not tweeted before^ ^older than $MINTIME^ ^No previous occurrence that was tweeted^ ...or... ^$TWEETEVERY is true^ then - AIRLINE=$(/usr/share/planefence/airlinename.sh ${RECORD[1]#@} ${RECORD[0]} ) + AIRLINE=$(/usr/share/planefence/airlinename.sh "${RECORD[1]#@}" "${RECORD[0]}" ) AIRLINETAG="#" if [[ "${RECORD[1]}" != "" ]] then - AIRLINETAG+="$(echo $AIRLINE | tr -d '[:space:]-')" + AIRLINETAG+="$(echo "$AIRLINE" | tr -d '[:space:]-')" ROUTE="$(getRoute "${RECORD[1]}")" fi @@ -240,23 +242,23 @@ then [[ "$tagfield" != "" ]] && customtag="$(awk -F "," -v field="$tagfield" -v icao="${RECORD[0]}" '$1 == icao {print $field; exit;}' "$PLANEFILE")" || customtag="" [[ "$customtag" != "" ]] && TWEET+="#$customtag " + TWEET+="%0A${RECORD[6]}" # Add attribution to the tweet: - TWEET+="%0A$ATTRIB%0A" + TWEET+="%0A$ATTRIB" + + # swap adsbexchange for the $TRACKSERVICE: + TWEET="${TWEET//globe.adsbexchange.com/"$TRACKSERVICE"}" # let's do some calcs on the actual tweet length, so we strip the minimum: teststring="${TWEET//%0A/ }" # replace newlines with a single character teststring="$(sed 's/https\?:\/\/[^ ]*\s/12345678901234567890123 /g' <<< "$teststring ")" # replace all URLS with 23 spaces - note the extra space after the string tweetlength=$(( ${#teststring} - 1 )) - (( tweetlength > 280 )) && echo "[$(date)][$APPNAME] Warning: PF tweet length is $tweetlength > 280: tweet will be truncated!" - (( tweetlength > 280 )) && maxlength=$(( ${#TWEET} + 280 - tweetlength )) || maxlength=280 - - TWEET="${TWEET:0:$maxlength}" - - # Now add the last field (attribution) without title or training Newline - # Reason: this is a URL that Twitter reinterprets and previews on the web - # Also, the Newline at the end tends to mess with Twurl - TWEET+="${RECORD[6]}" - + if (( tweetlength > 490 )); then + echo "[$(date)][$APPNAME] Warning: PF tweet length is $tweetlength > 490: tweet will be truncated!" + maxlength=$(( ${#TWEET} + 490 - tweetlength )) + TWEET="${TWEET:0:$maxlength}" + fi + LOG "Assessing ${RECORD[0]}: ${RECORD[1]:0:1}; diff=$TIMEDIFF secs; Tweeting... msg body: $TWEET" 1 # Before anything else, let's add the "tweeted" flag to the flight number: @@ -268,17 +270,17 @@ then GOTSNAP="false" snapfile="/tmp/snapshot.png" - newsnap="$(find /usr/share/planefence/persist/planepix -iname ${RECORD[0]}.jpg -print -quit 2>/dev/null || true)" + newsnap="$(find /usr/share/planefence/persist/planepix -iname "${RECORD[0]}.jpg" -print -quit 2>/dev/null || true)" # echo "-0- in planetweet: newsnap=\"$newsnap\" (find /usr/share/planefence/persist/planepix -iname ${RECORD[0]}.jpg -print -quit)" if [[ "$newsnap" != "" ]] then GOTSNAP="true" - rm -f $snapfile - ln -sf $newsnap $snapfile + rm -f "$snapfile" + ln -sf "$newsnap" "$snapfile" echo "[$(date)][$APPNAME] Using picture from $newsnap" else link=$(awk -F "," -v icao="${RECORD[0],,}" 'tolower($1) == icao { print $2 ; exit }' /usr/share/planefence/persist/planepix.txt 2>/dev/null || true) - if [[ "$link" != "" ]] && curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0" -s -L --fail $link -o $snapfile --show-error 2>/dev/stdout + if [[ "$link" != "" ]] && curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0" -s -L --fail "$link" -o $snapfile --show-error 2>/dev/stdout then echo "[$(date)][$APPNAME] Using picture from $link" GOTSNAP="true" @@ -288,7 +290,7 @@ then fi fi - if [[ "$GOTSNAP" == "false" ]] && curl -s -L --fail --max-time "$SCREENSHOT_TIMEOUT" $SCREENSHOTURL/snap/${RECORD[0]#\#} -o "/tmp/snapshot.png" + if [[ "$GOTSNAP" == "false" ]] && curl -s -L --fail --max-time "$SCREENSHOT_TIMEOUT" "$SCREENSHOTURL/snap/${RECORD[0]#\#}" -o "/tmp/snapshot.png" then GOTSNAP="true" echo "[$(date)][$APPNAME] Screenshot successfully retrieved at $SCREENSHOTURL for ${RECORD[0]}" @@ -299,8 +301,8 @@ then if [[ "${PF_DISCORD,,}" == "on" || "${PF_DISCORD,,}" == "true" ]] && [[ "x$PF_DISCORD_WEBHOOKS" != "x" ]] && [[ "x$DISCORD_FEEDER_NAME" != "x" ]] then LOG "Planefence sending Discord notification" - timeout 120 python3 "$PLANEFENCEDIR"/send-discord-alert.py "$CSVLINE" "$AIRLINE" - fi + timeout 120 python3 "$PLANEFENCEDIR"/send-discord-alert.py "$CSVLINE" "$AIRLINE" + fi # log the message we will try to tweet or toot: if [[ -n "$MASTODON_SERVER" ]] || [ "$TWEETON" == "yes" ] @@ -311,7 +313,8 @@ then if [[ -n "$MASTODON_SERVER" ]] then mast_id="null" - MASTTEXT="$(sed -e 's|\\/|/|g' -e 's|\\n|\n|g' -e 's|%0A|\n|g' <<< "${TWEET}")" + MASTTEXT="$(sed -e 's|\\/|/|g' -e 's|\\n|\n|g' -e 's|%0A|\n|g' <<< "${TWEET}")" + if [[ "$GOTSNAP" == "true" ]] then # we upload an image @@ -360,6 +363,7 @@ then LINK="$(echo "`twurl -r "status=$TWEET" /1.1/statuses/update.json`" | tee -a /tmp/tweets.log | jq '.entities."urls" | .[] | .url' | tr -d '\"')" fi + # shellcheck disable=SC2028 [[ "${LINK:0:12}" == "https://t.co" ]] && echo "[$(date)][$APPNAME] Planefence post to Twitter generated successfully. Tweet available at: $LINK" || echo "[$(date)][$APPNAME] PlaneFence Tweet error. Twitter returned:\n$(tail -1 /tmp/tweets.log)" rm -f $snapfile diff --git a/rootfs/usr/share/planefence/planeheat.sh b/rootfs/usr/share/planefence/planeheat.sh index c79c06a4..83385c2b 100755 --- a/rootfs/usr/share/planefence/planeheat.sh +++ b/rootfs/usr/share/planefence/planeheat.sh @@ -4,10 +4,10 @@ # # Usage: ./planeheat.sh [date] # -# 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/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 @@ -334,7 +334,7 @@ cat <"$PLANEHEATHTML" radius: 7, maxZoom: 14, blur: 11, - attribution: "docker:kx1t/planefence" + attribution: "docker:ghcr.io/sdr-enthusiasts/docker-planefence" }).addTo(map); var circle = L.circle([ parseFloat("$LAT_VIS"), parseFloat("$LON_VIS")], { color: 'blue', diff --git a/rootfs/usr/share/planefence/prep-planefence.sh b/rootfs/usr/share/planefence/prep-planefence.sh index 84fa0c58..83a4f607 100755 --- a/rootfs/usr/share/planefence/prep-planefence.sh +++ b/rootfs/usr/share/planefence/prep-planefence.sh @@ -1,10 +1,10 @@ #!/command/with-contenv bash #shellcheck shell=bash disable=SC2015,SC2268,SC2174,SC1091,SC2154 # ----------------------------------------------------------------------------------- -# 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/ # # Programmers note: when using sed for URLs or file names, make sure NOT to use '/' # as command separator, but use something else instead, for example '|' @@ -51,6 +51,7 @@ chmod -fR a+rw /usr/share/planefence/persist/{.[!.]*,*} chmod a=rwx /usr/share/planefence/persist/planepix if [[ -f /usr/share/planefence/persist/planefence.config ]]; then set -o allexport + # shellcheck disable=SC1091 source /usr/share/planefence/persist/planefence.config set +o allexport else @@ -215,9 +216,20 @@ if chk_enabled "${PF_TWEET,,}"; then sed -i 's/\(^\s*PLANETWEET=\).*/\1/' /usr/share/planefence/planefence.conf else sed -i 's|\(^\s*PLANETWEET=\).*|\1'"$(sed -n '/profiles:/{n;p;}' /root/.twurlrc | tr -d '[:blank:][=:=]')"'|' /usr/share/planefence/planefence.conf - [[ -n "$PF_TWATTRIB" ]] && sed -i 's|\(^\s*ATTRIB=\).*|\1'"\"$PF_TWATTRIB\""'|' /usr/share/planefence/planefence.conf - fi + [[ -n "$PF_TWATTRIB" ]] && sed -i 's|\(^\s*ATTRIB=\).*|\1'"\"$PF_TWATTRIB\""'|' /usr/share/planefence/planefence.conf + fi fi + +# Despite the name, this variable also works for Mastodon and Discord notifications: +# You can use PF_TWATTRIB/PA_TWATTRIB or PF_ATTRIB/PA_ATTRIB or simply $ATTRIB +# If PA_[TW]ATTRIB isn't set, but PF_[TW]ATTRIB has a value, then the latter will also be used for Plane-Alert +# Finally, if you set ATTRIB to a value, we will use that for both PA and PF and ignore any PF_[TW]ATTRIB/PA_[TW]ATTRIB values +[[ -n "$PF_TWATTRIB$PF_ATTRIB" ]] && configure_planefence "ATTRIB" "\"$PF_TWATTRIB$PF_ATTRIB\"" +[[ -n "$PA_TWATTRIB$PA_ATTRIB" ]] && configure_planealert "ATTRIB" "\"$PA_TWATTRIB$PA_ATTRIB\"" +[[ -z "$PA_TWATTRIB$PA_ATTRIB" ]] && [[ -n "$PF_TWATTRIB$PF_ATTRIB" ]] && configure_planealert "ATTRIB" "\"$PF_TWATTRIB$PF_ATTRIB\"" +[[ -n "$ATTRIB" ]] && configure_both "ATTRIB" "\"$ATTRIB\"" + + # ----------------------------------------------------------------------------------- # # Change the heatmap height and width if they are defined in the .env parameter file: @@ -227,8 +239,7 @@ fi # # Also do this for files in the past -- /usr/share/planefence/html/planefence-??????.html if find /usr/share/planefence/html/planefence-??????.html >/dev/null 2>&1; then - for i in /usr/share/planefence/html/planefence-??????.html - do + for i in /usr/share/planefence/html/planefence-??????.html; do [[ -n "$PF_MAPWIDTH" ]] && sed -i 's|\(^\s*
    " <<< "$mast_result" >/dev/null 2>&1; then + configure_both "MASTODON_NAME" "$(jq -r '.acct' <<< "$mast_result")" + fi if chk_enabled "${PF_MASTODON,,}"; then configure_planefence "MASTODON_ACCESS_TOKEN" "$MASTODON_ACCESS_TOKEN" configure_planefence "MASTODON_SERVER" "$MASTODON_SERVER" @@ -354,6 +369,12 @@ configure_planefence "PF_MOTD" "\"$PF_MOTD\"" configure_planealert "PA_MOTD" "\"$PA_MOTD\"" # #-------------------------------------------------------------------------------- +# Set TRACKSERVICE and TRACKLIMIT for Planefence and plane-alert. +[[ -n "$PF_TRACKSERVICE" ]] && configure_planefence "TRACKSERVICE" "$PF_TRACKSERVICE" || configure_planefence "TRACKSERVICE" "globe.adsbexchange.com" +[[ -n "$PA_TRACKSERVICE" ]] && configure_planealert "TRACKSERVICE" "$PA_TRACKSERVICE" || true +[[ -n "$PA_TRACKLIMIT" ]] && configure_planealert "TRACKLIMIT" "$PA_TRACKLIMIT" || true +# +#-------------------------------------------------------------------------------- # Last thing - save the date we processed the config to disk. That way, if ~/.planefence/planefence.conf is changed, # we know that we need to re-run this prep routine! diff --git a/rootfs/usr/share/planefence/send-discord-alert.py b/rootfs/usr/share/planefence/send-discord-alert.py index 344f55bf..14844471 100755 --- a/rootfs/usr/share/planefence/send-discord-alert.py +++ b/rootfs/usr/share/planefence/send-discord-alert.py @@ -4,10 +4,13 @@ # # Usage: ./send-discord-alert.py # -# Copyright 2022 Ramon F. Kolb - licensed under the terms and conditions +# Copyright 2022-2024 Ramon F. Kolb, kx1t +# Copyright 2022 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 @@ -63,6 +66,29 @@ def process_alert(config, plane): name = plane['tail_num'] if plane["airline"] != "": name = plane['airline'] + + try: + if config['PF_TRACKSERVICE'] == "": + trackservice="globe.adsbexchange.com" + trackname="AdsbExchange" + else: + trackservice=config['PF_TRACKSERVICE'] + trackname=config['PF_TRACKSERVICE'].replace('https://','') + trackname=trackname.replace('http://','') + trackname=trackname.replace('www.','') + trackname=trackname.replace('globe.','') + trackname=trackname.replace('radar.','') + trackname=trackname.replace('tar1090.','') + trackname=trackname.replace('.com','') + trackname=trackname.replace('.org','') + trackname=trackname.replace('.net','') + trackname=trackname.replace('/tar1090','') + trackname=trackname.replace('/map','') + trackname=trackname.replace('/radar','') + trackname=trackname.replace('/','') + except: + trackservice="globe.adsbexchange.com" + trackname="AdsbExchange" fa_link = pf.flightaware_link(plane['icao'], plane['tail_num']) @@ -70,7 +96,7 @@ def process_alert(config, plane): config["DISCORD_FEEDER_NAME"], config["PF_DISCORD_WEBHOOKS"], f"{name} is overhead at {pf.altitude_str(config, plane['alt'])}", - f"[Track on ADS-B Exchange]({plane['adsbx_url']})") + f"[Track on {trackname}]({plane['adsbx_url'].replace('globe.adsbexchange.com',trackservice)})") pf.attach_media(config, "PF", plane, webhooks, embed) diff --git a/rootfs/usr/share/planefence/send_discord b/rootfs/usr/share/planefence/send_discord index e3a27b6f..3b6b65b7 100755 --- a/rootfs/usr/share/planefence/send_discord +++ b/rootfs/usr/share/planefence/send_discord @@ -1,7 +1,7 @@ #!/command/with-contenv bash #shellcheck shell=bash disable=SC2015,SC2164,SC1090,SC2154,SC1091 #--------------------------------------------------------------------------------------------- -# Copyright (C) 2022-2023, Ramon F. Kolb (kx1t) +# Copyright (C) 2022-2024, Ramon F. Kolb (kx1t) # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the diff --git a/rootfs/usr/share/planefence/send_mastodon b/rootfs/usr/share/planefence/send_mastodon index ad722aec..52f8d1ca 100755 --- a/rootfs/usr/share/planefence/send_mastodon +++ b/rootfs/usr/share/planefence/send_mastodon @@ -1,7 +1,7 @@ #!/command/with-contenv bash #shellcheck shell=bash disable=SC2015,SC2164,SC1090,SC1091 #--------------------------------------------------------------------------------------------- -# Copyright (C) 2022-2023, Ramon F. Kolb (kx1t) +# Copyright (C) 2022-2024, Ramon F. Kolb (kx1t) # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the diff --git a/rootfs/usr/share/planefence/stage/pa_query.php b/rootfs/usr/share/planefence/stage/pa_query.php index 51d31914..7a1b80e6 100644 --- a/rootfs/usr/share/planefence/stage/pa_query.php +++ b/rootfs/usr/share/planefence/stage/pa_query.php @@ -50,7 +50,7 @@ echo "will return records of tail N141NE, N142NE, N143NE, and that have a timestamp that contains 2021/12/20 - 2021/21/29.
    "; echo "
    "; echo "Note that the date range is limited to the data available to Plane-Alert.
    "; - echo "(C)opyright 2021 by kx1t, available under GPL3 as defined at the PlaneFence repository at GitHub.
    "; + echo "(C)opyright 2021-2024 by kx1t, available under GPL3 as defined at the PlaneFence repository at GitHub.
    "; echo "
    " . $hex . $tail . $name . $equipment . $timestamp . $call . $lat . $lon; echo ""; } else { diff --git a/rootfs/usr/share/planefence/stage/pf_query.php b/rootfs/usr/share/planefence/stage/pf_query.php index 73af3e9a..98ada30f 100644 --- a/rootfs/usr/share/planefence/stage/pf_query.php +++ b/rootfs/usr/share/planefence/stage/pf_query.php @@ -34,7 +34,7 @@ echo "will return records of which the Hex ID starts with A followed by a D or E, and that have a start date/time that contains 2021/12/13, 2021/12/14, or 2021/12/15.
    "; echo "
    "; echo "Note that the date range is limited to the data available to PlaneFence. By default, this is set to the last 14 days.
    "; - echo "(C)opyright 2021 by kx1t, available under GPL3 as defined at the PlaneFence repository at GitHub.
    "; + echo "(C)opyright 2021-2024 by kx1t, available under GPL3 as defined at the PlaneFence repository at GitHub.
    "; echo ""; } else { if (strcmp($outputtype, "csv") == 0) { diff --git a/rootfs/usr/share/planefence/stage/planefence.config b/rootfs/usr/share/planefence/stage/planefence.config index 45c5c006..2b912f37 100644 --- a/rootfs/usr/share/planefence/stage/planefence.config +++ b/rootfs/usr/share/planefence/stage/planefence.config @@ -63,7 +63,12 @@ PF_TWEETEVERY=false # --------------------------------------------------------------------- # # If you tweet, you can personalize a string at the bottom using PF_TWATTRIB -PF_TWATTRIB="#planefence #adsb - docker:kx1t/planefence" +# You can use PF_ATTRIB/PA_ATTRIB or PF_TWATTRIB/PA_TWATTRIB (legacy params) or simply $ATTRIB +# If PA_[TW]ATTRIB isn't set, but PF_[TW]ATTRIB has a value, then the latter will also be used for Plane-Alert +# Finally, if you set ATTRIB to a value, we will use that for both PA and PF and ignore any PF_[TW]ATTRIB/PA_[TW]ATTRIB values +# +PF_ATTRIB="#adsb #planefence by kx1t - https://sdr-e.com/docker-planefence" +PA_ATTRIB="#adsb #planefence #planealert by kx1t - https://sdr-e.com/docker-planefence" # # --------------------------------------------------------------------- # Location of planefence log. You can see what it's doing with @@ -94,7 +99,7 @@ PF_SPEEDUNIT=knotph # If you run dump1090[-fa] or readsb in a different container or on a # different machine, then you should put here the domain name of that machine. # You should then configure your docker-compose.yml as described -# under (6) at https://github.com/kx1t/docker-planefence/blob/main/README.md +# under (6) at https://github.com/sdr-enthusiasts/docker-planefence/blob/main/README.md # # If you have set up "tar1090" as your mapping app of choice, and you are showing # MLAT data on the map, then we recommend using tar1090 as your data source. That @@ -320,7 +325,7 @@ PA_SILHOUETTES_LINK= # post about it in that channel -- see here: https://discord.gg/ytAW4WZ66B # # You can also configure posting to your own Discord Server, in which case you can determine your -# own posting policies. See here for explanation on how to set things up: https://github.com/kx1t/docker-planefence/blob/dev-discord_notify/README-discord-alerts.md +# own posting policies. See here for explanation on how to set things up: https://github.com/sdr-enthusiasts/docker-planefence/blob/dev-discord_notify/README-discord-alerts.md # For posting to the #planefence-alert channel on the SDR-Enthusiasts Discord Server, please send a DM to @kx1t at that server to request one. # # Switch OFF to ON to post alerts to Discord (PF=Planefence; PA=Plane-Alert): @@ -391,7 +396,6 @@ PA_MASTODON_VISIBILITY=unlisted PA_MASTODON_MAXIMGS=1 MASTODON_RETENTION_TIME=7 # -# # --------------------------------------------------------------------- # Plane-Alert Exclusions. Entries here will be excluded from Plane-Alert notifications on Mastodon and Discord, # and won't be recorded in the Plane-Alert web UI. Accepted values are ICAO type codes (e.g. TEX2 for T-6 Texans), @@ -399,4 +403,23 @@ MASTODON_RETENTION_TIME=7 # Kid Rock, ambulance, et cetera). Multiple exclusions should be separated by commas. Entries are not case sensitive. # After making additions or changes, examine the container logs to verify it's doing what you intended it to! # Note that URLs and image links are not searched. Leave this blank to disable. -PA_EXCLUSIONS= \ No newline at end of file +PA_EXCLUSIONS= +# +# --------------------------------------------------------------------- +# PF_TRACKSERVICE and PA_TRACKSERVICE determines the tar1090-like web service to render maps for Planefence and Plane-Alert. +# Examples values inlude: +# globe.adsbexchange.com +# my.adsb.radar/tar1090 +# globe.airplanes.live +# et cetera +# If omitted or left empty, globe.adsbexchange.com will be used +# Note -- These URLs will be invoked in the form "https://$PA_TRACKSERVICE/?icao=a00000" +# so only URLs that accept this format can be used +# +# PA_TRACKLIMIT sets the (max) number of unique aircraft shown as a link above the plane-alert table +# Don't make this too large - number greater than 250 will slow down your browser, and numbers greater than 1000 +# will probably make your browser crash. +# If omitted or left empty, the default value is 250. +PF_TRACKSERVICE=globe.adsbexchange.com +PA_TRACKSERVICE=globe.adsbexchange.com +PA_TRACKLIMIT=250