Skip to content

Commit

Permalink
Release 5.28 - Add BlueSky notifications (#218)
Browse files Browse the repository at this point in the history
* initial commit for bluesky notifications functionality

* cleanup

* make post2bsky  script executable

* cleanup

* bsky posting: hashtags, mime types support

* minor updates

* fix hashtag generation for BSky messages with images

* Correctly delete planeimg after sending BSky notification

* Check for image file size

* add support for lines and newlines

* minor logging improvements for BlueSky

* add indication to logs on when  rate limit will reset for BlueSky

* Add debugging for failed posts

* One more debug thingy

* Fix

* Update planefence_notify.sh

* fix for image and tag generation

* improve hashtag parsing

* updates to image uploads

* typo

* Get rid of single quotes in notifications

* Bugfix for annoying typo

* Fix removal of trailing spaces from airline owner

* implement BlueSky auth via sessionRefresh

* reduce max image size to 850KB

* bsky: improve image size check

* fixup

* more reductions

* cleanup

* add links to BlueSky profile on PF and PA webpages

* move some stuff around on the PF webpage

* minor fix

* cleanup

* increment version in advance of  PR merge to `main`

---------

Co-authored-by: Matthias Wirth <[email protected]>
  • Loading branch information
kx1t and wiedehopf authored Jan 12, 2025
1 parent a7f1b2b commit 0a9d9d5
Show file tree
Hide file tree
Showing 13 changed files with 506 additions and 54 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ RUN set -xe && \
KEPT_PACKAGES+=(ruby) && \
KEPT_PACKAGES+=(php-cgi) && \
KEPT_PACKAGES+=(html-xml-utils) && \
KEPT_PACKAGES+=(file) && \
KEPT_PACKAGES+=(jpegoptim) && \
KEPT_PACKAGES+=(pngquant) && \
#
KEPT_PIP3_PACKAGES+=(tzlocal) && \
KEPT_PIP3_PACKAGES+=(discord-webhook==1.0.0) && \
Expand Down
390 changes: 390 additions & 0 deletions rootfs/scripts/post2bsky.sh

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion rootfs/usr/lib/python3/dist-packages/pflib/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def build(username, urls, title, description, color=None):
if color is None:
color = 0x007bff # Blue
embed = DiscordEmbed(title=title, color=color, description=description)
embed.set_footer(text="Planefence by kx1t - https://planefence.com")
embed.set_footer(text="Planefence by kx1t - https://sdr-e.com/docker-planefence")

webhooks = dw.create_batch(urls=urls, username=username)

Expand Down
9 changes: 9 additions & 0 deletions rootfs/usr/share/plane-alert/plane-alert.conf
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,12 @@ set +a

RSS_SITELINK=""
RSS_FAVICONLINK=""
#
# ---------------------------------------------------------------------
# These are the parameters for BlueSky notifications:

BLUESKY_HANDLE=""
BLUESKY_APP_PASSWORD=""
BLUESKY_API=""
#
# ---------------------------------------------------------------------
1 change: 1 addition & 0 deletions rootfs/usr/share/plane-alert/plane-alert.header.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ <h2>This website shows a list of aircraft of interest that were heard by <a href
##MEGALINK##
##PFLINK##
##MASTODONLINK##
##BLUESKYLINK##
</ul>
</details>
</article>
Expand Down
87 changes: 47 additions & 40 deletions rootfs/usr/share/plane-alert/plane-alert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# Usage: ./plane-alert.sh <inputfile>
#
# Copyright 2021-2024 Ramon F. Kolb - licensed under the terms and conditions
# Copyright 2021-2025 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/sdr-enthusiasts/planefence/
Expand Down Expand Up @@ -121,10 +121,6 @@ fi
[ "$TESTING" == "true" ] && echo "2. $TMPDIR/plalert.out.tmp contains $(cat "$TMPDIR"/plalert.out.tmp | wc -l) lines"
# Now plalert.out.tmp contains SBS data


# echo xx1 ; cat $TMPDIR/plalert.out.tmp


# Let's figure out if we also need to find SQUAWKS
rm -f "$TMPDIR"/patmp
touch "$TMPDIR"/patmp
Expand Down Expand Up @@ -378,10 +374,10 @@ then
TWITTEXT+="\n$(sed 's|/|\\/|g' <<< "${pa_record[9]//globe.adsbexchange.com/"$TRACKSERVICE"}")"

TWITTEXT+="\n\n$ATTRIB"
TWITTEXT="${TWITTEXT//\'/}"

if [[ -n "$MASTODON_SERVER" ]] || [[ "$TWITTER" != "false" ]]
then
echo "[$(date)][$APPNAME] Attempting to Tweet or Toot this message:"
if [[ -n "$MASTODON_SERVER" ]] || [[ "$TWITTER" != "false" ]] || [[ -n "$BLUESKY_HANDLE" ]]; then
echo "[$(date)][$APPNAME] Attempting to Tweet, Toot, or Post this message:"
echo "[$(date)][$APPNAME] $(sed -e 's|\\/|/|g' -e 's|\\n| |g' -e 's|%0A| |g' <<< "${TWITTEXT}")"
fi

Expand Down Expand Up @@ -422,7 +418,7 @@ then
done

# convert $msg_array[@] into a JSON object:
MQTT_JSON="$(for i in "${!msg_array[@]}"; do printf '{"%s":"%s"}\n' "$i" "${msg_array[$i]}"; done | jq -sc add)"
MQTT_JSON="$(for i in "${!msg_array[@]}"; do printf '{"%s":"%s"}\n' "$i" "${msg_array[$i]}"; done | jq -sc add)"

# prep the MQTT host, port, etc
unset MQTT_TOPIC MQTT_PORT MQTT_USERNAME MQTT_PASSWORD MQTT_HOST
Expand All @@ -441,7 +437,7 @@ then
fi
if [[ $MQTT_HOST == *":"* ]]; then MQTT_PORT="${MQTT_PORT:-${MQTT_HOST#*:}}"; fi
MQTT_HOST="${MQTT_HOST%:*}" # finally strip the host so there's only a hostname or ip address

# log the message we are going to send:
echo "[$(date)][$APPNAME] Attempting to send a MQTT notification:"
echo "[$(date)][$APPNAME] MQTT Host: ${MQTT_HOST}"
Expand Down Expand Up @@ -475,6 +471,36 @@ then
fi
fi

# Inject BlueSky integration here:
if [[ -n "$BLUESKY_HANDLE" ]] && [[ -n "$BLUESKY_APP_PASSWORD" ]]; then
# get a list of images to upload
unset images
if [[ "$GOTSNAP" == "true" ]]; then images+=("$snapfile"); fi

# check if there are any images in the plane-alert-db
field=()
readarray -td, field <<< "${ALERT_DICT[${pa_record[0]#\#}]}"
rm -f "/tmp/planeimg*"
for (( i=0 ; i<=20; i++ ))
do
fld="$(echo ${field[$i]}|xargs -0)"
if [[ " jpg peg png gif " =~ " ${fld: -3} " ]] && (( ${#images[@]} < 4)); then
[[ "${fld:0:4}" != "http" ]] && fld="https://$fld" || true
if curl -sL -A "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0" "$fld" -o "/tmp/planeimg-$i.${fld: -3}"
then
images+=("/tmp/planeimg-$i.${fld: -3}")
fi
fi
done

# now send the BlueSky message:
echo "DEBUG: posting to BlueSky: /scripts/post2bsky.sh \"$(sed -e 's|\\/|/|g' -e 's|\\n|\n|g' -e 's|%0A|\n|g' <<< "${TWITTEXT}")\" ${images[*]}"
# shellcheck disable=SC2068
/scripts/post2bsky.sh "$(sed -e 's|\\/|/|g' -e 's|\\n|\n|g' -e 's|%0A|\n|g' <<< "${TWITTEXT}")" ${images[@]} || true
rm -f "/tmp/planeimg*"

fi

# Inject Mastodon integration here:
if [[ -n "$MASTODON_SERVER" ]]
then
Expand All @@ -485,7 +511,7 @@ then
if [[ "$GOTSNAP" == "true" ]]
then
response="$(curl -s -H "Authorization: Bearer ${MASTODON_ACCESS_TOKEN}" -H "Content-Type: multipart/form-data" -X POST "https://${MASTODON_SERVER}/api/v1/media" --form file="@${snapfile}")"
mast_id+=("$(jq '.id' <<< "$response"|xargs)")
mast_id+=("$(jq '.id' <<< "$response"|xargs -0)")

fi

Expand All @@ -495,7 +521,7 @@ then

for (( i=0 ; i<=20; i++ ))
do
fld="$(echo ${field[$i]}|xargs)"
fld="$(echo ${field[$i]}|xargs -0)"
ext="${fld: -3}"
if [[ " jpg png peg bmp gif " =~ " $ext " ]] && (( ${#mast_id[@]} < MASTODON_MAXIMGS ))
then
Expand All @@ -505,7 +531,7 @@ then
if curl -sL -A "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0" "$fld" -o "/tmp/planeimg.$ext"
then
response="$(curl -s -H "Authorization: Bearer ${MASTODON_ACCESS_TOKEN}" -H "Content-Type: multipart/form-data" -X POST "https://${MASTODON_SERVER}/api/v1/media" --form file="@/tmp/planeimg.$ext")"
[[ "$(jq '.id' <<< "$response" | xargs)" != "null" ]] && mast_id+=("$(jq '.id' <<< "$response" | xargs)") || true
[[ "$(jq '.id' <<< "$response" | xargs -0)" != "null" ]] && mast_id+=("$(jq '.id' <<< "$response" | xargs -0)") || true
rm -f "/tmp/planeimg.$ext"
fi
fi
Expand All @@ -521,11 +547,11 @@ then
# now send the Mastodon Toot.
response="$(curl -H "Authorization: Bearer ${MASTODON_ACCESS_TOKEN}" -s "https://${MASTODON_SERVER}/api/v1/statuses" -X POST $media_ids -F "status=${MASTTEXT}" -F "language=eng" -F "visibility=${MASTODON_VISIBILITY}")"
# check if there was an error
if [[ "$(jq '.error' <<< "$response"|xargs)" == "null" ]]
if [[ "$(jq '.error' <<< "$response"|xargs -0)" == "null" ]]
then
echo "[$(date)][$APPNAME] Planefence post to Mastodon generated successfully with visibility=${MASTODON_VISIBILITY}. Mastodon post available at: $(jq '.url' <<< "$response"|xargs)"
else
echo "[$(date)][$APPNAME] Mastodon post error. Mastodon returned this error: $(jq '.error' <<< "$response"|xargs)"
echo "[$(date)][$APPNAME] Mastodon post error. Mastodon returned this error: $(jq '.error' <<< "$response"|xargs -0)"
fi
fi

Expand Down Expand Up @@ -657,31 +683,6 @@ cp -f $PLANEALERTDIR/plane-alert.header.html "$TMPDIR"/plalert-index.tmp
# Create a FD for plalert-index.tml to reduce write cycles
exec 3>> "$TMPDIR"/plalert-index.tmp

SB="$(sed -n 's|^\s*SPORTSBADGER=\(.*\)|\1|p' /usr/share/planefence/persist/planefence.config)"
if [[ -n "$SB" ]]
then
cat <<EOF >&3
<!-- special feature for @Sportsbadger only -->
<section style="border: none; margin: 0; padding: 0; font: 12px/1.4 'Helvetica Neue', Arial, sans-serif;">
<article>
<details>
<summary style="font-weight: 900; font: 14px/1.4 'Helvetica Neue', Arial, sans-serif;">Special Feature - only for @SportsBadger</summary>
<h2>Per special request of @SportsBadger, here's the initial implementation of the "PlaneLatte" feature</h2>
Unfortunately, the IFTTT integration between the home espresso machine and PlaneLatte is still under development and will probably never be implemented. In the meantime, feel free to
pre-order your favo(u)rite drink at a Starbucks nearby. Future features will include a choice of Starbucks, Costa, and Pret-a-Manger, as well
as the local New England favorite: Dunkin' Donuts.
<ul>
<li><a href="https://www.starbucks.com/menu/product/407/hot?parent=%2Fdrinks%2Fhot-coffees%2Flattes" target="_blank">Caffe Latte</a>
<li><a href="https://www.starbucks.com/menu/product/409/hot?parent=%2Fdrinks%2Fhot-coffees%2Fcappuccinos" target="_blank">Cappuccino</a>
<li><a href="https://www.starbucks.com/menu/product/462/iced?parent=%2Fdrinks%2Ficed-teas%2Ficed-herbal-teas" target="_blank">Iced Passion Tango&reg; Tea Lemonade</a>, handshaken with ice, lemonade and, of course, passion.
<li>Additional beverages available upon request
</ul>
</details>
</article>
</section>
EOF
fi

# figure out if there are squawks:
awk -F "," '$12 != "" {rc = 1} END {exit !rc}' "$OUTFILE" && sqx="true" || sqx="false"

Expand Down Expand Up @@ -865,6 +866,12 @@ else
sed -i "s|##MASTODONLINK##||g" "$TMPDIR"/plalert-index.tmp
sed -i "s|##MASTOHEADER##||g" "$TMPDIR"/plalert-index.tmp
fi
if [[ -n "$BLUESKY_HANDLE" ]] && [[ -n "$BLUESKY_APP_PASSWORD" ]]; then
sed -i "s|##BLUESKYLINK##|<li>Planefence notifications are sent to <a href=\"https://bsky.app/profile/$BLUESKY_HANDLE\" target=\"_blank\">@$BLUESKY_HANDLE</a> at BlueSky.Social|g" "$TMPDIR"/plalert-index.tmp
else
sed -i "s|##BLUESKYLINK##||g" "$TMPDIR"/plalert-index.tmp
fi

if (( $(cat "$OUTFILE" | wc -l ) > 0 )); then
# shellcheck disable=SC2046
sed -i "s|##MEGALINK##|<li>Click <a href=\"https://$TRACKSERVICE/?icao=$(printf "%s," $(awk -F, 'BEGIN {ORS="\n"} !seen[$1]++ {print $1}' "$OUTFILE" | tail -$TRACKLIMIT))\">here</a> for a map with the current locations of most recent $TRACKLIMIT unique aircraft|g" "$TMPDIR"/plalert-index.tmp
Expand Down
2 changes: 1 addition & 1 deletion rootfs/usr/share/planefence/airlinename.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ if [[ -n "$b" ]] && [[ "$q" == "" ]]; then q="rdb"; fi
# Clean up the results
if [[ -n "$b" ]]; then
b="${b^^}"
b="$(echo "$b"|xargs -0)" #clean up extra spaces
b="$(echo "$b"|xargs)" #clean up extra spaces
b="${b% [A-Z0-9]}" #clean up single letters/numbers at the end, so "KENNEDY JOHN F" becomes "KENNEDY JOHN"
b="${b% DBA}" #clean up some undesired suffices, mostly corporate entity names
b="${b% TRUSTEE}"
Expand Down
2 changes: 1 addition & 1 deletion rootfs/usr/share/planefence/pf_notify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ CSVTMP=/tmp/pf_notify-tmp.csv
(( TWEET_MINTIME > 0 )) && MINTIME=$TWEET_MINTIME || MINTIME=100

# $ATTRIB contains the attribution line at the bottom of the tweet
ATTRIB="${ATTRIB:-#Planefence by kx1t - docker:kx1t/planefence}"
ATTRIB="${ATTRIB:-#Planefence by kx1t - https://sdr-e.com/docker-planefence}"

if [[ -n "$SOCKETCONFIG" ]]; then
case "$(grep "^distanceunit=" "$SOCKETCONFIG" |sed "s/distanceunit=//g")" in
Expand Down
9 changes: 8 additions & 1 deletion rootfs/usr/share/planefence/planefence.conf
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,15 @@ set +a
RSS_FAVICONLINK=""
#
# ---------------------------------------------------------------------
# These are the parameters for BlueSky notifications:

BLUESKY_HANDLE=""
BLUESKY_APP_PASSWORD=""
BLUESKY_API=""
#
# ---------------------------------------------------------------------
# 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.27-release
VERSION=5.28-release
9 changes: 5 additions & 4 deletions rootfs/usr/share/planefence/planefence.sh
Original file line number Diff line number Diff line change
Expand Up @@ -860,9 +860,9 @@ cat <<EOF >"$OUTFILEHTMTMP"
# You are taking an interest in this code! Great!
# I'm not a professional programmer, and your suggestions and contributions
# are always welcome. Join me at the GitHub link shown below, or via email
# at kx1t (at) amsat (dot) org.
# at kx1t (at) kx1t (dot) com.
#
# Copyright 2020-2024 Ramon. Kolb, kx1t - licensed under the terms and conditions
# Copyright 2020-20245 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/sdr-enthusiasts/docker-planefence/
Expand Down Expand Up @@ -961,6 +961,9 @@ EOF
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
if [[ -n "$BLUESKY_HANDLE" ]] && [[ -n "$BLUESKY_APP_PASSWORD" ]]; then printf "<li>Planefence notifications are sent to <a href=\"https://bsky.app/profile/%s\" target=\"_blank\">@%s</a> at BlueSky \n" "$BLUESKY_HANDLE" "$BLUESKY_HANDLE"; fi
[[ "$PLANETWEET" != "" ]] && printf "<li>Get notified instantaneously of aircraft in range by following <a href=\"http://twitter.com/%s\" target=\"_blank\">@%s</a> on Twitter!\n" "$PLANETWEET" "$PLANETWEET"
printf "<li> A RSS feed of the aircraft detected with Planefence is available at <a href=\"planefence.rss\">planefence.rss</a>\n"
[[ -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"
} >> "$OUTFILEHTMTMP"

Expand Down Expand Up @@ -992,10 +995,8 @@ EOF
(( ALTCORR > 0 )) && printf "<li>Minimum altitude is the altitude above local ground level, which is %s %s MSL." "$ALTCORR" "$ALTUNIT" >> "$OUTFILEHTMTMP" || printf "<li>Minimum altitude is the altitude above sea level"

[[ "$PLANETWEET" != "" ]] && printf "<li>Click on the word &quot;yes&quot; in the <b>Tweeted</b> column to see the Tweet.\n<li>Note that tweets are issued after a slight delay\n"
[[ "$PLANETWEET" != "" ]] && printf "<li>Get notified instantaneously of aircraft in range by following <a href=\"http://twitter.com/%s\" target=\"_blank\">@%s</a> on Twitter!\n" "$PLANETWEET" "$PLANETWEET"
(( $(find "$TMPDIR"/noisecapt-spectro*.png -daystart -maxdepth 1 -mmin -1440 -print 2>/dev/null | wc -l ) > 0 )) && printf "<li>Click on the word &quot;Spectrogram&quot; to see the audio spectrogram of the noisiest period while the aircraft was in range\n"
[[ "$PLANEALERT" == "ON" ]] && printf "<li>See a list of aircraft matching the station's Alert List <a href=\"plane-alert\" target=\"_blank\">here</a>\n"
printf "<li> A RSS feed of the aircraft detected with Planefence is available at <a href=\"planefence.rss\">planefence.rss</a>\n"
printf "<li> Press the header of any of the columns to sort by that column\n"
printf "</ul>\n"
} >> "$OUTFILEHTMTMP"
Expand Down
17 changes: 11 additions & 6 deletions rootfs/usr/share/planefence/planefence_notify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ 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
[[ -z "$ATTRIB" ]] && ATTRIB="#adsb #planefence by kx1t - http://github.com/sdr-enthusiasts/docker-planefence"
ATTRIB="${ATTRIB:-#adsb #planefence by kx1t - https://sdr-e.com/docker-planefence}"

if [ "$SOCKETCONFIG" != "" ]
then
Expand Down Expand Up @@ -149,7 +149,7 @@ getRoute()

if [[ -n "$origin" ]] && [[ -n "$destination" ]]
then
response="#$origin-#$destination"
response="#$origin - #$destination"
elif [[ -n "$origin" ]]
then
response="org: #$origin"
Expand Down Expand Up @@ -304,8 +304,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" ]
Expand All @@ -316,7 +316,7 @@ 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
Expand Down Expand Up @@ -351,7 +351,7 @@ then

msg_array[icao]="${RECORD[0]}"
msg_array[flight]="${RECORD[1]#@}"
msg_array[operator]="$(echo "${AIRLINE}" | xargs -0)"
msg_array[operator]="$(echo "${AIRLINE}" | xargs)"
if [[ -n "$ROUTE" ]]; then
if [[ "${ROUTE:0:4}" == "org:" ]]; then msg_array[origin]="${ROUTE:6}"
elif [[ "${ROUTE:0:5}" == "dest:" ]]; then msg_array[destination]="${ROUTE:7}"
Expand Down Expand Up @@ -425,6 +425,11 @@ then

fi

# Insert BlueSky notifications here:
if [[ -n "$BLUESKY_HANDLE" ]] && [[ -n "$BLUESKY_APP_PASSWORD" ]]; then
/scripts/post2bsky.sh "#Planefence $(sed -e 's|\\/|/|g' -e 's|\\n|\n|g' -e 's|%0A|\n|g' <<< "${TWEET}")" "$(if [[ "$GOTSNAP" == "true" ]]; then echo "$snapfile"; fi)" || true
fi

# And now, let's tweet!
if [ "$TWEETON" == "yes" ]
then
Expand Down
10 changes: 10 additions & 0 deletions rootfs/usr/share/planefence/prep-planefence.sh
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,16 @@ configure_planealert "PA_MOTD" "\"$PA_MOTD\""
[[ -n "$PA_RSS_FAVICONLINK" ]] && configure_planealert "RSS_FAVICONLINK" "$PA_RSS_FAVICONLINK" || true
#
#--------------------------------------------------------------------------------
# BlueSky related parameters:
chk_enabled "$PF_BLUESKY_ENABLED" && [[ -n "$BLUESKY_HANDLE" ]] && configure_planefence "BLUESKY_HANDLE" "$BLUESKY_HANDLE" || configure_planefence "BLUESKY_HANDLE" ""
chk_enabled "$PF_BLUESKY_ENABLED" && [[ -n "$BLUESKY_APP_PASSWORD" ]] && configure_planefence "BLUESKY_APP_PASSWORD" "$BLUESKY_APP_PASSWORD" || configure_planefence "BLUESKY_APP_PASSWORD" ""
chk_enabled "$PF_BLUESKY_ENABLED" && [[ -n "$BLUESKY_API" ]] && configure_planefence "BLUESKY_API" "$BLUESKY_API" || configure_planefence "BLUESKY_API" ""

chk_enabled "$PA_BLUESKY_ENABLED" && [[ -n "$BLUESKY_HANDLE" ]] && configure_planealert "BLUESKY_HANDLE" "$BLUESKY_HANDLE" || configure_planealert "BLUESKY_HANDLE" ""
chk_enabled "$PA_BLUESKY_ENABLED" && [[ -n "$BLUESKY_APP_PASSWORD" ]] && configure_planealert "BLUESKY_APP_PASSWORD" "$BLUESKY_APP_PASSWORD" || configure_planealert "BLUESKY_APP_PASSWORD" ""
chk_enabled "$PA_BLUESKY_ENABLED" && [[ -n "$BLUESKY_API" ]] && configure_planealert "BLUESKY_API" "$BLUESKY_API" || configure_planealert "BLUESKY_API" ""
#
#--------------------------------------------------------------------------------
# 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!

Expand Down
19 changes: 19 additions & 0 deletions rootfs/usr/share/planefence/stage/planefence.config
Original file line number Diff line number Diff line change
Expand Up @@ -481,3 +481,22 @@ PF_RSS_SITELINK=""
PF_RSS_FAVICONLINK=""
PA_RSS_SITELINK=""
PA_RSS_FAVICONLINK=""
#
# ---------------------------------------------------------------------
# These are optional parameters related to BlueSky notifications
# To enable BlueSky notifications, log into your BlueSky account and then browse to https://bsky.app/settings/app-passwords
# Once there, create a new App Password and use that in the BLUESKY_APP_PASSWORD parameter below.
# It should look like BLUESKY_APP_PASSWORD=aaaa-bbbb-cccc-dddd
# Also populate BLUESKY_HANDLE with your BlueSky Handle. This is the part after the "@" sign, for example
# BLUESKY_HANDLE=abcd.bsky.social
#
# The parameters "PF_BLUESKY_ENABLED" and "PA_BLUESKY_ENABLED" must be set to "on"/"enabled"/"1"/"yes" to start
# notification about Planefence and Plane-Alert respectively.
#
# If you want to post to another federated BlueSky server, you can update BLUESKY_API. (If you don't know what
# this means, then please leave this parameter empty/undefined). The default value for BLUESKY_API is "https://bsky.social/xrpc"
BLUESKY_APP_PASSWORD=""
BLUESKY_HANDLE=""
PF_BLUESKY_ENABLED=""
PA_BLUESKY_ENABLED=""
# BLUESKY_API="" # do not change unless you are sure that you know what you are doing!

0 comments on commit 0a9d9d5

Please sign in to comment.