v2.4.0 — internationalization (EN/RU) + custom git templates

- i18n engine (lib/i18n.sh, lib/lang/en.sh, lib/lang/ru.sh)
- first-run language picker, persisted to .language + config.json
- install.sh, common.sh, backup.sh, templates_catalog.sh wired through t()/tf()
- backup.sh preserves .language marker and records language in metadata.json
- custom git template feature (first item in pro template picker)
  * validates HTTPS URLs, rejects shell metachars
  * 100MB size guard, 90s clone timeout
  * auto-detects index.html in dist/public/build/_site/site/docs/out/www
- bot v2.4.0: i18n.py + lang/{en,ru}.json, /lang command, language toggle button
- bot: custom git template via text input with waiter gating
This commit is contained in:
anten-ka
2026-04-10 11:48:37 +03:00
parent 3495ab5b0f
commit 32f204c871

View File

@@ -6,9 +6,11 @@ set -euo pipefail
REPO="anten-ka/gotelegram_pro" REPO="anten-ka/gotelegram_pro"
BRANCH="${GOTELEGRAM_BRANCH:-test}" BRANCH="${GOTELEGRAM_BRANCH:-test}"
PAT="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" PAT="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"
INSTALL_DIR="/opt/gotelegram" INSTALL_DIR="/opt/gotelegram"
API="https://api.github.com/repos/${REPO}/contents" # Use raw.githubusercontent.com (CDN) — faster and avoids Contents API caching
# issues that occasionally return 404 for recently added files on non-default branches.
RAW="https://raw.githubusercontent.com/${REPO}/${BRANCH}"
RED='\033[0;31m' RED='\033[0;31m'
GREEN='\033[0;32m' GREEN='\033[0;32m'
@@ -47,17 +49,20 @@ download_file() {
dir=$(dirname "$local_path") dir=$(dirname "$local_path")
mkdir -p "$dir" mkdir -p "$dir"
local http_code # Retry up to 3 times with short backoff to tolerate transient CDN hiccups
http_code=$(curl -sL -w "%{http_code}" -o "$local_path" \ local attempt http_code
-H "Authorization: token ${PAT}" \ for attempt in 1 2 3; do
-H "Accept: application/vnd.github.raw" \ http_code=$(curl -sL -w "%{http_code}" -o "$local_path" \
"${API}/${remote_path}?ref=${BRANCH}") -H "Authorization: token ${PAT}" \
"${RAW}/${remote_path}")
if [ "$http_code" = "200" ]; then
return 0
fi
sleep 1
done
if [ "$http_code" != "200" ]; then echo -e " ${RED}${NC} Ошибка загрузки ${remote_path} (HTTP ${http_code})"
echo -e " ${RED}${NC} Ошибка загрузки ${remote_path} (HTTP ${http_code})" return 1
return 1
fi
return 0
} }
# File list # File list