diff --git a/apps/sqlpage/0.45.0/data.yml b/apps/sqlpage/0.45.0/data.yml deleted file mode 100644 index 93c75b405..000000000 --- a/apps/sqlpage/0.45.0/data.yml +++ /dev/null @@ -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 diff --git a/apps/sqlpage/0.45.0/docker-compose.yml b/apps/sqlpage/0.45.0/docker-compose.yml deleted file mode 100644 index 155b89b14..000000000 --- a/apps/sqlpage/0.45.0/docker-compose.yml +++ /dev/null @@ -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 diff --git a/apps/sqlpage/0.45.0/scripts/init.sh b/apps/sqlpage/0.45.0/scripts/init.sh deleted file mode 100755 index 79e38218b..000000000 --- a/apps/sqlpage/0.45.0/scripts/init.sh +++ /dev/null @@ -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 diff --git a/apps/sqlpage/0.45.0/.env.sample b/apps/sqlpage/0.46.0/.env.sample similarity index 84% rename from apps/sqlpage/0.45.0/.env.sample rename to apps/sqlpage/0.46.0/.env.sample index 396f68188..3952505c0 100644 --- a/apps/sqlpage/0.45.0/.env.sample +++ b/apps/sqlpage/0.46.0/.env.sample @@ -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 diff --git a/apps/sqlpage/0.45.0/config/migrations/0000_init.sql b/apps/sqlpage/0.46.0/config/migrations/0000_init.sql similarity index 100% rename from apps/sqlpage/0.45.0/config/migrations/0000_init.sql rename to apps/sqlpage/0.46.0/config/migrations/0000_init.sql diff --git a/apps/sqlpage/0.45.0/config/sqlpage.json b/apps/sqlpage/0.46.0/config/sqlpage.json similarity index 100% rename from apps/sqlpage/0.45.0/config/sqlpage.json rename to apps/sqlpage/0.46.0/config/sqlpage.json diff --git a/apps/sqlpage/0.46.0/data.yml b/apps/sqlpage/0.46.0/data.yml new file mode 100644 index 000000000..a952131a8 --- /dev/null +++ b/apps/sqlpage/0.46.0/data.yml @@ -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 diff --git a/apps/sqlpage/latest/docker-compose.yml b/apps/sqlpage/0.46.0/docker-compose.yml similarity index 96% rename from apps/sqlpage/latest/docker-compose.yml rename to apps/sqlpage/0.46.0/docker-compose.yml index 879b24e7e..0132cd512 100644 --- a/apps/sqlpage/latest/docker-compose.yml +++ b/apps/sqlpage/0.46.0/docker-compose.yml @@ -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" diff --git a/apps/sqlpage/0.46.0/scripts/init.sh b/apps/sqlpage/0.46.0/scripts/init.sh new file mode 100755 index 000000000..3bc3bf5e5 --- /dev/null +++ b/apps/sqlpage/0.46.0/scripts/init.sh @@ -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 diff --git a/apps/sqlpage/0.45.0/scripts/uninstall.sh b/apps/sqlpage/0.46.0/scripts/uninstall.sh similarity index 100% rename from apps/sqlpage/0.45.0/scripts/uninstall.sh rename to apps/sqlpage/0.46.0/scripts/uninstall.sh diff --git a/apps/sqlpage/0.45.0/scripts/upgrade.sh b/apps/sqlpage/0.46.0/scripts/upgrade.sh similarity index 100% rename from apps/sqlpage/0.45.0/scripts/upgrade.sh rename to apps/sqlpage/0.46.0/scripts/upgrade.sh diff --git a/apps/sqlpage/0.45.0/site-template/delete.sql b/apps/sqlpage/0.46.0/site-template/delete.sql similarity index 100% rename from apps/sqlpage/0.45.0/site-template/delete.sql rename to apps/sqlpage/0.46.0/site-template/delete.sql diff --git a/apps/sqlpage/0.45.0/site-template/index.sql b/apps/sqlpage/0.46.0/site-template/index.sql similarity index 100% rename from apps/sqlpage/0.45.0/site-template/index.sql rename to apps/sqlpage/0.46.0/site-template/index.sql diff --git a/apps/sqlpage/0.45.0/site-template/shell.sql b/apps/sqlpage/0.46.0/site-template/shell.sql similarity index 100% rename from apps/sqlpage/0.45.0/site-template/shell.sql rename to apps/sqlpage/0.46.0/site-template/shell.sql diff --git a/apps/sqlpage/0.45.0/site-template/timeline.sql b/apps/sqlpage/0.46.0/site-template/timeline.sql similarity index 100% rename from apps/sqlpage/0.45.0/site-template/timeline.sql rename to apps/sqlpage/0.46.0/site-template/timeline.sql diff --git a/apps/sqlpage/0.45.0/site-template/todo_form.sql b/apps/sqlpage/0.46.0/site-template/todo_form.sql similarity index 100% rename from apps/sqlpage/0.45.0/site-template/todo_form.sql rename to apps/sqlpage/0.46.0/site-template/todo_form.sql diff --git a/apps/sqlpage/data.yml b/apps/sqlpage/data.yml index f8cb5db0c..41eb1a37e 100644 --- a/apps/sqlpage/data.yml +++ b/apps/sqlpage/data.yml @@ -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 diff --git a/apps/sqlpage/latest/.env.sample b/apps/sqlpage/latest/.env.sample deleted file mode 100644 index 396f68188..000000000 --- a/apps/sqlpage/latest/.env.sample +++ /dev/null @@ -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 diff --git a/apps/sqlpage/latest/config/migrations/0000_init.sql b/apps/sqlpage/latest/config/migrations/0000_init.sql deleted file mode 100644 index f9d638a85..000000000 --- a/apps/sqlpage/latest/config/migrations/0000_init.sql +++ /dev/null @@ -1,5 +0,0 @@ -create table todos( - id integer primary key, - title text not null, - created_at timestamp default current_timestamp -); diff --git a/apps/sqlpage/latest/config/sqlpage.json b/apps/sqlpage/latest/config/sqlpage.json deleted file mode 100644 index d94aa8f8c..000000000 --- a/apps/sqlpage/latest/config/sqlpage.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "database_url": "sqlite:///var/www/sqlpage.db?mode=rwc" -} diff --git a/apps/sqlpage/latest/data.yml b/apps/sqlpage/latest/data.yml deleted file mode 100644 index 93c75b405..000000000 --- a/apps/sqlpage/latest/data.yml +++ /dev/null @@ -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 diff --git a/apps/sqlpage/latest/scripts/init.sh b/apps/sqlpage/latest/scripts/init.sh deleted file mode 100755 index 79e38218b..000000000 --- a/apps/sqlpage/latest/scripts/init.sh +++ /dev/null @@ -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 diff --git a/apps/sqlpage/latest/scripts/uninstall.sh b/apps/sqlpage/latest/scripts/uninstall.sh deleted file mode 100755 index c6af20129..000000000 --- a/apps/sqlpage/latest/scripts/uninstall.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -docker-compose down --volumes --remove-orphans diff --git a/apps/sqlpage/latest/scripts/upgrade.sh b/apps/sqlpage/latest/scripts/upgrade.sh deleted file mode 100755 index e73ce2436..000000000 --- a/apps/sqlpage/latest/scripts/upgrade.sh +++ /dev/null @@ -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" diff --git a/apps/sqlpage/latest/site-template/delete.sql b/apps/sqlpage/latest/site-template/delete.sql deleted file mode 100644 index 051348e2d..000000000 --- a/apps/sqlpage/latest/site-template/delete.sql +++ /dev/null @@ -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; diff --git a/apps/sqlpage/latest/site-template/index.sql b/apps/sqlpage/latest/site-template/index.sql deleted file mode 100644 index 812957835..000000000 --- a/apps/sqlpage/latest/site-template/index.sql +++ /dev/null @@ -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; diff --git a/apps/sqlpage/latest/site-template/shell.sql b/apps/sqlpage/latest/site-template/shell.sql deleted file mode 100644 index 5531a6d25..000000000 --- a/apps/sqlpage/latest/site-template/shell.sql +++ /dev/null @@ -1,4 +0,0 @@ -select 'shell' as component, - printf('Todo list (%d)', count(*)) as title, - 'timeline' as menu_item -from todos; diff --git a/apps/sqlpage/latest/site-template/timeline.sql b/apps/sqlpage/latest/site-template/timeline.sql deleted file mode 100644 index f472c2489..000000000 --- a/apps/sqlpage/latest/site-template/timeline.sql +++ /dev/null @@ -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; diff --git a/apps/sqlpage/latest/site-template/todo_form.sql b/apps/sqlpage/latest/site-template/todo_form.sql deleted file mode 100644 index 969069b60..000000000 --- a/apps/sqlpage/latest/site-template/todo_form.sql +++ /dev/null @@ -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; diff --git a/apps/sqlpage/logo.png b/apps/sqlpage/logo.png index e20fcb01c..63ff06f2b 100644 Binary files a/apps/sqlpage/logo.png and b/apps/sqlpage/logo.png differ