Merge pull request #318 from MacRimi/develop

New version 1.2.5
This commit is contained in:
MacRimi
2026-09-01 19:26:35 +02:00
committed by GitHub
288 changed files with 93734 additions and 8922 deletions
+138
View File
@@ -0,0 +1,138 @@
name: Build i18n messages
# Auto-translate missing keys in AppImage/messages/<locale>/common.json
# against the English source whenever the source changes.
#
# The Monitor's i18n layer (AppImage/lib/i18n/provider.tsx) does its own
# runtime fallback (locale → en → key), so this workflow doesn't break
# anything if it misses a key: it just eliminates the visible-English
# blocks in non-en locales.
#
# Guardrails baked into build_i18n_messages.py:
# - Never overwrites a key whose target value differs from EN (i.e.
# already translated by a human). This is what makes it safe to
# include sk in the default set: Vaso73's curated strings are
# protected end-to-end; auto only fills keys still on the EN
# fallback.
# - `{placeholder}` tokens are protected end-to-end.
#
# Triggers:
# - push to develop touching AppImage/messages/en/common.json
# - manual via workflow_dispatch
on:
push:
branches: [develop]
paths:
# Only en/ triggers the run — it's the source of truth. Other
# locales are destinations, and the bot auto-commits them at
# the end of every run; if they were in the trigger too, each
# auto-commit would fire another (empty) run.
# Manual edits to a curated locale that empty a key for the
# workflow to refill are the exception — dispatch this
# workflow manually from Actions in that case, or piggy-back
# a trivial en/ change onto the commit.
- 'AppImage/messages/en/common.json'
- '.github/scripts/build_i18n_messages.py'
- '.github/workflows/build-i18n-messages.yml'
workflow_dispatch:
inputs:
refresh:
description: 'Re-translate every key (overwrites human translations!)'
type: boolean
default: false
languages:
description: 'Comma-separated locales. Default: es,de,fr,it,pt,sk,sv (guardrail protects Vaso73 sk).'
default: 'es,de,fr,it,pt,sk,sv'
# Prevent two runs from racing on the same branch and fighting over the
# auto-commit. cancel-in-progress:false because a full first-run may take
# ~30 min for the initial bootstrap and interrupting mid-flight would
# waste the calls already made.
concurrency:
group: build-i18n-messages-${{ github.ref }}
cancel-in-progress: false
jobs:
translate:
runs-on: ubuntu-latest
permissions:
contents: write # auto-commit AppImage/messages/*/common.json to develop
# First-run bootstrap of ~5 locales × 3.8k keys can take a while at
# 0.15s/call with rate-limit backoffs. 90 min headroom.
timeout-minutes: 90
steps:
- name: Checkout develop
uses: actions/checkout@v4
with:
ref: develop
# Full history so the auto-commit doesn't drift when another
# push landed between trigger and this job start.
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install googletrans
run: |
python -m pip install --upgrade pip
# Same pinning as build-translation-cache.yml so the two
# workflows share behavior. Bump both in lockstep.
pip install 'googletrans==4.0.0-rc1' 'httpx==0.13.3' 'httpcore==0.9.1' 'h11==0.9.0'
- name: Translate missing keys
run: |
REFRESH_FLAG=""
if [[ "${{ github.event.inputs.refresh }}" == "true" ]]; then
REFRESH_FLAG="--refresh"
fi
LANGS="${{ github.event.inputs.languages }}"
# Keep this fallback in sync with the workflow_dispatch input
# default above AND with DEFAULT_LANGUAGES in the Python script —
# `push` triggers hit this branch (inputs are empty on push).
LANGS="${LANGS:-es,de,fr,it,pt,sk,sv}"
python .github/scripts/build_i18n_messages.py \
--source AppImage/messages/en/common.json \
--messages-dir AppImage/messages \
--languages "$LANGS" \
--provider googletrans \
$REFRESH_FLAG
- name: Commit + push if changed
run: |
if git diff --quiet -- AppImage/messages/; then
echo "No translation changes — skipping commit."
exit 0
fi
git config user.name "ProxMenuxBot"
git config user.email "bot@proxmenux.local"
git add AppImage/messages/
git commit -m "chore(i18n): auto-fill missing translations in messages/{locale}/common.json
Source: ${GITHUB_SHA::7}
Triggered by: ${{ github.event_name }}"
# Rebase-and-retry against develop: between the initial
# checkout and this push another workflow (e.g.
# build-translation-cache auto-commit) or a manual push can
# land on develop first, and a naked push fails with
# non-fast-forward — losing the freshly generated translation
# commit. Rebasing the local i18n commit on top of the newer
# HEAD is safe: paths don't overlap with cache/script
# workflows, and the same-branch collisions between two i18n
# runs are already blocked by the concurrency group above.
for attempt in 1 2 3 4 5; do
git fetch origin develop
if git rebase origin/develop && git push origin develop; then
echo "push succeeded on attempt ${attempt}"
exit 0
fi
echo "push attempt ${attempt} failed, retrying..."
git rebase --abort 2>/dev/null || true
sleep $(( attempt * 3 ))
done
echo "push failed after 5 attempts"
exit 1
+20 -1
View File
@@ -96,4 +96,23 @@ jobs:
Source: ${GITHUB_SHA::7}
Triggered by: ${{ github.event_name }}"
git push origin develop
# Rebase-and-retry against develop: between the initial
# checkout and this push another workflow (e.g.
# build-i18n-messages auto-commit) or a manual push can land
# on develop first, and a naked push fails with
# non-fast-forward — losing the freshly built cache commit.
# Paths don't overlap with the other workflows, and
# same-branch collisions between two cache runs are already
# blocked by the concurrency group.
for attempt in 1 2 3 4 5; do
git fetch origin develop
if git rebase origin/develop && git push origin develop; then
echo "push succeeded on attempt ${attempt}"
exit 0
fi
echo "push attempt ${attempt} failed, retrying..."
git rebase --abort 2>/dev/null || true
sleep $(( attempt * 3 ))
done
echo "push failed after 5 attempts"
exit 1
+119
View File
@@ -0,0 +1,119 @@
name: Build web documentation translations
on:
push:
branches: [develop]
paths:
- 'web/messages/en/*.json'
- 'web/messages/en/**/*.json'
- '.github/scripts/build_web_docs_i18n.py'
- '.github/scripts/build_translation_cache.py'
- '.github/workflows/build-web-docs-i18n.yml'
workflow_dispatch:
inputs:
languages:
description: 'Comma-separated locales'
default: 'es,de,fr,it,pt,sk,sv'
section:
description: 'File or directory below web/messages/en'
default: '.'
max_files:
description: 'Maximum pending files per locale; 0 means all'
default: '0'
refresh:
description: 'Overwrite existing translations in the selected scope'
type: boolean
default: false
dry_run:
description: 'Report pending coverage without writing files'
type: boolean
default: false
concurrency:
group: build-web-docs-i18n-${{ github.ref }}
cancel-in-progress: false
jobs:
translate:
runs-on: ubuntu-latest
permissions:
contents: write
timeout-minutes: 120
steps:
- name: Checkout develop
uses: actions/checkout@v4
with:
ref: develop
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install translation provider
run: |
python -m pip install --upgrade pip
pip install 'googletrans==4.0.0-rc1' 'httpx==0.13.3' 'httpcore==0.9.1' 'h11==0.9.0'
- name: Build missing translations
shell: bash
run: |
LANGUAGES="${{ github.event.inputs.languages }}"
LANGUAGES="${LANGUAGES:-es,de,fr,it,pt,sk,sv}"
SECTION="${{ github.event.inputs.section }}"
SECTION="${SECTION:-.}"
MAX_FILES="${{ github.event.inputs.max_files }}"
MAX_FILES="${MAX_FILES:-0}"
EXTRA_ARGS=()
if [[ "${{ github.event.inputs.refresh }}" == "true" ]]; then
EXTRA_ARGS+=(--refresh)
fi
if [[ "${{ github.event.inputs.dry_run }}" == "true" ]]; then
EXTRA_ARGS+=(--dry-run)
fi
python .github/scripts/build_web_docs_i18n.py \
--source-dir web/messages/en \
--messages-dir web/messages \
--languages "$LANGUAGES" \
--section "$SECTION" \
--max-files "$MAX_FILES" \
--provider googletrans \
--workers 4 \
"${EXTRA_ARGS[@]}"
- name: Validate catalogs
run: |
python .github/scripts/build_web_docs_i18n.py \
--source-dir web/messages/en \
--messages-dir web/messages \
--languages "${{ github.event.inputs.languages || 'es,de,fr,it,pt,sk,sv' }}" \
--check
- name: Commit and push changes
if: ${{ github.event.inputs.dry_run != 'true' }}
shell: bash
run: |
if git diff --quiet -- web/messages/; then
echo "No documentation translations changed."
exit 0
fi
git config user.name "ProxMenuxBot"
git config user.email "bot@proxmenux.local"
git add web/messages/
git commit -m "docs(i18n): update documentation translations"
for attempt in 1 2 3 4 5; do
git fetch origin develop
if git rebase origin/develop && git push origin develop; then
exit 0
fi
git rebase --abort 2>/dev/null || true
sleep $((attempt * 3))
done
exit 1
@@ -0,0 +1,164 @@
name: Update App Tracking Hints
on:
# Manual trigger from the Actions UI
workflow_dispatch:
# Re-merge whenever the generator, workflow, or the maintainer-
# curated runtime overrides change. `runtime_verified_overrides.json`
# is the file to edit when a real LXC reveals a canonical path the
# community-scripts helper doesn't ship (legacy /app/package.json,
# /opt/vaultwarden/bin/vaultwarden, etc.) — the generator folds it
# into the operational catalog every run.
push:
branches: [main]
paths:
- ".github/scripts/generate_app_tracking_catalog.py"
- ".github/workflows/update-app-tracking-hints.yml"
- "json/runtime_verified_overrides.json"
# Regen every 6h — picks up new community-scripts LXC apps and
# detector-relevant script edits without needing a manual trigger.
schedule:
- cron: "0 */6 * * *"
jobs:
update-hints:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: ⬇️ Checkout the repository
uses: actions/checkout@v6
- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: ⚙️ Generate app_tracking_hints.generated.json (intermediate)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# The generator writes 4 files; only `.generated.json` is
# consumed downstream by the merge step. The v2 catalog and
# per-app audit are useful for local review but not kept in
# the repo — written under /tmp so they never appear as
# dirty files here.
#
# `--runtime-overrides` folds real-CT evidence into the
# operational hints (canonical paths, cross-method fallbacks
# per app) so the runtime doesn't get fed helper-marker
# false-positives. Modern helper markers are included as their
# official version contract; runtime keeps them distinguishable from
# canonical package/binary/manual detectors for legacy compatibility.
run: |
python .github/scripts/generate_app_tracking_catalog.py \
--helpers-cache json/helpers_cache.json \
--existing json/app_tracking_hints.json \
--runtime-overrides json/runtime_verified_overrides.json \
--include-helper-markers \
--output json/app_tracking_hints.generated.json \
--v2-output /tmp/app_tracking_catalog.v2.json \
--audit-output /tmp/app_tracking_hints.audit.json
- name: 🧬 Smart-merge generated into app_tracking_hints.json
# Single source of truth: `app_tracking_hints.json` is the ONE
# file. It contains 3 kinds of entries:
# 1. Auto-verified from community-scripts (the generator
# manages every "generator-owned" field on these).
# 2. User-edited additions to those entries — extra fields
# the generator doesn't touch (default_ports,
# file_fallbacks, custom logo overrides…).
# 3. User-only entries the generator can't verify (Docker,
# AdGuard, Pi-hole, WireGuard, …) — left alone.
# Merge rule: for slugs the generator produces, refresh only
# the whitelisted fields; preserve everything else. For slugs
# NOT in the generator's output, keep the existing entry
# untouched.
run: |
python - <<'PY'
import json
from pathlib import Path
GEN = Path("json/app_tracking_hints.generated.json")
OUT = Path("json/app_tracking_hints.json")
# Fields owned by the generator — refreshed on every run.
# These are all populated deterministically by the generator
# (the audit script folds `runtime_verified_overrides.json`
# in as it runs), so a local hand-edit for a generator-known
# slug would get overwritten on the next tick. To add a new
# canonical path or a cross-method fallback for a slug the
# generator already knows, edit `runtime_verified_overrides
# .json` — that file IS the maintainer-controlled input.
#
# For user-only slugs (Docker, WireGuard, Pi-hole and any
# other entry not in the generator's output) EVERY field is
# preserved verbatim by the merge below — the whitelist only
# governs generator-covered slugs.
GENERATOR_FIELDS = {
"installed_via", "package", "file_path", "file_regex",
"binary_path", "binary_args", "python_path", "distribution",
"container_name", "label", "command_argv", "installed_version",
"repo", "github_source", "tag_regex", "installed_regex",
# Upstream source discriminator + per-type fields
# (http_json + docker_hub). Kept in the whitelist so a
# curated entry in runtime_verified_overrides.json can
# supply them and the smart merge won't drop them on the
# next regeneration.
"upstream_type", "upstream_url", "upstream_json_path",
"docker_image",
"logo", "website",
"default_ports", "file_fallbacks", "alt_detectors",
}
generated = json.loads(GEN.read_text(encoding="utf-8"))
existing = {}
if OUT.is_file():
try:
existing = json.loads(OUT.read_text(encoding="utf-8"))
if not isinstance(existing, dict):
existing = {}
except json.JSONDecodeError:
existing = {}
merged = {}
for slug, gen_entry in generated.items():
base = dict(existing.get(slug) or {})
# Refresh generator-owned fields (add/update).
for k, v in gen_entry.items():
if k in GENERATOR_FIELDS:
base[k] = v
# Drop generator-owned fields that the generator no
# longer emits for this slug (e.g. path renamed away).
for k in list(base):
if k in GENERATOR_FIELDS and k not in gen_entry:
del base[k]
merged[slug] = base
# Preserve user-only entries the generator can't verify.
for slug, entry in existing.items():
if slug not in generated and isinstance(entry, dict):
merged[slug] = dict(entry)
OUT.write_text(json.dumps(merged, indent=2, sort_keys=True) + "\n", encoding="utf-8")
added = sorted(set(generated) - set(existing))
removed = sorted(set(existing) - set(generated) - {s for s, e in existing.items() if not (
set(e.keys()) - GENERATOR_FIELDS
)})
print(f"merged: {len(merged)} entries "
f"(generated={len(generated)}, existing={len(existing)})")
if added:
print(f" new from generator: {len(added)}")
# Clean up the intermediate file so it doesn't get committed.
GEN.unlink()
PY
- name: 📤 Commit + push if changed
run: |
git config user.name "ProxMenuxBot"
git config user.email "bot@proxmenux.local"
git add json/app_tracking_hints.json
git diff --cached --quiet || git commit -m "Update app tracking hints"
git push