mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-09-23 01:53:59 +02:00
* feat(free_games_claimer): update upstream remaster to 1.6 Bumps the pinned Free-Games-Claimer-Remaster commit from 1.1 to the 1.6 release, adding the Ubisoft, Fab, AliExpress and Epic mobile stores, fixed daily scheduler times and the --accept-lang detection fix. Mirrors upstream's Chromium hardening (no-op xdg-open plus an AutoLaunchProtocolsFromOrigins managed policy) so app-scheme links cannot block the VNC session, and defaults upstream's release-update notification off because it advises "docker compose pull" instead of the add-on store. Closes #2990 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * feat(free_games_claimer): track upstream releases instead of a pinned commit The Dockerfile pinned upstream by commit SHA, which the repository updater cannot bump, so updater.json was paused and every upstream release needed a manual edit. Replaces the SHA with ARG BUILD_UPSTREAM="1.6" -- the repo-wide idiom the updater rewrites -- and downloads the matching v<version> source tarball. Unpauses updater.json and excludes upstream's development tags (v1.7d and similar), which carry no GitHub release. The add-on keeps its own 2.x version series: ha_version.py derives a strictly newer add-on version (2.1.0 -> 2.1.1) from a lower-sorting upstream tag, so Home Assistant still offers the update. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(free_games_claimer): survive an upstream tag naming change lastversion reports upstream's v1.7d development tag as release "1.7", for which GitHub serves no source archive; "github_exclude": "d" keeps it out of the updater's reach. As a second line of defence the build now also tries the tag name without the "v" prefix, so an unattended version bump cannot break the image build on a tag naming change alone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(free_games_claimer): make the description's store list explicitly partial The shortened description named a subset of the supported stores, which both review bots read as an inaccurate list. "and more" says the list is partial while keeping the line inside the 80 column limit. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(free_games_claimer): state the mutable-tag trade-off honestly The comment and README carried over a claim from the commit-pin era: that the image contents cannot change without a version bump. A release tag is mutable, so that is no longer true. Say what actually holds and why the trade-off is accepted. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(free_games_claimer): stop the upstream label guessing the tag form io.hass.upstream named the v-prefixed tag, which is wrong on the path where the build falls back to the unprefixed archive. Point it at the releases list, which is correct either way; the installed release is already recorded in updater.json, CHANGELOG.md and the startup banner. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
159 lines
5.3 KiB
Bash
Executable File
159 lines
5.3 KiB
Bash
Executable File
#!/usr/bin/env bashio
|
|
# shellcheck shell=bash
|
|
set -eo pipefail
|
|
|
|
CONFIG_FILE="/config/config.env"
|
|
if bashio::config.has_value 'CONFIG_LOCATION'; then
|
|
CONFIG_FILE="$(bashio::config 'CONFIG_LOCATION')"
|
|
fi
|
|
CONFIG_DIR="$(dirname "${CONFIG_FILE}")"
|
|
RUNTIME_CONFIG="/data/config.env"
|
|
|
|
mkdir -p "${CONFIG_DIR}" /data
|
|
|
|
# Recover from an old add-on bug that could create config.env as a directory.
|
|
if [ -d "${CONFIG_FILE}" ]; then
|
|
bashio::log.warning "Found a directory at ${CONFIG_FILE}; replacing it with a configuration file"
|
|
rm -rf "${CONFIG_FILE}"
|
|
fi
|
|
|
|
if [ ! -f "${CONFIG_FILE}" ]; then
|
|
install -m 0600 /templates/config.env "${CONFIG_FILE}"
|
|
bashio::log.warning \
|
|
"Created ${CONFIG_FILE}. Add account credentials there and restart the add-on if automatic login is required."
|
|
else
|
|
bashio::log.info "Using configuration from ${CONFIG_FILE}"
|
|
fi
|
|
|
|
# The remaster reads /fgc/data/config.env. /fgc/data is linked to Home
|
|
# Assistant's persistent /data volume by the Dockerfile.
|
|
install -m 0600 "${CONFIG_FILE}" "${RUNTIME_CONFIG}"
|
|
sed -i 's/\r$//' "${RUNTIME_CONFIG}"
|
|
|
|
# Export values needed by the VNC entrypoint as well as by the Python app.
|
|
set -a
|
|
# shellcheck source=/dev/null
|
|
source "${RUNTIME_CONFIG}"
|
|
set +a
|
|
|
|
# Upstream checks GitHub for newer releases and then tells the user to run
|
|
# "docker compose pull", which is wrong here: the add-on is updated through the
|
|
# Home Assistant add-on store. Default the check off, but honour an explicit
|
|
# NOTIFY_UPDATES from config.env.
|
|
export NOTIFY_UPDATES="${NOTIFY_UPDATES:-false}"
|
|
|
|
# The Home Assistant port mapping is intentionally kept at 6080 for a seamless
|
|
# upgrade from the previous add-on, even though the new upstream defaults to 7080.
|
|
if [ -n "${NOVNC_PORT:-}" ] && [ "${NOVNC_PORT}" != "6080" ]; then
|
|
bashio::log.warning "NOVNC_PORT=${NOVNC_PORT} is not supported by the add-on port mapping; using 6080"
|
|
fi
|
|
export NOVNC_PORT="6080"
|
|
export VNC_PORT="5900"
|
|
|
|
# Absolute paths from the former image pointed to its Firefox profile. The
|
|
# replacement uses Chromium profiles and must start with a separate directory.
|
|
if [ "${BROWSER_DIR:-}" = "/data/data/browser" ]; then
|
|
bashio::log.warning "Remapping legacy Firefox BROWSER_DIR to the remaster Chromium profile directory"
|
|
export BROWSER_DIR="data/browser"
|
|
fi
|
|
if [ "${SCREENSHOTS_DIR:-}" = "/data/data/screenshots" ]; then
|
|
export SCREENSHOTS_DIR="/fgc/data/screenshots"
|
|
fi
|
|
|
|
append_store() {
|
|
local store="${1}"
|
|
local current="${2}"
|
|
|
|
if [[ ",${current}," == *",${store},"* ]]; then
|
|
printf '%s' "${current}"
|
|
elif [ -n "${current}" ]; then
|
|
printf '%s,%s' "${current}" "${store}"
|
|
else
|
|
printf '%s' "${store}"
|
|
fi
|
|
}
|
|
|
|
legacy_commands_to_stores() {
|
|
local commands="${1}"
|
|
local selected=""
|
|
local command=""
|
|
local normalized=""
|
|
local command_list=()
|
|
|
|
IFS=';' read -ra command_list <<< "${commands}"
|
|
for command in "${command_list[@]}"; do
|
|
normalized="${command,,}"
|
|
case "${normalized}" in
|
|
*epic-games*|*epicgames*|*" epic"*|epic*)
|
|
selected="$(append_store "epic" "${selected}")"
|
|
;;
|
|
*prime-gaming*|*primegaming*|*" prime"*|prime*|*" amazon"*|amazon*)
|
|
selected="$(append_store "prime" "${selected}")"
|
|
;;
|
|
*steam-games*|*" steam"*|steam*)
|
|
selected="$(append_store "steam" "${selected}")"
|
|
;;
|
|
*gamerpower*)
|
|
selected="$(append_store "gamerpower" "${selected}")"
|
|
;;
|
|
*" gog"*|gog*)
|
|
selected="$(append_store "gog" "${selected}")"
|
|
;;
|
|
esac
|
|
done
|
|
|
|
printf '%s' "${selected}"
|
|
}
|
|
|
|
# A non-empty STORES add-on option takes priority. Otherwise retain a STORES
|
|
# value from config.env, then fall back to translating the legacy commands.
|
|
STORES_OPTION=""
|
|
if bashio::config.has_value 'STORES'; then
|
|
STORES_OPTION="$(bashio::config 'STORES')"
|
|
fi
|
|
if [ -n "${STORES_OPTION}" ]; then
|
|
export STORES="${STORES_OPTION}"
|
|
elif [ -z "${STORES:-}" ]; then
|
|
CMD_ARGUMENTS=""
|
|
if bashio::config.has_value 'CMD_ARGUMENTS'; then
|
|
CMD_ARGUMENTS="$(bashio::config 'CMD_ARGUMENTS')"
|
|
fi
|
|
STORES="$(legacy_commands_to_stores "${CMD_ARGUMENTS}")"
|
|
export STORES="${STORES:-epic,prime,gog}"
|
|
fi
|
|
|
|
bashio::log.info "Enabled stores: ${STORES:-epic,prime,gog}"
|
|
|
|
# Import claim history from vogler/free-games-claimer once. Legacy files and
|
|
# browser data are retained under /data/data for rollback and manual recovery.
|
|
/usr/local/bin/migrate_vogler_data.py
|
|
|
|
APP_COMMAND=(python3 /fgc/main.py)
|
|
RUN_ONCE="true"
|
|
if bashio::config.has_value 'RUN_ONCE' && ! bashio::config.true 'RUN_ONCE'; then
|
|
RUN_ONCE="false"
|
|
fi
|
|
if [ "${RUN_ONCE}" = "true" ]; then
|
|
APP_COMMAND+=(--once)
|
|
bashio::log.info "Starting a single claiming run (legacy-compatible mode)"
|
|
|
|
set +e
|
|
/usr/local/bin/docker-entrypoint.sh "${APP_COMMAND[@]}"
|
|
exit_code=$?
|
|
set -e
|
|
|
|
if [ "${exit_code}" -ne 0 ]; then
|
|
bashio::log.error "Free Games Claimer exited with status ${exit_code}"
|
|
else
|
|
bashio::log.info "Claiming run completed"
|
|
fi
|
|
|
|
bashio::log.info "Stopping the add-on"
|
|
sleep 2
|
|
bashio::addon.stop
|
|
exit "${exit_code}"
|
|
fi
|
|
|
|
bashio::log.info "Starting the built-in scheduler"
|
|
exec /usr/local/bin/docker-entrypoint.sh "${APP_COMMAND[@]}"
|