Auto backup: 2026-02-21 07:01

This commit is contained in:
Krilly
2026-02-21 07:01:51 +00:00
parent 8757148122
commit 17b5b82d99
2012 changed files with 352552 additions and 331 deletions

View File

@@ -12,8 +12,9 @@ source "$SCRIPT_DIR/../../.env" 2>/dev/null || true
FRESHRSS_URL="${FRESHRSS_URL:-http://freshrss.kangaroo-eel.ts.net}"
FRESHRSS_USER="${FRESHRSS_USER:-anthony}"
TELEGRAM_CHAT="${TELEGRAM_CHAT:-1793951355}"
GOTIFY_URL="${GOTIFY_URL:-http://runtipi.kangaroo-eel.ts.net:8129}"
GOTIFY_TOKEN="${GOTIFY_TOKEN:-AGKnHafW3FGzBlt}"
NTFY_URL="${NTFY_URL:-}"
NTFY_TOPIC="${NTFY_TOPIC:-}"
NTFY_MIN_PRIORITY="${NTFY_MIN_PRIORITY:-4}"
# Your interest keywords for relevance ranking
INTERESTS=(
@@ -174,40 +175,58 @@ send_telegram() {
log "Sending to Telegram..."
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
if [[ -z "${TELEGRAM_BOT_TOKEN:-}" ]]; then
log "ERROR: TELEGRAM_BOT_TOKEN is not set"
return 1
fi
local tg_response
tg_response=$(curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
-H "Content-Type: application/json" \
-d "{
\"chat_id\": \"$TELEGRAM_CHAT\",
\"text\": \"$message\",
\"parse_mode\": \"Markdown\",
\"disable_web_page_preview\": true
}" > /dev/null || {
}") || {
log "ERROR: Failed to send Telegram message"
return 1
}
if ! echo "$tg_response" | jq -e '.ok == true' > /dev/null 2>&1; then
log "ERROR: Telegram API rejected message: $tg_response"
return 1
fi
log "Sent to Telegram successfully"
}
send_gotify() {
send_ntfy() {
local title="$1"
local message="$2"
local priority="${3:-5}"
log "Sending to Gotify..."
curl -s -X POST "${GOTIFY_URL}/message?token=${GOTIFY_TOKEN}" \
-H "Content-Type: application/json" \
-d "{
\"title\": \"$title\",
\"message\": \"$message\",
\"priority\": $priority
}" > /dev/null || {
log "ERROR: Failed to send Gotify message"
local priority="${3:-4}"
local sound="${4:-default}"
[[ -z "$NTFY_URL" ]] && return 0
[[ -z "$NTFY_TOPIC" ]] && return 0
# Enforce minimum priority (default 4)
if [[ "$priority" =~ ^[0-9]+$ ]] && [[ "$NTFY_MIN_PRIORITY" =~ ^[0-9]+$ ]]; then
if (( priority < NTFY_MIN_PRIORITY )); then
priority="$NTFY_MIN_PRIORITY"
fi
fi
log "Sending to ntfy..."
curl -s -X POST "${NTFY_URL%/}/${NTFY_TOPIC}" \
-H "Title: $title" \
-H "Priority: $priority" \
-H "Sound: $sound" \
-d "$message" > /dev/null || {
log "ERROR: Failed to send ntfy message"
return 1
}
log "Sent to Gotify successfully"
log "Sent to ntfy successfully"
}
main() {
@@ -224,10 +243,10 @@ main() {
# Send to both channels
send_telegram "$digest"
# Plain text version for Gotify (strip markdown)
# Plain text version for ntfy (strip markdown)
local plain_digest
plain_digest=$(echo -e "$digest" | sed 's/\*//g' | sed 's/\[\([^]]*\)\]([^)]*)/\1/g')
send_gotify "FreshRSS Digest" "$plain_digest" 5
send_ntfy "FreshRSS Digest" "$plain_digest" 4 default
log "Digest complete!"
}