streamd: optional keys, per-stream proxy, auto deps; agent module.yaml sync; RTE AutoPlay; Telegram release announces
- streamd: MPD-only start, proxy field, ffmpeg/NRE/mp4decrypt auto-install - GET/PUT /api/modules for module.yaml sync; agent sync_modules - RTE Live-tab AutoPlay fixes; modules zip named bbc/rte/tg4.zip - Telegram notify scripts wired into Forgejo release workflows
This commit is contained in:
parent
f9c28be3f1
commit
ac8701b5a6
36 changed files with 1460 additions and 143 deletions
|
|
@ -74,16 +74,14 @@ foreach ($name in $Modules) {
|
|||
Remove-Item Env:GOOS, Env:GOARCH, Env:CGO_ENABLED -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Release zip gets module.yaml (= publish template, secrets empty/placeholders).
|
||||
# Release zip ships module.yaml only (= publish template renamed; no secrets).
|
||||
Copy-Item $publish (Join-Path $stage "module.yaml") -Force
|
||||
# Also keep the publish name for clarity.
|
||||
Copy-Item $publish (Join-Path $stage "module-publish.yaml") -Force
|
||||
|
||||
$readme = @"
|
||||
# module-$name ($Version)
|
||||
# $name ($Version)
|
||||
|
||||
Drop this folder into your Null DRM ``modules/$name/`` directory (or point
|
||||
``drm --modules-dir`` at a folder that contains ``$name/``).
|
||||
Unpack this zip into your Null DRM ``modules/$name/`` directory (or point
|
||||
``drm --modules-dir`` at a parent that contains ``$name/``).
|
||||
|
||||
1. Edit ``module.yaml`` — fill in any sensitive fields marked in comments.
|
||||
2. Copy the matching ``.bin/<goos>-<goarch>/$name[.exe]`` up to ``.bin/$name[.exe]``
|
||||
|
|
@ -91,12 +89,12 @@ Drop this folder into your Null DRM ``modules/$name/`` directory (or point
|
|||
if Go is installed.
|
||||
3. Run: ``drm modules`` then ``drm capture --app $name --channel …``
|
||||
|
||||
Local ``module.yaml`` with secrets must never be committed. This zip's
|
||||
``module.yaml`` is a rename of ``module-publish.yaml`` (universal values only).
|
||||
This zip's ``module.yaml`` is the published universal template (secrets empty).
|
||||
Do not commit a local ``module.yaml`` that contains secrets.
|
||||
"@
|
||||
Set-Content -Path (Join-Path $stage "README.md") -Value $readme -Encoding utf8
|
||||
|
||||
$zipName = "module-$name-$Version.zip"
|
||||
$zipName = "$name.zip"
|
||||
$zipPath = Join-Path $Out $zipName
|
||||
if (Test-Path $zipPath) { Remove-Item -Force $zipPath }
|
||||
Compress-Archive -Path (Join-Path $stage "*") -DestinationPath $zipPath -Force
|
||||
|
|
@ -113,4 +111,4 @@ foreach ($z in $builtZips) {
|
|||
}
|
||||
[System.IO.File]::WriteAllLines($sumsPath, $lines)
|
||||
Write-Host "DONE modules release $Version → $Out"
|
||||
Get-ChildItem $Out -Filter "module-*" | Format-Table Name, Length
|
||||
Get-ChildItem $Out -Filter "*.zip" | Where-Object { $_.Name -match '^(bbc|rte|tg4)\.zip$' } | Format-Table Name, Length
|
||||
|
|
|
|||
|
|
@ -41,18 +41,18 @@ for name in "${MODULES[@]}"; do
|
|||
go build -trimpath -ldflags='-s -w' -o "$bin" . )
|
||||
done <<< "$(printf '%s\n' "${TARGETS[@]}")"
|
||||
|
||||
# Ship module.yaml only (= publish template renamed; no secrets, no module-publish.yaml).
|
||||
cp "$publish" "$stage/module.yaml"
|
||||
cp "$publish" "$stage/module-publish.yaml"
|
||||
cat > "$stage/README.md" <<EOF
|
||||
# module-$name ($VERSION)
|
||||
# $name ($VERSION)
|
||||
|
||||
Drop into \`modules/$name/\`. Edit \`module.yaml\` for secrets. Copy
|
||||
Unpack into \`modules/$name/\`. Edit \`module.yaml\` for secrets. Copy
|
||||
\`.bin/<goos>-<goarch>/$name\` to \`.bin/$name\` for your OS, or rebuild with Go.
|
||||
|
||||
\`module.yaml\` in this zip is \`module-publish.yaml\` renamed (universal values).
|
||||
This zip's \`module.yaml\` is the published universal template (secrets empty).
|
||||
EOF
|
||||
|
||||
zip_path="$OUT/module-${name}-${VERSION}.zip"
|
||||
zip_path="$OUT/${name}.zip"
|
||||
rm -f "$zip_path"
|
||||
( cd "$stage" && zip -qr "$zip_path" . )
|
||||
built+=("$zip_path")
|
||||
|
|
@ -65,4 +65,4 @@ for z in "${built[@]}"; do
|
|||
( cd "$(dirname "$z")" && sha256sum "$(basename "$z")" ) >> "$sums"
|
||||
done
|
||||
echo "DONE modules release $VERSION → $OUT"
|
||||
ls -la "$OUT"/module-* 2>/dev/null || true
|
||||
ls -la "$OUT"/bbc.zip "$OUT"/rte.zip "$OUT"/tg4.zip 2>/dev/null || true
|
||||
|
|
|
|||
95
scripts/notify-telegram.ps1
Normal file
95
scripts/notify-telegram.ps1
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
# Post a release announce to Telegram.
|
||||
#
|
||||
# Required env:
|
||||
# TELEGRAM_BOT_TOKEN BotFather token (never commit)
|
||||
# TELEGRAM_CHAT_ID e.g. -1003721978702
|
||||
#
|
||||
# Usage:
|
||||
# $env:TELEGRAM_BOT_TOKEN="…"; $env:TELEGRAM_CHAT_ID="-1003721978702"
|
||||
# .\scripts\notify-telegram.ps1 -Tag v0.1.2
|
||||
# .\scripts\notify-telegram.ps1 -Tag modules-v0.1.2 -DryRun
|
||||
param(
|
||||
[string]$Tag = "",
|
||||
[string]$Kind = "auto", # auto | host | modules
|
||||
[string]$Title = "",
|
||||
[string]$Body = "",
|
||||
[string]$ReleaseUrl = "",
|
||||
[string]$RepoUrl = "https://git.nulldrm.com/nulldrm/Null-DRM-Official",
|
||||
[switch]$DryRun
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$Root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||
|
||||
if (-not $Tag) { $Tag = $env:RELEASE_TAG }
|
||||
if (-not $Tag) {
|
||||
try { $Tag = (git -C $Root describe --tags --exact-match 2>$null) } catch { }
|
||||
}
|
||||
if (-not $Tag) {
|
||||
try { $Tag = (git -C $Root describe --tags --always 2>$null) } catch { }
|
||||
}
|
||||
if (-not $Tag) { throw "usage: notify-telegram.ps1 -Tag v0.1.2" }
|
||||
|
||||
$Token = $env:TELEGRAM_BOT_TOKEN
|
||||
$Chat = $env:TELEGRAM_CHAT_ID
|
||||
if (-not $Token -or -not $Chat) {
|
||||
throw "TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID are required"
|
||||
}
|
||||
|
||||
if ($Kind -eq "auto") {
|
||||
if ($Tag -like "modules-v*") { $Kind = "modules" } else { $Kind = "host" }
|
||||
}
|
||||
|
||||
if (-not $ReleaseUrl) {
|
||||
if ($env:RELEASE_URL) { $ReleaseUrl = $env:RELEASE_URL }
|
||||
else { $ReleaseUrl = "$RepoUrl/releases/tag/$Tag" }
|
||||
}
|
||||
|
||||
if (-not $Title) {
|
||||
if ($env:RELEASE_TITLE) { $Title = $env:RELEASE_TITLE }
|
||||
elseif ($Kind -eq "modules") { $Title = "Null DRM $Tag" }
|
||||
else { $Title = "Null DRM $Tag" }
|
||||
}
|
||||
|
||||
if (-not $Body) {
|
||||
if ($env:RELEASE_BODY) {
|
||||
$Body = $env:RELEASE_BODY
|
||||
} elseif ($Kind -eq "modules") {
|
||||
$Body = @"
|
||||
<b>$Title</b>
|
||||
Provider module zips: <code>bbc.zip</code>, <code>rte.zip</code>, <code>tg4.zip</code>
|
||||
|
||||
Unpack each into <code>modules/<name>/</code> and edit <code>module.yaml</code> for secrets.
|
||||
|
||||
<a href="$ReleaseUrl">Download $Tag</a>
|
||||
"@
|
||||
} else {
|
||||
$Body = @"
|
||||
<b>$Title</b>
|
||||
Host CLI (<code>drm</code>) + on-device MITM (<code>proxy-android-arm64</code>).
|
||||
|
||||
<a href="$ReleaseUrl">Download $Tag</a>
|
||||
"@
|
||||
}
|
||||
}
|
||||
|
||||
if ($DryRun) {
|
||||
Write-Host "DRY_RUN chat=$Chat tag=$Tag kind=$Kind"
|
||||
Write-Host "----"
|
||||
Write-Host $Body
|
||||
return
|
||||
}
|
||||
|
||||
Write-Host "[*] Telegram notify → chat $Chat ($Tag)"
|
||||
$uri = "https://api.telegram.org/bot$Token/sendMessage"
|
||||
$form = @{
|
||||
chat_id = $Chat
|
||||
text = $Body
|
||||
parse_mode = "HTML"
|
||||
disable_web_page_preview = "false"
|
||||
}
|
||||
$resp = Invoke-RestMethod -Method Post -Uri $uri -Body $form
|
||||
if (-not $resp.ok) {
|
||||
throw "Telegram API error: $($resp | ConvertTo-Json -Compress)"
|
||||
}
|
||||
Write-Host "[+] Telegram announce sent for $Tag (message_id=$($resp.result.message_id))"
|
||||
95
scripts/notify-telegram.sh
Normal file
95
scripts/notify-telegram.sh
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
#!/usr/bin/env bash
|
||||
# Post a release announce to Telegram.
|
||||
#
|
||||
# Required env:
|
||||
# TELEGRAM_BOT_TOKEN BotFather token (Forgejo secret / local env — never commit)
|
||||
# TELEGRAM_CHAT_ID Channel chat id, e.g. -1003721978702
|
||||
#
|
||||
# Optional:
|
||||
# RELEASE_TAG / first arg tag name
|
||||
# RELEASE_URL release page URL
|
||||
# RELEASE_TITLE headline override
|
||||
# RELEASE_BODY full HTML body override
|
||||
# RELEASE_KIND host | modules | auto
|
||||
# RELEASE_REPO_URL default https://git.nulldrm.com/nulldrm/Null-DRM-Official
|
||||
# DRY_RUN=1 print, do not send
|
||||
#
|
||||
# Usage:
|
||||
# TELEGRAM_BOT_TOKEN=… TELEGRAM_CHAT_ID=… ./scripts/notify-telegram.sh v0.1.2
|
||||
# TELEGRAM_BOT_TOKEN=… TELEGRAM_CHAT_ID=… ./scripts/notify-telegram.sh modules-v0.1.2
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
TAG="${1:-${RELEASE_TAG:-}}"
|
||||
if [[ -z "$TAG" ]]; then
|
||||
TAG="$(git -C "$ROOT" describe --tags --exact-match 2>/dev/null || git -C "$ROOT" describe --tags --always 2>/dev/null || true)"
|
||||
fi
|
||||
if [[ -z "$TAG" ]]; then
|
||||
echo "usage: $0 <tag>" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
TOKEN="${TELEGRAM_BOT_TOKEN:-}"
|
||||
CHAT="${TELEGRAM_CHAT_ID:-}"
|
||||
if [[ -z "$TOKEN" || -z "$CHAT" ]]; then
|
||||
echo "TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID are required" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
KIND="${RELEASE_KIND:-auto}"
|
||||
if [[ "$KIND" == "auto" ]]; then
|
||||
case "$TAG" in
|
||||
modules-v*) KIND="modules" ;;
|
||||
*) KIND="host" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
REPO_URL="${RELEASE_REPO_URL:-https://git.nulldrm.com/nulldrm/Null-DRM-Official}"
|
||||
URL="${RELEASE_URL:-${REPO_URL}/releases/tag/${TAG}}"
|
||||
|
||||
if [[ -n "${RELEASE_TITLE:-}" ]]; then
|
||||
TITLE="$RELEASE_TITLE"
|
||||
else
|
||||
TITLE="Null DRM ${TAG}"
|
||||
fi
|
||||
|
||||
if [[ -n "${RELEASE_BODY:-}" ]]; then
|
||||
BODY="$RELEASE_BODY"
|
||||
elif [[ "$KIND" == "modules" ]]; then
|
||||
BODY="<b>${TITLE}</b>
|
||||
Provider module zips: <code>bbc.zip</code>, <code>rte.zip</code>, <code>tg4.zip</code>
|
||||
|
||||
Unpack each into <code>modules/<name>/</code> and edit <code>module.yaml</code> for secrets.
|
||||
|
||||
<a href=\"${URL}\">Download ${TAG}</a>"
|
||||
else
|
||||
BODY="<b>${TITLE}</b>
|
||||
Host CLI (<code>drm</code>) + on-device MITM (<code>proxy-android-arm64</code>).
|
||||
|
||||
<a href=\"${URL}\">Download ${TAG}</a>"
|
||||
fi
|
||||
|
||||
if [[ "${DRY_RUN:-}" == "1" ]]; then
|
||||
echo "DRY_RUN chat=$CHAT tag=$TAG kind=$KIND"
|
||||
echo "----"
|
||||
echo "$BODY"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "[*] Telegram notify → chat $CHAT ($TAG)"
|
||||
RESP=$(curl -sS -X POST "https://api.telegram.org/bot${TOKEN}/sendMessage" \
|
||||
--data-urlencode "chat_id=${CHAT}" \
|
||||
--data-urlencode "text=${BODY}" \
|
||||
--data-urlencode "parse_mode=HTML" \
|
||||
--data-urlencode "disable_web_page_preview=false")
|
||||
|
||||
case "$RESP" in
|
||||
*"\"ok\":true"*|*"\"ok\": true"*)
|
||||
echo "[+] Telegram announce sent for $TAG"
|
||||
;;
|
||||
*)
|
||||
echo "Telegram API error:" >&2
|
||||
echo "$RESP" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Loading…
Add table
Add a link
Reference in a new issue