mirror of
https://github.com/okxlin/appstore.git
synced 2026-11-22 00:00:30 +00:00
Merge pull request #9199 from okxlin/renovate/aaronleopold-stump-0.x
Update aaronleopold/stump Docker tag to v0.1.14
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
CONTAINER_NAME=stump
|
||||
PANEL_APP_PORT_HTTP=10801
|
||||
CONFIG_PATH=./data/config
|
||||
LIBRARY_PATH=./data/library
|
||||
TZ=Asia/Shanghai
|
||||
@@ -0,0 +1,67 @@
|
||||
additionalProperties:
|
||||
formFields:
|
||||
- default: 10801
|
||||
edit: true
|
||||
envKey: PANEL_APP_PORT_HTTP
|
||||
labelEn: HTTP Port
|
||||
labelZh: HTTP 端口
|
||||
label:
|
||||
en: HTTP Port
|
||||
zh: HTTP 端口
|
||||
zh-Hant: HTTP 埠
|
||||
ja: HTTP ポート
|
||||
ko: HTTP 포트
|
||||
ru: HTTP-порт
|
||||
ms: Port HTTP
|
||||
pt-br: Porta HTTP
|
||||
required: true
|
||||
rule: paramPort
|
||||
type: number
|
||||
- default: ./data/config
|
||||
edit: true
|
||||
envKey: CONFIG_PATH
|
||||
labelEn: Config Directory
|
||||
labelZh: 配置目录
|
||||
label:
|
||||
en: Config Directory
|
||||
zh: 配置目录
|
||||
zh-Hant: 設定目錄
|
||||
ja: 設定ディレクトリ
|
||||
ko: 설정 디렉터리
|
||||
ru: Каталог конфигурации
|
||||
ms: Direktori konfigurasi
|
||||
pt-br: Diretorio de configuracao
|
||||
required: true
|
||||
type: text
|
||||
- default: ./data/library
|
||||
edit: true
|
||||
envKey: LIBRARY_PATH
|
||||
labelEn: Library Directory
|
||||
labelZh: 书库目录
|
||||
label:
|
||||
en: Library Directory
|
||||
zh: 书库目录
|
||||
zh-Hant: 書庫目錄
|
||||
ja: ライブラリディレクトリ
|
||||
ko: 라이브러리 디렉터리
|
||||
ru: Каталог библиотеки
|
||||
ms: Direktori pustaka
|
||||
pt-br: Diretorio da biblioteca
|
||||
required: true
|
||||
type: text
|
||||
- default: Asia/Shanghai
|
||||
edit: true
|
||||
envKey: TZ
|
||||
labelEn: Timezone
|
||||
labelZh: 时区
|
||||
label:
|
||||
en: Timezone
|
||||
zh: 时区
|
||||
zh-Hant: 時區
|
||||
ja: タイムゾーン
|
||||
ko: 시간대
|
||||
ru: Часовой пояс
|
||||
ms: Zon waktu
|
||||
pt-br: Fuso horario
|
||||
required: true
|
||||
type: text
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
services:
|
||||
stump:
|
||||
image: aaronleopold/stump:0.1.14
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: always
|
||||
networks:
|
||||
- 1panel-network
|
||||
ports:
|
||||
- "${PANEL_APP_PORT_HTTP}:10801"
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=${TZ}
|
||||
- STUMP_CONFIG_DIR=/config
|
||||
volumes:
|
||||
- "${CONFIG_PATH}:/config"
|
||||
- "${LIBRARY_PATH}:/data"
|
||||
labels:
|
||||
createdBy: "Apps"
|
||||
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if command -v docker-compose >/dev/null 2>&1; then
|
||||
docker-compose down --remove-orphans
|
||||
else
|
||||
docker compose down --remove-orphans
|
||||
fi
|
||||
Executable
+133
@@ -0,0 +1,133 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
|
||||
ENV_FILE="${ENV_FILE:-${ROOT_DIR}/.env}"
|
||||
TMP_FILE=""
|
||||
|
||||
fail() {
|
||||
printf '%s\n' "$1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
if [[ -n "$TMP_FILE" && -e "$TMP_FILE" ]]; then
|
||||
unlink -- "$TMP_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
trap cleanup EXIT HUP INT TERM
|
||||
|
||||
read_env_value() {
|
||||
local key="$1"
|
||||
local value=""
|
||||
|
||||
if [[ -f "$ENV_FILE" ]]; then
|
||||
value="$(awk -v key="$key" '
|
||||
$0 ~ "^[[:space:]]*" key "[[:space:]]*=" {
|
||||
line = $0
|
||||
sub("^[[:space:]]*" key "[[:space:]]*=[[:space:]]*", "", line)
|
||||
value = line
|
||||
}
|
||||
END { print value }
|
||||
' "$ENV_FILE")"
|
||||
fi
|
||||
|
||||
if [[ ${#value} -ge 2 && "${value:0:1}" == '"' && "${value: -1}" == '"' ]]; then
|
||||
value="${value:1:${#value}-2}"
|
||||
elif [[ ${#value} -ge 2 && "${value:0:1}" == "'" && "${value: -1}" == "'" ]]; then
|
||||
value="${value:1:${#value}-2}"
|
||||
fi
|
||||
printf '%s\n' "$value"
|
||||
}
|
||||
|
||||
configured_value() {
|
||||
local key="$1"
|
||||
local default_value="$2"
|
||||
local value
|
||||
value="${!key:-}"
|
||||
if [[ -z "$value" ]]; then
|
||||
value="$(read_env_value "$key")"
|
||||
fi
|
||||
printf '%s\n' "${value:-$default_value}"
|
||||
}
|
||||
|
||||
resolve_app_path() {
|
||||
local key="$1"
|
||||
local raw="$2"
|
||||
local clean candidate resolved current part
|
||||
local -a parts=()
|
||||
case "$raw" in
|
||||
""|/*|.|..|../*|*/../*|*/..) echo "unsafe ${key} path" >&2; return 1 ;;
|
||||
esac
|
||||
if [[ "$raw" =~ [[:cntrl:]] ]]; then
|
||||
echo "unsafe ${key} path" >&2
|
||||
return 1
|
||||
fi
|
||||
clean="${raw#./}"
|
||||
[[ -n "$clean" ]] || { echo "unsafe ${key} path" >&2; return 1; }
|
||||
command -v realpath >/dev/null 2>&1 || { echo "realpath is required" >&2; return 1; }
|
||||
candidate="$ROOT_DIR/$clean"
|
||||
resolved="$(realpath -m -- "$candidate")" || { echo "unsafe ${key} path" >&2; return 1; }
|
||||
case "$resolved" in
|
||||
"$ROOT_DIR"/*) ;;
|
||||
*) echo "unsafe ${key} path" >&2; return 1 ;;
|
||||
esac
|
||||
current="$ROOT_DIR"
|
||||
IFS='/' read -r -a parts <<< "$clean"
|
||||
for part in "${parts[@]}"; do
|
||||
[[ -z "$part" || "$part" == "." ]] && continue
|
||||
current="$current/$part"
|
||||
if [[ -L "$current" ]]; then
|
||||
echo "unsafe ${key} path" >&2
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
printf '%s\n' "$resolved"
|
||||
}
|
||||
|
||||
config_path="$(configured_value CONFIG_PATH "./data/config")"
|
||||
[[ "$config_path" != *'$'* ]] || fail "unsafe CONFIG_PATH path"
|
||||
[[ "$config_path" != *'`'* ]] || fail "unsafe CONFIG_PATH path"
|
||||
[[ "$config_path" != *';'* ]] || fail "unsafe CONFIG_PATH path"
|
||||
[[ "$config_path" != *'&'* ]] || fail "unsafe CONFIG_PATH path"
|
||||
[[ "$config_path" != *'|'* ]] || fail "unsafe CONFIG_PATH path"
|
||||
[[ "$config_path" != *'<'* ]] || fail "unsafe CONFIG_PATH path"
|
||||
[[ "$config_path" != *'>'* ]] || fail "unsafe CONFIG_PATH path"
|
||||
[[ "$config_path" != *'('* ]] || fail "unsafe CONFIG_PATH path"
|
||||
[[ "$config_path" != *')'* ]] || fail "unsafe CONFIG_PATH path"
|
||||
config_dir="$(resolve_app_path CONFIG_PATH "$config_path")"
|
||||
config_file="$config_dir/Stump.toml"
|
||||
[[ ! -L "$config_file" ]] || fail "Stump.toml must not be a symbolic link"
|
||||
[[ ! -e "$config_file" ]] && exit 0
|
||||
[[ -f "$config_file" ]] || fail "Stump.toml must be a regular file"
|
||||
|
||||
# Stump 0.1.9 replaced the old config loader. The generated 0.1.7 file has
|
||||
# one field that no longer exists; removing only that obsolete field preserves
|
||||
# the database and every user-configured setting.
|
||||
if ! grep -Eq '^[[:space:]]*profile[[:space:]]*=' -- "$config_file"; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
backup_file="${config_file}.pre-v0.1.9"
|
||||
if [[ -e "$backup_file" || -L "$backup_file" ]]; then
|
||||
[[ ! -L "$backup_file" && -f "$backup_file" ]] || fail "migration backup is not a regular file"
|
||||
cmp -s -- "$backup_file" "$config_file" || fail "migration backup already exists with different contents"
|
||||
else
|
||||
cp -p -- "$config_file" "$backup_file"
|
||||
fi
|
||||
|
||||
TMP_FILE="$(mktemp "${config_file}.tmp.XXXXXX")"
|
||||
awk '
|
||||
/^[[:space:]]*profile[[:space:]]*=/ { removed = 1; next }
|
||||
{ print }
|
||||
END {
|
||||
if (!removed) exit 2
|
||||
}
|
||||
' "$config_file" > "$TMP_FILE" || fail "failed to migrate Stump.toml"
|
||||
|
||||
grep -Eq '^[[:space:]]*profile[[:space:]]*=' -- "$TMP_FILE" && fail "obsolete profile setting remains"
|
||||
chmod --reference="$config_file" "$TMP_FILE"
|
||||
chown --reference="$config_file" "$TMP_FILE"
|
||||
mv -f -- "$TMP_FILE" "$config_file"
|
||||
TMP_FILE=""
|
||||
Reference in New Issue
Block a user