Update sqlpage app

Rebuilt-from-PR: #6309
Source-PR: https://github.com/okxlin/appstore/pull/6309
Maintainer-workflow: appstore-pr-maintainer
This commit is contained in:
okxlin
2026-08-31 17:02:33 +08:00
parent b61c9e0eee
commit ded145e48e
30 changed files with 258 additions and 626 deletions
-134
View File
@@ -1,134 +0,0 @@
additionalProperties:
formFields:
- default: 127.0.0.1
edit: true
envKey: PANEL_APP_BIND_ADDRESS
labelEn: Bind Address
labelZh: 绑定地址
label:
en: Bind Address
zh: 绑定地址
zh-Hant: 綁定位址
ja: バインドアドレス
ko: 바인드 주소
ru: Адрес привязки
ms: Alamat ikatan
pt-br: Endereco de vinculacao
required: true
type: text
- default: 8080
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: production
edit: true
envKey: SQLPAGE_ENVIRONMENT
labelEn: Runtime Environment
labelZh: 运行环境
label:
en: Runtime Environment
zh: 运行环境
zh-Hant: 執行環境
ja: 実行環境
ko: 실행 환경
ru: Среда выполнения
ms: Persekitaran masa jalan
pt-br: Ambiente de execucao
required: true
type: select
values:
- label: production
value: production
- label: development
value: development
- default: sqlpage=info
edit: true
envKey: LOG_LEVEL
labelEn: Log Level
labelZh: 日志级别
label:
en: Log Level
zh: 日志级别
zh-Hant: 日誌級別
ja: ログレベル
ko: 로그 수준
ru: Уровень журнала
ms: Tahap log
pt-br: Nivel de log
required: true
type: select
values:
- label: error
value: sqlpage=error
- label: warn
value: sqlpage=warn
- label: info
value: sqlpage=info
- label: debug
value: sqlpage=debug
- default: "false"
edit: true
envKey: SQLPAGE_COMPRESS_RESPONSES
labelEn: Compress Responses
labelZh: 压缩响应
label:
en: Compress Responses
zh: 压缩响应
zh-Hant: 壓縮回應
ja: レスポンスを圧縮
ko: 응답 압축
ru: Сжатие ответов
ms: Mampatkan respons
pt-br: Compactar respostas
required: true
type: select
values:
- label: "false"
value: "false"
- label: "true"
value: "true"
- default: 5242880
edit: true
envKey: SQLPAGE_MAX_UPLOADED_FILE_SIZE
labelEn: Maximum Upload Size (bytes)
labelZh: 最大上传大小(字节)
label:
en: Maximum Upload Size (bytes)
zh: 最大上传大小(字节)
zh-Hant: 最大上傳大小(位元組)
ja: 最大アップロードサイズ(バイト)
ko: 최대 업로드 크기(바이트)
ru: Максимальный размер загрузки (байт)
ms: Saiz muat naik maksimum (bait)
pt-br: Tamanho maximo de upload (bytes)
required: true
type: number
- default: ./data
edit: true
envKey: APP_DATA_DIR
labelEn: Website Data Directory
labelZh: 网站数据目录
label:
en: Website Data Directory
zh: 网站数据目录
zh-Hant: 網站資料目錄
ja: Web サイトデータディレクトリ
ko: 웹사이트 데이터 디렉터리
ru: Каталог данных сайта
ms: Direktori data laman web
pt-br: Diretorio de dados do site
required: true
type: text
-36
View File
@@ -1,36 +0,0 @@
services:
sqlpage:
image: "lovasoa/sqlpage:v0.45.0"
container_name: ${CONTAINER_NAME}
restart: unless-stopped
user: "1000:1000"
networks:
- 1panel-network
ports:
- "${PANEL_APP_BIND_ADDRESS}:${PANEL_APP_PORT_HTTP}:8080"
environment:
- SQLPAGE_WEB_ROOT=/var/www
- SQLPAGE_CONFIGURATION_DIRECTORY=/etc/sqlpage
- SQLPAGE_ENVIRONMENT=${SQLPAGE_ENVIRONMENT}
- LOG_LEVEL=${LOG_LEVEL}
- SQLPAGE_COMPRESS_RESPONSES=${SQLPAGE_COMPRESS_RESPONSES}
- SQLPAGE_MAX_UPLOADED_FILE_SIZE=${SQLPAGE_MAX_UPLOADED_FILE_SIZE}
- SQLPAGE_ALLOW_EXEC=false
- SQLPAGE_MARKDOWN_ALLOW_DANGEROUS_HTML=false
- SQLPAGE_MARKDOWN_ALLOW_DANGEROUS_PROTOCOL=false
volumes:
- "${APP_DATA_DIR}:/var/www"
- "./config:/etc/sqlpage:ro"
read_only: true
tmpfs:
- /tmp:rw,nosuid,nodev,noexec,size=32m,uid=1000,gid=1000,mode=1777
cap_drop:
- ALL
security_opt:
- no-new-privileges:true
labels:
createdBy: "Apps"
networks:
1panel-network:
external: true
-104
View File
@@ -1,104 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
ENV_FILE="${ENV_FILE:-${ROOT_DIR}/.env}"
TEMPLATE_DIR="${ROOT_DIR}/site-template"
fail() {
printf '%s\n' "$1" >&2
exit 1
}
strip_matching_quotes() {
local value="$1"
if [[ ${#value} -ge 2 ]]; then
if [[ "${value:0:1}" == '"' && "${value: -1}" == '"' ]]; then
value="${value:1:${#value}-2}"
elif [[ "${value:0:1}" == "'" && "${value: -1}" == "'" ]]; then
value="${value:1:${#value}-2}"
fi
fi
printf '%s\n' "$value"
}
read_env_value() {
local key="$1"
local value=""
if [[ -f "$ENV_FILE" ]]; then
value="$(grep -E "^${key}=" "$ENV_FILE" | tail -n 1 | cut -d '=' -f 2- || true)"
fi
value="${value%$'\r'}"
strip_matching_quotes "$value"
}
path_is_dotenv_safe() {
local value="$1"
case "$value" in
*$'\n'* | *$'\r'* | *\\* | *'$'* | *'#'* | *'"'* | *"'"*) return 1 ;;
*) return 0 ;;
esac
}
[[ -d "$TEMPLATE_DIR" ]] || fail "Starter template directory not found: ${TEMPLATE_DIR}"
if [[ ${APP_DATA_DIR+x} ]]; then
DATA_DIR_RAW="$APP_DATA_DIR"
else
DATA_DIR_RAW="$(read_env_value APP_DATA_DIR)"
fi
DATA_DIR_RAW="$(strip_matching_quotes "${DATA_DIR_RAW:-./data}")"
[[ -n "$DATA_DIR_RAW" ]] || fail "APP_DATA_DIR must not be empty"
path_is_dotenv_safe "$DATA_DIR_RAW" || fail "APP_DATA_DIR contains unsupported dotenv characters"
if [[ "$DATA_DIR_RAW" = /* ]]; then
[[ ! -L "$DATA_DIR_RAW" ]] || fail "APP_DATA_DIR must not be a symbolic link"
DATA_DIR_ABS="$(realpath -m -- "$DATA_DIR_RAW")"
[[ "$DATA_DIR_ABS" != "/" ]] || fail "APP_DATA_DIR must not be the filesystem root"
if [[ -e "$DATA_DIR_ABS" ]]; then
[[ -d "$DATA_DIR_ABS" ]] || fail "APP_DATA_DIR must be a directory"
[[ "$(stat -c '%u:%g' "$DATA_DIR_ABS")" == "1000:1000" ]] || \
fail "Existing absolute APP_DATA_DIR must be owned by UID/GID 1000:1000"
else
install -d -m 0750 -- "$DATA_DIR_ABS"
if [[ "$(id -u)" -eq 0 ]]; then
chown 1000:1000 -- "$DATA_DIR_ABS"
fi
fi
else
DATA_DIR_PATH="${ROOT_DIR}/${DATA_DIR_RAW#./}"
[[ ! -L "$DATA_DIR_PATH" ]] || fail "APP_DATA_DIR must not be a symbolic link"
DATA_DIR_ABS="$(realpath -m -- "$DATA_DIR_PATH")"
case "$DATA_DIR_ABS" in
"${ROOT_DIR}"/*) ;;
*) fail "Relative APP_DATA_DIR must remain inside the application version directory" ;;
esac
if [[ -e "$DATA_DIR_ABS" && ! -d "$DATA_DIR_ABS" ]]; then
fail "APP_DATA_DIR must be a directory"
fi
install -d -m 0750 -- "$DATA_DIR_ABS"
if [[ "$(id -u)" -eq 0 ]]; then
chown 1000:1000 -- "$DATA_DIR_ABS"
fi
fi
[[ "$(stat -c '%u:%g' "$DATA_DIR_ABS")" == "1000:1000" ]] || \
fail "APP_DATA_DIR must be owned by UID/GID 1000:1000"
for source_file in "${TEMPLATE_DIR}"/*.sql; do
target_file="${DATA_DIR_ABS}/${source_file##*/}"
[[ ! -L "$target_file" ]] || fail "Starter target must not be a symbolic link: ${target_file}"
if [[ -e "$target_file" ]]; then
[[ -f "$target_file" ]] || fail "Starter target must be a regular file: ${target_file}"
continue
fi
install -m 0644 -- "$source_file" "$target_file"
if [[ "$(id -u)" -eq 0 ]]; then
chown 1000:1000 -- "$target_file"
fi
done
@@ -1,4 +1,4 @@
CONTAINER_NAME=sqlpage
CONTAINER_NAME=sqlpage-compose-check
PANEL_APP_BIND_ADDRESS=127.0.0.1
PANEL_APP_PORT_HTTP=8080
SQLPAGE_ENVIRONMENT=production
+150
View File
@@ -0,0 +1,150 @@
additionalProperties:
formFields:
- default: 127.0.0.1
edit: true
envKey: PANEL_APP_BIND_ADDRESS
labelEn: Bind Address
labelZh: 绑定地址
label:
en: Bind Address
zh: 绑定地址
zh-Hant: 綁定位址
ja: バインドアドレス
ko: 바인드 주소
ru: Адрес привязки
ms: Alamat ikatan
pt-br: Endereco de vinculacao
required: true
type: text
- default: 8080
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: production
edit: true
envKey: SQLPAGE_ENVIRONMENT
labelEn: Runtime Environment
labelZh: 运行环境
label:
en: Runtime Environment
zh: 运行环境
zh-Hant: 執行環境
ja: 実行環境
ko: 실행 환경
ru: Среда выполнения
ms: Persekitaran masa jalan
pt-br: Ambiente de execucao
required: true
type: select
values:
- label: production
value: production
- label: development
value: development
- default: sqlpage=info
edit: true
envKey: LOG_LEVEL
labelEn: Log Level
labelZh: 日志级别
label:
en: Log Level
zh: 日志级别
zh-Hant: 日誌級別
ja: ログレベル
ko: 로그 수준
ru: Уровень журнала
ms: Tahap log
pt-br: Nivel de log
required: true
type: select
values:
- label: error
value: sqlpage=error
- label: warn
value: sqlpage=warn
- label: info
value: sqlpage=info
- label: debug
value: sqlpage=debug
- default: 'false'
edit: true
envKey: SQLPAGE_COMPRESS_RESPONSES
labelEn: Compress Responses
labelZh: 压缩响应
label:
en: Compress Responses
zh: 压缩响应
zh-Hant: 壓縮回應
ja: レスポンスを圧縮
ko: 응답 압축
ru: Сжатие ответов
ms: Mampatkan respons
pt-br: Compactar respostas
required: true
type: select
values:
- label: 'false'
value: 'false'
- label: 'true'
value: 'true'
- default: 5242880
edit: true
envKey: SQLPAGE_MAX_UPLOADED_FILE_SIZE
labelEn: Maximum Upload Size (bytes)
labelZh: 最大上传大小(字节)
label:
en: Maximum Upload Size (bytes)
zh: 最大上传大小(字节)
zh-Hant: 最大上傳大小(位元組)
ja: 最大アップロードサイズ(バイト)
ko: 최대 업로드 크기(바이트)
ru: Максимальный размер загрузки (байт)
ms: Saiz muat naik maksimum (bait)
pt-br: Tamanho maximo de upload (bytes)
required: true
type: number
- default: ./data
edit: true
envKey: APP_DATA_DIR
labelEn: Website Data Directory
labelZh: 网站数据目录
label:
en: Website Data Directory
zh: 网站数据目录
zh-Hant: 網站資料目錄
ja: Web サイトデータディレクトリ
ko: 웹사이트 데이터 디렉터리
ru: Каталог данных сайта
ms: Direktori data laman web
pt-br: Diretorio de dados do site
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 horário
required: true
type: text
@@ -1,6 +1,6 @@
services:
sqlpage:
image: "lovasoa/sqlpage:latest"
image: "lovasoa/sqlpage:v0.46.0"
container_name: ${CONTAINER_NAME}
restart: unless-stopped
user: "1000:1000"
+94
View File
@@ -0,0 +1,94 @@
#!/usr/bin/env bash
set -euo pipefail
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export PATH
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
ENV_FILE="${ENV_FILE:-$ROOT_DIR/.env}"
TEMPLATE_DIR="${ROOT_DIR}/site-template"
fail() {
printf '%s\n' "$1" >&2
exit 1
}
read_env_value() {
local key="$1"
[[ -f "$ENV_FILE" ]] || return 0
local value
value="$(sed -n "s/^${key}=//p" "$ENV_FILE" | tail -n 1)"
case "$value" in
\"*\") value="${value#\"}"; value="${value%\"}" ;;
\'*\') value="${value#\'}"; value="${value%\'}" ;;
esac
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"
}
[[ -d "$TEMPLATE_DIR" ]] || fail "Starter template directory not found: ${TEMPLATE_DIR}"
DATA_DIR_RAW="$(configured_value APP_DATA_DIR ./data)"
DATA_DIR_ABS="$(resolve_app_path APP_DATA_DIR "$DATA_DIR_RAW")"
install -d -m 0750 -- "$DATA_DIR_ABS"
if [[ "$(id -u)" -eq 0 ]]; then
chown 1000:1000 -- "$DATA_DIR_ABS"
fi
[[ "$(stat -c '%u:%g' "$DATA_DIR_ABS")" == "1000:1000" ]] || \
fail "APP_DATA_DIR must be owned by UID/GID 1000:1000"
for source_file in "${TEMPLATE_DIR}"/*.sql; do
target_file="${DATA_DIR_ABS}/${source_file##*/}"
[[ ! -L "$target_file" ]] || fail "Starter target must not be a symbolic link: ${target_file}"
if [[ -e "$target_file" ]]; then
[[ -f "$target_file" ]] || fail "Starter target must be a regular file: ${target_file}"
continue
fi
install -m 0644 -- "$source_file" "$target_file"
if [[ "$(id -u)" -eq 0 ]]; then
chown 1000:1000 -- "$target_file"
fi
done
+12 -13
View File
@@ -1,15 +1,25 @@
name: SQLPage
tags:
- 工具
- Tool
title: 完全由 SQL 驱动的动态网站构建器
description: 完全由 SQL 驱动的动态网站构建器
additionalProperties:
key: sqlpage
name: SQLPage
tags:
- Tool
- Tool
type: website
website: https://sql-page.com
document: https://sql-page.com/documentation.sql
github: https://github.com/sqlpage/SQLPage
shortDescZh: 完全由 SQL 驱动的动态网站构建器
shortDescEn: A dynamic website builder powered entirely by SQL
crossVersionUpdate: true
limit: 0
architectures:
- amd64
- arm64
- armv7
description:
en: A dynamic website builder powered entirely by SQL
zh: 完全由 SQL 驱动的动态网站构建器
@@ -19,14 +29,3 @@ additionalProperties:
ru: Конструктор динамических сайтов, полностью управляемый SQL
ms: Pembina laman web dinamik yang dikuasakan sepenuhnya oleh SQL
pt-br: Construtor de sites dinamicos totalmente orientado por SQL
type: website
crossVersionUpdate: true
limit: 0
recommend: 0
website: https://sql-page.com
github: https://github.com/sqlpage/SQLPage
document: https://sql-page.com/documentation.sql
architectures:
- amd64
- arm64
- armv7
-8
View File
@@ -1,8 +0,0 @@
CONTAINER_NAME=sqlpage
PANEL_APP_BIND_ADDRESS=127.0.0.1
PANEL_APP_PORT_HTTP=8080
SQLPAGE_ENVIRONMENT=production
LOG_LEVEL=sqlpage=info
SQLPAGE_COMPRESS_RESPONSES=false
SQLPAGE_MAX_UPLOADED_FILE_SIZE=5242880
APP_DATA_DIR=./data
@@ -1,5 +0,0 @@
create table todos(
id integer primary key,
title text not null,
created_at timestamp default current_timestamp
);
-3
View File
@@ -1,3 +0,0 @@
{
"database_url": "sqlite:///var/www/sqlpage.db?mode=rwc"
}
-134
View File
@@ -1,134 +0,0 @@
additionalProperties:
formFields:
- default: 127.0.0.1
edit: true
envKey: PANEL_APP_BIND_ADDRESS
labelEn: Bind Address
labelZh: 绑定地址
label:
en: Bind Address
zh: 绑定地址
zh-Hant: 綁定位址
ja: バインドアドレス
ko: 바인드 주소
ru: Адрес привязки
ms: Alamat ikatan
pt-br: Endereco de vinculacao
required: true
type: text
- default: 8080
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: production
edit: true
envKey: SQLPAGE_ENVIRONMENT
labelEn: Runtime Environment
labelZh: 运行环境
label:
en: Runtime Environment
zh: 运行环境
zh-Hant: 執行環境
ja: 実行環境
ko: 실행 환경
ru: Среда выполнения
ms: Persekitaran masa jalan
pt-br: Ambiente de execucao
required: true
type: select
values:
- label: production
value: production
- label: development
value: development
- default: sqlpage=info
edit: true
envKey: LOG_LEVEL
labelEn: Log Level
labelZh: 日志级别
label:
en: Log Level
zh: 日志级别
zh-Hant: 日誌級別
ja: ログレベル
ko: 로그 수준
ru: Уровень журнала
ms: Tahap log
pt-br: Nivel de log
required: true
type: select
values:
- label: error
value: sqlpage=error
- label: warn
value: sqlpage=warn
- label: info
value: sqlpage=info
- label: debug
value: sqlpage=debug
- default: "false"
edit: true
envKey: SQLPAGE_COMPRESS_RESPONSES
labelEn: Compress Responses
labelZh: 压缩响应
label:
en: Compress Responses
zh: 压缩响应
zh-Hant: 壓縮回應
ja: レスポンスを圧縮
ko: 응답 압축
ru: Сжатие ответов
ms: Mampatkan respons
pt-br: Compactar respostas
required: true
type: select
values:
- label: "false"
value: "false"
- label: "true"
value: "true"
- default: 5242880
edit: true
envKey: SQLPAGE_MAX_UPLOADED_FILE_SIZE
labelEn: Maximum Upload Size (bytes)
labelZh: 最大上传大小(字节)
label:
en: Maximum Upload Size (bytes)
zh: 最大上传大小(字节)
zh-Hant: 最大上傳大小(位元組)
ja: 最大アップロードサイズ(バイト)
ko: 최대 업로드 크기(바이트)
ru: Максимальный размер загрузки (байт)
ms: Saiz muat naik maksimum (bait)
pt-br: Tamanho maximo de upload (bytes)
required: true
type: number
- default: ./data
edit: true
envKey: APP_DATA_DIR
labelEn: Website Data Directory
labelZh: 网站数据目录
label:
en: Website Data Directory
zh: 网站数据目录
zh-Hant: 網站資料目錄
ja: Web サイトデータディレクトリ
ko: 웹사이트 데이터 디렉터리
ru: Каталог данных сайта
ms: Direktori data laman web
pt-br: Diretorio de dados do site
required: true
type: text
-104
View File
@@ -1,104 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
ENV_FILE="${ENV_FILE:-${ROOT_DIR}/.env}"
TEMPLATE_DIR="${ROOT_DIR}/site-template"
fail() {
printf '%s\n' "$1" >&2
exit 1
}
strip_matching_quotes() {
local value="$1"
if [[ ${#value} -ge 2 ]]; then
if [[ "${value:0:1}" == '"' && "${value: -1}" == '"' ]]; then
value="${value:1:${#value}-2}"
elif [[ "${value:0:1}" == "'" && "${value: -1}" == "'" ]]; then
value="${value:1:${#value}-2}"
fi
fi
printf '%s\n' "$value"
}
read_env_value() {
local key="$1"
local value=""
if [[ -f "$ENV_FILE" ]]; then
value="$(grep -E "^${key}=" "$ENV_FILE" | tail -n 1 | cut -d '=' -f 2- || true)"
fi
value="${value%$'\r'}"
strip_matching_quotes "$value"
}
path_is_dotenv_safe() {
local value="$1"
case "$value" in
*$'\n'* | *$'\r'* | *\\* | *'$'* | *'#'* | *'"'* | *"'"*) return 1 ;;
*) return 0 ;;
esac
}
[[ -d "$TEMPLATE_DIR" ]] || fail "Starter template directory not found: ${TEMPLATE_DIR}"
if [[ ${APP_DATA_DIR+x} ]]; then
DATA_DIR_RAW="$APP_DATA_DIR"
else
DATA_DIR_RAW="$(read_env_value APP_DATA_DIR)"
fi
DATA_DIR_RAW="$(strip_matching_quotes "${DATA_DIR_RAW:-./data}")"
[[ -n "$DATA_DIR_RAW" ]] || fail "APP_DATA_DIR must not be empty"
path_is_dotenv_safe "$DATA_DIR_RAW" || fail "APP_DATA_DIR contains unsupported dotenv characters"
if [[ "$DATA_DIR_RAW" = /* ]]; then
[[ ! -L "$DATA_DIR_RAW" ]] || fail "APP_DATA_DIR must not be a symbolic link"
DATA_DIR_ABS="$(realpath -m -- "$DATA_DIR_RAW")"
[[ "$DATA_DIR_ABS" != "/" ]] || fail "APP_DATA_DIR must not be the filesystem root"
if [[ -e "$DATA_DIR_ABS" ]]; then
[[ -d "$DATA_DIR_ABS" ]] || fail "APP_DATA_DIR must be a directory"
[[ "$(stat -c '%u:%g' "$DATA_DIR_ABS")" == "1000:1000" ]] || \
fail "Existing absolute APP_DATA_DIR must be owned by UID/GID 1000:1000"
else
install -d -m 0750 -- "$DATA_DIR_ABS"
if [[ "$(id -u)" -eq 0 ]]; then
chown 1000:1000 -- "$DATA_DIR_ABS"
fi
fi
else
DATA_DIR_PATH="${ROOT_DIR}/${DATA_DIR_RAW#./}"
[[ ! -L "$DATA_DIR_PATH" ]] || fail "APP_DATA_DIR must not be a symbolic link"
DATA_DIR_ABS="$(realpath -m -- "$DATA_DIR_PATH")"
case "$DATA_DIR_ABS" in
"${ROOT_DIR}"/*) ;;
*) fail "Relative APP_DATA_DIR must remain inside the application version directory" ;;
esac
if [[ -e "$DATA_DIR_ABS" && ! -d "$DATA_DIR_ABS" ]]; then
fail "APP_DATA_DIR must be a directory"
fi
install -d -m 0750 -- "$DATA_DIR_ABS"
if [[ "$(id -u)" -eq 0 ]]; then
chown 1000:1000 -- "$DATA_DIR_ABS"
fi
fi
[[ "$(stat -c '%u:%g' "$DATA_DIR_ABS")" == "1000:1000" ]] || \
fail "APP_DATA_DIR must be owned by UID/GID 1000:1000"
for source_file in "${TEMPLATE_DIR}"/*.sql; do
target_file="${DATA_DIR_ABS}/${source_file##*/}"
[[ ! -L "$target_file" ]] || fail "Starter target must not be a symbolic link: ${target_file}"
if [[ -e "$target_file" ]]; then
[[ -f "$target_file" ]] || fail "Starter target must be a regular file: ${target_file}"
continue
fi
install -m 0644 -- "$source_file" "$target_file"
if [[ "$(id -u)" -eq 0 ]]; then
chown 1000:1000 -- "$target_file"
fi
done
-4
View File
@@ -1,4 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
docker-compose down --volumes --remove-orphans
-5
View File
@@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
exec "${SCRIPT_DIR}/init.sh"
@@ -1,16 +0,0 @@
delete from todos
where id = $todo_id and $confirm = 'yes'
returning
'redirect' as component,
'/' as link;
select 'dynamic' as component, sqlpage.run_sql('shell.sql') as properties;
select
'alert' as component,
'red' as color,
'Confirm deletion' as title,
'Are you sure you want to delete the following todo item?\n\n> ' || title as description_md,
'?todo_id=' || $todo_id || '&confirm=yes' as link,
'Delete' as link_text
from todos where id = $todo_id;
@@ -1,20 +0,0 @@
select 'dynamic' as component, sqlpage.run_sql('shell.sql') as properties;
select 'list' as component,
'Todo' as title,
'No todo yet...' as empty_title;
select
title,
'todo_form.sql?todo_id=' || id as edit_link,
'delete.sql?todo_id=' || id as delete_link
from todos;
select
'button' as component,
'center' as justify;
select
'todo_form.sql' as link,
'green' as color,
'Add new todo' as title,
'circle-plus' as icon;
@@ -1,4 +0,0 @@
select 'shell' as component,
printf('Todo list (%d)', count(*)) as title,
'timeline' as menu_item
from todos;
@@ -1,12 +0,0 @@
select 'dynamic' as component, sqlpage.run_sql('shell.sql') as properties;
select 'timeline' as component;
select
title,
'todo_form.sql?todo_id=' || id as link,
created_at as date,
'calendar' as icon,
'green' as color,
printf('%d days ago', julianday('now') - julianday(created_at)) as description
from todos
order by created_at desc;
@@ -1,22 +0,0 @@
insert or replace into todos(id, title)
select $todo_id, :todo
where :todo is not null
returning
'redirect' as component,
'/' as link;
select 'dynamic' as component, sqlpage.run_sql('shell.sql') as properties;
select
'form' as component,
'Todo' as title,
case when $todo_id is null then
'Add new todo'
else
'Edit todo'
end as validate;
select
'Todo item' as label,
'todo' as name,
'What do you have to do?' as placeholder,
(select title from todos where id = $todo_id) as value;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB