mirror of
https://github.com/sdr-enthusiasts/docker-planefence.git
synced 2025-12-22 11:17:06 +00:00
Merge branch 'main' into dev
This commit is contained in:
@@ -44,6 +44,9 @@ Once you have an account, please do the following:
|
||||

|
||||

|
||||
|
||||
Note -- if you post lots of traffic to Mastodon, please consider adding an Automatic Post Deletion time of 1 week.
|
||||
This will help manage storage costs for the operator of the Mastodon server!
|
||||
|
||||
## Configuring Planefence to use Mastodon
|
||||
|
||||
Please set the following parameters in your `planefence.config` file:
|
||||
@@ -55,6 +58,7 @@ PF_MASTODON=ON
|
||||
PA_MASTODON=ON
|
||||
PA_MASTODON_VISIBILITY=unlisted
|
||||
PF_MASTODON_VISIBILITY=unlisted
|
||||
MASTODON_RETENTION_TIME=7
|
||||
```
|
||||
|
||||
- Replace the values with the applicable server name and access token.
|
||||
|
||||
73
rootfs/scripts/masto_expire.sh
Executable file
73
rootfs/scripts/masto_expire.sh
Executable file
@@ -0,0 +1,73 @@
|
||||
#!/command/with-contenv bash
|
||||
#shellcheck shell=bash disable=SC1091,SC2174
|
||||
# -----------------------------------------------------------------------------------
|
||||
# Copyright 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/
|
||||
#
|
||||
# This package may incorporate other software and license terms.
|
||||
# -----------------------------------------------------------------------------------
|
||||
|
||||
if [[ -f /usr/share/planefence/persist/planefence.config ]]; then source /usr/share/planefence/persist/planefence.config; fi
|
||||
|
||||
ACCESS_TOKEN=$MASTODON_ACCESS_TOKEN
|
||||
INSTANCE_URL="https://$MASTODON_SERVER"
|
||||
|
||||
RETENTION_DAYS="${MASTODON_RETENTION_TIME}"
|
||||
|
||||
delete_toot() {
|
||||
local toot_id="$1"
|
||||
local result
|
||||
if result="$(curl -s --fail -X DELETE -H "Authorization: Bearer $ACCESS_TOKEN" "$INSTANCE_URL/api/v1/statuses/$toot_id" 2>&1)"; then
|
||||
echo "successfully deleted"
|
||||
else
|
||||
echo "error: $result"
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ -z "$RETENTION_DAYS" ]]; then
|
||||
echo "RETENTION_DAYS not set. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
unset toot_dates counter last_id
|
||||
declare -A toot_dates
|
||||
|
||||
now="$(date +%s)"
|
||||
|
||||
masto_id="$(curl -s -H "Authorization: Bearer $ACCESS_TOKEN" "$INSTANCE_URL/api/v1/accounts/verify_credentials" | jq -r '.id')"
|
||||
|
||||
while : ; do
|
||||
echo -n "Indexing Media IDs round $((++counter))"
|
||||
toots="$(curl -s -H "Authorization: Bearer $ACCESS_TOKEN" "$INSTANCE_URL/api/v1/accounts/$masto_id/statuses?limit=40${last_id:+&max_id=}${last_id}")"
|
||||
# shellcheck disable=SC2207
|
||||
toot_ids=($(jq -r '.[] | .id' <<< "$toots" 2>/dev/null))
|
||||
if (( ${#toot_ids[@]} == 0)); then
|
||||
echo "No more toots, we are done!"
|
||||
exit
|
||||
fi
|
||||
last_id="${toot_ids[-1]}"
|
||||
echo " ${#toot_ids[@]} toots"
|
||||
for t in "${toot_ids[@]}"; do
|
||||
if [[ -z "${toot_dates[$t]}" ]]; then
|
||||
toot_dates[$t]="$(date -d "$(jq -r 'map(select(.id == "'"$t"'"))[].created_at' <<< "$toots")" +%s)"
|
||||
echo -n "$t --> $(date -d @"${toot_dates[$t]}") "
|
||||
if (( (now - toot_dates[$t])/(60*60*24) > RETENTION_DAYS )); then
|
||||
echo -n " expired (age: $(( (now - toot_dates[$t])/(60*60*24) )) days): "
|
||||
if [[ "$1" == "delete" ]]; then
|
||||
echo -n "deleting... "
|
||||
delete_toot "$t";
|
||||
else
|
||||
echo "(not deleted)"
|
||||
fi
|
||||
else
|
||||
echo " not expired (age: $(( (now
|
||||
- toot_dates[$t])/(60*60*24) )) days)"
|
||||
fi
|
||||
else
|
||||
echo "$t --> duplicate, we're done!"
|
||||
exit
|
||||
fi
|
||||
done
|
||||
done
|
||||
@@ -149,6 +149,8 @@ set +a
|
||||
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"
|
||||
#
|
||||
|
||||
|
||||
@@ -406,7 +406,7 @@ then
|
||||
do
|
||||
fld="$(echo ${field[$i]}|xargs)"
|
||||
ext="${fld: -3}"
|
||||
if [[ " jpg png peg bmp gif " =~ " $ext " ]] && (( ${#mast_id[@]} < 4 ))
|
||||
if [[ " jpg png peg bmp gif " =~ " $ext " ]] && (( ${#mast_id[@]} < MASTODON_MAXIMGS ))
|
||||
then
|
||||
rm -f "/tmp/planeimg.*"
|
||||
[[ "$ext" == "peg" ]] && ext="jpeg" || true
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
# Feel free to make changes to the variables between these two lines. However, it is
|
||||
# STRONGLY RECOMMENDED to RTFM! See README.md for explanation of what these do.
|
||||
#
|
||||
# shellcheck disable=SC1091
|
||||
[[ -f "/usr/share/planefence/planefence.conf" ]] && source /usr/share/planefence/planefence.conf
|
||||
|
||||
CSVDIR=/usr/share/planefence/html
|
||||
@@ -26,14 +27,14 @@ CSVTMP=/usr/share/planefence/persist/.internal/pf-noise-csv.tmp
|
||||
NOISETMP=/usr/share/planefence/persist/.internal/pf-noise-data.tmp
|
||||
LOGFILE=/tmp/noise2fence.log
|
||||
VERBOSE=
|
||||
VERSION=0.2-docker
|
||||
VERSION=0.3-docker
|
||||
# -----------------------------------------------------------------------------------
|
||||
# Figure out if NOISECAPT is active or not. REMOTENOISE contains the URL of the NoiseCapt container/server
|
||||
# and is configured via the $PF_NOISECAPT variable in the .env file.
|
||||
# Only if REMOTENOISE contains a URL and this URL is reachable, we collect noise data
|
||||
# Note that this doesn't check for the validity of the actual URL, just that we can reach it.
|
||||
#replace wget with curl to save disk space --was [[ "x$REMOTENOISE" != "x" ]] && [[ "$(wget -q -O /dev/null $REMOTENOISE ; echo $?)" == "0" ]] && NOISECAPT=1 || NOISECAPT=0
|
||||
[[ "x$REMOTENOISE" != "x" ]] && [[ "$(curl --fail -s -o /dev/null $REMOTENOISE ; echo $?)" == "0" ]] && NOISECAPT=1 || NOISECAPT=0
|
||||
if [[ -n "$REMOTENOISE" ]] && curl --fail -s -o /dev/null "$REMOTENOISE"; then NOISECAPT=1; else NOISECAPT=0; fi
|
||||
|
||||
if [ "$NOISECAPT" != "1" ]
|
||||
then
|
||||
@@ -63,20 +64,19 @@ CSVFILE=$CSVNAMEBASE$NOISEDATE$CSVNAMEEXT
|
||||
|
||||
|
||||
# replace wget by curl to save disk space. was: if [ "$(wget -q -O - $REMOTENOISE/${LOGNAMEBASE##*/}$NOISEDATE$LOGNAMEEXT > $LOGNAMEBASE$NOISEDATE$LOGNAMEEXT.tmp ; echo $?)" != "0" ]
|
||||
if [ "$(curl --fail -s $REMOTENOISE/${LOGNAMEBASE##*/}$NOISEDATE$LOGNAMEEXT > $LOGNAMEBASE$NOISEDATE$LOGNAMEEXT.tmp ; echo $?)" != "0" ]
|
||||
if ! curl --fail -s "$REMOTENOISE/${LOGNAMEBASE##*/}$NOISEDATE$LOGNAMEEXT" > "$LOGNAMEBASE$NOISEDATE$LOGNAMEEXT.tmp"
|
||||
then
|
||||
echo "Can't reach $REMOTENOISE/${LOGNAMEBASE##*/}$NOISEDATE$LOGNAMEEXT ... exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mv -f $LOGNAMEBASE$NOISEDATE$LOGNAMEEXT.tmp $LOGNAMEBASE$NOISEDATE$LOGNAMEEXT
|
||||
mv -f "$LOGNAMEBASE$NOISEDATE$LOGNAMEEXT.tmp" "$LOGNAMEBASE$NOISEDATE$LOGNAMEEXT"
|
||||
LOG "Got $LOGNAMEBASE$NOISEDATE$LOGNAMEEXT from $REMOTELOG"
|
||||
|
||||
NOISEFILE=$LOGNAMEBASE$NOISEDATE$LOGNAMEEXT
|
||||
NOISEFILE="$LOGNAMEBASE$NOISEDATE$LOGNAMEEXT"
|
||||
|
||||
# make sure there's no stray TMP file around, so we can directly append
|
||||
[ -f "$CSVTMP" ] && rm "$CSVTMP"
|
||||
[ -f "$NOISETMP" ] && rm "$NOISETMP"
|
||||
rm -f "$CSVTMP" "$NOISETMP"
|
||||
|
||||
#Now iterate through the CSVFILE:
|
||||
LOG "------------------------------"
|
||||
@@ -88,13 +88,13 @@ then
|
||||
# Clean the $CSVFILE first
|
||||
# cat "$CSVFILE" | tr -d '\r' >/tmp/noisetmp.tmp
|
||||
# mv /tmp/noisetmp.tmp "$CSVFILE"
|
||||
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 -ra RECORD <<< "$CSVLINE"
|
||||
LOG "${#RECORD[*]} records in the current line: (${RECORD[*]})"
|
||||
# if there's no audio stored in the record
|
||||
if [ "${#RECORD[*]}" -le "7" ]
|
||||
@@ -115,7 +115,7 @@ then
|
||||
(( NUMPOS=NUMPOS+1 ))
|
||||
LOG "Start Position: $STARTPOS, Number of samples: $NUMPOS"
|
||||
# Then put the corresponding noisecapt records into $NOISETMP.
|
||||
tail --lines=+"$STARTPOS" $NOISEFILE | head --lines="$NUMPOS" > $NOISETMP
|
||||
tail --lines=+"$STARTPOS" "$NOISEFILE" | head --lines="$NUMPOS" > $NOISETMP
|
||||
#RECORD[6]="${RECORD[6]//[$'\t\r\n']}"
|
||||
# Next is to figure out the data that we want to add to the PLANEFENCE record.
|
||||
# $NOISEFILE and $NOISECAPT have the following format, with all audio values in dBFS:
|
||||
@@ -133,12 +133,7 @@ then
|
||||
fi
|
||||
# Now write everything back to $CSVTMP, which we will then copy back over the old CSV file
|
||||
( IFS=','; echo "${RECORD[*]}" >> "$CSVTMP" )
|
||||
LOG "The record now contains $(IFS=','; echo ${RECORD[*]})"
|
||||
#for i in {0..10}
|
||||
#do
|
||||
# printf "%s," "${RECORD[i]}" >> "$CSVTMP"
|
||||
#done
|
||||
# printf "%s\n" "${RECORD[11]}" >> "$CSVTMP"
|
||||
LOG "The record now contains ${RECORD[*]}"
|
||||
done < "$CSVFILE"
|
||||
|
||||
# Now, if there is a $CSVTMP file, we will overwrite $CSVFILE with it.
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#shellcheck disable=SC2015,SC1091,SC2129
|
||||
#
|
||||
# PLANEFENCE - a Bash shell script to render a HTML and CSV table with nearby aircraft
|
||||
# based on socket30003
|
||||
#
|
||||
# Usage: ./planefence.sh
|
||||
#
|
||||
@@ -31,7 +30,7 @@
|
||||
# Only change the variables below if you know what you are doing.
|
||||
|
||||
# all errors will show a line number and the command used to produce the error
|
||||
trap 'echo -e "[ERROR] $(basename $0) in line $LINENO when executing: $BASH_COMMAND"' ERR
|
||||
source /scripts/common
|
||||
|
||||
# We need to define the directory where the config file is located:
|
||||
|
||||
@@ -74,8 +73,7 @@ fi
|
||||
# first get DISTANCE unit:
|
||||
DISTUNIT="mi"
|
||||
#DISTCONV=1
|
||||
if [ "$SOCKETCONFIG" != "" ]
|
||||
then
|
||||
if [[ -f "$SOCKETCONFIG" ]]; then
|
||||
case "$(grep "^distanceunit=" "$SOCKETCONFIG" |sed "s/distanceunit=//g")" in
|
||||
nauticalmile)
|
||||
DISTUNIT="nm"
|
||||
@@ -93,8 +91,7 @@ fi
|
||||
|
||||
# get ALTITUDE unit:
|
||||
ALTUNIT="ft"
|
||||
if [ "$SOCKETCONFIG" != "" ]
|
||||
then
|
||||
if [[ -f "$SOCKETCONFIG" ]]; then
|
||||
case "$(grep "^altitudeunit=" "$SOCKETCONFIG" |sed "s/altitudeunit=//g")" in
|
||||
feet)
|
||||
ALTUNIT="ft"
|
||||
@@ -110,8 +107,7 @@ fi
|
||||
# replace wget by curl to save memory space. Was: [[ "x$REMOTENOISE" != "x" ]] && [[ "$(wget -q -O /tmp/noisecapt-$FENCEDATE.log $REMOTENOISE/noisecapt-$FENCEDATE.log ; echo $?)" == "0" ]] && NOISECAPT=1 || NOISECAPT=0
|
||||
if [[ "x$REMOTENOISE" != "x" ]]
|
||||
then
|
||||
if [[ "$(curl --fail -s "$REMOTENOISE"/noisecapt-"$FENCEDATE".log > /tmp/noisecapt-"$FENCEDATE".log; echo $?)" == "0" ]]
|
||||
then
|
||||
if curl --fail -s "$REMOTENOISE/noisecapt-$FENCEDATE.log" > "/tmp/noisecapt-$FENCEDATE.log"; then
|
||||
NOISECAPT=1
|
||||
else
|
||||
NOISECAPT=0
|
||||
@@ -243,22 +239,26 @@ EOF
|
||||
<th class="js-sort-number">5 min avg</th>
|
||||
<th class="js-sort-number">10 min avg</th>
|
||||
<th class="js-sort-number">1 hr avg</th>
|
||||
<th>Spectrogram</th>
|
||||
EOF
|
||||
# If there are spectrograms for today, then also make a column for these:
|
||||
# shellcheck disable=SC2012
|
||||
if (( $(ls -1 "$OUTFILEDIR/noisecapt-spectro-$FENCEDATE*.png" 2>/dev/null |wc -l) > 0 ))
|
||||
then
|
||||
printf "<th>Spectrogram</th>\n" >> "$2"
|
||||
SPECTROPRINT="true"
|
||||
else
|
||||
SPECTROPRINT="false"
|
||||
fi
|
||||
# # If there are spectrograms for today, then also make a column for these:
|
||||
# if compgen -G "$OUTFILEDIR/noisecapt-spectro-$FENCEDATE*.png" >/dev/null; then
|
||||
# printf " <th>Spectrogram</th>\n" >&3
|
||||
# SPECTROPRINT="true"
|
||||
# else
|
||||
# SPECTROPRINT="false"
|
||||
# fi
|
||||
# ^^^ this doesn't really work - there won't be any spectrograms at the beginning of the day, and
|
||||
# it will never create any, because SPECTROPRINT stays FALSE forever.
|
||||
# Instead, we'll set SPECTROPRINT=true always when HASNOISE=true. This may cause an empty column, but that's
|
||||
# preferred over not printing any spectrograms.
|
||||
SPECTROPRINT="true"
|
||||
fi
|
||||
|
||||
if [[ "$HASTWEET" == "true" ]]
|
||||
then
|
||||
# print a header for the Tweeted column
|
||||
printf " <th>Notified</th>\n" >> "$2"
|
||||
printf " <th>Notified</th>\n" >&3
|
||||
fi
|
||||
printf "</tr>\n" >&3
|
||||
|
||||
@@ -283,12 +283,11 @@ EOF
|
||||
# do this for the whole INPUT at once, doing it for every line is slow (subshell, sed initialization)
|
||||
# Step 1/5. Replace the map zoom by whatever $HEATMAPZOOM contains
|
||||
# shellcheck disable=SC2001
|
||||
[[ -n "$HEATMAPZOOM" ]] && INPUT=$(sed 's|\(^.*&zoom=\)[0-9]*\(.*\)|\1'"$HEATMAPZOOM"'\2|' <<< "$INPUT")
|
||||
[[ -n "$HEATMAPZOOM" ]] && INPUT=$(sed 's|\(^.*&zoom=\)[0-9]*\(.*\)|\1'"$HEATMAPZOOM"'\2|' <<< "$INPUT") || true
|
||||
|
||||
# Now write the table
|
||||
COUNTER=1
|
||||
while read -r NEWLINE
|
||||
do
|
||||
while read -r NEWLINE; do
|
||||
[[ "$NEWLINE" == "" ]] && continue # skip empty lines
|
||||
[[ "${NEWLINE::1}" == "#" ]] && continue #skip lines that start with a "#"
|
||||
|
||||
@@ -296,35 +295,32 @@ EOF
|
||||
|
||||
# Do some prep work:
|
||||
# --------------------------------------------------------------
|
||||
# Step 1/5. Replace the map zoom by whatever $HEATMAPZOOM contains
|
||||
# Step 1/6. Replace the map zoom by whatever $HEATMAPZOOM contains
|
||||
# this used to not work (-z instead of -n), to speed it up now, do it on the whole INPUT at once instead per line
|
||||
|
||||
# Step 2/5. If there is no flight number, insert the word "link"
|
||||
# Step 2/6. If there is no flight number, insert the word "link"
|
||||
[[ "${NEWVALUES[1]#@}" == "" ]] && NEWVALUES[1]+="link"
|
||||
|
||||
# Step 3/5. If there's noise data, get a background color:
|
||||
# Step 3/6. If there's noise data, get a background color:
|
||||
# (only when we are printing noise data, and there's actual data in this record)
|
||||
LOUDNESS=""
|
||||
if [[ "$HASNOISE" == "true" ]] && [[ "${NEWVALUES[9]}" != "" ]]
|
||||
then
|
||||
if [[ "$HASNOISE" == "true" ]] && [[ "${NEWVALUES[9]}" != "" ]]; then
|
||||
(( LOUDNESS = NEWVALUES[7] - NEWVALUES[11] ))
|
||||
BGCOLOR="$RED"
|
||||
(( LOUDNESS <= YELLOWLIMIT )) && BGCOLOR="$YELLOW"
|
||||
(( LOUDNESS <= GREENLIMIT )) && BGCOLOR="$GREEN"
|
||||
fi
|
||||
|
||||
# Step 4/5. Get a noise graph
|
||||
# Step 4/6. Get a noise graph
|
||||
# (only when we are printing noise data, and there's actual data in this record)
|
||||
if [[ "$HASNOISE" == "true" ]] && [[ "${NEWVALUES[7]}" != "" ]]
|
||||
then
|
||||
if [[ "$HASNOISE" == "true" ]] && [[ "${NEWVALUES[7]}" != "" ]]; then
|
||||
# First, the noise graph:
|
||||
# $NOISEGRAPHFILE is the full file path, NOISEGRAPHLINK is the subset with the filename only
|
||||
NOISEGRAPHFILE="$OUTFILEDIR"/"noisegraph-$(date -d "${NEWVALUES[2]}" +"%y%m%d-%H%M%S")-${NEWVALUES[0]}.png"
|
||||
NOISEGRAPHLINK=${NOISEGRAPHFILE##*/}
|
||||
|
||||
# If no graph already exists, create one:
|
||||
if [[ ! -f "$NOISEGRAPHFILE" ]]
|
||||
then
|
||||
if [[ ! -f "$NOISEGRAPHFILE" ]]; then
|
||||
# set some parameters for the graph:
|
||||
TITLE="Noise plot for ${NEWVALUES[1]#@} at ${NEWVALUES[3]}"
|
||||
STARTTIME=$(date -d "${NEWVALUES[2]}" +%s)
|
||||
@@ -333,30 +329,61 @@ EOF
|
||||
(( ENDTIME - STARTTIME < 30 )) && ENDTIME=$(( STARTTIME + 15 )) && STARTTIME=$(( STARTTIME - 15))
|
||||
NOWTIME=$(date +%s)
|
||||
# check if there are any noise samples
|
||||
if (( (NOWTIME - ENDTIME) > (ENDTIME - STARTTIME) )) && [[ -f "/usr/share/planefence/persist/.internal/noisecapt-$FENCEDATE.log" ]] && [[ "$(awk -v s="$STARTTIME" -v e=$$ENDTIME '$1>=s && $1<=e' /usr/share/planefence/persist/.internal/noisecapt-"$FENCEDATE".log | wc -l)" -gt "0" ]]
|
||||
then
|
||||
if (( (NOWTIME - ENDTIME) > (ENDTIME - STARTTIME) )) && [[ -f "/usr/share/planefence/persist/.internal/noisecapt-$FENCEDATE.log" ]] && [[ "$(awk -v s="$STARTTIME" -v e="$ENDTIME" '$1>=s && $1<=e' /usr/share/planefence/persist/.internal/noisecapt-"$FENCEDATE".log | wc -l)" -gt "0" ]]; then
|
||||
#echo debug gnuplot start=$STARTTIME end=$ENDTIME infile=/usr/share/planefence/persist/.internal/noisecapt-$FENCEDATE.log outfile=$NOISEGRAPHFILE
|
||||
gnuplot -e "offset=$(echo "$(date +%z) * 36" | bc); start=$STARTTIME; end=$ENDTIME; infile='/usr/share/planefence/persist/.internal/noisecapt-$FENCEDATE.log'; outfile='$NOISEGRAPHFILE'; plottitle='$TITLE'; margin=60" $PLANEFENCEDIR/noiseplot.gnuplot
|
||||
gnuplot -e "offset=$(echo "$(date +%z) * 36" | sed 's/+[0]\?//g' | bc); start=$STARTTIME; end=$ENDTIME; infile='/usr/share/planefence/persist/.internal/noisecapt-$FENCEDATE.log'; outfile='$NOISEGRAPHFILE'; plottitle='$TITLE'; margin=60" $PLANEFENCEDIR/noiseplot.gnuplot
|
||||
else
|
||||
NOISEGRAPHLINK=""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Step 5/5. Get a spectrogram
|
||||
# Step 5/6. Get a spectrogram
|
||||
# (only when we are printing noise data, and there's actual data in this record)
|
||||
if [[ "$HASNOISE" == "true" ]] && [[ "${NEWVALUES[7]}" != "" ]]
|
||||
then
|
||||
if [[ "$HASNOISE" == "true" ]] && [[ "${NEWVALUES[7]}" != "" ]]; then
|
||||
STARTTIME=$(date +%s -d "${NEWVALUES[2]}")
|
||||
ENDTIME=$(date +%s -d "${NEWVALUES[3]}")
|
||||
(( ENDTIME - STARTTIME < 30 )) && ENDTIME=$(( STARTTIME + 30 ))
|
||||
[[ -f "/usr/share/planefence/persist/.internal/noisecapt-$FENCEDATE.log" ]] && SPECTROFILE=noisecapt-spectro-$(date -d @"$(awk -F, -v a="$STARTTIME" -v b="$ENDTIME" 'BEGIN{c=-999; d=0}{if ($1>=0+a && $1<=1+b && $2>0+c) {c=$2; d=$1}} END{print d}' /usr/share/planefence/persist/.internal/noisecapt-"$FENCEDATE".log)" +%y%m%d-%H%M%S).png || SPECTROFILE=""
|
||||
# if it has a weird date, discard it because it wont exist.
|
||||
# otherwise, go get it from the remote server:
|
||||
# debug code: echo $REMOTENOISE/$SPECTROFILE to $OUTFILEDIR/$SPECTROFILE
|
||||
[[ "$SPECTROFILE" == "noisecapt-spectro-691231-190000.png" ]] && SPECTROFILE="" || curl --fail -s "$REMOTENOISE/$SPECTROFILE" > "$OUTFILEDIR/$SPECTROFILE"
|
||||
else
|
||||
SPECTROFILE=""
|
||||
|
||||
# get the measurement from noisecapt-"$FENCEDATE".log that contains the peak value
|
||||
# limited by $STARTTIME and $ENDTIME, and then get the corresponding spectrogram file name
|
||||
spectrotime="$(awk -F, -v a="$STARTTIME" -v b="$ENDTIME" 'BEGIN{c=-999; d=0}{if ($1>=0+a && $1<=1+b && $2>0+c) {c=$2; d=$1}} END{print d}' /usr/share/planefence/persist/.internal/noisecapt-"$FENCEDATE".log)"
|
||||
sf="noisecapt-spectro-$(date -d "@${spectrotime}" +"%y%m%d-%H%M%S").png"
|
||||
|
||||
if [[ ! -s "$OUTFILEDIR/$sf" ]]; then
|
||||
# we don't have $sf locally, or if it's an empty file, we get it:
|
||||
curl -sL "$REMOTENOISE/$sf" > "$OUTFILEDIR/$sf"
|
||||
fi
|
||||
# shellcheck disable=SC2012
|
||||
if [[ ! -s "$OUTFILEDIR/$sf" ]] || (( $(ls -s1 "$OUTFILEDIR/$sf" | awk '{print $1}') < 10 )); then
|
||||
# we don't have $sf (or it's an empty file) and we can't get it; so let's erase it in case it's an empty file:
|
||||
rm -f "$OUTFILEDIR/$sf"
|
||||
sf=""
|
||||
fi
|
||||
fi
|
||||
|
||||
# Step 6/6. Get a MP3 file
|
||||
# (only when we are printing noise data, and there's actual data in this record)
|
||||
if [[ "$HASNOISE" == "true" ]] && [[ "${NEWVALUES[7]}" != "" ]]; then
|
||||
STARTTIME=$(date +%s -d "${NEWVALUES[2]}")
|
||||
ENDTIME=$(date +%s -d "${NEWVALUES[3]}")
|
||||
(( ENDTIME - STARTTIME < 30 )) && ENDTIME=$(( STARTTIME + 30 ))
|
||||
|
||||
# get the measurement from noisecapt-"$FENCEDATE".log that contains the peak value
|
||||
# limited by $STARTTIME and $ENDTIME, and then get the corresponding spectrogram file name
|
||||
mp3time="$(awk -F, -v a="$STARTTIME" -v b="$ENDTIME" 'BEGIN{c=-999; d=0}{if ($1>=0+a && $1<=1+b && $2>0+c) {c=$2; d=$1}} END{print d}' /usr/share/planefence/persist/.internal/noisecapt-"$FENCEDATE".log)"
|
||||
mp3f="noisecapt-recording-$(date -d "@${mp3time}" +"%y%m%d-%H%M%S").mp3"
|
||||
|
||||
if [[ ! -s "$OUTFILEDIR/$mp3f" ]]; then
|
||||
# we don't have $sf locally, or if it's an empty file, we get it:
|
||||
curl -sL "$REMOTENOISE/$mp3f" > "$OUTFILEDIR/$mp3f"
|
||||
fi
|
||||
# shellcheck disable=SC2012
|
||||
if [[ ! -s "$OUTFILEDIR/$mp3f" ]] || (( $(ls -s1 "$OUTFILEDIR/$mp3f" | awk '{print $1}') < 4 )); then
|
||||
# we don't have $mp3f (or it's an empty file) and we can't get it; so let's erase it in case it's an empty file:
|
||||
rm -f "$OUTFILEDIR/$mp3f"
|
||||
mp3f=""
|
||||
fi
|
||||
fi
|
||||
|
||||
# --------------------------------------------------------------
|
||||
@@ -370,8 +397,7 @@ EOF
|
||||
# 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 " <td><a href=\"%s\" target=\"_blank\">%s</a></td>\n" "${NEWVALUES[6]//globe.adsbexchange.com/"$TRACKSERVICE"}" "${NEWVALUES[0]}" >&3 # ICAO
|
||||
printf " <td><a href=\"%s\" target=\"_blank\">%s</a></td>\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 [[ "$AIRLINECODES" != "" ]]; then
|
||||
if [[ "${CALLSIGN}" != "" ]] && [[ "${CALLSIGN}" != "link" ]]; then
|
||||
|
||||
# look up callsign in associative array to get the airline name
|
||||
@@ -388,15 +414,13 @@ EOF
|
||||
fi
|
||||
|
||||
# update associative array to be written to disk
|
||||
if [[ -z ${AIRLINENAME} ]]
|
||||
then
|
||||
if [[ -z ${AIRLINENAME} ]]; then
|
||||
NEWNAMES[${CALLSIGN}]="UNKNOWN"
|
||||
else
|
||||
NEWNAMES[${CALLSIGN}]="${AIRLINENAME}"
|
||||
fi
|
||||
|
||||
if [[ $CALLSIGN =~ ^N[0-9][0-9a-zA-Z]+$ ]] && [[ "${CALLSIGN:0:4}" != "NATO" ]] && [[ "${NEWVALUES[0]:0:1}" == "A" ]]
|
||||
then
|
||||
if [[ $CALLSIGN =~ ^N[0-9][0-9a-zA-Z]+$ ]] && [[ "${CALLSIGN:0:4}" != "NATO" ]] && [[ "${NEWVALUES[0]:0:1}" == "A" ]]; then
|
||||
printf " <td><a href=\"https://registry.faa.gov/AircraftInquiry/Search/NNumberResult?nNumberTxt=%s\" target=\"_blank\">%s</a></td>\n" "${CALLSIGN}" "${AIRLINENAME}" >&3
|
||||
else
|
||||
printf " <td>%s</td>\n" "${AIRLINENAME}" >&3 || printf " <td></td>\n" >&3
|
||||
@@ -411,13 +435,10 @@ EOF
|
||||
printf " <td>%s %s</td>\n" "${NEWVALUES[5]}" "$DISTUNIT" >&3 # min distance
|
||||
|
||||
# Print the noise values if we have determined that there is data
|
||||
if [[ "$HASNOISE" == "true" ]]
|
||||
then
|
||||
if [[ "$HASNOISE" == "true" ]]; then
|
||||
# First the loudness field, which needs a color and a link to a noise graph:
|
||||
if [[ "$LOUDNESS" != "" ]]
|
||||
then
|
||||
if [[ "$NOISEGRAPHLINK" != "" ]]
|
||||
then
|
||||
if [[ -n "$LOUDNESS" ]]; then
|
||||
if [[ -n "$NOISEGRAPHLINK" ]]; then
|
||||
printf " <td style=\"background-color: %s\"><a href=\"%s\" target=\"_blank\">%s dB</a></td>\n" "$BGCOLOR" "$NOISEGRAPHLINK" "$LOUDNESS" >&3
|
||||
else
|
||||
printf " <td style=\"background-color: %s\">%s dB</td>\n" "$BGCOLOR" "$LOUDNESS" >&3
|
||||
@@ -426,10 +447,18 @@ EOF
|
||||
printf " <td></td>\n" >&3 # print an empty field
|
||||
fi
|
||||
|
||||
for i in {7..11}
|
||||
do
|
||||
if [[ "${NEWVALUES[i]}" != "" ]]
|
||||
then
|
||||
if [[ "${NEWVALUES[7]}" != "" ]]; then
|
||||
if [[ -n "$mp3f" ]] && [[ -f "$OUTFILEDIR/$mp3f" ]]; then
|
||||
printf " <td><a href=\"%s\" target=\"_blank\">%s dBFS</td>\n" "$mp3f" "${NEWVALUES[7]}" >&3 # print actual value with "dBFS" unit
|
||||
else
|
||||
printf " <td>%s dBFS</td>\n" "${NEWVALUES[7]}" >&3 # print actual value with "dBFS" unit
|
||||
fi
|
||||
else
|
||||
printf " <td></td>\n" >&3 # print an empty field
|
||||
fi
|
||||
|
||||
for i in {8..11}; do
|
||||
if [[ "${NEWVALUES[i]}" != "" ]]; then
|
||||
printf " <td>%s dBFS</td>\n" "${NEWVALUES[i]}" >&3 # print actual value with "dBFS" unit
|
||||
else
|
||||
printf " <td></td>\n" >&3 # print an empty field
|
||||
@@ -437,11 +466,9 @@ EOF
|
||||
done
|
||||
|
||||
# print SpectroFile:
|
||||
if [[ "$SPECTROPRINT" == "true" ]]
|
||||
then
|
||||
if [[ -f "$OUTFILEDIR/$SPECTROFILE" ]]
|
||||
then
|
||||
printf " <td><a href=\"%s\" target=\"_blank\">Spectrogram</a></td>\n" "$SPECTROFILE" >&3
|
||||
if [[ "$SPECTROPRINT" == "true" ]]; then
|
||||
if [[ -n "$sf" ]] && [[ -f "$OUTFILEDIR/$sf" ]]; then
|
||||
printf " <td><a href=\"%s\" target=\"_blank\">Spectrogram</a></td>\n" "$sf" >&3
|
||||
else
|
||||
printf " <td></td>\n" >&3
|
||||
fi
|
||||
@@ -449,16 +476,12 @@ EOF
|
||||
fi
|
||||
|
||||
# If there is a tweet value, then provide info and link as available
|
||||
if [[ "$HASTWEET" == "true" ]]
|
||||
then
|
||||
if [[ "$HASTWEET" == "true" ]]; then
|
||||
# Was there a tweet?
|
||||
if [[ "${NEWVALUES[1]::1}" == "@" ]]
|
||||
then
|
||||
if [[ "${NEWVALUES[1]::1}" == "@" ]]; then
|
||||
# Print "yes" and add a link if available
|
||||
if [[ "${NEWVALUES[-1]::13}" == "https://t.co/" ]]
|
||||
then
|
||||
# shellcheck disable=SC2021
|
||||
printf " <td><a href=\"%s\" target=\"_blank\">tweet</a></td>\n" "$(tr -dc '[[:print:]]' <<< "${NEWVALUES[-1]}")" >&3
|
||||
if [[ "${NEWVALUES[-1]::13}" == "https://t.co/" ]]; then
|
||||
printf " <td><a href=\"%s\" target=\"_blank\">tweet</a></td>\n" "$(tr -dc '[:print:]' <<< "${NEWVALUES[-1]}")" >&3
|
||||
else
|
||||
printf " <td>discord</td>\n" >&3
|
||||
fi
|
||||
@@ -512,7 +535,7 @@ EOF
|
||||
{ printf " | %s" "$(date -d "$d" +%d-%b-%Y): "
|
||||
printf "<a href=\"%s\" target=\"_top\">html</a> - " "planefence-$(date -d "$d" +"%y%m%d").html"
|
||||
printf "<a href=\"%s\" target=\"_top\">csv</a>" "planefence-$(date -d "$d" +"%y%m%d").csv"
|
||||
} >> "$2"
|
||||
} >> "$2"
|
||||
done
|
||||
{ printf "</p>\n"
|
||||
printf "<p>Additional dates may be available by browsing to planefence-yymmdd.html in this directory.</p>"
|
||||
@@ -520,8 +543,7 @@ EOF
|
||||
} >> "$2"
|
||||
|
||||
# and print the footer:
|
||||
if [ "$3" == "standalone" ]
|
||||
then
|
||||
if [[ "$3" == "standalone" ]]; then
|
||||
printf "</body>\n</html>\n" >>"$2"
|
||||
fi
|
||||
}
|
||||
@@ -602,7 +624,7 @@ fi
|
||||
|
||||
# if the PRUNESTARTFILE file doesn't exist
|
||||
# note down that we started up, write down 0 for the next prune as nothing will be older than PRUNEMINS
|
||||
if ! [ -f "$PRUNESTARTFILE" ] || [[ "$LASTFENCEDATE" != "$FENCEDATE" ]]; then
|
||||
if [[ ! -f "$PRUNESTARTFILE" ]] || [[ "$LASTFENCEDATE" != "$FENCEDATE" ]]; then
|
||||
echo 0 > $PRUNESTARTFILE
|
||||
# if PRUNESTARTFILE is older than PRUNEMINS, do the pruning
|
||||
elif [[ $(find $PRUNESTARTFILE -mmin +$PRUNEMINS | wc -l) == 1 ]]; then
|
||||
@@ -654,7 +676,7 @@ tail --lines=+"$READLINES" "$SOCKETFILE" > "$INFILETMP"
|
||||
|
||||
# First, run planefence.py to create the CSV file:
|
||||
LOG "Invoking planefence.py..."
|
||||
$PLANEFENCEDIR/planefence.py --logfile="$INFILETMP" --outfile="$OUTFILETMP" --maxalt="$MAXALT" --altcorr="$ALTCORR" --dist="$DIST" --distunit=$DISTUNIT --lat="$LAT" --lon="$LON" "$VERBOSE" "$CALCDIST" --trackservice="$TRACKSERVICE" | LOG
|
||||
$PLANEFENCEDIR/planefence.py --logfile="$INFILETMP" --outfile="$OUTFILETMP" --maxalt="$MAXALT" --altcorr="$ALTCORR" --dist="$DIST" --distunit="$DISTUNIT" --lat="$LAT" --lon="$LON" "$VERBOSE" "$CALCDIST" --trackservice="$TRACKSERVICE" | LOG
|
||||
LOG "Returned from planefence.py..."
|
||||
|
||||
# Now we need to combine any double entries. This happens when a plane was in range during two consecutive Planefence runs
|
||||
@@ -766,75 +788,7 @@ then
|
||||
|
||||
fi
|
||||
|
||||
# Now see is IGNORETIME is set. If so, we need to filter duplicates
|
||||
# We will do it all in memory - load OUTFILECSV into an array, process the array, and write back to disk:
|
||||
#if [[ -f "$OUTFILECSV" ]] && [[ "$IGNORETIME" -gt 0 ]]
|
||||
#then
|
||||
#
|
||||
# # read the entire OUTFILECSV into memory: line by line into 'l[]'
|
||||
# unset l
|
||||
# i=0
|
||||
# while IFS= read -r l[i]
|
||||
# do
|
||||
# (( i++ ))
|
||||
# done < "$OUTFILECSV"
|
||||
#
|
||||
# # if the file was empty, stop processing
|
||||
#
|
||||
# # $l[] contains all the OUTFILECSV lines. $i contains the total line count
|
||||
# # Loop through them in reverse order - skip the top one as the 1st entry is always unique
|
||||
# # Note - if the file is empty or has only 1 element, then the initial value of j (=i-1) = -1 or 0 and the
|
||||
# # loop will be skipped. This is intentional behavior.
|
||||
#
|
||||
# for (( j=i-1; j>0; j-- ))
|
||||
# do
|
||||
# unset r
|
||||
# IFS=, read -ra r <<< "${l[j]}"
|
||||
# # $l now contains the entire line, $r contains the line in records. Start time is in r[2]. End time is in r[3]
|
||||
# # We now need to filter out any that are too close in time
|
||||
# echo r: ${r[@]}
|
||||
# echo rst: date -d "${r[2]}" +%s
|
||||
# rst=$(date -d "${r[2]}" +%s) # get the record's start time in seconds (rst= r start time)
|
||||
# icao="${r[0]}" # get the record's icao address
|
||||
# for (( k=j-1; k>=0; k-- ))
|
||||
# do
|
||||
# # if the line is empty, continue, else read in the line
|
||||
# [[ -z "${l[k]}" ]] && continue
|
||||
# unset s
|
||||
# IFS=, read -ra s <<< "${l[k]}"
|
||||
#
|
||||
# # skip/continue if ICAO don't match
|
||||
# [[ "${s[0]}" != "$icao" ]] && continue
|
||||
#
|
||||
# # stop processing this loop if the time diff is larger
|
||||
# tet=$(date -d "${s[3]}" +%s) # (tet= test's end time. Didn't want to use 'set')
|
||||
# echo tet: date -d "${s[3]}" +%s
|
||||
# (( rst - tet > IGNORETIME )) && break
|
||||
#
|
||||
# # If we're still here, then the ICAO's match and the time is within the IGNORETIME boundaries.
|
||||
# # So we take action and empty out the entire string
|
||||
# l[k]=""
|
||||
# done
|
||||
# done
|
||||
#
|
||||
# # Now, the array in memory contains the records, with empty lines for the dupes
|
||||
# # Write back all lines except for the empty ones:
|
||||
# rm -f /tmp/pf-out.tmp
|
||||
# for ((a=0; a<i; a++))
|
||||
# do
|
||||
# [[ -z "${l[a]}" ]] && echo "${l[a]}" >> /tmp/pf-out.tmp
|
||||
# done
|
||||
# # mv /tmp/pf-out.tmp "$OUTFILECSV"
|
||||
# mv -f /tmp/pf-out.tmp /usr/share/planefence/persist
|
||||
#
|
||||
# # clean up some memory
|
||||
# unset l r s i j k a rst tet icao
|
||||
#
|
||||
#fi
|
||||
|
||||
#----end implementation of ignore list---#
|
||||
# And see if we need to invoke PlaneTweet:
|
||||
|
||||
# see if we need to invoke PlaneTweet:
|
||||
[[ "$BASETIME" != "" ]] && echo "7. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- done applying filters, invoking PlaneTweet" || true
|
||||
|
||||
if [[ -n "$PLANETWEET" || "${PF_DISCORD,,}" == "true" || "${PF_DISCORD,,}" == "on" || -n "$MASTODON_SERVER" ]] && [[ -z "$1" ]]
|
||||
@@ -869,14 +823,14 @@ then
|
||||
# also create a noisegraph for the full day:
|
||||
[[ "$BASETIME" != "" ]] && echo "9b. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- creating day-long Noise Graph" || true
|
||||
rm -f /tmp/noiselog 2>/dev/null
|
||||
[[ -f "/usr/share/planefence/persist/.internal/noisecapt-$(date -d yesterday +%y%m%d).log" ]] && cp -f "/usr/share/planefence/persist/.internal/noisecapt-$(date -d "yesterday" +%y%m%d).log" /tmp/noiselog
|
||||
[[ -f "/usr/share/planefence/persist/.internal/noisecapt-$(date -d today +%y%m%d).log" ]] && cat "/usr/share/planefence/persist/.internal/noisecapt-$(date -d "today" +%y%m%d).log" >> /tmp/noiselog
|
||||
gnuplot -e "offset=$(echo "$(date +%z) * 36" | bc); start=$(date -d yesterday +%s); end=$(date +%s); infile='/tmp/noiselog'; outfile='/usr/share/planefence/html/noiseplot-latest.jpg'; plottitle='Noise Plot over Last 24 Hours (End date = $(date +%Y-%m-%d))'; margin=60" $PLANEFENCEDIR/noiseplot.gnuplot
|
||||
[[ -f "/usr/share/planefence/persist/.internal/noisecapt-$(date -d "yesterday" +%y%m%d).log" ]] && cp -f "/usr/share/planefence/persist/.internal/noisecapt-$(date -d "yesterday" +%y%m%d).log" /tmp/noiselog
|
||||
[[ -f "/usr/share/planefence/persist/.internal/noisecapt-$(date -d "today" +%y%m%d).log" ]] && cat "/usr/share/planefence/persist/.internal/noisecapt-$(date -d "today" +%y%m%d).log" >> /tmp/noiselog
|
||||
gnuplot -e "offset=$(echo "$(date +%z) * 36" | sed 's/+[0]\?//g' | bc); start=$(date -d "yesterday" +%s); end=$(date +%s); infile='/tmp/noiselog'; outfile='/usr/share/planefence/html/noiseplot-latest.jpg'; plottitle='Noise Plot over Last 24 Hours (End date = $(date +%Y-%m-%d))'; margin=60" $PLANEFENCEDIR/noiseplot.gnuplot
|
||||
rm -f /tmp/noiselog 2>/dev/null
|
||||
|
||||
elif (( $(find "$TMPDIR"/noisecapt-spectro*.png -daystart -maxdepth 1 -mmin -1440 -print 2>/dev/null | wc -l ) > 0 ))
|
||||
then
|
||||
ln -sf "$(find "$TMPDIR"/noisecapt-spectro*.png -daystart -maxdepth 1 -mmin -1440 -print 2>/dev/null | tail -1)" "$OUTFILEDIR/noisecapt-spectro-latest.png"
|
||||
ln -sf "$(find "$TMPDIR"/noisecapt-spectro*.png -daystart -maxdepth 1 -mmin -1440 -print 2>/dev/null | tail -1)" "$OUTFILEDIR"/noisecapt-spectro-latest.png
|
||||
else
|
||||
rm -f "$OUTFILEDIR"/noisecapt-spectro-latest.png 2>/dev/null
|
||||
fi
|
||||
@@ -937,8 +891,7 @@ gtag('config', 'UA-171737107-1');
|
||||
<script type="text/javascript" src="sort-table.js"></script>
|
||||
EOF
|
||||
|
||||
if [[ "${AUTOREFRESH,,}" == "true" ]]
|
||||
then
|
||||
if [[ "${AUTOREFRESH,,}" == "true" ]]; then
|
||||
REFRESH_INT="$(sed -n 's/\(^\s*PF_INTERVAL=\)\(.*\)/\2/p' /usr/share/planefence/persist/planefence.config)"
|
||||
cat <<EOF >>"$OUTFILEHTMTMP"
|
||||
<meta http-equiv="refresh" content="$REFRESH_INT">
|
||||
@@ -991,17 +944,15 @@ ${PF_MOTD}
|
||||
<details open>
|
||||
<summary style="font-weight: 900; font: 14px/1.4 'Helvetica Neue', Arial, sans-serif;">Executive Summary</summary>
|
||||
<ul>
|
||||
<li>Last update: $(date +"%b %d, %Y %R:%S %Z")
|
||||
<li>Maximum distance from <a href="https://www.openstreetmap.org/?mlat=$LAT_VIS&mlon=$LON_VIS#map=14/$LAT_VIS/$LON_VIS&layers=H" target=_blank>${LAT_VIS}°N, ${LON_VIS}°E</a>: $DIST $DISTUNIT
|
||||
|
||||
<li>Only aircraft below $(printf "%'.0d" "$MAXALT") $ALTUNIT are reported
|
||||
<li>Data extracted from $(printf "%'.0d" $TOTALLINES) <a href="https://en.wikipedia.org/wiki/Automatic_dependent_surveillance_%E2%80%93_broadcast" target="_blank">ADS-B messages</a> received since midnight today
|
||||
|
||||
<li>Last update: $(date +"%b %d, %Y %R:%S %Z")
|
||||
<li>Maximum distance from <a href="https://www.openstreetmap.org/?mlat=$LAT_VIS&mlon=$LON_VIS#map=14/$LAT_VIS/$LON_VIS&layers=H" target=_blank>${LAT_VIS}°N, ${LON_VIS}°E</a>: $DIST $DISTUNIT
|
||||
<li>Only aircraft below $(printf "%'.0d" "$MAXALT") $ALTUNIT are reported
|
||||
<li>Data extracted from $(printf "%'.0d" $TOTALLINES) <a href="https://en.wikipedia.org/wiki/Automatic_dependent_surveillance_%E2%80%93_broadcast" target="_blank">ADS-B messages</a> received since midnight today
|
||||
EOF
|
||||
{ [[ -n "$FUDGELOC" ]] && printf "<li> 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 "<li> %d entries were filtered out today because of an <a href=\"ignorelist.txt\" target=\"_blank\">ignore list</a>\n" "$(</run/planefence/filtered-"$FENCEDATE")"
|
||||
{ [[ -n "$FUDGELOC" ]] && printf " <li> 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 " <li> %d entries were filtered out today because of an <a href=\"ignorelist.txt\" target=\"_blank\">ignore list</a>\n" "$(</run/planefence/filtered-"$FENCEDATE")"
|
||||
if [[ -n "$MASTODON_SERVER" ]] && [[ -n "$MASTODON_ACCESS_TOKEN" ]] && [[ -n "$MASTODON_NAME" ]]; then
|
||||
printf "<li>Get notified instantaneously of aircraft in range by following <a href=\"https://%s/@%s\" rel=\"me\">@%s@%s</a> on Mastodon" \
|
||||
printf "<li>Get notified instantaneously of aircraft in range by following <a href=\"https://%s/@%s\" rel=\"me\">@%s@%s</a> on Mastodon" \
|
||||
"$MASTODON_SERVER" "$MASTODON_NAME" "$MASTODON_NAME" "$MASTODON_SERVER"
|
||||
fi
|
||||
[[ -n "$PA_LINK" ]] && printf "<li> Additionally, click <a href=\"%s\" target=\"_blank\">here</a> to visit Plane Alert: a watchlist of aircraft in general range of the station\n" "$PA_LINK"
|
||||
@@ -1146,12 +1097,10 @@ EOF
|
||||
|
||||
[[ "$BASETIME" != "" ]] && echo "16. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- starting final cleanup" || true
|
||||
|
||||
# shellcheck disable=SC2164
|
||||
pushd "$OUTFILEDIR" > /dev/null
|
||||
pushd "$OUTFILEDIR" > /dev/null || true
|
||||
mv -f "$OUTFILEHTMTMP" "$OUTFILEHTML"
|
||||
ln -sf "${OUTFILEHTML##*/}" index.html
|
||||
# shellcheck disable=SC2164
|
||||
popd > /dev/null
|
||||
popd > /dev/null || true
|
||||
|
||||
# VERY last thing... ensure that the log doesn't overflow:
|
||||
if [ "$VERBOSE" != "" ] && [ "$LOGFILE" != "" ] && [ "$LOGFILE" != "logger" ] && [[ -f $LOGFILE ]] && (( $(wc -l < "$LOGFILE") > 8000 ))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/command/with-contenv bash
|
||||
#shellcheck shell=bash disable=SC2015,SC2268,SC2174 source=/usr/share/planefence/persist/planefence.config
|
||||
#shellcheck shell=bash disable=SC2015,SC2268,SC2174,SC1091,SC2154
|
||||
# -----------------------------------------------------------------------------------
|
||||
# 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
|
||||
@@ -11,14 +11,14 @@
|
||||
#
|
||||
# -----------------------------------------------------------------------------------
|
||||
#
|
||||
APPNAME="$(hostname)/planefence"
|
||||
source /scripts/common
|
||||
|
||||
REMOTEURL=$(sed -n 's/\(^\s*REMOTEURL=\)\(.*\)/\2/p' /usr/share/planefence/planefence.conf)
|
||||
|
||||
function configure_planefence() {
|
||||
local SETTING_NAME="$1"
|
||||
local SETTING_VALUE="$2"
|
||||
if [[ "x$SETTING_VALUE" != "x" ]]
|
||||
then
|
||||
if [[ -n "$SETTING_VALUE" ]]; then
|
||||
sed -i "s~\(^\s*${SETTING_NAME}=\).*~\1${SETTING_VALUE}~" /usr/share/planefence/planefence.conf
|
||||
else
|
||||
sed -i "s|\(^\s*${SETTING_NAME}=\).*|\1|" /usr/share/planefence/planefence.conf
|
||||
@@ -27,8 +27,7 @@ function configure_planefence() {
|
||||
function configure_planealert() {
|
||||
local SETTING_NAME="$1"
|
||||
local SETTING_VALUE="$2"
|
||||
if [[ "x$SETTING_VALUE" != "x" ]]
|
||||
then
|
||||
if [[ -n "$SETTING_VALUE" ]]; then
|
||||
sed -i "s~\(^\s*${SETTING_NAME}=\).*~\1${SETTING_VALUE}~" /usr/share/plane-alert/plane-alert.conf
|
||||
else
|
||||
sed -i "s|\(^\s*${SETTING_NAME}=\).*|\1|" /usr/share/plane-alert/plane-alert.conf
|
||||
@@ -39,17 +38,18 @@ function configure_both() {
|
||||
configure_planealert "$1" "$2"
|
||||
}
|
||||
|
||||
[[ "$LOGLEVEL" != "ERROR" ]] && echo "[$APPNAME][$(date)] Running PlaneFence configuration - either the container is restarted or a config change was detected." || true
|
||||
[[ "$LOGLEVEL" != "ERROR" ]] && "${s6wrap[@]}" echo" Running PlaneFence configuration - either the container is restarted or a config change was detected." || true
|
||||
# Sometimes, variables are passed in through .env in the Docker-compose directory
|
||||
# However, if there is a planefence.config file in the ..../persist directory
|
||||
# (by default exposed to ~/.planefence) then export all of those variables as well
|
||||
# note that the grep strips off any spaces at the beginning of a line, and any commented line
|
||||
mkdir -p -m 0700 /usr/share/planefence/persist/.internal
|
||||
mkdir -p -m 0777 /usr/share/planefence/persist/.internal
|
||||
mkdir -p /usr/share/planefence/persist/planepix
|
||||
chmod -fR a+rw /usr/share/planefence/persist /usr/share/planefence/persist/{.[!.]*,*}
|
||||
chmod -f a=rwx /usr/share/planefence/persist
|
||||
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
|
||||
if [[ -f /usr/share/planefence/persist/planefence.config ]]; then
|
||||
set -o allexport
|
||||
# shellcheck disable=SC1091
|
||||
source /usr/share/planefence/persist/planefence.config
|
||||
@@ -93,8 +93,7 @@ mkdir -p /usr/share/planefence/html/plane-alert
|
||||
cp -n /usr/share/plane-alert/plane-alert-db.txt /usr/share/planefence/persist
|
||||
#
|
||||
# LOOPTIME is the time between two runs of PlaneFence (in seconds)
|
||||
if [[ "$PF_INTERVAL" != "" ]]
|
||||
then
|
||||
if [[ "$PF_INTERVAL" != "" ]]; then
|
||||
export LOOPTIME=$PF_INTERVAL
|
||||
|
||||
else
|
||||
@@ -108,31 +107,26 @@ fi
|
||||
mkdir -p /run/planefence
|
||||
# -----------------------------------------------------------------------------------
|
||||
# Do one last check. If FEEDER_LAT= empty or 90.12345, then the user obviously hasn't touched the config file.
|
||||
if [[ "x$FEEDER_LAT" == "x" ]] || [[ "$FEEDER_LAT" == "90.12345" ]]
|
||||
then
|
||||
if [[ -z "$FEEDER_LAT" ]] || [[ "$FEEDER_LAT" == "90.12345" ]]; then
|
||||
sleep 10s
|
||||
echo "[$APPNAME][$(date)] ----------------------------------------------------------"
|
||||
echo "[$APPNAME][$(date)] !!! STOP !!!! You haven't configured FEEDER_LON and/or FEEDER_LAT for PlaneFence !!!!"
|
||||
echo "[$APPNAME][$(date)] Planefence will not run unless you edit it configuration."
|
||||
echo "[$APPNAME][$(date)] You can do this by pressing CTRL-c now and typing:"
|
||||
echo "[$APPNAME][$(date)] sudo nano -l ~/.planefence/planefence.config"
|
||||
echo "[$APPNAME][$(date)] Once done, restart the container and this message should disappear."
|
||||
echo "[$APPNAME][$(date)] ----------------------------------------------------------"
|
||||
while true
|
||||
do
|
||||
sleep 99999
|
||||
done
|
||||
"${s6wrap[@]}" echo" ----------------------------------------------------------"
|
||||
"${s6wrap[@]}" echo" !!! STOP !!!! You haven\'t configured FEEDER_LON and/or FEEDER_LAT for PlaneFence !!!!"
|
||||
"${s6wrap[@]}" echo" Planefence will not run unless you edit it configuration."
|
||||
"${s6wrap[@]}" echo" You can do this by pressing CTRL-c now and typing:"
|
||||
"${s6wrap[@]}" echo" sudo nano -l ~/.planefence/planefence.config"
|
||||
"${s6wrap[@]}" echo" Once done, restart the container and this message should disappear."
|
||||
"${s6wrap[@]}" echo" ----------------------------------------------------------"
|
||||
exec sleep infinity
|
||||
fi
|
||||
|
||||
#
|
||||
# Set logging in planefence.conf:
|
||||
#
|
||||
if [[ "$PF_LOG" == "off" ]]
|
||||
then
|
||||
if chk_disabled "$PF_LOG"; then
|
||||
export LOGFILE=/dev/null
|
||||
sed -i 's/\(^\s*VERBOSE=\).*/\1'""'/' /usr/share/planefence/planefence.conf
|
||||
else
|
||||
[[ "x$PF_LOG" == "x" ]] && export LOGFILE="/tmp/planefence.log" || export LOGFILE="$PF_LOG"
|
||||
[[ -z "$PF_LOG" ]] && export LOGFILE="/tmp/planefence.log" || export LOGFILE="$PF_LOG"
|
||||
fi
|
||||
# echo pflog=$PF_LOG and logfile=$LOGFILE
|
||||
sed -i 's|\(^\s*LOGFILE=\).*|\1'"$LOGFILE"'|' /usr/share/planefence/planefence.conf
|
||||
@@ -140,26 +134,25 @@ sed -i 's|\(^\s*LOGFILE=\).*|\1'"$LOGFILE"'|' /usr/share/planefence/planefence.c
|
||||
# -----------------------------------------------------------------------------------
|
||||
#
|
||||
# read the environment variables and put them in the planefence.conf file:
|
||||
[[ "x$FEEDER_LAT" != "x" ]] && sed -i 's/\(^\s*LAT=\).*/\1'"\"$FEEDER_LAT\""'/' /usr/share/planefence/planefence.conf || { echo "[$APPNAME][$(date)] Error - \$FEEDER_LAT ($FEEDER_LAT) not defined"; while :; do sleep 2073600; done; }
|
||||
[[ "x$FEEDER_LONG" != "x" ]] && sed -i 's/\(^\s*LON=\).*/\1'"\"$FEEDER_LONG\""'/' /usr/share/planefence/planefence.conf || { echo "[$APPNAME][$(date)] Error - \$FEEDER_LONG not defined"; while :; do sleep 2073600; done; }
|
||||
[[ "x$PF_MAXALT" != "x" ]] && sed -i 's/\(^\s*MAXALT=\).*/\1'"\"$PF_MAXALT\""'/' /usr/share/planefence/planefence.conf
|
||||
[[ "x$PF_MAXDIST" != "x" ]] && sed -i 's/\(^\s*DIST=\).*/\1'"\"$PF_MAXDIST\""'/' /usr/share/planefence/planefence.conf
|
||||
[[ "x$PF_ELEVATION" != "x" ]] && sed -i 's/\(^\s*ALTCORR=\).*/\1'"\"$PF_ELEVATION\""'/' /usr/share/planefence/planefence.conf
|
||||
[[ "x$PF_NAME" != "x" ]] && sed -i 's/\(^\s*MY=\).*/\1'"\"$PF_NAME\""'/' /usr/share/planefence/planefence.conf || sed -i 's/\(^\s*MY=\).*/\1\"My\"/' /usr/share/planefence/planefence.conf
|
||||
[[ "x$PF_TRACKSVC" != "x" ]] && sed -i 's|\(^\s*TRACKSERVICE=\).*|\1'"\"$PF_TRACKSVC\""'|' /usr/share/planefence/planefence.conf
|
||||
[[ "x$PF_MAPURL" != "x" ]] && sed -i 's|\(^\s*MYURL=\).*|\1'"\"$PF_MAPURL\""'|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*MYURL=\).*|\1|' /usr/share/planefence/planefence.conf
|
||||
[[ "x$PF_NOISECAPT" != "x" ]] && sed -i 's|\(^\s*REMOTENOISE=\).*|\1'"\"$PF_NOISECAPT\""'|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*REMOTENOISE=\).*|\1|' /usr/share/planefence/planefence.conf
|
||||
[[ "x$PF_FUDGELOC" != "x" ]] && sed -i 's|\(^\s*FUDGELOC=\).*|\1'"\"$PF_FUDGELOC\""'|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*FUDGELOC=\).*|\1|' /usr/share/planefence/planefence.conf
|
||||
[[ "$PF_OPENAIP_LAYER" == "ON" ]] && sed -i 's|\(^\s*OPENAIP_LAYER=\).*|\1'"\"ON\""'|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*OPENAIP_LAYER=\).*|\1'"\"OFF\""'|' /usr/share/planefence/planefence.conf
|
||||
[[ "x$PF_TWEET_MINTIME" != "x" ]] && sed -i 's|\(^\s*TWEET_MINTIME=\).*|\1'"$PF_TWEET_MINTIME"'|' /usr/share/planefence/planefence.conf
|
||||
[[ -n "$FEEDER_LAT" ]] && sed -i 's/\(^\s*LAT=\).*/\1'"\"$FEEDER_LAT\""'/' /usr/share/planefence/planefence.conf || { "${s6wrap[@]}" echo" Error - \$FEEDER_LAT ($FEEDER_LAT) not defined"; while :; do sleep 2073600; done; }
|
||||
[[ -n "$FEEDER_LONG" ]] && sed -i 's/\(^\s*LON=\).*/\1'"\"$FEEDER_LONG\""'/' /usr/share/planefence/planefence.conf || { "${s6wrap[@]}" echo" Error - \$FEEDER_LONG not defined"; while :; do sleep 2073600; done; }
|
||||
[[ -n "$PF_MAXALT" ]] && sed -i 's/\(^\s*MAXALT=\).*/\1'"\"$PF_MAXALT\""'/' /usr/share/planefence/planefence.conf
|
||||
[[ -n "$PF_MAXDIST" ]] && sed -i 's/\(^\s*DIST=\).*/\1'"\"$PF_MAXDIST\""'/' /usr/share/planefence/planefence.conf
|
||||
[[ -n "$PF_ELEVATION" ]] && sed -i 's/\(^\s*ALTCORR=\).*/\1'"\"$PF_ELEVATION\""'/' /usr/share/planefence/planefence.conf
|
||||
[[ -n "$PF_NAME" ]] && sed -i 's/\(^\s*MY=\).*/\1'"\"$PF_NAME\""'/' /usr/share/planefence/planefence.conf || sed -i 's/\(^\s*MY=\).*/\1\"My\"/' /usr/share/planefence/planefence.conf
|
||||
[[ -n "$PF_TRACKSVC" ]] && sed -i 's|\(^\s*TRACKSERVICE=\).*|\1'"\"$PF_TRACKSVC\""'|' /usr/share/planefence/planefence.conf
|
||||
[[ -n "$PF_MAPURL" ]] && sed -i 's|\(^\s*MYURL=\).*|\1'"\"$PF_MAPURL\""'|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*MYURL=\).*|\1|' /usr/share/planefence/planefence.conf
|
||||
[[ -n "$PF_NOISECAPT" ]] && sed -i 's|\(^\s*REMOTENOISE=\).*|\1'"\"$PF_NOISECAPT\""'|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*REMOTENOISE=\).*|\1|' /usr/share/planefence/planefence.conf
|
||||
[[ -n "$PF_FUDGELOC" ]] && sed -i 's|\(^\s*FUDGELOC=\).*|\1'"\"$PF_FUDGELOC\""'|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*FUDGELOC=\).*|\1|' /usr/share/planefence/planefence.conf
|
||||
chk_enabled "$PF_OPENAIP_LAYER" && sed -i 's|\(^\s*OPENAIP_LAYER=\).*|\1'"\"ON\""'|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*OPENAIP_LAYER=\).*|\1'"\"OFF\""'|' /usr/share/planefence/planefence.conf
|
||||
[[ -n "$PF_TWEET_MINTIME" ]] && sed -i 's|\(^\s*TWEET_MINTIME=\).*|\1'"$PF_TWEET_MINTIME"'|' /usr/share/planefence/planefence.conf
|
||||
[[ "$PF_TWEET_BEHAVIOR" == "PRE" ]] && sed -i 's|\(^\s*TWEET_BEHAVIOR=\).*|\1PRE|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*TWEET_BEHAVIOR=\).*|\1POST|' /usr/share/planefence/planefence.conf
|
||||
[[ "$PF_PLANEALERT" == "ON" ]] && sed -i 's|\(^\s*PA_LINK=\).*|\1\"'"$PF_PA_LINK"'\"|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*PA_LINK=\).*|\1|' /usr/share/planefence/planefence.conf
|
||||
[[ "$PF_TWEETEVERY" == "true" ]] && sed -i 's|\(^\s*TWEETEVERY=\).*|\1true|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*TWEETEVERY=\).*|\1false|' /usr/share/planefence/planefence.conf
|
||||
[[ "x$PA_HISTTIME" != "x" ]] && sed -i 's|\(^\s*HISTTIME=\).*|\1\"'"$PA_HISTTIME"'\"|' /usr/share/plane-alert/plane-alert.conf
|
||||
[[ "x$PF_ALERTHEADER" != "x" ]] && sed -i "s|\(^\s*ALERTHEADER=\).*|\1\'$PF_ALERTHEADER\'|" /usr/share/plane-alert/plane-alert.conf
|
||||
chk_enabled "$PF_PLANEALERT" && sed -i 's|\(^\s*PA_LINK=\).*|\1\"'"$PF_PA_LINK"'\"|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*PA_LINK=\).*|\1|' /usr/share/planefence/planefence.conf
|
||||
chk_enabled "$PF_TWEETEVERY" && sed -i 's|\(^\s*TWEETEVERY=\).*|\1true|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*TWEETEVERY=\).*|\1false|' /usr/share/planefence/planefence.conf
|
||||
[[ -n "$PA_HISTTIME" ]] && sed -i 's|\(^\s*HISTTIME=\).*|\1\"'"$PA_HISTTIME"'\"|' /usr/share/plane-alert/plane-alert.conf
|
||||
[[ -n "$PF_ALERTHEADER" ]] && sed -i "s|\(^\s*ALERTHEADER=\).*|\1\'$PF_ALERTHEADER\'|" /usr/share/plane-alert/plane-alert.conf
|
||||
|
||||
if [[ "x$PF_SOCK30003HOST" != "x" ]]
|
||||
then
|
||||
if [[ -n "$PF_SOCK30003HOST" ]]; then
|
||||
# shellcheck disable=SC2001
|
||||
a=$(sed 's|\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)|\1\_\2\_\3\_\4|g' <<< "$PF_SOCK30003HOST")
|
||||
sed -i 's|\(^\s*LOGFILEBASE=/run/socket30003/dump1090-\).*|\1'"$a"'-|' /usr/share/planefence/planefence.conf
|
||||
@@ -167,13 +160,13 @@ then
|
||||
unset a
|
||||
else
|
||||
sleep 10s
|
||||
echo "[$APPNAME][$(date)] ----------------------------------------------------------"
|
||||
echo "[$APPNAME][$(date)] !!! STOP !!!! You haven't configured PF_SOCK30003HOST for PlaneFence !!!!"
|
||||
echo "[$APPNAME][$(date)] Planefence will not run unless you edit it configuration."
|
||||
echo "[$APPNAME][$(date)] You can do this by pressing CTRL-c now and typing:"
|
||||
echo "[$APPNAME][$(date)] sudo nano -l ~/.planefence/planefence.config"
|
||||
echo "[$APPNAME][$(date)] Once done, restart the container and this message should disappear."
|
||||
echo "[$APPNAME][$(date)] ----------------------------------------------------------"
|
||||
"${s6wrap[@]}" echo" ----------------------------------------------------------"
|
||||
"${s6wrap[@]}" echo" !!! STOP !!!! You haven't configured PF_SOCK30003HOST for PlaneFence !!!!"
|
||||
"${s6wrap[@]}" echo" Planefence will not run unless you edit it configuration."
|
||||
"${s6wrap[@]}" echo" You can do this by pressing CTRL-c now and typing:"
|
||||
"${s6wrap[@]}" echo" sudo nano -l ~/.planefence/planefence.config"
|
||||
"${s6wrap[@]}" echo" Once done, restart the container and this message should disappear."
|
||||
"${s6wrap[@]}" echo" ----------------------------------------------------------"
|
||||
while true
|
||||
do
|
||||
sleep 99999
|
||||
@@ -181,10 +174,10 @@ else
|
||||
fi
|
||||
#
|
||||
# Deal with duplicates. Put IGNOREDUPES in its place and create (or delete) the link to the ignorelist:
|
||||
[[ "x$PF_IGNOREDUPES" != "x" ]] && sed -i 's|\(^\s*IGNOREDUPES=\).*|\1ON|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*IGNOREDUPES=\).*|\1OFF|' /usr/share/planefence/planefence.conf
|
||||
[[ "x$PF_COLLAPSEWITHIN" != "x" ]] && sed -i 's|\(^\s*COLLAPSEWITHIN=\).*|\1'"$PF_COLLAPSEWITHIN"'|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*IGNOREDUPES=\).*|\1300|' /usr/share/planefence/planefence.conf
|
||||
a=$(sed -n 's/^\s*IGNORELIST=\(.*\)/\1/p' /usr/share/planefence/planefence.conf | sed 's/\"//g')
|
||||
[[ "$a" != "" ]] && ln -sf "$a" /usr/share/planefence/html/ignorelist.txt || rm -f /usr/share/planefence/html/ignorelist.txt
|
||||
[[ -n "$PF_IGNOREDUPES" ]] && sed -i 's|\(^\s*IGNOREDUPES=\).*|\1ON|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*IGNOREDUPES=\).*|\1OFF|' /usr/share/planefence/planefence.conf
|
||||
[[ -n "$PF_COLLAPSEWITHIN" ]] && sed -i 's|\(^\s*COLLAPSEWITHIN=\).*|\1'"$PF_COLLAPSEWITHIN"'|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*IGNOREDUPES=\).*|\1300|' /usr/share/planefence/planefence.conf
|
||||
a="$(sed -n 's/^\s*IGNORELIST=\(.*\)/\1/p' /usr/share/planefence/planefence.conf | sed 's/\"//g')"
|
||||
[[ -n "$a" ]] && ln -sf "$a" /usr/share/planefence/html/ignorelist.txt || rm -f /usr/share/planefence/html/ignorelist.txt
|
||||
unset a
|
||||
#
|
||||
# -----------------------------------------------------------------------------------
|
||||
@@ -193,8 +186,8 @@ unset a
|
||||
#
|
||||
sed -i 's/\(^\s*LAT=\).*/\1'"\"$FEEDER_LAT\""'/' /usr/share/planefence/planeheat.sh
|
||||
sed -i 's/\(^\s*LON=\).*/\1'"\"$FEEDER_LONG\""'/' /usr/share/planefence/planeheat.sh
|
||||
[[ "x$PF_MAXALT" != "x" ]] && sed -i 's/\(^\s*MAXALT=\).*/\1'"\"$PF_MAXALT\""'/' /usr/share/planefence/planeheat.sh
|
||||
[[ "x$PF_MAXDIST" != "x" ]] && sed -i 's/\(^\s*DIST=\).*/\1'"\"$PF_MAXDIST\""'/' /usr/share/planefence/planeheat.sh
|
||||
[[ -n "$PF_MAXALT" ]] && sed -i 's/\(^\s*MAXALT=\).*/\1'"\"$PF_MAXALT\""'/' /usr/share/planefence/planeheat.sh
|
||||
[[ -n "$PF_MAXDIST" ]] && sed -i 's/\(^\s*DIST=\).*/\1'"\"$PF_MAXDIST\""'/' /usr/share/planefence/planeheat.sh
|
||||
# -----------------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -211,21 +204,20 @@ sed -i 's/\(^\s*LON=\).*/\1'"\"$FEEDER_LONG\""'/' /usr/share/planefence/planehea
|
||||
#
|
||||
# enable or disable tweeting:
|
||||
#
|
||||
[[ "${PF_TWEET,,}" == "off" ]] && sed -i 's/\(^\s*PLANETWEET=\).*/\1/' /usr/share/planefence/planefence.conf
|
||||
if [[ "${PF_TWEET,,}" == "on" ]]
|
||||
then
|
||||
if [[ ! -f ~/.twurlrc ]]
|
||||
then
|
||||
echo "[$APPNAME][$(date)] Warning: PF_TWEET is set to ON in .env file, but the Twitter account is not configured."
|
||||
echo "[$APPNAME][$(date)] Sign up for a developer account at Twitter, create an app, and get a Consumer Key / Secret."
|
||||
echo "[$APPNAME][$(date)] Then run this from the host machine: \"docker exec -it planefence /root/config_tweeting.sh\""
|
||||
echo "[$APPNAME][$(date)] For more information on how to sign up for a Twitter Developer Account, see this link:"
|
||||
echo "[$APPNAME][$(date)] https://elfsight.com/blog/2020/03/how-to-get-twitter-api-key/"
|
||||
echo "[$APPNAME][$(date)] PlaneFence will continue to start without Twitter functionality."
|
||||
chk_disabled "${PF_TWEET}" && sed -i 's/\(^\s*PLANETWEET=\).*/\1/' /usr/share/planefence/planefence.conf
|
||||
if chk_enabled "${PF_TWEET,,}"; then
|
||||
if [[ ! -f ~/.twurlrc ]]; then
|
||||
"${s6wrap[@]}" echo" Warning: PF_TWEET is set to ON in .env file, but the Twitter account is not configured."
|
||||
"${s6wrap[@]}" echo" Sign up for a developer account at Twitter, create an app, and get a Consumer Key / Secret."
|
||||
"${s6wrap[@]}" echo" Then run this from the host machine: \"docker exec -it planefence /root/config_tweeting.sh\""
|
||||
"${s6wrap[@]}" echo" For more information on how to sign up for a Twitter Developer Account, see this link:"
|
||||
"${s6wrap[@]}" echo" https://elfsight.com/blog/2020/03/how-to-get-twitter-api-key/"
|
||||
"${s6wrap[@]}" echo" PlaneFence will continue to start without Twitter functionality."
|
||||
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
|
||||
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:
|
||||
@@ -241,54 +233,49 @@ fi
|
||||
# -----------------------------------------------------------------------------------
|
||||
#
|
||||
# Change the heatmap height and width if they are defined in the .env parameter file:
|
||||
[[ "x$PF_MAPHEIGHT" != "x" ]] && sed -i 's|\(^\s*HEATMAPHEIGHT=\).*|\1'"\"$PF_MAPHEIGHT\""'|' /usr/share/planefence/planefence.conf
|
||||
[[ "x$PF_MAPWIDTH" != "x" ]] && sed -i 's|\(^\s*HEATMAPWIDTH=\).*|\1'"\"$PF_MAPWIDTH\""'|' /usr/share/planefence/planefence.conf
|
||||
[[ "x$PF_MAPZOOM" != "x" ]] && sed -i 's|\(^\s*HEATMAPZOOM=\).*|\1'"\"$PF_MAPZOOM\""'|' /usr/share/planefence/planefence.conf
|
||||
[[ -n "$PF_MAPHEIGHT" ]] && sed -i 's|\(^\s*HEATMAPHEIGHT=\).*|\1'"\"$PF_MAPHEIGHT\""'|' /usr/share/planefence/planefence.conf
|
||||
[[ -n "$PF_MAPWIDTH" ]] && sed -i 's|\(^\s*HEATMAPWIDTH=\).*|\1'"\"$PF_MAPWIDTH\""'|' /usr/share/planefence/planefence.conf
|
||||
[[ -n "$PF_MAPZOOM" ]] && sed -i 's|\(^\s*HEATMAPZOOM=\).*|\1'"\"$PF_MAPZOOM\""'|' /usr/share/planefence/planefence.conf
|
||||
#
|
||||
# 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
|
||||
[[ "x$PF_MAPWIDTH" != "x" ]] && sed -i 's|\(^\s*<div id=\"map\" style=\"width:.*;\)|<div id=\"map\" style=\"width:'"$PF_MAPWIDTH"';|' "$i"
|
||||
[[ "x$PF_MAPHEIGHT" != "x" ]] && sed -i 's|\(; height:[^\"]*\)|; height: '"$PF_MAPHEIGHT"'\"|' "$i"
|
||||
[[ "x$PF_MAPZOOM" != "x" ]] && sed -i 's|\(^\s*var map =.*], \)\(.*\)|\1'"$PF_MAPZOOM"');|' "$i"
|
||||
if find /usr/share/planefence/html/planefence-??????.html >/dev/null 2>&1; then
|
||||
for i in /usr/share/planefence/html/planefence-??????.html; do
|
||||
[[ -n "$PF_MAPWIDTH" ]] && sed -i 's|\(^\s*<div id=\"map\" style=\"width:.*;\)|<div id=\"map\" style=\"width:'"$PF_MAPWIDTH"';|' "$i"
|
||||
[[ -n "$PF_MAPHEIGHT" ]] && sed -i 's|\(; height:[^\"]*\)|; height: '"$PF_MAPHEIGHT"'\"|' "$i"
|
||||
[[ -n "$PF_MAPZOOM" ]] && sed -i 's|\(^\s*var map =.*], \)\(.*\)|\1'"$PF_MAPZOOM"');|' "$i"
|
||||
done
|
||||
fi
|
||||
|
||||
# place the screenshotting URL in place:
|
||||
|
||||
if [[ "x$PF_SCREENSHOTURL" != "x" ]]
|
||||
then
|
||||
if [[ -n "$PF_SCREENSHOTURL" ]]; then
|
||||
sed -i 's|\(^\s*SCREENSHOTURL=\).*|\1'"\"$PF_SCREENSHOTURL\""'|' /usr/share/planefence/planefence.conf
|
||||
sed -i 's|\(^\s*SCREENSHOTURL=\).*|\1'"\"$PF_SCREENSHOTURL\""'|' /usr/share/plane-alert/plane-alert.conf
|
||||
fi
|
||||
if [[ "x$PF_SCREENSHOT_TIMEOUT" != "x" ]]
|
||||
then
|
||||
if [[ -n "$PF_SCREENSHOT_TIMEOUT" ]]; then
|
||||
sed -i 's|\(^\s*SCREENSHOT_TIMEOUT=\).*|\1'"\"$PF_SCREENSHOT_TIMEOUT\""'|' /usr/share/planefence/planefence.conf
|
||||
sed -i 's|\(^\s*SCREENSHOT_TIMEOUT=\).*|\1'"\"$PF_SCREENSHOT_TIMEOUT\""'|' /usr/share/plane-alert/plane-alert.conf
|
||||
fi
|
||||
|
||||
# if it still doesn't exist, something went drastically wrong and we need to set $PF_PLANEALERT to OFF!
|
||||
if [[ ! -f /usr/share/planefence/persist/plane-alert-db.txt ]] && [[ "$PF_PLANEALERT" == "ON" ]]
|
||||
then
|
||||
echo "[$APPNAME][$(date)] Cannot find or create the plane-alert-db.txt file. Disabling Plane-Alert."
|
||||
echo "[$APPNAME][$(date)] Do this on the host to get a base file:"
|
||||
echo "[$APPNAME][$(date)] curl --compressed -s https://raw.githubusercontent.com/kx1t/docker-planefence/plane-alert/plane-alert-db.txt >~/.planefence/plane-alert-db.txt"
|
||||
echo "[$APPNAME][$(date)] and then restart this docker container"
|
||||
if [[ ! -f /usr/share/planefence/persist/plane-alert-db.txt ]] && chk_enabled "$PF_PLANEALERT"; then
|
||||
"${s6wrap[@]}" echo" Cannot find or create the plane-alert-db.txt file. Disabling Plane-Alert."
|
||||
"${s6wrap[@]}" echo" Do this on the host to get a base file:"
|
||||
"${s6wrap[@]}" echo" curl --compressed -s https://raw.githubusercontent.com/kx1t/docker-planefence/plane-alert/plane-alert-db.txt >~/.planefence/plane-alert-db.txt"
|
||||
"${s6wrap[@]}" echo" and then restart this docker container"
|
||||
PF_PLANEALERT="OFF"
|
||||
fi
|
||||
|
||||
# make sure $PLANEALERT is set to ON in the planefence.conf file, so it will be invoked:
|
||||
[[ "$PF_PLANEALERT" == "ON" ]] && sed -i 's|\(^\s*PLANEALERT=\).*|\1'"\"ON\""'|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*PLANEALERT=\).*|\1'"\"OFF\""'|' /usr/share/planefence/planefence.conf
|
||||
chk_enabled "$PF_PLANEALERT" && sed -i 's|\(^\s*PLANEALERT=\).*|\1'"\"ON\""'|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*PLANEALERT=\).*|\1'"\"OFF\""'|' /usr/share/planefence/planefence.conf
|
||||
# Go get the plane-alert-db files:
|
||||
/usr/share/plane-alert/get-pa-alertlist.sh
|
||||
/usr/share/plane-alert/get-silhouettes.sh
|
||||
|
||||
# Now make sure that the file containing the twitter IDs is rewritten with 1 ID per line
|
||||
[[ "x$PF_PA_TWID" != "x" ]] && tr , "\n" <<< "$PF_PA_TWID" > /usr/share/plane-alert/plane-alert.twitterid || rm -f /usr/share/plane-alert/plane-alert.twitterid
|
||||
[[ -n "$PF_PA_TWID" ]] && tr , "\n" <<< "$PF_PA_TWID" > /usr/share/plane-alert/plane-alert.twitterid || rm -f /usr/share/plane-alert/plane-alert.twitterid
|
||||
# and write the rest of the parameters into their place
|
||||
[[ "x$PF_PA_TWID" != "x" ]] && [[ "$PF_PA_TWEET" == "DM" ]] && sed -i 's|\(^\s*TWITTER=\).*|\1DM|' /usr/share/plane-alert/plane-alert.conf || sed -i 's|\(^\s*TWITTER=\).*|\1false|' /usr/share/plane-alert/plane-alert.conf
|
||||
[[ -n "$PF_PA_TWID" ]] && [[ "$PF_PA_TWEET" == "DM" ]] && sed -i 's|\(^\s*TWITTER=\).*|\1DM|' /usr/share/plane-alert/plane-alert.conf || sed -i 's|\(^\s*TWITTER=\).*|\1false|' /usr/share/plane-alert/plane-alert.conf
|
||||
[[ "$PF_PA_TWEET" == "TWEET" ]] && sed -i 's|\(^\s*TWITTER=\).*|\1TWEET|' /usr/share/plane-alert/plane-alert.conf
|
||||
[[ "$PF_PA_TWEET" != "TWEET" ]] && [[ "$PF_PA_TWEET" != "DM" ]] && sed -i 's|\(^\s*TWITTER=\).*|\1false|' /usr/share/plane-alert/plane-alert.conf
|
||||
configure_planefence "PF_DISCORD" "$PF_DISCORD"
|
||||
@@ -303,8 +290,7 @@ configure_both "NOTIFICATION_SERVER" "\"NOTIFICATION_SERVER\""
|
||||
configure_planefence "OPENAIPKEY" "$PF_OPENAIPKEY"
|
||||
|
||||
# Configure Mastodon parameters:
|
||||
if [[ -n "$MASTODON_SERVER" ]] && [[ -n "$MASTODON_ACCESS_TOKEN" ]]
|
||||
then
|
||||
if [[ -n "$MASTODON_SERVER" ]] && [[ -n "$MASTODON_ACCESS_TOKEN" ]]; then
|
||||
MASTODON_SERVER="${MASTODON_SERVER,,}"
|
||||
# strip http:// https://
|
||||
[[ "${MASTODON_SERVER:0:7}" == "http://" ]] && MASTODON_SERVER="${MASTODON_SERVER:7}" || true
|
||||
@@ -313,32 +299,31 @@ then
|
||||
if ! grep -iq "The access token is invalid\|<body class='error'>" <<< "$mast_result" >/dev/null 2>&1; then
|
||||
configure_both "MASTODON_NAME" "$(jq -r '.acct' <<< "$mast_result")"
|
||||
fi
|
||||
if [[ "${PF_MASTODON,,}" == "on" ]]
|
||||
then
|
||||
if chk_enabled "${PF_MASTODON,,}"; then
|
||||
configure_planefence "MASTODON_ACCESS_TOKEN" "$MASTODON_ACCESS_TOKEN"
|
||||
configure_planefence "MASTODON_SERVER" "$MASTODON_SERVER"
|
||||
[[ -n "$PF_MASTODON_VISIBILITY" ]] && configure_planefence "MASTODON_VISIBILITY" "$PF_MASTODON_VISIBILITY" || configure_planefence "MASTODON_VISIBILITY" "unlisted"
|
||||
configure_planefence "MASTODON_VISIBILITY" "${PF_MASTODON_VISIBILITY:-unlisted}"
|
||||
else
|
||||
configure_planefence "MASTODON_ACCESS_TOKEN" ""
|
||||
configure_planefence "MASTODON_SERVER" ""
|
||||
fi
|
||||
if [[ "${PA_MASTODON,,}" == "on" ]]
|
||||
then
|
||||
if chk_enabled "${PA_MASTODON,,}"; then
|
||||
configure_planealert "MASTODON_ACCESS_TOKEN" "$MASTODON_ACCESS_TOKEN"
|
||||
configure_planealert "MASTODON_SERVER" "$MASTODON_SERVER"
|
||||
[[ -n "$PA_MASTODON_VISIBILITY" ]] && configure_planealert "MASTODON_VISIBILITY" "$PA_MASTODON_VISIBILITY" || configure_planealert "MASTODON_VISIBILITY" "unlisted"
|
||||
configure_planealert
|
||||
configure_planealert "MASTODON_VISIBILITY" "${PA_MASTODON_VISIBILITY:-unlisted}"
|
||||
configure_planealert "MASTODON_MAXIMGS" "${PA_MASTODON_MAXIMGS:-1}"
|
||||
configure_planealert "MASTODON_RETENTION_TIME" "${MASTODON_RETENTION_TIME:-7}"
|
||||
else
|
||||
configure_planealert "MASTODON_ACCESS_TOKEN" ""
|
||||
configure_planealert "MASTODON_SERVER" ""
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ "x$PF_NAME" != "x" ]] && sed -i 's|\(^\s*NAME=\).*|\1'"\"$PF_NAME\""'|' /usr/share/plane-alert/plane-alert.conf || sed -i 's|\(^\s*NAME=\).*|\1My|' /usr/share/plane-alert/plane-alert.conf
|
||||
[[ "x$PF_MAPURL" != "x" ]] && sed -i 's|\(^\s*ADSBLINK=\).*|\1'"\"$PF_MAPURL\""'|' /usr/share/plane-alert/plane-alert.conf
|
||||
# removed for now - hardcoding PlaneAlert map zoom to 7 in plane-alert.conf: [[ "x$PF_MAPZOOM" != "x" ]] && sed -i 's|\(^\s*MAPZOOM=\).*|\1'"\"$PF_MAPZOOM\""'|' /usr/share/plane-alert/plane-alert.conf
|
||||
[[ "x$PF_PARANGE" != "x" ]] && sed -i 's|\(^\s*RANGE=\).*|\1'"$PF_PARANGE"'|' /usr/share/plane-alert/plane-alert.conf || sed -i 's|\(^\s*RANGE=\).*|\1999999|' /usr/share/plane-alert/plane-alert.conf
|
||||
[[ "x$PF_PA_SQUAWKS" != "x" ]] && sed -i 's|\(^\s*SQUAWKS=\).*|\1'"$PF_PA_SQUAWKS"'|' /usr/share/plane-alert/plane-alert.conf || sed -i 's|\(^\s*SQUAWKS=\).*|\1|' /usr/share/plane-alert/plane-alert.conf
|
||||
[[ -n "$PF_NAME" ]] && sed -i 's|\(^\s*NAME=\).*|\1'"\"$PF_NAME\""'|' /usr/share/plane-alert/plane-alert.conf || sed -i 's|\(^\s*NAME=\).*|\1My|' /usr/share/plane-alert/plane-alert.conf
|
||||
[[ -n "$PF_MAPURL" ]] && sed -i 's|\(^\s*ADSBLINK=\).*|\1'"\"$PF_MAPURL\""'|' /usr/share/plane-alert/plane-alert.conf
|
||||
# removed for now - hardcoding PlaneAlert map zoom to 7 in plane-alert.conf: [[ -n "$PF_MAPZOOM" ]] && sed -i 's|\(^\s*MAPZOOM=\).*|\1'"\"$PF_MAPZOOM\""'|' /usr/share/plane-alert/plane-alert.conf
|
||||
[[ -n "$PF_PARANGE" ]] && sed -i 's|\(^\s*RANGE=\).*|\1'"$PF_PARANGE"'|' /usr/share/plane-alert/plane-alert.conf || sed -i 's|\(^\s*RANGE=\).*|\1999999|' /usr/share/plane-alert/plane-alert.conf
|
||||
[[ -n "$PF_PA_SQUAWKS" ]] && sed -i 's|\(^\s*SQUAWKS=\).*|\1'"$PF_PA_SQUAWKS"'|' /usr/share/plane-alert/plane-alert.conf || sed -i 's|\(^\s*SQUAWKS=\).*|\1|' /usr/share/plane-alert/plane-alert.conf
|
||||
|
||||
configure_both "AUTOREFRESH" "${PF_AUTOREFRESH,,}"
|
||||
|
||||
@@ -352,18 +337,17 @@ cp -f /usr/share/planefence/stage/sort-table.js /usr/share/planefence/html/plane
|
||||
sleep 1
|
||||
if [[ "$PF_DISTUNIT" != $(sed -n 's/^\s*distanceunit=\(.*\)/\1/p' /usr/share/socket30003/socket30003.cfg) ]] \
|
||||
|| [[ "$PF_ALTUNIT" != $(sed -n 's/^\s*altitudeunit=\(.*\)/\1/p' /usr/share/socket30003/socket30003.cfg) ]] \
|
||||
|| [[ "$PF_SPEEDUNIT" != $(sed -n 's/^\s*speedunit=\(.*\)/\1/p' /usr/share/socket30003/socket30003.cfg) ]]
|
||||
then
|
||||
[[ "x$PF_DISTUNIT" != "x" ]] && sed -i 's/\(^\s*distanceunit=\).*/\1'"$PF_DISTUNIT"'/' /usr/share/socket30003/socket30003.cfg
|
||||
[[ "x$PF_SPEEDUNIT" != "x" ]] && sed -i 's/\(^\s*speedunit=\).*/\1'"$PF_SPEEDUNIT"'/' /usr/share/socket30003/socket30003.cfg
|
||||
[[ "x$PF_ALTUNIT" != "x" ]] && sed -i 's/\(^\s*altitudeunit=\).*/\1'"$PF_ALTUNIT"'/' /usr/share/socket30003/socket30003.cfg
|
||||
|| [[ "$PF_SPEEDUNIT" != $(sed -n 's/^\s*speedunit=\(.*\)/\1/p' /usr/share/socket30003/socket30003.cfg) ]]; then
|
||||
[[ -n "$PF_DISTUNIT" ]] && sed -i 's/\(^\s*distanceunit=\).*/\1'"$PF_DISTUNIT"'/' /usr/share/socket30003/socket30003.cfg
|
||||
[[ -n "$PF_SPEEDUNIT" ]] && sed -i 's/\(^\s*speedunit=\).*/\1'"$PF_SPEEDUNIT"'/' /usr/share/socket30003/socket30003.cfg
|
||||
[[ -n "$PF_ALTUNIT" ]] && sed -i 's/\(^\s*altitudeunit=\).*/\1'"$PF_ALTUNIT"'/' /usr/share/socket30003/socket30003.cfg
|
||||
fi
|
||||
#
|
||||
#--------------------------------------------------------------------------------
|
||||
# Check if the remote airlinename server is online
|
||||
#[[ "$PF_CHECKREMOTEDB" != "OFF" ]] && a="$(curl -L -s https://get-airline.planefence.com/?flight=hello_from_$(grep 'PF_NAME' /usr/share/planefence/persist/planefence.config | awk -F '=' '{ print $2 }' | tr -dc '[:alnum:]')_bld_$([[ -f /usr/share/planefence/build ]] && cat /usr/share/planefence/build || cat /root/.buildtime | cut -c 1-23 | tr ' ' '_'))" || a=""
|
||||
#shellcheck disable=SC2046
|
||||
[[ "$PF_CHECKREMOTEDB" != "OFF" ]] && a="$(curl -L -s "$REMOTEURL"/?flight=hello_from_$(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))" || a=""
|
||||
! chk_disabled "$PF_CHECKREMOTEDB" && a="$(curl -L -s "$REMOTEURL"/?flight=hello_from_$(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))" || a=""
|
||||
[[ "${a:0:4}" == "#100" ]] && sed -i 's|\(^\s*CHECKREMOTEDB=\).*|\1ON|' /usr/share/planefence/planefence.conf || sed -i 's|\(^\s*CHECKREMOTEDB=\).*|\1OFF|' /usr/share/planefence/planefence.conf
|
||||
#
|
||||
#--------------------------------------------------------------------------------
|
||||
@@ -376,8 +360,8 @@ fi
|
||||
# if curl -L -s https://raw.githubusercontent.com/sdr-enthusiasts/plane-alert-db/main/planepix.txt > /usr/share/planefence/persist/planepix.txt.samplefile
|
||||
# then
|
||||
# chmod a+r /usr/share/planefence/persist/planepix.txt.samplefile
|
||||
# echo "[$APPNAME][$(date)] Successfully downloaded planepix sample file to ~/.planefence/planepix.txt.samplefile directory."
|
||||
# echo "[$APPNAME][$(date)] To use it, rename it to, or incorporate it into ~/.planefence/planepix.txt. Any entries in this file will replace the tar1090 screenshot with a picture of the plane."
|
||||
# "${s6wrap[@]}" echo" Successfully downloaded planepix sample file to ~/.planefence/planepix.txt.samplefile directory."
|
||||
# "${s6wrap[@]}" echo" To use it, rename it to, or incorporate it into ~/.planefence/planepix.txt. Any entries in this file will replace the tar1090 screenshot with a picture of the plane."
|
||||
# fi
|
||||
#--------------------------------------------------------------------------------
|
||||
# Put the MOTDs in place:
|
||||
|
||||
@@ -383,7 +383,9 @@ NOTIFICATION_SERVER=planefence-notifier
|
||||
# MASTODON_SERVER contains the server name (please omit http://), for example MASTODON_SERVER=airwaves.social
|
||||
# MASTODON_ACCESS_TOKEN contains the Access Token of the Mastodon Application
|
||||
# PF/PA_PF_MASTODON_VISIBILITY can be `public`, `unlisted`, or `private`.
|
||||
# See here for a detailed walk-through: https://github.com/sdr-enthusiasts/docker-planefence/blob/dev/README-Mastodon.md
|
||||
# PA_MASTODON_MAXIMGS contains the max number of images uploaded to Mastodon. If you are using airwaves.social,
|
||||
# please be considerate of (expensive) disk space charges for the owner and keep this to 1
|
||||
# See here for a detailed walk-through: https://github.com/kx1t/docker-planefence/blob/main/README-Mastodon.md
|
||||
#
|
||||
PF_MASTODON=OFF
|
||||
PA_MASTODON=OFF
|
||||
@@ -391,6 +393,8 @@ MASTODON_SERVER=airwaves.social
|
||||
MASTODON_ACCESS_TOKEN=
|
||||
PF_MASTODON_VISIBILITY=unlisted
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user