Native install: mandatory install directory, UI delivered from the repository
- install.sh always asks for the install directory (--prefix or a prompt with confirmation, no default); refuses system directories, the repository checkout itself, paths inside/containing it and non-empty directories (a resumed install is allowed). A preflight refusal says nothing was changed. - UI is part of the repository: committed build in deploy/ui-dist with SOURCE_HASH and a staleness guard (check-ui.sh, loud warning). install.sh and update.sh resolve the UI: --ui-dist FILE|DIR, --build-ui, committed build; install stops without a UI unless --no-ui. update.sh swaps the UI when its hash differs from the installed one (.ui-source-hash). - build-ui.sh: --docker, --local (host Node >= 20.19, temporary copy), --node-download (portable Node, SHA-256 verified), --publish. - Verified on Alpine 3.23: install without UI options installs the real UI; local build equals the Docker build; update skips an unchanged UI and warns on a stale build. --node-download is untested (needs network). - Docs: Scenario 2 guide, change summary, plan, README. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4abd2044f0
commit
8371d889a4
31 files changed
+920
-114
No files matched your search
+282
-46
@@ -1,70 +1,306 @@
|
||||
#!/bin/sh
|
||||
# Build the web UI (APP_UI, Vue/Vite) in a Node 20 container into a tarball for install.sh / update.sh.
|
||||
# Build the web UI (APP_UI, Vue/Vite) into a tarball and/or into the repository (deploy/ui-dist).
|
||||
#
|
||||
# deploy/native/build-ui.sh [-o FILE] [--image IMAGE]
|
||||
# deploy/native/build-ui.sh [--docker | --local [--node-download]] [-o FILE] [--publish]
|
||||
# [--image IMAGE] [--repo DIR] [--check]
|
||||
#
|
||||
# -o FILE output tarball (default: deploy/native/ui-dist.tar.gz); its top level is the content of dist/
|
||||
# --image IMAGE Node image (default node:20-alpine, or OVPMON_NODE_IMAGE)
|
||||
# --docker build in a Node 20 container (needs Docker on the build machine)
|
||||
# --local build with the Node of this machine (>= 20.19 and npm), no container
|
||||
# --node-download with --local: download the official Node 20 (glibc, x86_64/aarch64) into a temporary
|
||||
# directory, verify its SHA-256, build with it and delete it (nothing is installed;
|
||||
# needs curl, tar and xz; not for Alpine/musl: there use apk add nodejs npm)
|
||||
# --publish refresh deploy/ui-dist/ and its SOURCE_HASH in the repository (maintainer step before
|
||||
# committing UI changes); without -o no tarball is written then
|
||||
# -o FILE output tarball (default without --publish: deploy/native/ui-dist.tar.gz); its top level is
|
||||
# the content of dist/ plus SOURCE_HASH
|
||||
# --image IMAGE Node image for --docker (default node:20-alpine, or OVPMON_NODE_IMAGE)
|
||||
# --repo DIR build another checkout of the repository (default: the one this script is in)
|
||||
# --check only check that the chosen builder is usable, build nothing
|
||||
#
|
||||
# Needs Docker on the machine that builds (not on the target host, which needs no Node at all).
|
||||
# Nothing is written into the source tree: APP_UI is mounted read-only and copied inside the
|
||||
# container; only the output file is created. Then, on the target host:
|
||||
# Without --docker/--local: Docker when the daemon works, otherwise the local Node.
|
||||
# Nothing is written into the source tree: the build runs on a copy of APP_UI (a container sees it read-only;
|
||||
# --local copies it into a temporary directory and runs npm ci there), only the outputs are created.
|
||||
# SOURCE_HASH is the hash of the UI sources (lib.sh ui_source_hash); install.sh and update.sh compare it with
|
||||
# the current sources. On the target host, use the build directly or pass the tarball:
|
||||
# deploy/native/install.sh --ui-dist deploy/native/ui-dist.tar.gz
|
||||
# deploy/native/update.sh --ui-dist deploy/native/ui-dist.tar.gz
|
||||
# See DOCS/Deployment/Scenario2_System_Services.md
|
||||
set -eu
|
||||
|
||||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
ROOT_DIR=$(cd "$SCRIPT_DIR/../.." && pwd)
|
||||
. "$SCRIPT_DIR/lib.sh"
|
||||
DEPLOY_LOG="" # a build tool is not a deployment: no entries in the deploy log
|
||||
|
||||
log() { printf '%s %s\n' "$(date -u '+%Y-%m-%d %H:%M:%S')" "$*"; }
|
||||
warn() { log "WARNING: $*" >&2; }
|
||||
die() { log "ERROR: $*" >&2; exit 1; }
|
||||
usage() { sed -n '2,14p' "$0" | sed 's/^# \{0,1\}//'; }
|
||||
usage() { sed -n '2,/^set -eu$/{/^set -eu$/!p}' "$0" | sed 's/^# \{0,1\}//'; }
|
||||
|
||||
OUT="$SCRIPT_DIR/ui-dist.tar.gz"
|
||||
OUT=""
|
||||
IMAGE="${OVPMON_NODE_IMAGE:-node:20-alpine}"
|
||||
MODE=""
|
||||
NODE_DL=0
|
||||
PUBLISH=0
|
||||
CHECK_ONLY=0
|
||||
REPO="$ROOT_DIR"
|
||||
NODE_MAJOR="${OVPMON_NODE_MAJOR:-20}"
|
||||
WORK=""
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-o) [ $# -ge 2 ] || die "-o needs a value"; OUT="$2"; shift 2 ;;
|
||||
--image) [ $# -ge 2 ] || die "--image needs a value"; IMAGE="$2"; shift 2 ;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
*) usage >&2; die "unknown option: $1" ;;
|
||||
-o) [ $# -ge 2 ] || die "-o needs a value"; OUT="$2"; shift 2 ;;
|
||||
--image) [ $# -ge 2 ] || die "--image needs a value"; IMAGE="$2"; shift 2 ;;
|
||||
--repo) [ $# -ge 2 ] || die "--repo needs a value"; REPO="$2"; shift 2 ;;
|
||||
--docker) [ "$MODE" != local ] || die "--docker and --local exclude each other"; MODE=docker; shift ;;
|
||||
--local) [ "$MODE" != docker ] || die "--docker and --local exclude each other"; MODE=local; shift ;;
|
||||
--node-download) NODE_DL=1; shift ;;
|
||||
--publish) PUBLISH=1; shift ;;
|
||||
--check) CHECK_ONLY=1; shift ;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
*) usage >&2; die "unknown option: $1" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
command -v docker >/dev/null 2>&1 || die "docker not found in PATH. This script builds the UI in a Node 20 container; install Docker on the build machine (the target host does not need it), or build APP_UI yourself (npm install && npm run build) and pack the content of dist/ as a .tar.gz with index.html at its top level"
|
||||
docker info >/dev/null 2>&1 || die "the Docker daemon is not running or not accessible for this user (start it, use sudo or join the docker group)"
|
||||
[ -f "$ROOT_DIR/APP_UI/package.json" ] || die "APP_UI/package.json not found in $ROOT_DIR"
|
||||
REPO=$(cd "$REPO" 2>/dev/null && pwd) || die "--repo: directory not found"
|
||||
ROOT_DIR="$REPO"
|
||||
APP_UI="$REPO/APP_UI"
|
||||
[ -f "$APP_UI/package.json" ] || die "APP_UI/package.json not found in $REPO"
|
||||
|
||||
case "$OUT" in /*) ;; *) OUT="$PWD/$OUT" ;; esac
|
||||
OUT_DIR=$(dirname "$OUT")
|
||||
OUT_NAME=$(basename "$OUT")
|
||||
mkdir -p "$OUT_DIR"
|
||||
OUT_DIR=$(cd "$OUT_DIR" && pwd)
|
||||
TMP_NAME=".$OUT_NAME.tmp.$$"
|
||||
trap 'rm -f "$OUT_DIR/$TMP_NAME"' EXIT
|
||||
cleanup() {
|
||||
_rc=$?
|
||||
set +e
|
||||
[ -z "$WORK" ] || rm -rf "$WORK"
|
||||
[ -z "${OUT_TMP:-}" ] || rm -f "$OUT_TMP"
|
||||
exit "$_rc"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
trap 'exit 130' INT
|
||||
trap 'exit 143' TERM
|
||||
|
||||
log "building the UI with $IMAGE (APP_UI is mounted read-only, nothing is written into the source tree)"
|
||||
# npm ci when a lock file exists (reproducible), npm install otherwise (as the all-in-one Dockerfile)
|
||||
docker run --rm \
|
||||
-v "$ROOT_DIR/APP_UI":/src:ro \
|
||||
-v "$OUT_DIR":/out \
|
||||
-e TMP_NAME="$TMP_NAME" -e HOST_UID="$(id -u)" -e HOST_GID="$(id -g)" \
|
||||
"$IMAGE" sh -c '
|
||||
set -eu
|
||||
mkdir /build
|
||||
tar -C /src --exclude=node_modules --exclude=dist -cf - . | tar -C /build -xf -
|
||||
cd /build
|
||||
if [ -f package-lock.json ]; then npm ci --no-audit --no-fund; else npm install --no-audit --no-fund; fi
|
||||
npm run build
|
||||
[ -f dist/index.html ] || { echo "build produced no dist/index.html" >&2; exit 1; }
|
||||
tar -czf "/out/$TMP_NAME" -C dist .
|
||||
chown "$HOST_UID:$HOST_GID" "/out/$TMP_NAME"
|
||||
' || die "the UI build failed (see the output above)"
|
||||
# ---------------------------------------------------------------------------------------------
|
||||
# Builder selection and prerequisites
|
||||
# ---------------------------------------------------------------------------------------------
|
||||
docker_ready() { command -v docker >/dev/null 2>&1 && docker info >/dev/null 2>&1; }
|
||||
|
||||
tar -tzf "$OUT_DIR/$TMP_NAME" | grep -q -E '^(\./)?index\.html$' || die "the archive has no index.html"
|
||||
mv "$OUT_DIR/$TMP_NAME" "$OUT"
|
||||
trap - EXIT
|
||||
log "UI archive written: $OUT ($(du -h "$OUT" | awk '{print $1}'))"
|
||||
log "use it with: deploy/native/install.sh --ui-dist $OUT or deploy/native/update.sh --ui-dist $OUT"
|
||||
if [ "$NODE_DL" = 1 ]; then
|
||||
[ "$MODE" != docker ] || die "--node-download is for --local builds, not for --docker"
|
||||
MODE=local
|
||||
fi
|
||||
if [ -z "$MODE" ]; then
|
||||
if docker_ready; then MODE=docker; else MODE=local; fi
|
||||
fi
|
||||
|
||||
# node_ok NODE_BINARY: runs and is Node 20.19 or newer (the minimum of the Vite version of APP_UI)
|
||||
node_ok() {
|
||||
local v maj rest min
|
||||
v=$("$1" --version 2>/dev/null) || return 1
|
||||
v=${v#v}; maj=${v%%.*}; rest=${v#*.}; min=${rest%%.*}
|
||||
case "$maj$min" in ""|*[!0-9]*) return 1 ;; esac
|
||||
[ "$maj" -gt 20 ] || { [ "$maj" -eq 20 ] && [ "$min" -ge 19 ]; }
|
||||
}
|
||||
|
||||
is_musl() {
|
||||
[ -e /etc/alpine-release ] && return 0
|
||||
ls /lib/ld-musl-* >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# node_help: how to get a usable Node on this OS (printed before the script stops)
|
||||
node_help() {
|
||||
local id like
|
||||
id=""; like=""
|
||||
if [ -r /etc/os-release ]; then
|
||||
id=$( . /etc/os-release; printf '%s' "${ID:-}" )
|
||||
like=$( . /etc/os-release; printf '%s' "${ID_LIKE:-}" )
|
||||
fi
|
||||
printf '%s\n' "How to get Node.js >= 20.19 with npm on this machine:" >&2
|
||||
case "$id $like" in
|
||||
*alpine*)
|
||||
printf '%s\n' " Alpine: apk add nodejs npm (then check: node --version, it must be 20.19 or newer)" >&2
|
||||
printf '%s\n' " --node-download does not work on Alpine (the official binaries are glibc, Alpine is musl)" >&2 ;;
|
||||
*debian*|*ubuntu*)
|
||||
printf '%s\n' " Debian/Ubuntu: the distribution's Node is usually too old (Debian 12 and Ubuntu 24.04: Node 18)." >&2
|
||||
printf '%s\n' " Either add --node-download (needs: apt-get install -y curl xz-utils; nothing is installed)," >&2
|
||||
printf '%s\n' " or install Node 20+ (with npm) from https://nodejs.org/ or the NodeSource repository." >&2 ;;
|
||||
*)
|
||||
printf '%s\n' " Install Node.js 20.19 or newer with npm (https://nodejs.org/), or use --docker on a machine with Docker." >&2 ;;
|
||||
esac
|
||||
printf '%s\n' " Without any of this: build on another machine with Docker and copy the tarball (-o FILE) here." >&2
|
||||
}
|
||||
|
||||
check_local() {
|
||||
if [ "$NODE_DL" = 1 ]; then
|
||||
[ "$(uname -s)" = Linux ] || die "--node-download supports Linux only"
|
||||
if is_musl; then
|
||||
node_help
|
||||
die "--node-download is not possible on Alpine/musl: the official Node binaries need glibc (apk add nodejs npm)"
|
||||
fi
|
||||
case "$(uname -m)" in
|
||||
x86_64|amd64) NODE_ARCH=x64 ;;
|
||||
aarch64|arm64) NODE_ARCH=arm64 ;;
|
||||
*) die "--node-download: unsupported CPU architecture $(uname -m) (x86_64 and aarch64 only)" ;;
|
||||
esac
|
||||
for _c in curl tar xz; do
|
||||
command -v "$_c" >/dev/null 2>&1 || die "--node-download needs $_c (Debian/Ubuntu: apt-get install -y curl xz-utils)"
|
||||
done
|
||||
return 0
|
||||
fi
|
||||
if ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then
|
||||
node_help
|
||||
die "node and npm are not installed (needed for --local)"
|
||||
fi
|
||||
if ! node_ok node; then
|
||||
node_help
|
||||
die "the installed Node is too old: $(node --version 2>&1) (needed: 20.19 or newer)"
|
||||
fi
|
||||
}
|
||||
|
||||
check_docker() {
|
||||
command -v docker >/dev/null 2>&1 || die "docker not found in PATH. Install Docker on the build machine (the target host does not need it), or use --local (Node 20.19+, or --node-download)"
|
||||
docker info >/dev/null 2>&1 || die "the Docker daemon is not running or not accessible for this user (start it, use sudo or join the docker group), or use --local"
|
||||
}
|
||||
|
||||
if [ "$MODE" = docker ]; then check_docker; else check_local; fi
|
||||
if [ "$CHECK_ONLY" = 1 ]; then
|
||||
if [ "$MODE" = docker ]; then log "builder ready: Docker ($IMAGE)"
|
||||
elif [ "$NODE_DL" = 1 ]; then log "builder ready: official Node $NODE_MAJOR will be downloaded into a temporary directory (linux-$NODE_ARCH)"
|
||||
else log "builder ready: local Node $(node --version) with npm $(npm --version)"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$PUBLISH" = 1 ]; then
|
||||
[ -d "$REPO/deploy" ] || die "--publish needs the repository checkout ($REPO/deploy not found)"
|
||||
elif [ -z "$OUT" ]; then
|
||||
OUT="$SCRIPT_DIR/ui-dist.tar.gz"
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------------------------
|
||||
# Build: both modes leave $WORK/ui.tar.gz (content of dist/ plus SOURCE_HASH)
|
||||
# ---------------------------------------------------------------------------------------------
|
||||
WORK=$(mktemp -d "${TMPDIR:-/tmp}/ovpmon-ui-build.XXXXXX") || die "cannot create a temporary directory"
|
||||
chmod 755 "$WORK"
|
||||
TAR="$WORK/ui.tar.gz"
|
||||
HASH=$(ui_source_hash "$APP_UI") || die "cannot compute the hash of the UI sources ($APP_UI/src missing, or no sha256sum/shasum)"
|
||||
log "UI sources: $APP_UI (hash $HASH)"
|
||||
|
||||
# fetch_node: official Node 20 (latest-v20.x) into $WORK/node; the archive is verified against SHASUMS256.txt
|
||||
fetch_node() {
|
||||
local base sums line want file got
|
||||
base="https://nodejs.org/dist/latest-v${NODE_MAJOR}.x"
|
||||
sums="$WORK/SHASUMS256.txt"
|
||||
log "downloading $base/SHASUMS256.txt"
|
||||
curl -fsSL --retry 3 --connect-timeout 20 -o "$sums" "$base/SHASUMS256.txt" \
|
||||
|| die "cannot download $base/SHASUMS256.txt (no network access to nodejs.org?)"
|
||||
line=$(grep -E "^[0-9a-f]{64} node-v${NODE_MAJOR}\.[0-9]+\.[0-9]+-linux-${NODE_ARCH}\.tar\.xz\$" "$sums" | head -n 1 || true)
|
||||
[ -n "$line" ] || die "no node-v${NODE_MAJOR}.*-linux-${NODE_ARCH}.tar.xz entry in $base/SHASUMS256.txt"
|
||||
want=$(printf '%s' "$line" | cut -c1-64)
|
||||
file=$(printf '%s' "$line" | cut -c67-)
|
||||
log "downloading $base/$file"
|
||||
curl -fsSL --retry 3 --connect-timeout 20 -o "$WORK/$file" "$base/$file" || die "cannot download $base/$file"
|
||||
got=$(sha256_run "$WORK/$file" | awk '{ print $1 }')
|
||||
[ "$got" = "$want" ] || die "SHA-256 of $file does not match SHASUMS256.txt (expected $want, got $got): the download is not used"
|
||||
log "SHA-256 verified: $file"
|
||||
mkdir -p "$WORK/node"
|
||||
xz -dc "$WORK/$file" | tar -xf - -C "$WORK/node" || die "cannot unpack $file"
|
||||
rm -f "$WORK/$file"
|
||||
NODE_BIN=$(ls -d "$WORK"/node/node-v*/bin 2>/dev/null | head -n 1 || true)
|
||||
[ -n "$NODE_BIN" ] && [ -x "$NODE_BIN/node" ] || die "the unpacked Node has no bin/node"
|
||||
node_ok "$NODE_BIN/node" || die "the downloaded Node is not usable here or older than 20.19: $("$NODE_BIN/node" --version 2>&1 || true)"
|
||||
log "using the downloaded Node $("$NODE_BIN/node" --version) (temporary, deleted after the build)"
|
||||
}
|
||||
|
||||
build_local() {
|
||||
local e name
|
||||
mkdir -p "$WORK/src"
|
||||
# copy of APP_UI without node_modules and dist: the source tree stays untouched
|
||||
for e in "$APP_UI"/* "$APP_UI"/.[!.]*; do
|
||||
[ -e "$e" ] || [ -L "$e" ] || continue
|
||||
name=$(basename "$e")
|
||||
case "$name" in node_modules|dist) continue ;; esac
|
||||
cp -R "$e" "$WORK/src/"
|
||||
done
|
||||
if [ "$NODE_DL" = 1 ]; then
|
||||
fetch_node
|
||||
PATH="$NODE_BIN:$PATH"
|
||||
export PATH
|
||||
export npm_config_cache="$WORK/npm-cache" # nothing is left on the host
|
||||
fi
|
||||
cd "$WORK/src"
|
||||
log "building the UI with the local Node $(node --version), npm $(npm --version)"
|
||||
if [ -f package-lock.json ]; then
|
||||
npm ci --no-audit --no-fund || die "npm ci failed (see the output above)"
|
||||
else
|
||||
npm install --no-audit --no-fund || die "npm install failed (see the output above)"
|
||||
fi
|
||||
npm run build || die "npm run build failed (see the output above)"
|
||||
[ -f dist/index.html ] || die "the build produced no dist/index.html"
|
||||
printf '%s\n' "$HASH" > dist/SOURCE_HASH
|
||||
tar -czf "$TAR" -C dist .
|
||||
cd "$WORK"
|
||||
}
|
||||
|
||||
build_docker() {
|
||||
log "building the UI with $IMAGE (APP_UI is mounted read-only, nothing is written into the source tree)"
|
||||
# npm ci when a lock file exists (reproducible), npm install otherwise (as the all-in-one Dockerfile)
|
||||
docker run --rm \
|
||||
-v "$APP_UI":/src:ro \
|
||||
-v "$WORK":/out \
|
||||
-e SOURCE_HASH="$HASH" -e HOST_UID="$(id -u)" -e HOST_GID="$(id -g)" \
|
||||
"$IMAGE" sh -c '
|
||||
set -eu
|
||||
mkdir /build
|
||||
tar -C /src --exclude=node_modules --exclude=dist -cf - . | tar -C /build -xf -
|
||||
cd /build
|
||||
if [ -f package-lock.json ]; then npm ci --no-audit --no-fund; else npm install --no-audit --no-fund; fi
|
||||
npm run build
|
||||
[ -f dist/index.html ] || { echo "build produced no dist/index.html" >&2; exit 1; }
|
||||
printf "%s\n" "$SOURCE_HASH" > dist/SOURCE_HASH
|
||||
tar -czf /out/ui.tar.gz -C dist .
|
||||
chown "$HOST_UID:$HOST_GID" /out/ui.tar.gz
|
||||
' || die "the UI build failed (see the output above)"
|
||||
}
|
||||
|
||||
if [ "$MODE" = docker ]; then build_docker; else build_local; fi
|
||||
|
||||
tar -tzf "$TAR" | grep -q -E '^(\./)?index\.html$' || die "the archive has no index.html"
|
||||
[ "$(ui_hash_of "$TAR")" = "$HASH" ] || die "the archive has no valid SOURCE_HASH"
|
||||
|
||||
# ---------------------------------------------------------------------------------------------
|
||||
# Outputs
|
||||
# ---------------------------------------------------------------------------------------------
|
||||
if [ -n "$OUT" ]; then
|
||||
case "$OUT" in /*) ;; *) OUT="$PWD/$OUT" ;; esac
|
||||
mkdir -p "$(dirname "$OUT")"
|
||||
OUT_TMP="$(dirname "$OUT")/.$(basename "$OUT").tmp.$$"
|
||||
cp "$TAR" "$OUT_TMP" && mv "$OUT_TMP" "$OUT" || die "cannot write $OUT"
|
||||
log "UI archive written: $OUT ($(du -h "$OUT" | awk '{print $1}'))"
|
||||
log "use it with: deploy/native/install.sh --ui-dist $OUT or deploy/native/update.sh --ui-dist $OUT"
|
||||
fi
|
||||
|
||||
if [ "$PUBLISH" = 1 ]; then
|
||||
DEST="$REPO/deploy/ui-dist"
|
||||
NEW="$REPO/deploy/.ui-dist.new.$$"
|
||||
OLD="$REPO/deploy/.ui-dist.old.$$"
|
||||
rm -rf "$NEW"
|
||||
mkdir -p "$NEW"
|
||||
tar -xzf "$TAR" -C "$NEW" --no-same-owner || { rm -rf "$NEW"; die "cannot unpack the build for publishing"; }
|
||||
chmod -R go-w,a+rX "$NEW"
|
||||
# the old directory is moved aside first, so a failure never leaves a half-written deploy/ui-dist
|
||||
if [ -e "$DEST" ]; then mv "$DEST" "$OLD" || { rm -rf "$NEW"; die "cannot replace $DEST"; }; fi
|
||||
if ! mv "$NEW" "$DEST"; then
|
||||
[ ! -e "$OLD" ] || mv "$OLD" "$DEST"
|
||||
rm -rf "$NEW"
|
||||
die "cannot move the new build to $DEST (the previous one was restored)"
|
||||
fi
|
||||
rm -rf "$OLD"
|
||||
ui_repo_state "$REPO" || true
|
||||
if [ "$UI_STATE" = fresh ]; then
|
||||
log "published: $DEST (SOURCE_HASH $HASH); the build matches the APP_UI sources"
|
||||
else
|
||||
warn "published, but the check against the sources says '$UI_STATE': were the sources changed during the build? Run deploy/native/check-ui.sh"
|
||||
fi
|
||||
if command -v git >/dev/null 2>&1 && git -C "$REPO" check-ignore -q deploy/ui-dist/index.html 2>/dev/null; then
|
||||
warn "deploy/ui-dist is ignored by git (.gitignore): it cannot be committed"
|
||||
fi
|
||||
log "now commit it together with the UI change: git add deploy/ui-dist"
|
||||
fi
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
# Check that the committed UI build (deploy/ui-dist) matches the UI sources (APP_UI).
|
||||
#
|
||||
# deploy/native/check-ui.sh [REPO_DIR]
|
||||
#
|
||||
# Prints fresh, stale or missing. Exit code: 0 fresh, 1 stale (the build is older than the sources: run
|
||||
# deploy/native/build-ui.sh --publish and commit deploy/ui-dist), 2 missing or not checkable.
|
||||
# Run it before a commit or a release that touches APP_UI. It changes nothing.
|
||||
# See DOCS/Deployment/Scenario2_System_Services.md
|
||||
set -eu
|
||||
|
||||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
. "$SCRIPT_DIR/lib.sh"
|
||||
DEPLOY_LOG=""
|
||||
|
||||
case "${1:-}" in
|
||||
-h|--help) sed -n '2,/^set -eu$/{/^set -eu$/!p}' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
|
||||
esac
|
||||
REPO=$(cd "${1:-$ROOT_DIR}" 2>/dev/null && pwd) || { echo "error: directory not found: ${1:-}" >&2; exit 2; }
|
||||
|
||||
rc=0
|
||||
ui_repo_state "$REPO" || rc=1
|
||||
if [ "$rc" = 1 ]; then
|
||||
echo "error: cannot compute the hash of $REPO/APP_UI (sources missing, or no sha256sum/shasum)" >&2
|
||||
exit 2
|
||||
fi
|
||||
case "$UI_STATE" in
|
||||
fresh)
|
||||
echo "fresh: deploy/ui-dist matches the APP_UI sources (hash $UI_CUR_HASH)"
|
||||
exit 0 ;;
|
||||
stale)
|
||||
echo "stale: $(ui_stale_lines | head -n 1)"
|
||||
ui_stale_lines | sed -n '2,$p' | sed 's/^/ /'
|
||||
exit 1 ;;
|
||||
*)
|
||||
echo "missing: no committed UI build in $REPO/deploy/ui-dist (index.html)"
|
||||
echo " Maintainers: run deploy/native/build-ui.sh --publish and commit deploy/ui-dist."
|
||||
exit 2 ;;
|
||||
esac
|
||||
+110
-23
@@ -1,12 +1,22 @@
|
||||
#!/bin/sh
|
||||
# Install OpenVPN Monitor & Profiler as system services (no containers): Alpine (OpenRC), Debian, Ubuntu (systemd).
|
||||
#
|
||||
# deploy/native/install.sh [--prefix DIR] [--ui-dist FILE] [--https-port N] [--host-name NAME]
|
||||
# [--admin-user NAME] [--force]
|
||||
# deploy/native/install.sh [--prefix DIR] [--ui-dist FILE|DIR | --build-ui [--node-download] | --no-ui]
|
||||
# [--https-port N] [--host-name NAME] [--admin-user NAME] [--force]
|
||||
#
|
||||
# --prefix install directory (default /opt/OpenVPN-Monitoring-Simple): APP_CORE, APP_PROFILER, venvs
|
||||
# --ui-dist UI tarball made by deploy/native/build-ui.sh (the host needs no Node). Without it a
|
||||
# placeholder page is installed; add the UI later with update.sh --ui-dist
|
||||
# --prefix install directory (APP_CORE, APP_PROFILER, venvs). REQUIRED: without the option the script
|
||||
# asks for it (no default is assumed). It must be a new or empty directory, different from
|
||||
# this repository checkout (the checkout is only the source) and not a system directory
|
||||
# --ui-dist UI tarball made by deploy/native/build-ui.sh, or a directory with index.html (the host
|
||||
# needs no Node). Highest priority
|
||||
# --build-ui build the UI now from APP_UI (Docker when it works, otherwise Node >= 20.19 on this host);
|
||||
# for a host where the committed build is stale or missing
|
||||
# --node-download with --build-ui: fetch a temporary official Node 20 (checksum verified, glibc only,
|
||||
# needs curl and xz) instead of the system Node; nothing is installed
|
||||
# --no-ui install a placeholder page instead of the UI (on purpose)
|
||||
# Without these options the committed build deploy/ui-dist of the repository is installed
|
||||
# automatically (a warning is printed when it is older than APP_UI); when there is no UI
|
||||
# source at all the install stops
|
||||
# --https-port HTTPS port of the web UI (default 8088)
|
||||
# --host-name DNS name or IP of this host: certificate name and CORS origin (default: detected address)
|
||||
# --admin-user login of the initial administrator (default: admin); the password is generated
|
||||
@@ -22,11 +32,14 @@ SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
. "$SCRIPT_DIR/lib.sh"
|
||||
|
||||
usage() {
|
||||
sed -n '2,18p' "$0" | sed 's/^# \{0,1\}//'
|
||||
sed -n '2,/^set -eu$/{/^set -eu$/!p}' "$0" | sed 's/^# \{0,1\}//'
|
||||
}
|
||||
|
||||
PREFIX="$DEFAULT_PREFIX"
|
||||
PREFIX=""
|
||||
UI_DIST=""
|
||||
UI_BUILD=0
|
||||
UI_NODE_DL=0
|
||||
NO_UI=0
|
||||
HTTPS_PORT=8088
|
||||
HOST_NAME=""
|
||||
ADMIN_USER="admin"
|
||||
@@ -37,6 +50,9 @@ while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--prefix) [ $# -ge 2 ] || die "--prefix needs a value"; PREFIX="$2"; shift 2 ;;
|
||||
--ui-dist) [ $# -ge 2 ] || die "--ui-dist needs a value"; UI_DIST="$2"; shift 2 ;;
|
||||
--build-ui) UI_BUILD=1; shift ;;
|
||||
--node-download) UI_NODE_DL=1; shift ;;
|
||||
--no-ui) NO_UI=1; shift ;;
|
||||
--https-port) [ $# -ge 2 ] || die "--https-port needs a value"; HTTPS_PORT="$2"; shift 2 ;;
|
||||
--host-name) [ $# -ge 2 ] || die "--host-name needs a value"; HOST_NAME="$2"; shift 2 ;;
|
||||
--admin-user) [ $# -ge 2 ] || die "--admin-user needs a value"; ADMIN_USER="$2"; shift 2 ;;
|
||||
@@ -46,7 +62,68 @@ while [ $# -gt 0 ]; do
|
||||
esac
|
||||
done
|
||||
|
||||
valid_prefix "$PREFIX" || die "invalid --prefix '$PREFIX' (absolute path of letters, digits, . _ - and /)"
|
||||
SRC="$ROOT_DIR"
|
||||
|
||||
# prefix_problem DIR: prints why DIR cannot be the install directory (nothing = acceptable).
|
||||
# The install directory gets mkdir/chmod 755 and root-owned code: it must be a dedicated place.
|
||||
prefix_problem() {
|
||||
local d n sabs
|
||||
d="$1"
|
||||
valid_prefix "$d" || { echo "not an absolute path of letters, digits, . _ - and /"; return; }
|
||||
# normalise: no trailing slash, no double slash, no . or .. segments
|
||||
case "$d" in *//*|*/./*|*/../*|*/.|*/..|*/) echo "write the path without //, ., .. or a trailing /"; return ;; esac
|
||||
case "$d" in
|
||||
/|/bin|/boot|/dev|/etc|/home|/lib|/lib64|/media|/mnt|/opt|/proc|/root|/run|/sbin|/srv|/sys|/tmp|/usr|/var|/usr/local|/usr/lib|/var/lib|/var/log|/var/www|/etc/openvpn|/etc/ovpmon)
|
||||
echo "a system directory (the installer changes its permissions); choose a dedicated directory, e.g. $DEFAULT_PREFIX"; return ;;
|
||||
esac
|
||||
sabs=$(abs_dir "$SRC")
|
||||
[ "$d" != "$sabs" ] || { echo "this is the repository checkout itself ($sabs): the checkout is only the source of the installation. Choose another directory, or move/clone the repository elsewhere"; return; }
|
||||
case "$d/" in "$sabs"/*) echo "inside the repository checkout ($sabs): choose a directory outside of it"; return ;; esac
|
||||
case "$sabs/" in "$d"/*) echo "the repository checkout ($sabs) is inside it: choose a directory that does not contain the checkout"; return ;; esac
|
||||
if [ -e "$d" ] && [ ! -d "$d" ]; then echo "exists and is not a directory"; return; fi
|
||||
if [ -d "$d" ] && [ ! -f "$INCOMPLETE_MARK" ]; then
|
||||
n=$(ls -A "$d" 2>/dev/null | wc -l)
|
||||
[ "$n" -eq 0 ] || { echo "already exists and is not empty (an installation, or other data). To upgrade an installation use update.sh; otherwise choose a new directory"; return; }
|
||||
fi
|
||||
}
|
||||
|
||||
# The install directory is always asked for: it decides where the code, the PKI and the client profiles
|
||||
# live, and it is not something to guess. Without a terminal it must be given with --prefix.
|
||||
ask_prefix() {
|
||||
local ans tries p
|
||||
[ -t 0 ] || die "--prefix DIR is required (no terminal to ask on). Example: --prefix $DEFAULT_PREFIX"
|
||||
echo "Install directory: where APP_CORE, APP_PROFILER and their virtualenvs are installed."
|
||||
echo "The PKI and the client profiles live below it. It must be a new or empty directory outside"
|
||||
echo "this repository checkout ($ROOT_DIR). Suggestion: $DEFAULT_PREFIX"
|
||||
tries=0
|
||||
while [ "$tries" -lt 3 ]; do
|
||||
printf 'Install directory (absolute path): '
|
||||
read -r ans || die "no input: --prefix DIR is required"
|
||||
if [ -z "$ans" ]; then
|
||||
echo " an install directory is required (type the path; there is no default)"
|
||||
else
|
||||
p=$(prefix_problem "$ans")
|
||||
if [ -z "$p" ]; then
|
||||
PREFIX="$ans"
|
||||
printf 'Install into %s ? [y/N] ' "$PREFIX"
|
||||
read -r ans || die "no input"
|
||||
case "$ans" in y|Y|yes|YES) return 0 ;; esac
|
||||
echo " not confirmed"
|
||||
else
|
||||
echo " not accepted: $p"
|
||||
fi
|
||||
fi
|
||||
tries=$((tries + 1))
|
||||
done
|
||||
die "no valid install directory given"
|
||||
}
|
||||
|
||||
if [ -z "$PREFIX" ]; then
|
||||
ask_prefix
|
||||
else
|
||||
_problem=$(prefix_problem "$PREFIX")
|
||||
[ -z "$_problem" ] || die "invalid --prefix '$PREFIX': $_problem"
|
||||
fi
|
||||
valid_port "$HTTPS_PORT" || die "invalid --https-port '$HTTPS_PORT'"
|
||||
case "$ADMIN_USER" in
|
||||
""|*[!A-Za-z0-9._-]*) die "invalid --admin-user (letters, digits, . _ - only)" ;;
|
||||
@@ -55,14 +132,19 @@ case "$HOST_NAME" in
|
||||
*[!A-Za-z0-9.-]*) die "invalid --host-name (letters, digits, . and - only)" ;;
|
||||
esac
|
||||
[ -z "$UI_DIST" ] || case "$UI_DIST" in /*) ;; *) UI_DIST="$PWD/$UI_DIST" ;; esac
|
||||
SRC="$ROOT_DIR"
|
||||
[ "$UI_NODE_DL" = 0 ] || [ "$UI_BUILD" = 1 ] || die "--node-download only works together with --build-ui"
|
||||
[ "$NO_UI" = 0 ] || { [ -z "$UI_DIST" ] && [ "$UI_BUILD" = 0 ]; } || die "--no-ui excludes --ui-dist and --build-ui"
|
||||
[ -z "$UI_DIST" ] || [ "$UI_BUILD" = 0 ] || die "use either --ui-dist or --build-ui, not both"
|
||||
|
||||
on_exit() {
|
||||
_rc=$?
|
||||
set +e
|
||||
trap '' INT TERM
|
||||
if [ "$_rc" -ne 0 ]; then
|
||||
log "install stopped in phase '$CURRENT_PHASE'. Nothing is lost: fix the cause and run the script again (it resumes; existing secrets, certificates and data are kept)" >&2
|
||||
case "$CURRENT_PHASE" in
|
||||
start|0*) log "install stopped in phase '$CURRENT_PHASE': nothing was changed on this system" >&2 ;;
|
||||
*) log "install stopped in phase '$CURRENT_PHASE'. Nothing is lost: fix the cause and run the script again with the same --prefix (it resumes; existing secrets, certificates and data are kept)" >&2 ;;
|
||||
esac
|
||||
fi
|
||||
[ -z "${TMPD:-}" ] || rm -rf "$TMPD"
|
||||
release_lock
|
||||
@@ -95,15 +177,9 @@ fi
|
||||
|
||||
[ -f "$SRC/APP_CORE/openvpn_api_v3.py" ] && [ -f "$SRC/APP_PROFILER/main.py" ] \
|
||||
|| die "run the script from a complete checkout of the repository (APP_CORE and APP_PROFILER not found in $SRC)"
|
||||
if [ -z "$UI_DIST" ] && [ -f "$SCRIPT_DIR/ui-dist.tar.gz" ]; then
|
||||
UI_DIST="$SCRIPT_DIR/ui-dist.tar.gz"
|
||||
log "using the UI archive $UI_DIST"
|
||||
fi
|
||||
if [ -n "$UI_DIST" ]; then
|
||||
check_ui_archive "$UI_DIST"
|
||||
else
|
||||
warn "no --ui-dist: a placeholder page is installed instead of the web UI (build it with deploy/native/build-ui.sh, then update.sh --ui-dist FILE)"
|
||||
fi
|
||||
# UI source order (ui_resolve, run below after the cheap checks): --ui-dist, --build-ui, the committed
|
||||
# deploy/ui-dist, an archive next to the scripts. Nothing found: stop, unless --no-ui
|
||||
UI_FALLBACK="$SCRIPT_DIR/ui-dist.tar.gz"
|
||||
|
||||
# ports: ours may already be bound when the script is resumed
|
||||
if svc_active ovpmon-api 2>/dev/null; then
|
||||
@@ -119,6 +195,16 @@ if port_in_use 1194 udp; then log "note: 1194/udp is in use; OpenVPN uses the po
|
||||
check_free "$PREFIX" "$MIN_FREE_PREFIX_MB" "the installation (code and virtualenvs)"
|
||||
check_free /var/lib 256 "data"
|
||||
|
||||
if [ "$NO_UI" = 1 ]; then
|
||||
warn "--no-ui: only a placeholder page is installed instead of the web UI (update.sh installs the UI from the repository later)"
|
||||
else
|
||||
ui_resolve "$SRC" "$TMPD"
|
||||
if [ -z "$UI_SRC" ]; then
|
||||
die "no UI source found: there is no --ui-dist, no committed build in $SRC/deploy/ui-dist and no archive $UI_FALLBACK. Choose one: --build-ui (builds from APP_UI with Docker or Node 20.19+, add --node-download for a temporary Node), --ui-dist FILE|DIR (built elsewhere with deploy/native/build-ui.sh), or --no-ui (placeholder page on purpose). A complete clone of the repository contains deploy/ui-dist"
|
||||
fi
|
||||
log "UI: $UI_ORIGIN"
|
||||
fi
|
||||
|
||||
mkdir -p "$ETC_DIR"
|
||||
chmod 755 "$ETC_DIR"
|
||||
: > "$INCOMPLETE_MARK"
|
||||
@@ -300,16 +386,16 @@ log "services enabled at boot: $SERVICES"
|
||||
|
||||
# UI files
|
||||
mkdir -p "$(dirname "$WEB_ROOT")"
|
||||
if [ -n "$UI_DIST" ]; then
|
||||
stage_ui "$UI_DIST" "$WEB_ROOT.new"
|
||||
if [ -n "$UI_SRC" ]; then
|
||||
stage_ui "$UI_SRC" "$WEB_ROOT.new"
|
||||
swap_dir "$WEB_ROOT.new" "$WEB_ROOT" "$WEB_ROOT.old"
|
||||
rm -rf "$WEB_ROOT.old"
|
||||
log "UI files installed to $WEB_ROOT from $UI_DIST"
|
||||
log "UI files installed to $WEB_ROOT: $UI_ORIGIN"
|
||||
elif [ ! -f "$WEB_ROOT/index.html" ]; then
|
||||
mkdir -p "$WEB_ROOT"
|
||||
cat > "$WEB_ROOT/index.html" <<'EOF'
|
||||
<!doctype html><meta charset="utf-8"><title>OpenVPN Monitor</title>
|
||||
<h1>OpenVPN Monitor</h1><p>The web UI is not installed yet. Build it with deploy/native/build-ui.sh and run deploy/native/update.sh --ui-dist FILE.</p>
|
||||
<h1>OpenVPN Monitor</h1><p>The web UI is not installed (install.sh --no-ui). Run deploy/native/update.sh: it installs the UI from the repository; or pass --ui-dist FILE|DIR or --build-ui.</p>
|
||||
EOF
|
||||
chmod -R a+rX "$WEB_ROOT"
|
||||
log "placeholder page written to $WEB_ROOT"
|
||||
@@ -417,6 +503,7 @@ FP=$(openssl x509 -noout -fingerprint -sha256 -in "$TLS_DIR/ovpmon.crt" 2>/dev/n
|
||||
printf '\n'
|
||||
log "=== INSTALLED: $OS_ID $OS_VERSION_ID, $INIT, prefix $PREFIX ==="
|
||||
printf ' Web UI: https://%s:%s/ (self-signed certificate; SHA-256 %s)\n' "${HOST_NAME:-${HOST_IP:-<server-address>}}" "$HTTPS_PORT" "${FP:-n/a}"
|
||||
printf ' UI files: %s (%s)\n' "$WEB_ROOT" "${UI_ORIGIN:-placeholder page (--no-ui)}"
|
||||
printf ' Config: %s (root:root 600), helper: %s, %s\n' "$ENV_FILE" "$HELPER_CONF" "$HELPER_DEST"
|
||||
printf ' Data: %s (databases), %s/APP_PROFILER/easy-rsa (PKI), %s/APP_PROFILER/client-config\n' "$DATA_DIR" "$PREFIX" "$PREFIX"
|
||||
printf ' Logs: %s, %s\n' "$APP_LOG_DIR" "$OVPN_LOG_DIR"
|
||||
|
||||
+155
-8
@@ -714,19 +714,166 @@ ensure_runtime_files() {
|
||||
fi
|
||||
}
|
||||
|
||||
# check_ui_archive FILE: a readable tarball with index.html
|
||||
check_ui_archive() {
|
||||
[ -f "$1" ] || die "UI archive not found: $1 (build it with deploy/native/build-ui.sh)"
|
||||
tar -tzf "$1" >/dev/null 2>&1 || die "UI archive is not a readable .tar.gz: $1"
|
||||
tar -tzf "$1" | grep -q -E '^(\./)?index\.html$' || die "UI archive has no index.html at its top level: $1"
|
||||
# ---- UI: sources, committed build, staging ----
|
||||
# The UI is part of the repository: deploy/ui-dist holds a build of APP_UI together with SOURCE_HASH, the hash
|
||||
# of the sources it was built from (ui_source_hash). The installed web root records the hash it came from in
|
||||
# $UI_HASH_FILE, so update.sh can tell when the UI changed. See DOCS/Deployment/Scenario2_System_Services.md
|
||||
UI_HASH_FILE=.ui-source-hash
|
||||
|
||||
# sha256_run [FILE...]: sha256sum, or shasum -a 256 (macOS); "hash name" lines, stdin when no file is given
|
||||
sha256_run() {
|
||||
if command -v sha256sum >/dev/null 2>&1; then sha256sum "$@"
|
||||
elif command -v shasum >/dev/null 2>&1; then shasum -a 256 "$@"
|
||||
else die "neither sha256sum nor shasum found"
|
||||
fi
|
||||
}
|
||||
|
||||
# stage_ui FILE DIR: extract into a fresh DIR (never into the live web root)
|
||||
# valid_hash VALUE: 64 hexadecimal digits
|
||||
valid_hash() {
|
||||
case "$1" in
|
||||
""|*[!0-9a-f]*) return 1 ;;
|
||||
esac
|
||||
[ "${#1}" -eq 64 ]
|
||||
}
|
||||
|
||||
# ui_source_hash [APP_UI_DIR]: SHA-256 over the UI sources (default: this repository's APP_UI), deterministic and
|
||||
# the same on busybox and GNU: relative paths of src/, public/ and the build configuration files in C-locale
|
||||
# order, the sha256 of every file with its path, then the sha256 of that list. node_modules and dist are never
|
||||
# part of it. Prints the hash; fails when there are no sources.
|
||||
ui_source_hash() {
|
||||
local d
|
||||
d="${1:-$ROOT_DIR/APP_UI}"
|
||||
[ -f "$d/package.json" ] && [ -d "$d/src" ] || return 1
|
||||
command -v sha256sum >/dev/null 2>&1 || command -v shasum >/dev/null 2>&1 || return 1
|
||||
(
|
||||
cd "$d" || exit 1
|
||||
{
|
||||
for f in index.html package.json package-lock.json vite.config.js jsconfig.json; do
|
||||
if [ -f "$f" ]; then echo "$f"; fi
|
||||
done
|
||||
find src public -type f ! -name .DS_Store 2>/dev/null
|
||||
} | LC_ALL=C sort | while IFS= read -r f; do sha256_run "$f"; done | sha256_run | awk '{ print $1 }'
|
||||
)
|
||||
}
|
||||
|
||||
# ui_hash_of SOURCE: the SOURCE_HASH stored in a UI directory or tarball, "unknown" when there is none
|
||||
ui_hash_of() {
|
||||
local h
|
||||
h=""
|
||||
if [ -d "$1" ]; then
|
||||
h=$(tr -d ' \t\r\n' 2>/dev/null < "$1/SOURCE_HASH" || true)
|
||||
elif [ -f "$1" ]; then
|
||||
h=$(tar -xzOf "$1" ./SOURCE_HASH 2>/dev/null || tar -xzOf "$1" SOURCE_HASH 2>/dev/null || true)
|
||||
h=$(printf '%s' "$h" | tr -d ' \t\r\n')
|
||||
fi
|
||||
if valid_hash "$h"; then printf '%s' "$h"; else printf 'unknown'; fi
|
||||
}
|
||||
|
||||
# ui_repo_state REPO_DIR: sets UI_STATE (fresh | stale | missing), UI_BUILT_HASH (SOURCE_HASH of the committed
|
||||
# build) and UI_CUR_HASH (hash of the APP_UI sources now). A build without a valid SOURCE_HASH counts as stale
|
||||
# (it cannot be shown to match). Returns 1 when the hash of the sources cannot be computed.
|
||||
ui_repo_state() {
|
||||
local dir
|
||||
dir="$1/deploy/ui-dist"
|
||||
UI_STATE=missing; UI_BUILT_HASH=""; UI_CUR_HASH=""
|
||||
[ -f "$dir/index.html" ] || return 0
|
||||
UI_CUR_HASH=$(ui_source_hash "$1/APP_UI") || { UI_CUR_HASH=""; return 1; }
|
||||
UI_BUILT_HASH=$(ui_hash_of "$dir")
|
||||
if [ "$UI_BUILT_HASH" = "$UI_CUR_HASH" ]; then UI_STATE=fresh; else UI_STATE=stale; fi
|
||||
}
|
||||
|
||||
# ui_stale_lines: the explanation printed when the committed build is older than the sources (one line each)
|
||||
ui_stale_lines() {
|
||||
echo "the committed UI build deploy/ui-dist is OLDER than the APP_UI sources (build: ${UI_BUILT_HASH:-none}, sources: $UI_CUR_HASH)."
|
||||
echo "It does NOT contain the latest UI changes."
|
||||
echo "Maintainers: run deploy/native/build-ui.sh --publish and commit deploy/ui-dist."
|
||||
echo "On this host: add --build-ui to build the current UI now (Docker, or Node 20.19+ / --node-download; see build-ui.sh --help)."
|
||||
}
|
||||
|
||||
# ui_build_check / ui_build_run REPO OUT: prerequisites of the build, the build into the tarball OUT (build-ui.sh
|
||||
# picks Docker when it works, otherwise the local Node; UI_NODE_DL=1 adds --node-download)
|
||||
ui_build_check() {
|
||||
[ -f "$SCRIPT_DIR/build-ui.sh" ] || die "$SCRIPT_DIR/build-ui.sh not found"
|
||||
if [ "${UI_NODE_DL:-0}" = 1 ]; then sh "$SCRIPT_DIR/build-ui.sh" --check --node-download; else sh "$SCRIPT_DIR/build-ui.sh" --check; fi \
|
||||
|| die "the UI cannot be built on this host (see above)"
|
||||
}
|
||||
ui_build_run() {
|
||||
log "building the UI from $1/APP_UI (--build-ui); this takes a few minutes"
|
||||
if [ "${UI_NODE_DL:-0}" = 1 ]; then sh "$SCRIPT_DIR/build-ui.sh" --repo "$1" -o "$2" --node-download; else sh "$SCRIPT_DIR/build-ui.sh" --repo "$1" -o "$2"; fi \
|
||||
|| die "the UI build failed (see above)"
|
||||
}
|
||||
|
||||
# check_ui_source FILE|DIR: a readable .tar.gz with index.html at its top level, or a directory with index.html
|
||||
check_ui_source() {
|
||||
if [ -d "$1" ]; then
|
||||
[ -f "$1/index.html" ] && [ -r "$1/index.html" ] || die "UI directory has no readable index.html: $1"
|
||||
elif [ -f "$1" ]; then
|
||||
tar -tzf "$1" >/dev/null 2>&1 || die "UI archive is not a readable .tar.gz: $1"
|
||||
tar -tzf "$1" | grep -q -E '^(\./)?index\.html$' || die "UI archive has no index.html at its top level: $1"
|
||||
else
|
||||
die "UI source not found: $1 (a .tar.gz from deploy/native/build-ui.sh, or a directory with index.html)"
|
||||
fi
|
||||
}
|
||||
|
||||
# ui_resolve REPO_DIR TMP_DIR: picks the UI source. Input: UI_DIST (explicit FILE|DIR), UI_BUILD=1 (--build-ui),
|
||||
# UI_FALLBACK (optional tarball of last resort). Order: explicit, build now, committed deploy/ui-dist, fallback.
|
||||
# Output: UI_SRC (path, empty when nothing was found), UI_KIND (explicit|build|repo|fallback), UI_ORIGIN (text).
|
||||
# A stale committed build is used with a loud warning; --build-ui always builds fresh from the sources.
|
||||
ui_resolve() {
|
||||
local repo tmp line
|
||||
repo="$1"; tmp="$2"
|
||||
UI_SRC=""; UI_KIND=""; UI_ORIGIN=""
|
||||
if [ -n "${UI_DIST:-}" ]; then
|
||||
check_ui_source "$UI_DIST"
|
||||
UI_SRC="$UI_DIST"; UI_KIND=explicit; UI_ORIGIN="$UI_DIST (--ui-dist)"
|
||||
return 0
|
||||
fi
|
||||
if [ "${UI_BUILD:-0}" = 1 ]; then
|
||||
ui_build_check
|
||||
ui_build_run "$repo" "$tmp/ui-build.tar.gz"
|
||||
check_ui_source "$tmp/ui-build.tar.gz"
|
||||
UI_SRC="$tmp/ui-build.tar.gz"; UI_KIND=build; UI_ORIGIN="built now from APP_UI (--build-ui)"
|
||||
return 0
|
||||
fi
|
||||
if ui_repo_state "$repo"; then
|
||||
case "$UI_STATE" in
|
||||
fresh)
|
||||
UI_SRC="$repo/deploy/ui-dist"; UI_KIND=repo; UI_ORIGIN="deploy/ui-dist of the repository (up to date with APP_UI)" ;;
|
||||
stale)
|
||||
ui_stale_lines | while IFS= read -r line; do warn "$line"; done
|
||||
UI_SRC="$repo/deploy/ui-dist"; UI_KIND=repo; UI_ORIGIN="deploy/ui-dist of the repository (STALE: older than APP_UI)" ;;
|
||||
*)
|
||||
log "no committed UI build in $repo/deploy/ui-dist" ;;
|
||||
esac
|
||||
else
|
||||
warn "cannot compute the hash of $repo/APP_UI (sources missing or no sha256sum/shasum): the committed UI build cannot be checked for staleness"
|
||||
if [ -f "$repo/deploy/ui-dist/index.html" ]; then
|
||||
UI_SRC="$repo/deploy/ui-dist"; UI_KIND=repo; UI_ORIGIN="deploy/ui-dist of the repository (not verified)"
|
||||
fi
|
||||
fi
|
||||
if [ -z "$UI_SRC" ] && [ -n "${UI_FALLBACK:-}" ] && [ -f "$UI_FALLBACK" ]; then
|
||||
check_ui_source "$UI_FALLBACK"
|
||||
UI_SRC="$UI_FALLBACK"; UI_KIND=fallback; UI_ORIGIN="$UI_FALLBACK (archive found next to the scripts)"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# stage_ui FILE|DIR DIR: a validated copy in a fresh DIR (never the live web root). Records the hash of the
|
||||
# sources the build came from in DIR/$UI_HASH_FILE (SOURCE_HASH of the build, "unknown" for foreign archives).
|
||||
stage_ui() {
|
||||
local h
|
||||
check_ui_source "$1"
|
||||
h=$(ui_hash_of "$1")
|
||||
rm -rf "$2"
|
||||
mkdir -p "$2"
|
||||
tar -xzf "$1" -C "$2" --no-same-owner || die "cannot extract the UI archive"
|
||||
[ -f "$2/index.html" ] || die "index.html missing after extracting the UI archive"
|
||||
if [ -d "$1" ]; then
|
||||
( cd "$1" && tar -cf - . ) | ( cd "$2" && tar -xf - --no-same-owner ) || die "cannot copy the UI directory $1"
|
||||
else
|
||||
tar -xzf "$1" -C "$2" --no-same-owner || die "cannot extract the UI archive"
|
||||
fi
|
||||
[ -f "$2/index.html" ] && [ -r "$2/index.html" ] || die "index.html missing in the staged UI files"
|
||||
rm -f "$2/SOURCE_HASH"
|
||||
printf '%s\n' "$h" > "$2/$UI_HASH_FILE"
|
||||
chown -R root:root "$2"
|
||||
chmod -R go-w "$2"
|
||||
chmod -R a+rX "$2"
|
||||
|
||||
+43
-12
@@ -1,17 +1,23 @@
|
||||
#!/bin/sh
|
||||
# Update OpenVPN Monitor & Profiler (system services) without touching the data.
|
||||
#
|
||||
# deploy/native/update.sh [--prefix DIR] [--ui-dist FILE] [--source DIR] [--no-pull] [--yes] [--rollback]
|
||||
# deploy/native/update.sh [--prefix DIR] [--ui-dist FILE|DIR | --build-ui [--node-download]] [--source DIR]
|
||||
# [--no-pull] [--yes] [--rollback]
|
||||
#
|
||||
# --prefix install directory (default: from /etc/ovpmon/deploy.state, else /opt/OpenVPN-Monitoring-Simple)
|
||||
# --ui-dist UI tarball from build-ui.sh; without it the UI files are left as they are
|
||||
# --ui-dist UI tarball from build-ui.sh, or a directory with index.html: always installed (highest priority)
|
||||
# --build-ui build the UI now from APP_UI (Docker when it works, otherwise Node >= 20.19 on this host) and
|
||||
# install it; --node-download fetches a temporary official Node 20 for that (checksum verified,
|
||||
# glibc only, needs curl and xz)
|
||||
# Without these the committed build deploy/ui-dist of the source is installed automatically when
|
||||
# it differs from the installed UI (<web root>/.ui-source-hash); no UI source: the UI stays
|
||||
# --source checkout with the new version (default: the repository this script is in)
|
||||
# --no-pull no "git pull --ff-only" of the source checkout (offline hosts, sources already in place)
|
||||
# --yes no confirmation questions
|
||||
# --rollback restore code, databases, configuration, PKI and client profiles from the newest backup
|
||||
#
|
||||
# Phases: 0 preflight, 1 BACKUP (verified, /var/backups/ovpmon/<UTC time>/), 2 git pull, 3 PREPARE the new
|
||||
# code and virtualenvs next to the install dir (old code untouched), 4 STOP the application services (OpenVPN
|
||||
# code, virtualenvs and UI next to the install dir (old code untouched), 4 STOP the application services (OpenVPN
|
||||
# keeps running) and swap the code in, 5 DATABASE MIGRATION as its own step with the new code (nothing is
|
||||
# started on an unmigrated database), 6 UI, nginx, helper, doas rules, service definitions, 7 START and health
|
||||
# checks. A failure after the stop triggers an automatic rollback from the backup of this run.
|
||||
@@ -23,11 +29,14 @@ SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
. "$SCRIPT_DIR/lib.sh"
|
||||
|
||||
usage() {
|
||||
sed -n '2,19p' "$0" | sed 's/^# \{0,1\}//'
|
||||
sed -n '2,/^set -eu$/{/^set -eu$/!p}' "$0" | sed 's/^# \{0,1\}//'
|
||||
}
|
||||
|
||||
PREFIX=""
|
||||
UI_DIST=""
|
||||
UI_BUILD=0
|
||||
UI_NODE_DL=0
|
||||
UI_RESULT="kept as it is (no UI source)"
|
||||
SOURCE=""
|
||||
NO_PULL=0
|
||||
ASSUME_YES=0
|
||||
@@ -206,6 +215,8 @@ main() {
|
||||
case "$1" in
|
||||
--prefix) [ $# -ge 2 ] || die "--prefix needs a value"; PREFIX="$2"; shift 2 ;;
|
||||
--ui-dist) [ $# -ge 2 ] || die "--ui-dist needs a value"; UI_DIST="$2"; shift 2 ;;
|
||||
--build-ui) UI_BUILD=1; shift ;;
|
||||
--node-download) UI_NODE_DL=1; shift ;;
|
||||
--source) [ $# -ge 2 ] || die "--source needs a value"; SOURCE="$2"; shift 2 ;;
|
||||
--no-pull) NO_PULL=1; shift ;;
|
||||
--yes|-y) ASSUME_YES=1; shift ;;
|
||||
@@ -215,6 +226,9 @@ main() {
|
||||
esac
|
||||
done
|
||||
|
||||
[ "$UI_NODE_DL" = 0 ] || [ "$UI_BUILD" = 1 ] || die "--node-download only works together with --build-ui"
|
||||
[ -z "$UI_DIST" ] || [ "$UI_BUILD" = 0 ] || die "use either --ui-dist or --build-ui, not both"
|
||||
|
||||
TMPD=$(mktemp -d /tmp/ovpmon-update.XXXXXX) || die "cannot create a temporary directory"
|
||||
trap on_exit EXIT
|
||||
trap 'exit 130' INT
|
||||
@@ -271,10 +285,13 @@ main() {
|
||||
PULL_TOUCHES_LIVE=0
|
||||
fi
|
||||
if [ -n "$UI_DIST" ]; then
|
||||
check_ui_archive "$UI_DIST"
|
||||
log "UI archive: $UI_DIST"
|
||||
check_ui_source "$UI_DIST"
|
||||
log "UI: $UI_DIST (--ui-dist), will be installed"
|
||||
elif [ "$UI_BUILD" = 1 ]; then
|
||||
ui_build_check
|
||||
log "UI: will be built from APP_UI after the source update (--build-ui) and installed"
|
||||
else
|
||||
log "no --ui-dist: the UI files stay as they are (if APP_UI changed, build and pass a new archive)"
|
||||
log "UI: the committed build deploy/ui-dist of the source is installed after the source update when it differs from the installed UI"
|
||||
fi
|
||||
|
||||
SERVICES_WERE_RUNNING=1
|
||||
@@ -340,7 +357,7 @@ main() {
|
||||
|
||||
# ----- Phase 3: prepare ----------------------------------------------------------------
|
||||
CURRENT_PHASE="3 prepare"
|
||||
phase 3 "PREPARE the new code and virtualenvs (the running system is not touched)"
|
||||
phase 3 "PREPARE the new code, virtualenvs and UI (the running system is not touched)"
|
||||
STAGING="${PREFIX}.new"
|
||||
if [ -e "$STAGING" ]; then
|
||||
[ -f "$STAGING/.ovpmon-staging" ] || die "$STAGING exists and was not created by this script: remove or rename it"
|
||||
@@ -356,10 +373,23 @@ main() {
|
||||
smoke_component "$STAGING/APP_PROFILER" profiler || die "the new APP_PROFILER virtualenv cannot import the application's dependencies"
|
||||
lock_down_code "$STAGING/APP_CORE" "$STAGING/APP_PROFILER"
|
||||
log "new code and virtualenvs are ready in $STAGING (dependencies installed and importable)"
|
||||
if [ -n "$UI_DIST" ]; then
|
||||
stage_ui "$UI_DIST" "$WEB_ROOT.new"
|
||||
UI_STAGED=1
|
||||
log "new UI files are ready in $WEB_ROOT.new"
|
||||
# the UI source is decided here, after the source update (git pull may have brought a new build)
|
||||
ui_resolve "$SOURCE" "$TMPD"
|
||||
if [ -z "$UI_SRC" ]; then
|
||||
log "no UI source found (no --ui-dist or --build-ui, no committed build in $SOURCE/deploy/ui-dist): the installed UI stays as it is"
|
||||
else
|
||||
_have=$(cat "$WEB_ROOT/$UI_HASH_FILE" 2>/dev/null || echo "none")
|
||||
_new=$(ui_hash_of "$UI_SRC")
|
||||
if [ "$UI_KIND" = repo ] && valid_hash "$_new" && [ "$_new" = "$_have" ]; then
|
||||
log "UI: $UI_ORIGIN; the installed UI comes from the same sources (hash $_new): not replaced"
|
||||
UI_RESULT="unchanged (same sources as the installed UI)"
|
||||
else
|
||||
log "UI: $UI_ORIGIN; installed UI: ${_have}, new: ${_new}"
|
||||
stage_ui "$UI_SRC" "$WEB_ROOT.new"
|
||||
UI_STAGED=1
|
||||
UI_RESULT="replaced: $UI_ORIGIN"
|
||||
log "new UI files are ready in $WEB_ROOT.new"
|
||||
fi
|
||||
fi
|
||||
|
||||
# ----- Phase 4: stop and swap ----------------------------------------------------------
|
||||
@@ -477,6 +507,7 @@ main() {
|
||||
printf '\n'
|
||||
log "=== UPDATE SUCCESSFUL: $OLD_VERSION -> $NEW_VERSION ==="
|
||||
printf ' Install dir: %s\n' "$PREFIX"
|
||||
printf ' UI: %s\n' "$UI_RESULT"
|
||||
printf ' Backup: %s (the newest %s backups are kept)\n' "$BACKUP_DIR" "$KEEP_BACKUPS"
|
||||
printf ' Rollback: %s --rollback\n' "$0"
|
||||
printf ' OpenVPN was not restarted by the update: connected VPN users stayed connected.\n'
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteBase /
|
||||
RewriteRule ^index\.html$ - [L]
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule . /index.html [L]
|
||||
</IfModule>
|
||||
@@ -0,0 +1 @@
|
||||
39d777d3a2df602f7ce737dd7fe333c29695557053b85cba7f3b3d8c367ec20b
|
||||
@@ -0,0 +1 @@
|
||||
import{G as $,H as N,r as S,I as ae,o as ne,F as ue,a as j,c as x,d,A as V,g as z,J as K,x as Q,t as de,w as B,q as U,m as q,C as ee,j as ce,k}from"./index-DQu6UtRL.js";import{S as O}from"./vendor-ui-jlFFG6nm.js";import{a as te,_ as re}from"./ConfirmModal-likdDJzi.js";import"./vendor-charts-Bcjh2pZL.js";var T=function(){return T=Object.assign||function(c){for(var f,u=1,h=arguments.length;u<h;u++){f=arguments[u];for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(c[m]=f[m])}return c},T.apply(this,arguments)};var D;(function(s){var c=(function(){function a(e,t,r,n){if(this.version=e,this.errorCorrectionLevel=t,this.modules=[],this.isFunction=[],e<a.MIN_VERSION||e>a.MAX_VERSION)throw new RangeError("Version value out of range");if(n<-1||n>7)throw new RangeError("Mask value out of range");this.size=e*4+17;for(var o=[],i=0;i<this.size;i++)o.push(!1);for(var i=0;i<this.size;i++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();var v=this.addEccAndInterleave(r);if(this.drawCodewords(v),n==-1)for(var p=1e9,i=0;i<8;i++){this.applyMask(i),this.drawFormatBits(i);var M=this.getPenaltyScore();M<p&&(n=i,p=M),this.applyMask(i)}h(0<=n&&n<=7),this.mask=n,this.applyMask(n),this.drawFormatBits(n),this.isFunction=[]}return a.encodeText=function(e,t){var r=s.QrSegment.makeSegments(e);return a.encodeSegments(r,t)},a.encodeBinary=function(e,t){var r=s.QrSegment.makeBytes(e);return a.encodeSegments([r],t)},a.encodeSegments=function(e,t,r,n,o,i){if(r===void 0&&(r=1),n===void 0&&(n=40),o===void 0&&(o=-1),i===void 0&&(i=!0),!(a.MIN_VERSION<=r&&r<=n&&n<=a.MAX_VERSION)||o<-1||o>7)throw new RangeError("Invalid value");var v,p;for(v=r;;v++){var M=a.getNumDataCodewords(v,t)*8,w=m.getTotalBits(e,v);if(w<=M){p=w;break}if(v>=n)throw new RangeError("Data too long")}for(var C=0,A=[a.Ecc.MEDIUM,a.Ecc.QUARTILE,a.Ecc.HIGH];C<A.length;C++){var y=A[C];i&&p<=a.getNumDataCodewords(v,y)*8&&(t=y)}for(var b=[],_=0,R=e;_<R.length;_++){var P=R[_];f(P.mode.modeBits,4,b),f(P.numChars,P.mode.numCharCountBits(v),b);for(var F=0,g=P.getData();F<g.length;F++){var l=g[F];b.push(l)}}h(b.length==p);var E=a.getNumDataCodewords(v,t)*8;h(b.length<=E),f(0,Math.min(4,E-b.length),b),f(0,(8-b.length%8)%8,b),h(b.length%8==0);for(var I=236;b.length<E;I^=253)f(I,8,b);for(var L=[];L.length*8<b.length;)L.push(0);return b.forEach(function(Y,G){return L[G>>>3]|=Y<<7-(G&7)}),new a(v,t,L,o)},a.prototype.getModule=function(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]},a.prototype.getModules=function(){return this.modules},a.prototype.drawFunctionPatterns=function(){for(var e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);for(var t=this.getAlignmentPatternPositions(),r=t.length,e=0;e<r;e++)for(var n=0;n<r;n++)e==0&&n==0||e==0&&n==r-1||e==r-1&&n==0||this.drawAlignmentPattern(t[e],t[n]);this.drawFormatBits(0),this.drawVersion()},a.prototype.drawFormatBits=function(e){for(var t=this.errorCorrectionLevel.formatBits<<3|e,r=t,n=0;n<10;n++)r=r<<1^(r>>>9)*1335;var o=(t<<10|r)^21522;h(o>>>15==0);for(var n=0;n<=5;n++)this.setFunctionModule(8,n,u(o,n));this.setFunctionModule(8,7,u(o,6)),this.setFunctionModule(8,8,u(o,7)),this.setFunctionModule(7,8,u(o,8));for(var n=9;n<15;n++)this.setFunctionModule(14-n,8,u(o,n));for(var n=0;n<8;n++)this.setFunctionModule(this.size-1-n,8,u(o,n));for(var n=8;n<15;n++)this.setFunctionModule(8,this.size-15+n,u(o,n));this.setFunctionModule(8,this.size-8,!0)},a.prototype.drawVersion=function(){if(!(this.version<7)){for(var e=this.version,t=0;t<12;t++)e=e<<1^(e>>>11)*7973;var r=this.version<<12|e;h(r>>>18==0);for(var t=0;t<18;t++){var n=u(r,t),o=this.size-11+t%3,i=Math.floor(t/3);this.setFunctionModule(o,i,n),this.setFunctionModule(i,o,n)}}},a.prototype.drawFinderPattern=function(e,t){for(var r=-4;r<=4;r++)for(var n=-4;n<=4;n++){var o=Math.max(Math.abs(n),Math.abs(r)),i=e+n,v=t+r;0<=i&&i<this.size&&0<=v&&v<this.size&&this.setFunctionModule(i,v,o!=2&&o!=4)}},a.prototype.drawAlignmentPattern=function(e,t){for(var r=-2;r<=2;r++)for(var n=-2;n<=2;n++)this.setFunctionModule(e+n,t+r,Math.max(Math.abs(n),Math.abs(r))!=1)},a.prototype.setFunctionModule=function(e,t,r){this.modules[t][e]=r,this.isFunction[t][e]=!0},a.prototype.addEccAndInterleave=function(e){var t=this.version,r=this.errorCorrectionLevel;if(e.length!=a.getNumDataCodewords(t,r))throw new RangeError("Invalid argument");for(var n=a.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][t],o=a.ECC_CODEWORDS_PER_BLOCK[r.ordinal][t],i=Math.floor(a.getNumRawDataModules(t)/8),v=n-i%n,p=Math.floor(i/n),M=[],w=a.reedSolomonComputeDivisor(o),C=0,A=0;C<n;C++){var y=e.slice(A,A+p-o+(C<v?0:1));A+=y.length;var b=a.reedSolomonComputeRemainder(y,w);C<v&&y.push(0),M.push(y.concat(b))}for(var _=[],R=function(P){M.forEach(function(F,g){(P!=p-o||g>=v)&&_.push(F[P])})},C=0;C<M[0].length;C++)R(C);return h(_.length==i),_},a.prototype.dLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{r as _,a as U,o as G,u as Z,b as q,c as r,d as t,t as i,e as I,f as J,g as f,w as z,v as K,h as Q,F as E,i as j,j as Y,k as d,n as $}from"./index-DQu6UtRL.js";import{C as H}from"./vendor-charts-Bcjh2pZL.js";import"./vendor-ui-jlFFG6nm.js";const tt={class:"kpi-grid mb-4"},et={class:"stat-item"},st={class:"stat-content"},at={class:"stat-item"},ot={class:"stat-content"},lt={class:"stat-item"},nt={class:"stat-content"},it={class:"card mb-4"},rt={class:"card-header d-flex justify-content-between align-items-center flex-wrap"},dt={class:"chart-header-controls"},ct={class:"d-flex align-items-center"},ut={class:"toggle-wrapper me-2"},mt={class:"toggle-switch"},ft={class:"card-body"},pt={class:"chart-container"},vt={class:"row"},ht={class:"col-lg-7"},_t={class:"card"},gt={class:"card-body p-0"},bt={class:"table-responsive"},xt={class:"table"},yt={key:0},Ct={key:1},kt={class:"user-select-all fw-bold",style:{color:"var(--text-heading)"}},wt={class:"font-monospace text-muted"},St={class:"d-flex align-items-center"},Rt={class:"progress flex-grow-1",style:{height:"6px"}},Tt={class:"ms-2 small text-muted w-25 text-end"},At={class:"col-lg-5"},Dt={class:"card mb-4"},Mt={class:"card-body p-3",style:{"min-height":"120px","max-height":"200px","overflow-y":"auto"}},Et={key:0,class:"text-muted text-center py-3 mb-0"},Nt={key:1,class:"text-muted text-center py-3 mb-0"},Lt={key:2,class:"list-group list-group-flush"},Bt={class:"fw-bold small"},Ut={class:"text-muted",style:{"font-size":"0.75rem"}},It={class:"badge status-warning text-dark"},zt={class:"card"},jt={class:"card-body d-flex align-items-center justify-content-around p-4",style:{"min-height":"200px"}},Ht={class:"pie-container",style:{width:"140px",height:"140px",flex:"0 0 auto"}},Ot={class:"ms-3 flex-grow-1"},Vt={class:"mb-3"},Ft={class:"h5 mb-0",style:{color:"var(--text-heading)"}},Pt={class:"h5 mb-0",style:{color:"var(--text-heading)"}},Wt=96,Jt={__name:"Analytics",setup(Xt){const{fetchAnalytics:O,fetchCertificates:V}=Y(),{formatBytes:C,parseServerDate:F}=J(),{config:P}=Z(),w=_(null),S=_(null);let g=null,b=null;const p=U({analytics:!0,certs:!0}),x=_("24h"),y=_(!1),o=U({concurrentUsers:"-",totalTraffic:0,expiringCerts:"-",totalReceived:0,totalSent:0,totalReceivedString:"-",totalSentString:"-"}),R=_([]),T=_([]);let N=null;const A=async()=>{p.analytics=!0;try{const a=await O(x.value);a.success&&W(a.data)}catch(a){console.error(a)}finally{p.analytics=!1}},L=async()=>{p.certs=!0;try{const a=await V();if(a.success&&Array.isArray(a.data)){const e=a.data.filter(s=>!s.is_revoked&&!s.is_expired&&s.days_remaining!==null&&s.days_remaining<=45);o.expiringCerts=e.length,T.value=e.sort((s,n)=>(s.days_remaining||0)-(n.days_remaining||0))}}catch(a){console.error(a)}finally{p.certs=!1}},W=a=>{o.concurrentUsers=a.max_concurrent_24h||0;const e=a.traffic_distribution||{rx:0,tx:0};o.totalReceived=Number(e.rx||0),o.totalSent=Number(e.tx||0),o.totalTraffic=o.totalReceived+o.totalSent,o.totalReceivedString=C(o.totalReceived),o.totalSentString=C(o.totalSent),R.value=(a.top_clients_24h||[]).map(s=>({name:s.common_name,total:Number(s.total_traffic||0),percent:o.totalTraffic>0?(Number(s.total_traffic)/o.totalTraffic*100).toFixed(1):0})),N=a.global_history_24h||[],D(),B()},D=()=>{if(!w.value)return;g&&g.destroy();const a=X(N,Wt),e=[],s=[],n=[];a.forEach(c=>{const m=F(c.timestamp);let u="";x.value.includes("h")||x.value==="1d"?u=m.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):u=m.toLocaleDateString([],{month:"short",day:"numeric"})+" "+m.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),e.push(u),y.value?(s.push(c.rx_rate_mbps||0),n.push(c.tx_rate_mbps||0)):(s.push(c.bytes_received/(1024*1024)),n.push(c.bytes_sent/(1024*1024)))});const l=document.documentElement.getAttribute("data-theme")==="dark",v=l?"rgba(240, 246, 252, 0.1)":"rgba(0,0,0,0.05)",h=l?"#8b949e":"#6c757d",k=w.value.getContext("2d");g=new H(k,{type:"line",data:{labels:e,datasets:[{label:y.value?"RX Mbps":"Received (MB)",data:s,borderColor:"#1652B8",backgroundColor:"rgba(22, 82, 184, 0.15)",borderWidth:2,fill:!0,tension:.3,pointRadius:3,pointHoverRadius:4},{label:y.value?"TX Mbps":"Sent (MB)",data:n,borderColor:"#EC7C31",backgroundColor:"rgba(236, 124, 49, 0.15)",borderWidth:2,fill:!0,tension:.3,pointRadius:3,pointHoverRadius:4}]},options:{responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},plugins:{legend:{labels:{color:h}}},scales:{x:{ticks:{color:h,maxTicksLimit:8},grid:{color:v}},y:{beginAtZero:!0,ticks:{color:h},grid:{color:v}}}}})},B=()=>{if(!S.value)return;b&&b.destroy();const a=S.value.getContext("2d"),s=document.documentElement.getAttribute("data-theme")==="dark"?"#161b22":"#ffffff";b=new H(a,{type:"doughnut",data:{labels:["Received","Sent"],datasets:[{data:[o.totalReceived,o.totalSent],backgroundColor:["#1652B8","#EC7C31"],borderColor:s,borderWidth:2,hoverOffset:4}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:"70%",plugins:{legend:{display:!1}}}})},X=(a,e)=>{if(!a||a.lLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{r as m,l as Q,k as i,m as R,d as e,w as D,p as ne,q as j,g as C,s as y,c,x as w,t as n,F as A,y as G,o as oe,z as ie,A as P,e as H,h as re,i as K,j as de,B as ue,C as F}from"./index-DQu6UtRL.js";import{_ as J,a as ce}from"./ConfirmModal-likdDJzi.js";import{T as pe}from"./vendor-ui-jlFFG6nm.js";import"./vendor-charts-Bcjh2pZL.js";const fe={class:"mb-3"},ve={class:"input-group"},me=["disabled"],_e={__name:"NewClientModal",emits:["create"],setup(r,{expose:d,emit:E}){const T=E,g=m(null),l=m(""),f=m(null),x=()=>{l.value="",g.value.show(),setTimeout(()=>f.value?.focus(),500)},b=()=>{g.value.hide()},k=()=>{l.value&&(T("create",l.value),b())};return d({open:x,close:b}),($,v)=>(i(),Q(J,{id:"newClientModal",title:"Create New Client",ref_key:"modal",ref:g},{body:R(()=>[e("div",fe,[v[2]||(v[2]=e("label",{for:"clientName",class:"form-label small text-muted text-uppercase fw-bold"},"Client Name",-1)),e("div",ve,[v[1]||(v[1]=e("span",{class:"input-group-text"},[e("i",{class:"fas fa-user"})],-1)),D(e("input",{type:"text",class:"form-control",id:"clientName","onUpdate:modelValue":v[0]||(v[0]=p=>l.value=p),placeholder:"e.g. laptop-user",onKeyup:ne(k,["enter"]),ref_key:"inputRef",ref:f},null,544),[[j,l.value]])]),v[3]||(v[3]=e("div",{class:"form-text mt-2 text-muted small"},[e("i",{class:"fas fa-info-circle me-1"}),C(" Use only alphanumeric characters, dashes, or underscores. ")],-1))])]),footer:R(()=>[e("button",{type:"button",class:"btn-action btn-action-secondary",onClick:b},"Cancel"),e("button",{type:"button",class:"btn-action btn-action-save",onClick:k,disabled:!l.value}," Create Client ",8,me)]),_:1},512))}},be={class:"d-flex align-items-center gap-2 flex-wrap"},ge={class:"modal-title fw-bold mb-0",style:{color:"var(--text-heading)"}},ye={key:0},xe={class:"profile-meta"},ke={key:0,class:"text-muted"},he={class:"certificate-file text-muted small text-break mt-0"},Ce={class:"form-text text-end"},we=["disabled"],$e={__name:"ProfileDetailsModal",emits:["save"],setup(r,{expose:d,emit:E}){const T=E,g=m(null),l=m(null),f=m(""),x=y(()=>f.value!==(l.value?.note||"")),b=y(()=>{const u=l.value;return u?.is_revoked?{label:"Revoked",cls:"status-expired"}:u?.is_expired?{label:"Expired",cls:"status-expired"}:u?.days_remaining!=null&&u.days_remaining<=30?{label:"Expiring Soon",cls:"status-warning"}:{label:"Active",cls:"status-valid"}}),k=y(()=>{const u=l.value?.days_remaining;return u==null?"":u>0?`${u} d`:"expired"}),$=u=>{if(!u)return"N/A";const o=new Date(u);if(isNaN(o))return u;const h=V=>String(V).padStart(2,"0");return`${o.getFullYear()}-${h(o.getMonth()+1)}-${h(o.getDate())} ${h(o.getHours())}:${h(o.getMinutes())}`},v=u=>{l.value=u,f.value=u.note||"",g.value.show()},p=()=>{g.value.hide()},S=()=>{T("save",{id:l.value.id,note:f.value}),p()};return d({open:v,close:p}),(u,o)=>(i(),Q(J,{id:"profileDetailsModal",title:"Profile Details",ref_key:"modal",ref:g},{header:R(()=>[e("div",be,[e("h5",ge,n(l.value?.username),1),l.value?(i(),c("span",{key:0,class:G(["status-badge",b.value.cls])},n(b.value.label),3)):w("",!0)])]),body:R(()=>[l.value?(i(),c("div",ye,[e("dl",xe,[o[2]||(o[2]=e("dt",null,"Created",-1)),e("dd",null,n($(l.value.created_at)),1),o[3]||(o[3]=e("dt",null,"Expires",-1)),e("dd",null,[C(n($(l.value.expiration_date)),1),k.value?(i(),c("span",ke," ("+n(k.value)+")",1)):w("",!0)]),l.value.revoked_at?(i(),c(A,{key:0},[o[1]||(o[1]=e("dt",null,"Revoked",-1)),e("dd",null,n($(l.value.revoked_at)),1)],64)):w("",!0),o[4]||(o[4]=e("dt",null,"File",-1)),e("dd",he,n(l.value.file_path||"N/A"),1)]),o[5]||(o[5]=e("label",{for:"profileNote",class:"form-label small text-muted text-uppercase fw-bold"},"Note",-1)),D(e("textarea",{class:"form-control",id:"profileNote",rows:"3",maxlength:"1000","onUpdate:modelValue":o[0]||(o[0]=h=>f.value=h),placeholder:"Add a note about this profile..."},null,512),[[j,f.value]]),e("div",Ce,n(f.value.length)+" / 1000",1)])):w("",!0)]),footer:R(()=>[e("button",{type:"button",class:"btn-action btn-action-secondary",onClick:p},"Close"),e("button",{type:"button",class:"btn-action btn-action-save",onClick:S,disabled:!x.value},"Save",8,we)]),_:1},512))}},O=(r,d)=>{r._noteTooltip=new pe(r,{title:d,placement:"top",container:"body",html:!1,trigger:"hover",customClass:"note-tooltip"})},Y=r=>{r._noteTooltip?.dispose(),r._noteTooltip=null},Ne=r=>r._noteTooltip?.hide(),q={mounted(r,d){r.addEventListener("click",()=>Ne(r)),d.value&&O(r,d.value)},updated(r,d){d.value!==d.oldValue&&(Y(r),d.value&&O(r,d.value))},unmounted(r){Y(r)}},Te={class:"stats-info mb-4",id:"statsInfo"},Me={class:"stat-item"},Ae={class:"stat-value"},De={class:"stat-item"},Ee={class:"stat-value"},Le={class:"stat-item"},Re={class:"stat-value"},Se={class:"stat-item"},Ve={class:"stat-value"},Be={class:"d-flex justify-content-between align-items-center mb-3 flex-wrap gap-3"},He={class:"d-flex gap-3 align-items-center flex-wrap"},Ue={class:"input-group input-group-sm",style:{width:"250px"}},Pe=["disabled","title"],Fe={class:"d-flex align-items-center"},je={Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{M as B}from"./vendor-ui-jlFFG6nm.js";import{r as o,o as M,b as $,l as C,k as u,d as e,y as g,e as S,c as k,x as w,K as _,T as z,t as p,m as y}from"./index-DQu6UtRL.js";const T=["id"],E={class:"modal-content"},L={class:"modal-header border-0 pb-0"},N={class:"modal-title fw-bold",style:{color:"var(--text-heading)"}},R={class:"modal-body"},V={key:0,class:"modal-footer border-0 pt-0"},q={__name:"BaseModal",props:{id:{type:String,required:!0},title:{type:String,default:""},size:{type:String,default:""}},emits:["close","opened","closed"],setup(d,{expose:f,emit:b}){const v=d,t=b,s=o(null);let a=null;const i=v.size||"",c=()=>{a?.show()},r=()=>{a?.hide()};return M(()=>{a=new B(s.value),s.value.addEventListener("shown.bs.modal",()=>{t("opened")}),s.value.addEventListener("hidden.bs.modal",()=>{t("closed"),t("close")})}),$(()=>{a?.dispose()}),f({show:c,hide:r}),(n,m)=>(u(),C(z,{to:"body"},[e("div",{class:"modal fade",id:d.id,tabindex:"-1","aria-hidden":"true",ref_key:"modalRef",ref:s},[e("div",{class:g(["modal-dialog modal-dialog-centered",S(i)])},[e("div",E,[e("div",L,[_(n.$slots,"header",{},()=>[e("h5",N,p(d.title),1)]),m[0]||(m[0]=e("button",{type:"button",class:"btn-close","data-bs-dismiss":"modal","aria-label":"Close"},null,-1))]),e("div",R,[_(n.$slots,"body")]),n.$slots.footer?(u(),k("div",V,[_(n.$slots,"footer")])):w("",!0)])],2)],8,T)]))}},A={class:"text-main"},j={__name:"ConfirmModal",emits:["confirm"],setup(d,{expose:f,emit:b}){const v=b,t=o(null),s=o(""),a=o(""),i=o("Confirm"),c=o("btn-action-danger"),r=o(!0),n=o(null),m=l=>{s.value=l.title||"Are you sure?",a.value=l.message||"",i.value=l.confirmText||"Confirm",c.value=l.confirmBtnClass||"btn-action-danger",r.value=l.showCancel!==!1,n.value=l.data||null,t.value.show()},h=()=>{t.value.hide()},x=()=>{v("confirm",n.value),h()};return f({open:m,close:h}),(l,D)=>(u(),C(q,{id:"confirmModal",title:s.value,ref_key:"modal",ref:t},{body:y(()=>[e("p",A,p(a.value),1)]),footer:y(()=>[r.value?(u(),k("button",{key:0,type:"button",class:"btn-action btn-action-secondary",onClick:h},"Cancel")):w("",!0),e("button",{type:"button",class:g(["btn-action",c.value]),onClick:x},p(i.value),3)]),_:1},8,["title"]))}};export{q as _,j as a};
|
||||
@@ -0,0 +1 @@
|
||||
import{a as I,r as P,s as m,o as A,b as T,c,d as t,C as D,x as N,w as l,q as a,v as V,h as B,g as w,t as R,j as L,B as M,z as O,k as p}from"./index-DQu6UtRL.js";import"./vendor-charts-Bcjh2pZL.js";import"./vendor-ui-jlFFG6nm.js";const G={class:"config-wrapper"},j={class:"config-card"},F={class:"config-row"},Q={class:"config-col"},Y={class:"config-col"},H={class:"config-row"},X={class:"config-col",style:{"max-width":"50%"}},J={class:"select-container"},W={class:"config-row"},Z={class:"config-col"},h={class:"config-col"},ss={class:"config-row"},ts={class:"config-col"},es={class:"config-col"},ns={class:"config-row"},is={class:"config-col"},ls={class:"config-col"},as={class:"config-row"},os={class:"config-col"},rs={class:"select-container"},us={class:"config-col"},ds={class:"number-input-container"},cs={class:"number-input-controls"},ps={class:"config-row"},fs={class:"config-col"},ys={class:"number-input-container"},vs={class:"number-input-controls"},gs={class:"config-col"},bs={class:"number-input-container"},_s={class:"number-input-controls"},ms={class:"config-row"},ws={class:"config-col"},Cs={class:"number-input-container"},ks={class:"number-input-controls"},xs={class:"config-col"},qs={class:"toggle-wrapper"},Is={class:"toggle-switch"},Ps={class:"btn-action-group"},Vs=["disabled"],zs=["disabled","title"],Us={key:0,class:"fas fa-spinner fa-spin"},Ss={key:1,class:"fas fa-play-circle"},Ks=["disabled"],Es={key:0,class:"fas fa-spinner fa-spin"},$s={key:1,class:"fas fa-trash-alt"},As={key:0,class:"config-label"},Rs={__name:"PKIConfig",setup(Ts){const{profilesApiClient:f}=L(),z=M(),{refresh:C}=O(),n=I({fqdn_ca:"",fqdn_server:"",easyrsa_dn:"cn_only",easyrsa_req_country:"",easyrsa_req_province:"",easyrsa_req_city:"",easyrsa_req_org:"",easyrsa_req_email:"",easyrsa_req_ou:"",easyrsa_key_size:2048,easyrsa_ca_expire:null,easyrsa_cert_expire:null,easyrsa_cert_renew:null,easyrsa_crl_days:null,easyrsa_batch:!0}),r=P(!1),u=P(""),o=I({state:"idle",step:null,initialized:!1,error:null}),g=m(()=>o.state==="running"||u.value==="init"),b=m(()=>r.value||g.value),U={"init-pki":"Initializing PKI...",ca:"Building CA...","server-cert":"Building server certificate...",dh:"Generating DH parameters (this can take several minutes)...","ta-key":"Generating TLS key...",crl:"Generating CRL..."},S=m(()=>U[o.step]||"Initializing PKI...");let y=null;const d=(i,s="success")=>z.show(i,s),K=async()=>{try{const s=(await f.get("/config",{params:{section:"pki"}})).data,e=s.pki?s.pki:s;Object.keys(e).forEach(_=>{n.hasOwnProperty(_)&&(n[_]=e[_])})}catch(i){console.error(i),d("Failed to load PKI config from Management API.","error")}},k=()=>{y&&(clearInterval(y),y=null)},x=()=>{y||(y=setInterval(()=>v(),3e3))},v=async(i=!1)=>{const s=o.state==="running";try{const e=await f.get("/system/init/status");Object.assign(o,e.data)}catch(e){console.error(e);return}if(o.state==="running"){x();return}k(),s&&C(),s&&o.state==="done"?d("PKI initialized successfully!","success"):(s||i)&&o.state==="error"&&d(`Error initializing: ${o.error}`,"error")},q=async()=>{r.value=!0,u.value="save";try{await f.put("/config/pki",n),d("Configuration saved successfully!","success")}catch(i){d(`Error saving: ${i.message}`,"error")}finally{r.value=!1,u.value=""}},E=async()=>{if(confirm("Are you sure you want to Initialize system? This will start the PKI initialization process.")){r.value=!0,u.value="init";try{await f.post("/system/init"),o.state="running",x()}catch(i){i.response&&i.response.status===409?await v():d(`Error initializing: ${i.response?.data?.detail||i.message}`,"error")}finally{r.value=!1,u.value=""}}},$=async()=>{if(confirm("Are you sure you want to CLEAR PKI? This will delete all certificates and cannot be undone.")){r.value=!0,u.value="clear";try{const s=(await f.delete("/system/pki")).data;d(s.message||"PKI cleared successfully!","warning"),await v(),C()}catch(i){d(`Error clearing PKI: ${i.response?.data?.detail||i.message}`,"error")}finally{r.value=!1,u.value=""}}};return A(()=>{K(),v(!0)}),T(k),(i,s)=>(p(),c("div",G,[t("div",j,[s[58]||(s[58]=t("div",{class:"config-header"},[t("h1",null,"PKI Infrastructure Configuration")],-1)),t("form",{onSubmit:D(q,["prevent"])},[t("div",F,[t("div",Q,[s[23]||(s[23]=t("label",{class:"config-label"},"FQDN: CA Cert CN",-1)),l(t("input",{type:"text",class:"config-input","onUpdate:modelValue":s[0]||(s[0]=e=>n.fqdn_ca=e)},null,512),[[a,n.fqdn_ca]])]),t("div",Y,[s[24]||(s[24]=t("label",{class:"config-label"},"FQDN: Server Cert CN",-1)),l(t("input",{type:"text",class:"config-input","onUpdate:modelValue":s[1]||(s[1]=e=>n.fqdn_server=e)},null,512),[[a,n.fqdn_server]])])]),s[55]||(s[55]=t("div",{class:"config-divider"},null,-1)),t("div",H,[t("div",X,[s[27]||(s[27]=t("label",{class:"config-label"},"EASYRSA DN",-1)),t("div",J,[l(t("select",{class:"config-select","onUpdate:modelValue":s[2]||(s[2]=e=>n.easyrsa_dn=e)},[...s[25]||(s[25]=[t("option",{value:"cn_only"},"CN_ONLY",-1),t("option",{value:"org"},"ORG",-1)])],512),[[V,n.easyrsa_dn]]),s[26]|Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{s as S,z as w,a as C,r as g,o as M,b as $,c as o,d as t,t as c,n as P,y as x,e as y,g as _,j as I,B as U,k as i}from"./index-DQu6UtRL.js";import"./vendor-charts-Bcjh2pZL.js";import"./vendor-ui-jlFFG6nm.js";const j={class:"config-wrapper"},A={class:"config-card"},B={class:"stats-grid mb-4"},N={class:"stat-item full-width cpu-progress"},z={class:"stat-label d-flex justify-content-between"},T={class:"progress"},V=["aria-valuenow"],D={class:"stat-item"},F={class:"d-flex align-items-center"},O={class:"stat-item"},R={class:"stat-value"},E={class:"stat-item"},H={class:"stat-value"},K={class:"stat-item"},L={class:"stat-value monospace"},q={class:"btn-action-group justify-content-center"},G=["disabled","title"],J={key:0,class:"fas fa-spinner fa-spin"},Q={key:1,class:"fas fa-play"},W=["disabled","title"],X={key:0,class:"fas fa-spinner fa-spin"},Y={key:1,class:"fas fa-sync-alt"},Z=["disabled"],ss={key:0,class:"fas fa-spinner fa-spin"},ts={key:1,class:"fas fa-stop"},is={__name:"ServerManagement",setup(es){const{profilesApiClient:f}=I(),h=U(),{status:r,refresh:k}=w(),b=S(()=>r.server_ready?"":r.pki_ready&&r.missing.length?`Missing server files: ${r.missing.join(", ")}`:"Initialize PKI first"),a=C({status:"unknown",pid:null,cpu_percent:0,memory_mb:0,uptime:null}),n=g(!1),l=g("");let d=null;const m=(e,s="success")=>h.show(e,s),p=async()=>{try{const e=await f.get("/server/process/stats");Object.assign(a,e.data)}catch(e){console.error("Failed to fetch stats:",e)}},v=async e=>{if(confirm(`Are you sure you want to ${e.toUpperCase()} the OpenVPN service?`)){n.value=!0,l.value=e;try{const s=await f.post(`/server/process/${e}`);m(s.data.message||`Service ${e} successful`,"success"),setTimeout(p,1e3)}catch(s){const u=s.response?.data?.detail||s.message;m(`Failed to ${e}: ${u}`,"error")}finally{n.value=!1,l.value=""}}};return M(()=>{k(),p(),d=setInterval(p,5e3)}),$(()=>{d&&clearInterval(d)}),(e,s)=>(i(),o("div",j,[t("div",A,[s[11]||(s[11]=t("div",{class:"config-header"},[t("h1",null,"Server Process Management")],-1)),t("div",B,[t("div",N,[t("label",z,[s[3]||(s[3]=t("span",null,"CPU Usage",-1)),t("span",null,c(a.cpu_percent)+"%",1)]),t("div",T,[t("div",{class:"progress-bar progress-bar-brand",role:"progressbar",style:P({width:Math.min(a.cpu_percent,100)+"%"}),"aria-valuenow":a.cpu_percent,"aria-valuemin":"0","aria-valuemax":"100"},null,12,V)])]),t("div",D,[s[4]||(s[4]=t("label",{class:"stat-label"},"Status",-1)),t("div",F,[t("span",{class:x(["status-badge","status-"+(a.status==="running"?"active":"revoked")])},c(a.status.toUpperCase()),3)])]),t("div",O,[s[5]||(s[5]=t("label",{class:"stat-label"},"Process ID",-1)),t("div",R,c(a.pid||"N/A"),1)]),t("div",E,[s[6]||(s[6]=t("label",{class:"stat-label"},"Memory (RSS)",-1)),t("div",H,c(a.memory_mb)+" MB",1)]),t("div",K,[s[7]||(s[7]=t("label",{class:"stat-label"},"Uptime",-1)),t("div",L,c(a.uptime||"N/A"),1)])]),t("div",q,[t("button",{type:"button",class:"btn-action btn-action-primary",onClick:s[0]||(s[0]=u=>v("start")),disabled:n.value||a.status==="running"||!y(r).server_ready,title:b.value},[n.value&&l.value==="start"?(i(),o("i",J)):(i(),o("i",Q)),s[8]||(s[8]=_(" Start Service ",-1))],8,G),t("button",{type:"button",class:"btn-action btn-action-save",onClick:s[1]||(s[1]=u=>v("restart")),disabled:n.value||!y(r).server_ready,title:b.value},[n.value&&l.value==="restart"?(i(),o("i",X)):(i(),o("i",Y)),s[9]||(s[9]=_(" Restart Service ",-1))],8,W),t("button",{type:"button",class:"btn-action btn-action-danger",onClick:s[2]||(s[2]=u=>v("stop")),disabled:n.value||a.status!=="running"},[n.value&&l.value==="stop"?(i(),o("i",ss)):(i(),o("i",ts)),s[10]||(s[10]=_(" Stop Service ",-1))],8,Z)])])]))}};export{is as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{a as N,r as k,D as A,o as E,z as F,c as i,e as R,d as t,A as B,g as v,m as j,E as z,x as _,w as l,v as K,q as u,h as c,F as C,i as x,C as O,j as q,B as G,k as a}from"./index-DQu6UtRL.js";import"./vendor-charts-Bcjh2pZL.js";import"./vendor-ui-jlFFG6nm.js";const X={class:"config-wrapper"},H={key:0,class:"config-card"},J={key:1,class:"config-card"},Q={class:"config-row"},W={class:"config-col"},Y={class:"select-container"},Z={class:"config-col"},h={class:"number-input-container"},ss={class:"number-input-controls"},ts={class:"config-row"},ns={class:"config-col"},os={class:"config-col"},es={class:"config-row"},ls={class:"config-col"},is={class:"number-input-container"},as={class:"number-input-controls"},rs={class:"config-col"},ds={class:"number-input-container"},us={class:"number-input-controls"},ps={class:"config-row"},cs={class:"config-col"},fs={class:"toggle-wrapper"},vs={class:"toggle-switch"},gs={key:0,class:"nested-box fade-in"},bs={class:"config-row mb-2"},ms={class:"config-col"},_s={class:"list-container"},ys=["onUpdate:modelValue"],ks=["onClick"],ws={class:"config-row"},Cs={class:"config-col"},xs={class:"toggle-wrapper"},Ss={class:"toggle-switch"},Vs={key:1,class:"nested-box fade-in"},Us={class:"config-row mb-2"},Ps={class:"config-col"},Ds={class:"list-container"},Ts=["onUpdate:modelValue"],$s=["onClick"],Is={class:"config-row"},Ls={class:"config-col"},Ms={class:"toggle-wrapper"},Ns={class:"toggle-switch"},As={class:"config-col"},Es={class:"toggle-wrapper"},Fs={class:"toggle-switch"},Rs={class:"config-col"},Bs={class:"toggle-wrapper"},js={class:"toggle-switch"},zs={class:"config-row"},Ks={class:"config-col"},Os={class:"toggle-wrapper"},qs={class:"toggle-switch"},Gs={key:2,class:"nested-box fade-in"},Xs={class:"config-row"},Hs={class:"config-col"},Js={class:"config-row mt-3"},Qs={class:"config-col"},Ws={class:"config-row mt-4"},Ys={class:"config-col"},Zs={class:"toggle-wrapper"},hs={class:"toggle-switch"},st={key:3,class:"nested-box fade-in"},tt={class:"config-row"},nt={class:"config-col"},ot={class:"config-col"},et={class:"number-input-container"},lt={class:"number-input-controls"},it={class:"btn-action-group"},at=["disabled"],rt={key:0,class:"fas fa-spinner fa-spin"},dt={key:1,class:"fas fa-save"},ut=["disabled"],pt={key:0,class:"fas fa-spinner fa-spin"},ct={key:1,class:"fas fa-rocket"},mt={__name:"VPNConfig",setup(ft){const{profilesApiClient:y}=q(),S=G(),{status:V,refresh:w}=F(),n=N({protocol:"udp",port:1194,vpn_network:"",public_ip:"",tun_mtu:0,mssfix:0,tunnel_type:"FULL",split_routes:[],user_defined_dns:!1,dns_servers:[],duplicate_cn:!1,client_to_client:!1,crl_verify:!1,user_defined_cdscripts:!1,connect_script:"",disconnect_script:"",management_interface:!1,management_interface_address:"",management_port:7505}),g=k(!1),p=k(!1),f=k("");A(g,e=>{n.tunnel_type=e?"SPLIT":"FULL"});function U(e){if(!e)return"";const s=e.split(".");let r=0;const o={255:8,254:7,252:6,248:5,240:4,224:3,192:2,128:1,0:0};for(let d of s)r+=o[parseInt(d)]||0;return r}const b=(e,s="success")=>S.show(e,s),P=()=>n.split_routes.push(""),D=e=>n.split_routes.splice(e,1),T=()=>n.dns_servers.push(""),$=e=>n.dns_servers.splice(e,1),I=async()=>{try{const s=(await y.get("/config",{params:{section:"server"}})).data,r=s.server?s.server:s;if(Object.keys(r).forEach(o=>{n.hasOwnProperty(o)&&(o==="tunnel_type"&&(g.value=r[o]==="SPLIT"),n[o]=r[o])}),r.vpn_network&&r.vpn_netmask){const o=U(r.vpn_netmask);o&&(n.vpn_network=`${r.vpn_network}/${o}`)}}catch(e){console.error(e),b("Failed to load Server config from Management API.","error")}},L=async()=>{p.value=!0,f.value="save";const e={...n};if(e.split_routes=e.split_routes.filter(s=>s&&s.trim()!==""),e.dns_servers=e.dns_servers.filter(s=>s&&s.trim()!==""),e.vpn_network.includes("/")){const[s,r]=e.vpn_network.split("/");e.vpn_network=s}try{await y.put("/config/server",e),b("Server configuration saved!","success")}catch(s){b(`Error saving: ${s.response?.data?.detail||s.message}`,"error")}finally{p.value=!1,f.value=""}},M=async()=>{p.value=!0,f.value="apply";try{const s=(await y.post("/server/configure")).data;b(s.message||"Configuration applied!","success")}catch(e){b(`Error applying: ${e.response?.data?.detail||e.message}`,"error"),w()}finally{p.value=!1,f.value=""}};return E(()=>{w(),I()}),(e,s)=>{const r=z("router-link");return a(),i("div",X,[R(V).pki_ready?(a(),i("div",J,[s[75]||(s[75]=t("div",{class:"config-header"},[t("h1",null,"Server Infrastructure Configuration")],-1)),t("form",{onSubmit:O(L,["prevent"])},[t("div",Q,[t("div",W,[s[30]||(s[30]=t("label",{class:"config-label"},"Tunnel Protocol",-1)),t("div",Y,[l(t("select",{class:"config-select","onUpdate:modelValue":s[0]||(s[0]=o=>n.protocol=o)},[...s[28]||(s[28]=[t("option",{value:"tcp"},"TCP",-1),t("option",{value:"udp"},"UDP",-1)])],512),[[K,n.protocol]]),s[29]||(s[29]=t("div",{class:"select-arrow"},[t("i",{class:"fas fa-chevron-down"})],-1))])]),t("div",Z,[s[33]||(s[33]=t("label",{class:"config-label"},"Tunnel Port",-1)),t("div",h,[l(Line truncated
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Analytics-CE9OWhfn.js","assets/vendor-charts-Bcjh2pZL.js","assets/vendor-ui-jlFFG6nm.js","assets/Certificates-DL4-OpRZ.js","assets/ConfirmModal-likdDJzi.js","assets/PKIConfig-CJEinDsL.js","assets/VPNConfig-cSWblOqw.js","assets/ServerManagement-DWxVTYxH.js","assets/Account-B9jhwMBa.js"])))=>i.map(i=>d[i]);
|
||||
import{C as zu,r as om}from"./vendor-charts-Bcjh2pZL.js";import{M as lm}from"./vendor-ui-jlFFG6nm.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();function wl(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Be={},Ds=[],mn=()=>{},Gu=()=>!1,Ni=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),El=e=>e.startsWith("onUpdate:"),rt=Object.assign,Al=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},am=Object.prototype.hasOwnProperty,Ne=(e,t)=>am.call(e,t),oe=Array.isArray,Ms=e=>Or(e)==="[object Map]",zs=e=>Or(e)==="[object Set]",Cc=e=>Or(e)==="[object Date]",me=e=>typeof e=="function",Xe=e=>typeof e=="string",Zt=e=>typeof e=="symbol",$e=e=>e!==null&&typeof e=="object",Ju=e=>($e(e)||me(e))&&me(e.then)&&me(e.catch),Xu=Object.prototype.toString,Or=e=>Xu.call(e),cm=e=>Or(e).slice(8,-1),Yu=e=>Or(e)==="[object Object]",Cl=e=>Xe(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,ur=wl(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ki=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},um=/-\w/g,zt=ki(e=>e.replace(um,t=>t.slice(1).toUpperCase())),fm=/\B([A-Z])/g,qn=ki(e=>e.replace(fm,"-$1").toLowerCase()),Ii=ki(e=>e.charAt(0).toUpperCase()+e.slice(1)),No=ki(e=>e?`on${Ii(e)}`:""),Un=(e,t)=>!Object.is(e,t),fi=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Qu=(e,t,n,s=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:s,value:n})},Li=e=>{const t=parseFloat(e);return isNaN(t)?e:t},dm=e=>{const t=Xe(e)?Number(e):NaN;return isNaN(t)?e:t};let xc;const Di=()=>xc||(xc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Mi(e){if(oe(e)){const t={};for(let n=0;n<e.length;n++){const s=e[n],r=Xe(s)?gm(s):Mi(s);if(r)for(const o in r)t[o]=r[o]}return t}else if(Xe(e)||$e(e))return e}const hm=/;(?![^(]*\))/g,pm=/:([^]+)/,mm=/\/\*[^]*?\*\//g;function gm(e){const t={};return e.replace(mm,"").split(hm).forEach(n=>{if(n){const s=n.split(pm);s.length>1&&(t[s[0].trim()]=s[1].trim())}}),t}function ft(e){let t="";if(Xe(e))t=e;else if(oe(e))for(let n=0;n<e.length;n++){const s=ft(e[n]);s&&(t+=s+" ")}else if($e(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const _m="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",bm=wl(_m);function Zu(e){return!!e||e===""}function vm(e,t){if(e.length!==t.length)return!1;let n=!0;for(let s=0;n&&s<e.length;s++)n=Rr(e[s],t[s]);return n}function Rr(e,t){if(e===t)return!0;let n=Cc(e),s=Cc(t);if(n||s)return n&&s?e.getTime()===t.getTime():!1;if(n=Zt(e),s=Zt(t),n||s)return e===t;if(n=oe(e),s=oe(t),n||s)return n&&s?vm(e,t):!1;if(n=$e(e),s=$e(t),n||s){if(!n||!s)return!1;const r=Object.keys(e).length,o=Object.keys(t).length;if(r!==o)return!1;for(const l in e){const c=e.hasOwnProperty(l),u=t.hasOwnProperty(l);if(c&&!u||!c&&u||!Rr(e[l],t[l]))return!1}}return String(e)===String(t)}function xl(e,t){return e.findIndex(n=>Rr(n,t))}const ef=e=>!!(e&&e.__v_isRef===!0),Ge=e=>Xe(e)?e:e==null?"":oe(e)||$e(e)&&(e.toString===Xu||!me(e.toString))?ef(e)?Ge(e.value):JSON.stringify(e,tf,2):String(e),tf=(e,t)=>ef(t)?tf(e,t.value):Ms(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[s,r],o)=>(n[ko(s,o)+" =>"]=r,n),{})}:zs(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>ko(n))}:Zt(t)?ko(t):$e(t)&&!oe(t)&&!Yu(t)?String(t):t,ko=(e,t="")=>{var n;return Zt(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};let Rt;class ym{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Rt,!t&&Rt&&(this.index=(Rt.scopes||(Rt.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].pause();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].resume();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].resume()}}run(t){if(this._active){const n=Rt;try{return Rt=this,t()}finally{Rt=n}}}on(){++this._on===1&&(this.prevScope=Rt,Rt=this)}off(){this._on>0&&--this._on===0&&(Rt=this.prevScope,this.pLine truncated
|
||||
`).forEach(function(l){r=l.indexOf(":"),n=l.substring(0,r).trim().toLowerCase(),s=l.substring(r+1).trim(),!(!n||t[n]&&Wb[n])&&(n==="set-cookie"?t[n]?t[n].push(s):t[n]=[s]:t[n]=t[n]?t[n]+", "+s:s)}),t},_u=Symbol("internals");function ir(e){return e&&String(e).trim().toLowerCase()}function vi(e){return e===!1||e==null?e:S.isArray(e)?e.map(vi):String(e)}function zb(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=n.exec(e);)t[s[1]]=s[2];return t}const Gb=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Vo(e,t,n,s,r){if(S.isFunction(s))return s.call(this,t,n);if(r&&(t=n),!!S.isString(t)){if(S.isString(s))return t.indexOf(s)!==-1;if(S.isRegExp(s))return s.test(t)}}function Jb(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,s)=>n.toUpperCase()+s)}function Xb(e,t){const n=S.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+n,{value:function(r,o,l){return this[s].call(this,t,r,o,l)},configurable:!0})})}let Nt=class{constructor(t){t&&this.set(t)}set(t,n,s){const r=this;function o(c,u,h){const d=ir(u);if(!d)throw new Error("header name must be a non-empty string");const p=S.findKey(r,d);(!p||r[p]===void 0||h===!0||h===void 0&&r[p]!==!1)&&(r[p||u]=vi(c))}const l=(c,u)=>S.forEach(c,(h,d)=>o(h,d,u));if(S.isPlainObject(t)||t instanceof this.constructor)l(t,n);else if(S.isString(t)&&(t=t.trim())&&!Gb(t))l(Kb(t),n);else if(S.isObject(t)&&S.isIterable(t)){let c={},u,h;for(const d of t){if(!S.isArray(d))throw TypeError("Object iterator must return a key-value pair");c[h=d[0]]=(u=c[h])?S.isArray(u)?[...u,d[1]]:[u,d[1]]:d[1]}l(c,n)}else t!=null&&o(n,t,s);return this}get(t,n){if(t=ir(t),t){const s=S.findKey(this,t);if(s){const r=this[s];if(!n)return r;if(n===!0)return zb(r);if(S.isFunction(n))return n.call(this,r,s);if(S.isRegExp(n))return n.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=ir(t),t){const s=S.findKey(this,t);return!!(s&&this[s]!==void 0&&(!n||Vo(this,this[s],s,n)))}return!1}delete(t,n){const s=this;let r=!1;function o(l){if(l=ir(l),l){const c=S.findKey(s,l);c&&(!n||Vo(s,s[c],c,n))&&(delete s[c],r=!0)}}return S.isArray(t)?t.forEach(o):o(t),r}clear(t){const n=Object.keys(this);let s=n.length,r=!1;for(;s--;){const o=n[s];(!t||Vo(this,this[o],o,t,!0))&&(delete this[o],r=!0)}return r}normalize(t){const n=this,s={};return S.forEach(this,(r,o)=>{const l=S.findKey(s,o);if(l){n[l]=vi(r),delete n[o];return}const c=t?Jb(o):String(o).trim();c!==o&&delete n[o],n[c]=vi(r),s[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return S.forEach(this,(s,r)=>{s!=null&&s!==!1&&(n[r]=t&&S.isArray(s)?s.join(", "):s)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
||||
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const s=new this(t);return n.forEach(r=>s.set(r)),s}static accessor(t){const s=(this[_u]=this[_u]={accessors:{}}).accessors,r=this.prototype;function o(l){const c=ir(l);s[c]||(Xb(r,l),s[c]=!0)}return S.isArray(t)?t.forEach(o):o(t),this}};Nt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);S.reduceDescriptors(Nt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[n]=s}}});S.freezeMethods(Nt);function qo(e,t){const n=this||Mr,s=t||n,r=Nt.from(s.headers);let o=s.data;return S.forEach(e,function(c){o=c.call(n,o,r.normalize(),t?t.status:void 0)}),r.normalize(),o}function Sd(e){return!!(e&&e.__CANCEL__)}function Js(e,t,n){ge.call(this,e??"canceled",ge.ERR_CANCELED,t,n),this.name="CanceledError"}S.inherits(Js,ge,{__CANCEL__:!0});function Td(e,t,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):t(new ge("Request failed with status code "+n.status,[ge.ERR_BAD_REQUEST,ge.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Yb(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Qb(e,t){e=e||10;const n=new Array(e),s=new Array(e);let r=0,o=0,l;return t=t!==void 0?t:1e3,function(u){const h=Date.now(),d=s[o];l||(l=h),n[r]=u,s[r]=h;let p=o,_=0;for(;p!==r;)_+=n[p++],p=p%e;if(r=(r+1)%e,r===o&&(o=(o+1)%e),h-l<t)return;const v=d&&h-d;return v?Math.round(_*1e3/v):void 0}}function Zb(e,t){let n=0,s=1e3/t,r,o;const l=(h,d=Date.now())=>{n=d,r=null,o&&(clearTimeout(o),o=null),e(...h)};return[(...h)=>{const d=Date.now(),p=d-n;p>=s?l(h,d):(r=h,o||(o=setTimeout(()=>{o=null,l(r)},s-p)))},()=>r&&l(r)]}const Pi=(e,t,n=3)=>{let s=0;const r=Qb(50,250);return Zb(o=>{const l=o.loaded,c=o.lengthComputable?o.total:void 0,u=l-s,h=r(u),d=l<=c;s=l;const p={loaded:l,total:c,progress:c?l/c:void 0,bytes:u,rate:h||void 0,estimated:h&&c&&d?(c-l)/h:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(p)},n)},bu=(e,t)=>{const n=e!=null;return[s=>t[0]({lengthComputable:n,total:e,loaded:s}),t[1]]},vu=e=>(...t)=>S.asap(()=>e(...t)),ev=gt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,gt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(gt.origin),gt.navigator&&/(msie|trident)/i.test(gt.navigator.userAgent)):()=>!0,tv=gt.hasStandardBrowserEnv?{write(e,t,n,s,r,o,l){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];S.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),S.isString(s)&&c.push(`path=${s}`),S.isString(r)&&c.push(`domain=${r}`),o===!0&&c.push("secure"),S.isString(l)&&c.push(`SameSite=${l}`),document.cookie=c.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function nv(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function sv(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Od(e,t,n){let s=!nv(t);return e&&(s||n==!1)?sv(e,t):t}const yu=e=>e instanceof Nt?{...e}:e;function ps(e,t){t=t||{};const n={};function s(h,d,p,_){return S.isPlainObject(h)&&S.isPlainObject(d)?S.merge.call({caseless:_},h,d):S.isPlainObject(d)?S.merge({},d):S.isArray(d)?d.slice():d}function r(h,d,p,_){if(S.isUndefined(d)){if(!S.isUndefined(h))return s(void 0,h,p,_)}else return s(h,d,p,_)}function o(h,d){if(!S.isUndefined(d))return s(void 0,d)}function l(h,d){if(S.isUndefined(d)){if(!S.isUndefined(h))return s(void 0,h)}else return s(void 0,d)}function c(h,d,p){if(p in t)return s(h,d);if(p in e)return s(void 0,h)}const u={url:o,method:o,data:o,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:c,headers:(h,d,p)=>r(yu(h),yu(d),p,!0)};return S.forEach(Object.keys({...e,...t}),function(d){const p=u[d]||r,_=p(e[d],t[d],d);S.isUndefined(_)&&p!==c||(n[d]=_)}),n}const Rd=e=>{const t=ps({},e);let{data:n,withXSRFToken:s,xsrfHeaderName:r,xsrfCookieName:o,headers:l,auth:c}=t;if(t.headers=l=Nt.from(l),t.url=Ad(Od(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&l.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),S.isFormData(n)){if(gt.hasStandardBrowserEnv||gt.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if(S.isFunction(n.getHeaders)){const u=n.getHeaders(),h=["content-type","content-length"];Object.entries(u).forEach(([d,p])=>{h.inclu
Line truncated
|
||||
`+l.map(Su).join(`
|
||||
`):" "+Su(l[0]):"as no adapter specified";throw new ge("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return r}const Nd={getAdapter:pv,adapters:ql};function Wo(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Js(null,e)}function Tu(e){return Wo(e),e.headers=Nt.from(e.headers),e.data=qo.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Nd.getAdapter(e.adapter||Mr.adapter,e)(e).then(function(s){return Wo(e),s.data=qo.call(e,e.transformResponse,s),s.headers=Nt.from(s.headers),s},function(s){return Sd(s)||(Wo(e),s&&s.response&&(s.response.data=qo.call(e,e.transformResponse,s.response),s.response.headers=Nt.from(s.response.headers))),Promise.reject(s)})}const kd="1.13.2",Gi={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Gi[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const Ou={};Gi.transitional=function(t,n,s){function r(o,l){return"[Axios v"+kd+"] Transitional option '"+o+"'"+l+(s?". "+s:"")}return(o,l,c)=>{if(t===!1)throw new ge(r(l," has been removed"+(n?" in "+n:"")),ge.ERR_DEPRECATED);return n&&!Ou[l]&&(Ou[l]=!0,console.warn(r(l," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,l,c):!0}};Gi.spelling=function(t){return(n,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function mv(e,t,n){if(typeof e!="object")throw new ge("options must be an object",ge.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let r=s.length;for(;r-- >0;){const o=s[r],l=t[o];if(l){const c=e[o],u=c===void 0||l(c,o,e);if(u!==!0)throw new ge("option "+o+" must be "+u,ge.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ge("Unknown option "+o,ge.ERR_BAD_OPTION)}}const yi={assertOptions:mv,validators:Gi},fn=yi.validators;let ds=class{constructor(t){this.defaults=t||{},this.interceptors={request:new gu,response:new gu}}async request(t,n){try{return await this._request(t,n)}catch(s){if(s instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const o=r.stack?r.stack.replace(/^.+\n/,""):"";try{s.stack?o&&!String(s.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(s.stack+=`
|
||||
`+o):s.stack=o}catch{}}throw s}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=ps(this.defaults,n);const{transitional:s,paramsSerializer:r,headers:o}=n;s!==void 0&&yi.assertOptions(s,{silentJSONParsing:fn.transitional(fn.boolean),forcedJSONParsing:fn.transitional(fn.boolean),clarifyTimeoutError:fn.transitional(fn.boolean)},!1),r!=null&&(S.isFunction(r)?n.paramsSerializer={serialize:r}:yi.assertOptions(r,{encode:fn.function,serialize:fn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),yi.assertOptions(n,{baseUrl:fn.spelling("baseURL"),withXsrfToken:fn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=o&&S.merge(o.common,o[n.method]);o&&S.forEach(["delete","get","head","post","put","patch","common"],y=>{delete o[y]}),n.headers=Nt.concat(l,o);const c=[];let u=!0;this.interceptors.request.forEach(function(x){typeof x.runWhen=="function"&&x.runWhen(n)===!1||(u=u&&x.synchronous,c.unshift(x.fulfilled,x.rejected))});const h=[];this.interceptors.response.forEach(function(x){h.push(x.fulfilled,x.rejected)});let d,p=0,_;if(!u){const y=[Tu.bind(this),void 0];for(y.unshift(...c),y.push(...h),_=y.length,d=Promise.resolve(n);p<_;)d=d.then(y[p++],y[p++]);return d}_=c.length;let v=n;for(;p<_;){const y=c[p++],x=c[p++];try{v=y(v)}catch(O){x.call(this,O);break}}try{d=Tu.call(this,v)}catch(y){return Promise.reject(y)}for(p=0,_=h.length;p<_;)d=d.then(h[p++],h[p++]);return d}getUri(t){t=ps(this.defaults,t);const n=Od(t.baseURL,t.url,t.allowAbsoluteUrls);return Ad(n,t.params,t.paramsSerializer)}};S.forEach(["delete","get","head","options"],function(t){ds.prototype[t]=function(n,s){return this.request(ps(s||{},{method:t,url:n,data:(s||{}).data}))}});S.forEach(["post","put","patch"],function(t){function n(s){return function(o,l,c){return this.request(ps(c||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:o,data:l}))}}ds.prototype[t]=n(),ds.prototype[t+"Form"]=n(!0)});let gv=class Id{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const s=this;this.promise.then(r=>{if(!s._listeners)return;let o=s._listeners.length;for(;o-- >0;)s._listeners[o](r);s._listeners=null}),this.promise.then=r=>{let o;const l=new Promise(c=>{s.subscribe(c),o=c}).then(r);return l.cancel=function(){s.unsubscribe(o)},l},t(function(o,l,c){s.reason||(s.reason=new Js(o,l,c),n(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=s=>{t.abort(s)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Id(function(r){t=r}),cancel:t}}};function _v(e){return function(n){return e.apply(null,n)}}function bv(e){return S.isObject(e)&&e.isAxiosError===!0}const ml={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ml).forEach(([e,t])=>{ml[t]=e});function Ld(e){const t=new ds(e),n=fd(ds.prototype.request,t);return S.extend(n,ds.prototype,t,{allOwnKeys:!0}),S.extend(n,t,null,{allOwnKeys:!0}),n.create=function(r){return Ld(ps(e,r))},n}const Ke=Ld(Mr);Ke.Axios=ds;Ke.CanceledError=Js;Ke.CancelToken=gv;Ke.isCancel=Sd;Ke.VERSION=kd;Ke.toFormData=zi;Ke.AxiosError=ge;Ke.Cancel=Ke.CanceledError;Ke.all=function(t){return Promise.all(t)};Ke.spread=_v;Ke.isAxiosError=bv;Ke.mergeConfig=ps;Ke.AxiosH
Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
@charset "UTF-8";:root,[data-bs-theme=light]{--bs-blue:#0d6efd;--bs-indigo:#6610f2;--bs-purple:#6f42c1;--bs-pink:#d63384;--bs-red:#dc3545;--bs-orange:#fd7e14;--bs-yellow:#ffc107;--bs-green:#198754;--bs-teal:#20c997;--bs-cyan:#0dcaf0;--bs-black:#000;--bs-white:#fff;--bs-gray:#6c757d;--bs-gray-dark:#343a40;--bs-gray-100:#f8f9fa;--bs-gray-200:#e9ecef;--bs-gray-300:#dee2e6;--bs-gray-400:#ced4da;--bs-gray-500:#adb5bd;--bs-gray-600:#6c757d;--bs-gray-700:#495057;--bs-gray-800:#343a40;--bs-gray-900:#212529;--bs-primary:#0d6efd;--bs-secondary:#6c757d;--bs-success:#198754;--bs-info:#0dcaf0;--bs-warning:#ffc107;--bs-danger:#dc3545;--bs-light:#f8f9fa;--bs-dark:#212529;--bs-primary-rgb:13,110,253;--bs-secondary-rgb:108,117,125;--bs-success-rgb:25,135,84;--bs-info-rgb:13,202,240;--bs-warning-rgb:255,193,7;--bs-danger-rgb:220,53,69;--bs-light-rgb:248,249,250;--bs-dark-rgb:33,37,41;--bs-primary-text-emphasis:#052c65;--bs-secondary-text-emphasis:#2b2f32;--bs-success-text-emphasis:#0a3622;--bs-info-text-emphasis:#055160;--bs-warning-text-emphasis:#664d03;--bs-danger-text-emphasis:#58151c;--bs-light-text-emphasis:#495057;--bs-dark-text-emphasis:#495057;--bs-primary-bg-subtle:#cfe2ff;--bs-secondary-bg-subtle:#e2e3e5;--bs-success-bg-subtle:#d1e7dd;--bs-info-bg-subtle:#cff4fc;--bs-warning-bg-subtle:#fff3cd;--bs-danger-bg-subtle:#f8d7da;--bs-light-bg-subtle:#fcfcfd;--bs-dark-bg-subtle:#ced4da;--bs-primary-border-subtle:#9ec5fe;--bs-secondary-border-subtle:#c4c8cb;--bs-success-border-subtle:#a3cfbb;--bs-info-border-subtle:#9eeaf9;--bs-warning-border-subtle:#ffe69c;--bs-danger-border-subtle:#f1aeb5;--bs-light-border-subtle:#e9ecef;--bs-dark-border-subtle:#adb5bd;--bs-white-rgb:255,255,255;--bs-black-rgb:0,0,0;--bs-font-sans-serif:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue","Noto Sans","Liberation Sans",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--bs-font-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--bs-gradient:linear-gradient(180deg, rgba(255, 255, 255, .15), rgba(255, 255, 255, 0));--bs-body-font-family:var(--bs-font-sans-serif);--bs-body-font-size:1rem;--bs-body-font-weight:400;--bs-body-line-height:1.5;--bs-body-color:#212529;--bs-body-color-rgb:33,37,41;--bs-body-bg:#fff;--bs-body-bg-rgb:255,255,255;--bs-emphasis-color:#000;--bs-emphasis-color-rgb:0,0,0;--bs-secondary-color:rgba(33, 37, 41, .75);--bs-secondary-color-rgb:33,37,41;--bs-secondary-bg:#e9ecef;--bs-secondary-bg-rgb:233,236,239;--bs-tertiary-color:rgba(33, 37, 41, .5);--bs-tertiary-color-rgb:33,37,41;--bs-tertiary-bg:#f8f9fa;--bs-tertiary-bg-rgb:248,249,250;--bs-heading-color:inherit;--bs-link-color:#0d6efd;--bs-link-color-rgb:13,110,253;--bs-link-decoration:underline;--bs-link-hover-color:#0a58ca;--bs-link-hover-color-rgb:10,88,202;--bs-code-color:#d63384;--bs-highlight-color:#212529;--bs-highlight-bg:#fff3cd;--bs-border-width:1px;--bs-border-style:solid;--bs-border-color:#dee2e6;--bs-border-color-translucent:rgba(0, 0, 0, .175);--bs-border-radius:.375rem;--bs-border-radius-sm:.25rem;--bs-border-radius-lg:.5rem;--bs-border-radius-xl:1rem;--bs-border-radius-xxl:2rem;--bs-border-radius-2xl:var(--bs-border-radius-xxl);--bs-border-radius-pill:50rem;--bs-box-shadow:0 .5rem 1rem rgba(0, 0, 0, .15);--bs-box-shadow-sm:0 .125rem .25rem rgba(0, 0, 0, .075);--bs-box-shadow-lg:0 1rem 3rem rgba(0, 0, 0, .175);--bs-box-shadow-inset:inset 0 1px 2px rgba(0, 0, 0, .075);--bs-focus-ring-width:.25rem;--bs-focus-ring-opacity:.25;--bs-focus-ring-color:rgba(13, 110, 253, .25);--bs-form-valid-color:#198754;--bs-form-valid-border-color:#198754;--bs-form-invalid-color:#dc3545;--bs-form-invalid-border-color:#dc3545}[data-bs-theme=dark]{color-scheme:dark;--bs-body-color:#dee2e6;--bs-body-color-rgb:222,226,230;--bs-body-bg:#212529;--bs-body-bg-rgb:33,37,41;--bs-emphasis-color:#fff;--bs-emphasis-color-rgb:255,255,255;--bs-secondary-color:rgba(222, 226, 230, .75);--bs-secondary-color-rgb:222,226,230;--bs-secondary-bg:#343a40;--bs-secondary-bg-rgb:52,58,64;--bs-tertiary-color:rgba(222, 226, 230, .5);--bs-tertiary-color-rgb:222,226,230;--bs-tertiary-bg:#2b3035;--bs-tertiary-bg-rgb:43,48,53;--bs-primary-text-emphasis:#6ea8fe;--bs-secondary-text-emphasis:#a7acb1;--bs-success-text-emphasis:#75b798;--bs-info-text-emphasis:#6edff6;--bs-warning-text-emphasis:#ffda6a;--bs-danger-text-emphasis:#ea868f;--bs-light-text-emphasis:#f8f9fa;--bs-dark-text-emphasis:#dee2e6;--bs-primary-bg-subtle:#031633;--bs-secondary-bg-subtle:#161719;--bs-success-bg-subtle:#051b11;--bs-info-bg-subtle:#032830;--bs-warning-bg-subtle:#332701;--bs-danger-bg-subtle:#2c0b0e;--bs-light-bg-subtle:#343a40;--bs-dark-bg-subtle:#1a1d20;--bs-primary-border-subtle:#084298;--bs-secondary-border-subtle:#41464b;--bs-success-border-subtle:#0f5132;--bs-info-border-subtle:#087990;--bs-warning-border-subtle:#997404;--bs-danger-border-subtle:#842029;--bs-light-border-subtle:#495057;--bs-dark-border-subtle:#343a40;--bs-heading-color:inherit;--Line truncated
|
||||
@@ -0,0 +1,3 @@
|
||||
function fe(i){return i+.5|0}const pt=(i,t,e)=>Math.max(Math.min(i,e),t);function Jt(i){return pt(fe(i*2.55),0,255)}function _t(i){return pt(fe(i*255),0,255)}function ht(i){return pt(fe(i/2.55)/100,0,1)}function Ii(i){return pt(fe(i*100),0,100)}const et={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},ai=[..."0123456789ABCDEF"],so=i=>ai[i&15],no=i=>ai[(i&240)>>4]+ai[i&15],me=i=>(i&240)>>4===(i&15),oo=i=>me(i.r)&&me(i.g)&&me(i.b)&&me(i.a);function ro(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&et[i[1]]*17,g:255&et[i[2]]*17,b:255&et[i[3]]*17,a:t===5?et[i[4]]*17:255}:(t===7||t===9)&&(e={r:et[i[1]]<<4|et[i[2]],g:et[i[3]]<<4|et[i[4]],b:et[i[5]]<<4|et[i[6]],a:t===9?et[i[7]]<<4|et[i[8]]:255})),e}const ao=(i,t)=>i<255?t(i):"";function lo(i){var t=oo(i)?so:no;return i?"#"+t(i.r)+t(i.g)+t(i.b)+ao(i.a,t):void 0}const co=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function on(i,t,e){const s=t*Math.min(e,1-e),n=(o,r=(o+i/30)%12)=>e-s*Math.max(Math.min(r-3,9-r,1),-1);return[n(0),n(8),n(4)]}function ho(i,t,e){const s=(n,o=(n+i/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[s(5),s(3),s(1)]}function uo(i,t,e){const s=on(i,1,.5);let n;for(t+e>1&&(n=1/(t+e),t*=n,e*=n),n=0;n<3;n++)s[n]*=1-t-e,s[n]+=t;return s}function fo(i,t,e,s,n){return i===n?(t-e)/s+(t<e?6:0):t===n?(e-i)/s+2:(i-t)/s+4}function xi(i){const e=i.r/255,s=i.g/255,n=i.b/255,o=Math.max(e,s,n),r=Math.min(e,s,n),a=(o+r)/2;let l,c,h;return o!==r&&(h=o-r,c=a>.5?h/(2-o-r):h/(o+r),l=fo(e,s,n,h,o),l=l*60+.5),[l|0,c||0,a]}function _i(i,t,e,s){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,s)).map(_t)}function yi(i,t,e){return _i(on,i,t,e)}function go(i,t,e){return _i(uo,i,t,e)}function po(i,t,e){return _i(ho,i,t,e)}function rn(i){return(i%360+360)%360}function mo(i){const t=co.exec(i);let e=255,s;if(!t)return;t[5]!==s&&(e=t[6]?Jt(+t[5]):_t(+t[5]));const n=rn(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?s=go(n,o,r):t[1]==="hsv"?s=po(n,o,r):s=yi(n,o,r),{r:s[0],g:s[1],b:s[2],a:e}}function bo(i,t){var e=xi(i);e[0]=rn(e[0]+t),e=yi(e),i.r=e[0],i.g=e[1],i.b=e[2]}function xo(i){if(!i)return;const t=xi(i),e=t[0],s=Ii(t[1]),n=Ii(t[2]);return i.a<255?`hsla(${e}, ${s}%, ${n}%, ${ht(i.a)})`:`hsl(${e}, ${s}%, ${n}%)`}const Fi={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},zi={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function _o(){const i={},t=Object.keys(zi),e=Object.keys(Fi);let s,n,o,r,a;for(s=0;s<t.length;s++){for(r=a=t[s],n=0;n<e.length;n++)o=e[n],a=Line truncated
|
||||
`)>-1?i.split(`
|
||||
`):i}function jc(i,t){const{element:e,datasetIndex:s,index:n}=t,o=i.getDatasetMeta(s).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:i,label:r,parsed:o.getParsed(n),raw:i.data.datasets[s].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:e}}function Hs(i,t){const e=i.chart.ctx,{body:s,footer:n,title:o}=i,{boxWidth:r,boxHeight:a}=t,l=j(t.bodyFont),c=j(t.titleFont),h=j(t.footerFont),d=o.length,u=n.length,f=s.length,g=G(t.padding);let p=g.height,m=0,b=s.reduce((y,_)=>y+_.before.length+_.lines.length+_.after.length,0);if(b+=i.beforeBody.length+i.afterBody.length,d&&(p+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),b){const y=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=f*y+(b-f)*l.lineHeight+(b-1)*t.bodySpacing}u&&(p+=t.footerMarginTop+u*h.lineHeight+(u-1)*t.footerSpacing);let x=0;const v=function(y){m=Math.max(m,e.measureText(y).width+x)};return e.save(),e.font=c.string,R(i.title,v),e.font=l.string,R(i.beforeBody.concat(i.afterBody),v),x=t.displayColors?r+2+t.boxPadding:0,R(s,y=>{R(y.before,v),R(y.lines,v),R(y.after,v)}),x=0,e.font=h.string,R(i.footer,v),e.restore(),m+=g.width,{width:m,height:p}}function $c(i,t){const{y:e,height:s}=t;return e<s/2?"top":e>i.height-s/2?"bottom":"center"}function Yc(i,t,e,s){const{x:n,width:o}=s,r=e.caretSize+e.caretPadding;if(i==="left"&&n+o+r>t.width||i==="right"&&n-o-r<0)return!0}function Xc(i,t,e,s){const{x:n,width:o}=e,{width:r,chartArea:{left:a,right:l}}=i;let c="center";return s==="center"?c=n<=(a+l)/2?"left":"right":n<=o/2?c="left":n>=r-o/2&&(c="right"),Yc(c,i,t,e)&&(c="center"),c}function js(i,t,e){const s=e.yAlign||t.yAlign||$c(i,e);return{xAlign:e.xAlign||t.xAlign||Xc(i,t,e,s),yAlign:s}}function Uc(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function Kc(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function $s(i,t,e,s){const{caretSize:n,caretPadding:o,cornerRadius:r}=i,{xAlign:a,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=Lt(r);let g=Uc(t,a);const p=Kc(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,u)+n:a==="right"&&(g+=Math.max(d,f)+n),{x:$(g,0,s.width-t.width),y:$(p,0,s.height-t.height)}}function De(i,t,e){const s=G(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function Ys(i){return nt([],ct(i))}function qc(i,t,e){return Mt(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Xs(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const eo={beforeTitle:at,title(i){if(i.length>0){const t=i[0],e=t.chart.data.labels,s=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(s>0&&t.dataIndex<s)return e[t.dataIndex]}return""},afterTitle:at,beforeBody:at,beforeLabel:at,label(i){if(this&&this.options&&this.options.mode==="dataset")return i.label+": "+i.formattedValue||i.formattedValue;let t=i.dataset.label||"";t&&(t+=": ");const e=i.formattedValue;return A(e)||(t+=e),t},labelColor(i){const e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(i){const e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:at,afterBody:at,beforeFooter:at,footer:at,afterFooter:at};function Z(i,t,e,s){const n=i[t].call(e,s);return typeof n>"u"?eo[t].call(e,s):n}class Us extends gt{static positioners=ee;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,s=this.options.setContext(this.getContext()),n=s.enabled&&e.options.animation&&s.animations,o=new Rn(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=qc(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:s}=e,n=Z(s,"beforeTitle",this,t),o=Z(s,"title",this,t),r=Z(s,"afterTitle",this,t);let a=[];return a=nt(a,ct(n)),a=nt(a,ct(o)),a=nt(a,ct(r)),a}getBeforeBody(t,e){return Ys(Z(e.ca
Line truncated
|
||||
@@ -0,0 +1,63 @@
|
||||
var H="top",U="bottom",q="right",j="left",un="auto",lt=[H,U,q,j],Re="start",Je="end",Vs="clippingParents",oo="viewport",qe="popper",Hs="reference",Yn=lt.reduce(function(t,e){return t.concat([e+"-"+Re,e+"-"+Je])},[]),so=[].concat(lt,[un]).reduce(function(t,e){return t.concat([e,e+"-"+Re,e+"-"+Je])},[]),js="beforeRead",Ws="read",Fs="afterRead",zs="beforeMain",Ks="main",Ys="afterMain",Us="beforeWrite",qs="write",Gs="afterWrite",Xs=[js,Ws,Fs,zs,Ks,Ys,Us,qs,Gs];function ue(t){return t?(t.nodeName||"").toLowerCase():null}function G(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Ve(t){var e=G(t).Element;return t instanceof e||t instanceof Element}function J(t){var e=G(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function io(t){if(typeof ShadowRoot>"u")return!1;var e=G(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function Vr(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var o=e.styles[n]||{},s=e.attributes[n]||{},i=e.elements[n];!J(i)||!ue(i)||(Object.assign(i.style,o),Object.keys(s).forEach(function(r){var a=s[r];a===!1?i.removeAttribute(r):i.setAttribute(r,a===!0?"":a)}))})}function Hr(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(o){var s=e.elements[o],i=e.attributes[o]||{},r=Object.keys(e.styles.hasOwnProperty(o)?e.styles[o]:n[o]),a=r.reduce(function(c,f){return c[f]="",c},{});!J(s)||!ue(s)||(Object.assign(s.style,a),Object.keys(i).forEach(function(c){s.removeAttribute(c)}))})}}const ro={name:"applyStyles",enabled:!0,phase:"write",fn:Vr,effect:Hr,requires:["computeStyles"]};function le(t){return t.split("-")[0]}var Me=Math.max,Xt=Math.min,et=Math.round;function Un(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Qs(){return!/^((?!chrome|android).)*safari/i.test(Un())}function tt(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var o=t.getBoundingClientRect(),s=1,i=1;e&&J(t)&&(s=t.offsetWidth>0&&et(o.width)/t.offsetWidth||1,i=t.offsetHeight>0&&et(o.height)/t.offsetHeight||1);var r=Ve(t)?G(t):window,a=r.visualViewport,c=!Qs()&&n,f=(o.left+(c&&a?a.offsetLeft:0))/s,d=(o.top+(c&&a?a.offsetTop:0))/i,g=o.width/s,w=o.height/i;return{width:g,height:w,top:d,right:f+g,bottom:d+w,left:f,x:f,y:d}}function ao(t){var e=tt(t),n=t.offsetWidth,o=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-o)<=1&&(o=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:o}}function Zs(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&io(n)){var o=e;do{if(o&&t.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function me(t){return G(t).getComputedStyle(t)}function jr(t){return["table","td","th"].indexOf(ue(t))>=0}function Ce(t){return((Ve(t)?t.ownerDocument:t.document)||window.document).documentElement}function dn(t){return ue(t)==="html"?t:t.assignedSlot||t.parentNode||(io(t)?t.host:null)||Ce(t)}function Yo(t){return!J(t)||me(t).position==="fixed"?null:t.offsetParent}function Wr(t){var e=/firefox/i.test(Un()),n=/Trident/i.test(Un());if(n&&J(t)){var o=me(t);if(o.position==="fixed")return null}var s=dn(t);for(io(s)&&(s=s.host);J(s)&&["html","body"].indexOf(ue(s))<0;){var i=me(s);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return s;s=s.parentNode}return null}function At(t){for(var e=G(t),n=Yo(t);n&&jr(n)&&me(n).position==="static";)n=Yo(n);return n&&(ue(n)==="html"||ue(n)==="body"&&me(n).position==="static")?e:n||Wr(t)||e}function lo(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function _t(t,e,n){return Me(t,Xt(e,n))}function Fr(t,e,n){var o=_t(t,e,n);return o>n?n:o}function Js(){return{top:0,right:0,bottom:0,left:0}}function ei(t){return Object.assign({},Js(),t)}function ti(t,e){return e.reduce(function(n,o){return n[o]=t,n},{})}var zr=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,ei(typeof e!="number"?e:ti(e,lt))};function Kr(t){var e,n=t.state,o=t.name,s=t.options,i=n.elements.arrow,r=n.modifiersData.popperOffsets,a=le(n.placement),c=lo(a),f=[j,q].indexOf(a)>=0,d=f?"height":"width";if(!(!i||!r)){var g=zr(s.padding,n),w=ao(i),m=c==="y"?H:j,C=c==="y"?U:q,b=n.rects.reference[d]+n.rects.reference[c]-r[c]-n.rects.popper[d],_=r[c]-n.rects.reference[c],k=At(i),x=k?c==="y"?k.clientHeight||0:k.clientWidth||0:0,$=b/2-_/2,v=g[m],A=x-w[d]-g[C],T=x/2-w[d]/2+$,S=_t(v,T,A),M=c;n.modifiersData[o]=(e={},e[M]=S,e.centerOffset=S-T,e)}}function Yr(t){var e=t.state,n=t.options,o=n.elementLine truncated
|
||||
a[href],
|
||||
area[href],
|
||||
input:not([disabled]),
|
||||
select:not([disabled]),
|
||||
textarea:not([disabled]),
|
||||
button:not([disabled]),
|
||||
iframe,
|
||||
object,
|
||||
embed,
|
||||
[tabindex="0"],
|
||||
[contenteditable],
|
||||
audio[controls],
|
||||
video[controls],
|
||||
summary
|
||||
`,So=()=>{const t=y();if(!t)return[];const e=t.querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])'),n=Array.from(e).sort((i,r)=>{const a=parseInt(i.getAttribute("tabindex")||"0"),c=parseInt(r.getAttribute("tabindex")||"0");return a>c?1:a<c?-1:0}),o=t.querySelectorAll(Gd),s=Array.from(o).filter(i=>i.getAttribute("tabindex")!=="-1");return[...new Set(n.concat(s))].filter(i=>K(i))},xo=()=>pe(document.body,l.shown)&&!pe(document.body,l["toast-shown"])&&!pe(document.body,l["no-backdrop"]),En=()=>{const t=y();return t?pe(t,l.toast):!1},Xd=()=>{const t=y();return t?t.hasAttribute("data-loading"):!1},Z=(t,e)=>{if(t.textContent="",e){const o=new DOMParser().parseFromString(e,"text/html"),s=o.querySelector("head");s&&Array.from(s.childNodes).forEach(r=>{t.appendChild(r)});const i=o.querySelector("body");i&&Array.from(i.childNodes).forEach(r=>{r instanceof HTMLVideoElement||r instanceof HTMLAudioElement?t.appendChild(r.cloneNode(!0)):t.appendChild(r)})}},pe=(t,e)=>{if(!e)return!1;const n=e.split(/\s+/);for(let o=0;o<n.length;o++)if(!t.classList.contains(n[o]))return!1;return!0},Qd=(t,e)=>{Array.from(t.classList).forEach(n=>{!Object.values(l).includes(n)&&!Object.values(en).includes(n)&&!Object.values(e.showClass||{}).includes(n)&&t.classList.remove(n)})},X=(t,e,n)=>{if(Qd(t,e),!e.customClass)return;const o=e.customClass[n];if(o){if(typeof o!="string"&&!o.forEach){W(`Invalid type of customClass.${n}! Expected string or iterable object, got "${typeof o}"`);return}E(t,o)}},yn=(t,e)=>{if(!e)return null;switch(e){case"select":case"textarea":case"file":return t.querySelector(`.${l.popup} > .${l[e]}`);case"checkbox":return t.querySelector(`.${l.popup} > .${l.checkbox} input`);case"radio":return t.querySelector(`.${l.popup} > .${l.radio} input:checked`)||t.querySelector(`.${l.popup} > .${l.radio} input:first-child`);case"range":return t.querySelector(`.${l.popup} > .${l.range} input`);default:return t.querySelector(`.${l.popup} > .${l.input}`)}},Yi=t=>{if(t.focus(),t.type!=="file"){const e=t.value;t.value="",t.value=e}},Ui=(t,e,n)=>{!t||!e||(typeof e=="string"&&(e=e.split(/\s+/).filter(Boolean)),e.forEach(o=>{Array.isArray(t)?t.forEach(s=>{n?s.classList.add(o):s.classList.remove(o)}):n?t.classList.add(o):t.classList.remove(o)}))},E=(t,e)=>{Ui(t,e,!0)},ne=(t,e)=>{Ui(t,e,!1)},ve=(t,e)=>{const n=Array.from(t.children);for(let o=0;o<n.length;o++){const s=n[o];if(s instanceof HTMLElement&&pe(s,e))return s}},Be=(t,e,n)=>{n===`${parseInt(`${n}`)}`&&(n=parseInt(n)),n||parseInt(`${n}`)===0?t.style.setProperty(e,typeof n=="number"?`${n}px`:n):t.style.removeProperty(e)},P=(t,e="flex")=>{t&&(t.style.display=e)},R=t=>{t&&(t.style.display="none")},$o=(t,e="block")=>{t&&new MutationObserver(()=>{Lt(t,t.innerHTML,e)}).observe(t,{childList:!0,subtree:!0})},$s=(t,e,n,o)=>{const s=t.querySelector(e);s&&s.style.setProperty(n,o)},Lt=(t,e,n="flex")=>{e?P(t,n):R(t)},K=t=>!!(t&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)),Zd=()=>!K(de())&&!K(ze())&&!K(ht()),Jn=t=>t.scrollHeight>t.clientHeight,Jd=(t,e)=>{let n=t;for(;n&&n!==e;){if(Jn(n))return!0;n=n.parentElement}return!1},qi=t=>{const e=window.getComputedStyle(t),n=parseFloat(e.getPropertyValue("animation-duration")||"0"),o=parseFloat(e.getPropertyValue("transition-duration")||"0");return n>0||o>0},Lo=(t,e=!1)=>{const n=_n();n&&K(n)&&(e&&(n.style.transition="none",n.style.width="100%"),setTimeout(()=>{n.style.transition=`width ${t/1e3}s linear`,n.style.width="0%"},10))},ef=()=>{const t=_n();if(!t)return;const e=parseInt(window.getComputedStyle(t).width);t.style.removeProperty("transition"),t.style.width="100%";const n=parseInt(window.getComputedStyle(t).width),o=e/n*100;t.style.width=`${o}%`},tf=()=>typeof window>"u"||typeof document>"u",nf=`
|
||||
<div aria-labelledby="${l.title}" aria-describedby="${l["html-container"]}" class="${l.popup}" tabindex="-1">
|
||||
<button type="button" class="${l.close}"></button>
|
||||
<ul class="${l["progress-steps"]}"></ul>
|
||||
<div class="${l.icon}"></div>
|
||||
<img class="${l.image}" />
|
||||
<h2 class="${l.title}" id="${l.title}"></h2>
|
||||
<div class="${l["html-container"]}" id="${l["html-container"]}"></div>
|
||||
<input class="${l.input}" id="${l.input}" />
|
||||
<input type="file" class="${l.file}" />
|
||||
<div class="${l.range}">
|
||||
<input type="range" />
|
||||
<output></output>
|
||||
</div>
|
||||
<select class="${l.select}" id="${l.select}"></select>
|
||||
<div class="${l.radio}"></div>
|
||||
<label class="${l.checkbox}">
|
||||
<input type="checkbox" id="${l.checkbox}" />
|
||||
<span class="${l.label}"></span>
|
||||
</label>
|
||||
<textarea class="${l.textarea}" id="${l.textarea}"></textarea>
|
||||
<div class="${l["validation-message"]}" id="${l["validation-message"]}"></div>
|
||||
<div class="${l.actions}">
|
||||
<div class="${l.loader}"></div>
|
||||
<button type="button" class="${l.confirm}"></button>
|
||||
<button type="button" class="${l.deny}"></button>
|
||||
<button type="button" class="${l.cancel}"></button>
|
||||
</div>
|
||||
<div class="${l.footer}"></div>
|
||||
<div class="${l["timer-progress-bar-container"]}">
|
||||
<div class="${l["timer-progress-bar"]}"></div>
|
||||
</div>
|
||||
</div>
|
||||
`.replace(/(^|\n)\s*/g,""),of=()=>{const t=F();return t?(t.remove(),ne([document.documentElement,document.body],[l["no-backdrop"],l["toast-shown"],l["has-column"]]),!0):!1},De=()=>{h.currentInstance&&h.currentInstance.resetValidationMessage()},sf=()=>{const t=y();if(!t)return;const e=ve(t,l.input),n=ve(t,l.file),o=t.querySelector(`.${l.range} input`),s=t.querySelector(`.${l.range} output`),i=ve(t,l.select),r=t.querySelector(`.${l.checkbox} input`),a=ve(t,l.textarea);e&&(e.oninput=De),n&&(n.onchange=De),i&&(i.onchange=De),r&&(r.onchange=De),a&&(a.oninput=De),o&&s&&(o.oninput=()=>{De(),s.value=o.value},o.onchange=()=>{De(),s.value=o.value})},rf=t=>{if(typeof t=="string"){const e=document.querySelector(t);if(!e)throw new Error(`Target element "${t}" not found`);return e}return t},af=t=>{const e=y();e&&(e.setAttribute("role",t.toast?"alert":"dialog"),e.setAttribute("aria-live",t.toast?"polite":"assertive"),t.toast||e.setAttribute("aria-modal","true"))},lf=t=>{window.getComputedStyle(t).direction==="rtl"&&(E(F(),l.rtl),h.isRTL=!0)},cf=t=>{const e=of();if(tf()){Fe("SweetAlert2 requires document to initialize");return}const n=document.createElement("div");n.className=l.container,e&&E(n,l["no-transition"]),Z(n,nf),n.dataset.swal2Theme=t.theme;const o=rf(t.target||"body");o.appendChild(n),t.topLayer&&(n.setAttribute("popover",""),n.showPopover()),af(t),lf(o),sf()},No=(t,e)=>{t instanceof HTMLElement?e.appendChild(t):typeof t=="object"?uf(t,e):t&&Z(e,t)},uf=(t,e)=>{"jquery"in t?df(e,t):Z(e,t.toString())},df=(t,e)=>{if(t.textContent="",0 in e)for(let n=0;n in e;n++)t.appendChild(e[n].cloneNode(!0));else t.appendChild(e.cloneNode(!0))},ff=(t,e)=>{const n=$t(),o=pt();!n||!o||(!e.showConfirmButton&&!e.showDenyButton&&!e.showCancelButton?R(n):P(n),X(n,e,"actions"),hf(n,o,e),Z(o,e.loaderHtml||""),X(o,e,"loader"))};function hf(t,e,n){const o=de(),s=ze(),i=ht();!o||!s||!i||(zn(o,"confirm",n),zn(s,"deny",n),zn(i,"cancel",n),pf(o,s,i,n),n.reverseButtons&&(n.toast?(t.insertBefore(i,o),t.insertBefore(s,o)):(t.insertBefore(i,e),t.insertBefore(s,e),t.insertBefore(o,e))))}function pf(t,e,n,o){if(!o.buttonsStyling){ne([t,e,n],l.styled);return}E([t,e,n],l.styled),o.confirmButtonColor&&t.style.setProperty("--swal2-confirm-button-background-color",o.confirmButtonColor),o.denyButtonColor&&e.style.setProperty("--swal2-deny-button-background-color",o.denyButtonColor),o.cancelButtonColor&&n.style.setProperty("--swal2-cancel-button-background-color",o.cancelButtonColor),Fn(t),Fn(e),Fn(n)}function Fn(t){const e=window.getComputedStyle(t);if(e.getPropertyValue("--swal2-action-button-focus-box-shadow"))return;const n=e.backgroundColor.replace(/rgba?\((\d+), (\d+), (\d+).*/,"rgba($1, $2, $3, 0.5)");t.style.setProperty("--swal2-action-button-focus-box-shadow",e.getPropertyValue("--swal2-outline").replace(/ rgba\(.*/,` ${n}`))}function zn(t,e,n){const o=yo(e);Lt(t,n[`show${o}Button`],"inline-block"),Z(t,n[`${e}ButtonText`]||""),t.setAttribute("aria-label",n[`${e}ButtonAriaLabel`]||""),t.className=l[e],X(t,n,`${e}Button`)}const mf=(t,e)=>{const n=ko();n&&(Z(n,e.closeButtonHtml||""),X(n,e,"closeButton"),Lt(n,e.showCloseButton),n.setAttribute("aria-label",e.closeButtonAriaLabel||""))},gf=(t,e)=>{const n=F();n&&(wf(n,e.backdrop),bf(n,e.position),vf(n,e.grow),X(n,e,"container"))};function wf(t,e){typeof e=="string"?t.style.background=e:e||E([document.documentElement,document.body],l["no-backdrop"])}function bf(t,e){e&&(e in l?E(t,l[e]):(W('The "position" parameter is not valid, defaulting to "center"'),E(t,l.center)))}function vf(t,e){e&&E(t,l[`grow-${e}`])}var O={innerParams:new WeakMap,domCache:new WeakMap};const _f=["input","file","range","select","radio","checkbox","textarea"],Ef=(t,e)=>{const n=y();if(!n)return;const o=O.innerParams.get(t),s=!o||e.input!==o.input;_f.forEach(i=>{const r=ve(n,l[i]);r&&(Tf(i,e.inputAttributes),r.className=l[i],s&&R(r))}),e.input&&(s&&yf(e),Cf(e))},yf=t=>{if(!t.input)return;if(!L[t.input]){Fe(`Unexpected type of input! Expected ${Object.keys(L).join(" | ")}, got "${t.input}"`);return}const e=Gi(t.input);if(!e)return;const n=L[t.input](e,t);P(e),t.inputAutoFocus&&setTimeout(()=>{Yi(n)})},Af=t=>{for(let e=0;e<t.attributes.length;e++){const n=t.attributes[e].name;["id","type","value","style"].includes(n)||t.removeAttribute(n)}},Tf=(t,e)=>{const n=y();if(!n)return;const o=yn(n,t);if(o){Af(o);for(const s in e)o.setAttribute(s,e[s])}},Cf=t=>{if(!t.input)return;const e=Gi(t.input);e&&X(e,t,"input")},Do=(t,e)=>{!t.placeholder&&e.inputPlaceholder&&(t.placeholder=e.inputPlaceholder)},Nt=(t,e,n)=>{if(n.inputLabel){const o=document.createElement("label"),s=l["input-label"];o.setAttribute("for",t.id),o.className=s,typeof n.customClass=="object"&&E(o,n.customClass.inputLabel),o.innerText=n.inputLabel,e.insertAdjacentElement("beforebegin",o)}},Gi=t=>{const e=y();if(e)return ve(e,l[t]||l.input)},tn=(t,e)=>{["string","number"].includes(typeof e)?t.value=`${e}`:To(e)||W(`Unexpected type of inputValue! Expected "string", "number" or "Line truncated
|
||||
${t.animation?'<div class="swal2-success-circular-line-left"></div>':""}
|
||||
<span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>
|
||||
<div class="swal2-success-ring"></div>
|
||||
${t.animation?'<div class="swal2-success-fix"></div>':""}
|
||||
${t.animation?'<div class="swal2-success-circular-line-right"></div>':""}
|
||||
`,$f=`
|
||||
<span class="swal2-x-mark">
|
||||
<span class="swal2-x-mark-line-left"></span>
|
||||
<span class="swal2-x-mark-line-right"></span>
|
||||
</span>
|
||||
`,Ns=(t,e)=>{if(!e.icon&&!e.iconHtml)return;let n=t.innerHTML,o="";e.iconHtml?o=Ds(e.iconHtml):e.icon==="success"?(o=xf(e),n=n.replace(/ style=".*?"/g,"")):e.icon==="error"?o=$f:e.icon&&(o=Ds({question:"?",warning:"!",info:"i"}[e.icon])),n.trim()!==o.trim()&&Z(t,o)},Lf=(t,e)=>{if(e.iconColor){t.style.color=e.iconColor,t.style.borderColor=e.iconColor;for(const n of[".swal2-success-line-tip",".swal2-success-line-long",".swal2-x-mark-line-left",".swal2-x-mark-line-right"])$s(t,n,"background-color",e.iconColor);$s(t,".swal2-success-ring","border-color",e.iconColor)}},Ds=t=>`<div class="${l["icon-content"]}">${t}</div>`,Nf=(t,e)=>{const n=zi();if(n){if(!e.imageUrl){R(n);return}P(n,""),n.setAttribute("src",e.imageUrl),n.setAttribute("alt",e.imageAlt||""),Be(n,"width",e.imageWidth),Be(n,"height",e.imageHeight),n.className=l.image,X(n,e,"image")}};let Io=!1,Qi=0,Zi=0,Ji=0,er=0;const Df=t=>{t.addEventListener("mousedown",nn),document.body.addEventListener("mousemove",on),t.addEventListener("mouseup",sn),t.addEventListener("touchstart",nn),document.body.addEventListener("touchmove",on),t.addEventListener("touchend",sn)},If=t=>{t.removeEventListener("mousedown",nn),document.body.removeEventListener("mousemove",on),t.removeEventListener("mouseup",sn),t.removeEventListener("touchstart",nn),document.body.removeEventListener("touchmove",on),t.removeEventListener("touchend",sn)},nn=t=>{const e=y();if(!e)return;const n=ft();if(t.target===e||n&&n.contains(t.target)){Io=!0;const o=tr(t);Qi=o.clientX,Zi=o.clientY,Ji=parseInt(e.style.insetInlineStart)||0,er=parseInt(e.style.insetBlockStart)||0,E(e,"swal2-dragging")}},on=t=>{const e=y();if(e&&Io){let{clientX:n,clientY:o}=tr(t);const s=n-Qi;e.style.insetInlineStart=`${Ji+(h.isRTL?-s:s)}px`,e.style.insetBlockStart=`${er+(o-Zi)}px`}},sn=()=>{const t=y();Io=!1,ne(t,"swal2-dragging")},tr=t=>{let e=0,n=0;return t.type.startsWith("mouse")?(e=t.clientX,n=t.clientY):t.type.startsWith("touch")&&(e=t.touches[0].clientX,n=t.touches[0].clientY),{clientX:e,clientY:n}},Pf=(t,e)=>{const n=F(),o=y();if(!(!n||!o)){if(e.toast){Be(n,"width",e.width),o.style.width="100%";const s=pt();s&&o.insertBefore(s,ft())}else Be(o,"width",e.width);Be(o,"padding",e.padding),e.color&&(o.style.color=e.color),e.background&&(o.style.background=e.background),R(vn()),Mf(o,e),e.draggable&&!e.toast?(E(o,l.draggable),Df(o)):(ne(o,l.draggable),If(o))}},Mf=(t,e)=>{const n=e.showClass||{};t.className=`${l.popup} ${K(t)?n.popup:""}`,e.toast?(E([document.documentElement,document.body],l["toast-shown"]),E(t,l.toast)):E(t,l.modal),X(t,e,"popup"),typeof e.customClass=="string"&&E(t,e.customClass),e.icon&&E(t,l[`icon-${e.icon}`])},Bf=(t,e)=>{const n=Oo();if(!n)return;const{progressSteps:o,currentProgressStep:s}=e;if(!o||o.length===0||s===void 0){R(n);return}P(n),n.textContent="",s>=o.length&&W("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),o.forEach((i,r)=>{const a=Rf(i);if(n.appendChild(a),r===s&&E(a,l["active-progress-step"]),r!==o.length-1){const c=Vf(e);n.appendChild(c)}})},Rf=t=>{const e=document.createElement("li");return E(e,l["progress-step"]),Z(e,t),e},Vf=t=>{const e=document.createElement("li");return E(e,l["progress-step-line"]),t.progressStepsDistance&&Be(e,"width",t.progressStepsDistance),e},Hf=(t,e)=>{const n=Fi();n&&($o(n),Lt(n,!!(e.title||e.titleText),"block"),e.title&&No(e.title,n),e.titleText&&(n.innerText=e.titleText),X(n,e,"title"))},nr=(t,e)=>{var n;Pf(t,e),gf(t,e),Bf(t,e),Sf(t,e),Nf(t,e),Hf(t,e),mf(t,e),Of(t,e),ff(t,e),kf(t,e);const o=y();typeof e.didRender=="function"&&o&&e.didRender(o),(n=h.eventEmitter)===null||n===void 0||n.emit("didRender",o)},jf=()=>K(y()),or=()=>{var t;return(t=de())===null||t===void 0?void 0:t.click()},Wf=()=>{var t;return(t=ze())===null||t===void 0?void 0:t.click()},Ff=()=>{var t;return(t=ht())===null||t===void 0?void 0:t.click()},mt=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),sr=t=>{if(t.keydownTarget&&t.keydownHandlerAdded&&t.keydownHandler){const e=t.keydownHandler;t.keydownTarget.removeEventListener("keydown",e,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!1}},zf=(t,e,n)=>{if(sr(t),!e.toast){const o=i=>Yf(e,i,n);t.keydownHandler=o;const s=e.keydownListenerCapture?window:y();if(s){t.keydownTarget=s,t.keydownListenerCapture=e.keydownListenerCapture;const i=o;t.keydownTarget.addEventListener("keydown",i,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!0}}},eo=(t,e)=>{var n;const o=So();if(o.length){t=t+e,t===-2&&(t=o.length-1),t===o.length?t=0:t===-1&&(t=o.length-1),o[t].focus();return}(n=y())===null||n===void 0||n.focus()},ir=["ArrowRight","ArrowDown"],Kf=["ArrowLeft","ArrowUp"],Yf=(t,e,n)=>{t&&(e.isComposing||e.keyCode===229||(t.stopKeydownPropagation&&e.stopPropagation(),e.key==="Enter"?Uf(e,t):e.key==="Tab"?qf(e):[...ir,...Kf].includes(e.key)?Gf(e.key):e.key==="Escape"&&Xf(e,t,n)))},Uf=(t,e)=>{if(!bn(e.allowEnterKey))reLine truncated
|
||||
showLoaderOnConfirm should be used together with preConfirm, see usage example:
|
||||
https://sweetalert2.github.io/#ajax-request`),bp(t),typeof t.title=="string"&&(t.title=t.title.split(`
|
||||
`).join("<br />")),cf(t)}let ae;var Yt=new WeakMap;class N{constructor(...e){if(Vd(this,Yt,Promise.resolve({isConfirmed:!1,isDenied:!1,isDismissed:!0})),typeof window>"u")return;ae=this;const n=Object.freeze(this.constructor.argsToParams(e));this.params=n,this.isAwaitingPromise=!1,Hd(Yt,this,this._main(ae.params))}_main(e,n={}){if(Cr(Object.assign({},n,e)),h.currentInstance){const i=rt.swalPromiseResolve.get(h.currentInstance),{isAwaitingPromise:r}=h.currentInstance;h.currentInstance._destroy(),r||i({isDismissed:!0}),xo()&&rr()}h.currentInstance=ae;const o=Ep(e,n);vp(o),Object.freeze(o),h.timeout&&(h.timeout.stop(),delete h.timeout),clearTimeout(h.restoreFocusTimeout);const s=yp(ae);return nr(ae,o),O.innerParams.set(ae,o),_p(ae,s,o)}then(e){return Ss(Yt,this).then(e)}finally(e){return Ss(Yt,this).finally(e)}}const _p=(t,e,n)=>new Promise((o,s)=>{const i=r=>{t.close({isDismissed:!0,dismiss:r,isConfirmed:!1,isDenied:!1})};rt.swalPromiseResolve.set(t,o),rt.swalPromiseReject.set(t,s),e.confirmButton.onclick=()=>{yh(t)},e.denyButton.onclick=()=>{Ah(t)},e.cancelButton.onclick=()=>{Th(t,i)},e.closeButton.onclick=()=>{i(mt.close)},Mh(n,e,i),zf(h,n,i),hh(t,n),hp(n),Ap(h,n,i),Tp(e,n),setTimeout(()=>{e.container.scrollTop=0})}),Ep=(t,e)=>{const n=sp(t),o=Object.assign({},Ee,e,n,t);return o.showClass=Object.assign({},Ee.showClass,o.showClass),o.hideClass=Object.assign({},Ee.hideClass,o.hideClass),o.animation===!1&&(o.showClass={backdrop:"swal2-noanimation"},o.hideClass={}),o},yp=t=>{const e={popup:y(),container:F(),actions:$t(),confirmButton:de(),denyButton:ze(),cancelButton:ht(),loader:pt(),closeButton:ko(),validationMessage:vn(),progressSteps:Oo()};return O.domCache.set(t,e),e},Ap=(t,e,n)=>{const o=_n();R(o),e.timer&&(t.timeout=new op(()=>{n("timer"),delete t.timeout},e.timer),e.timerProgressBar&&o&&(P(o),X(o,e,"timerProgressBar"),setTimeout(()=>{t.timeout&&t.timeout.running&&Lo(e.timer)})))},Tp=(t,e)=>{if(!e.toast){if(!bn(e.allowEnterKey)){Wi("allowEnterKey"),kp();return}Cp(t)||Op(t,e)||eo(-1,1)}},Cp=t=>{const e=Array.from(t.popup.querySelectorAll("[autofocus]"));for(const n of e)if(n instanceof HTMLElement&&K(n))return n.focus(),!0;return!1},Op=(t,e)=>e.focusDeny&&K(t.denyButton)?(t.denyButton.focus(),!0):e.focusCancel&&K(t.cancelButton)?(t.cancelButton.focus(),!0):e.focusConfirm&&K(t.confirmButton)?(t.confirmButton.focus(),!0):!1,kp=()=>{document.activeElement instanceof HTMLElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur()};N.prototype.disableButtons=wr;N.prototype.enableButtons=gr;N.prototype.getInput=hr;N.prototype.disableInput=vr;N.prototype.enableInput=br;N.prototype.hideLoading=an;N.prototype.disableLoading=an;N.prototype.showValidationMessage=_r;N.prototype.resetValidationMessage=Er;N.prototype.close=_e;N.prototype.closePopup=_e;N.prototype.closeModal=_e;N.prototype.closeToast=_e;N.prototype.rejectPromise=cr;N.prototype.update=Or;N.prototype._destroy=kr;Object.assign(N,np);Object.keys(Ph).forEach(t=>{N[t]=function(...e){if(ae&&ae[t])return ae[t](...e)}});N.DismissReason=mt;N.version="11.26.17";const no=N;no.default=no;typeof document<"u"&&(function(t,e){var n=t.createElement("style");if(t.getElementsByTagName("head")[0].appendChild(n),n.styleSheet)n.styleSheet.disabled||(n.styleSheet.cssText=e);else try{n.innerHTML=e}catch{n.innerText=e}})(document,':root{--swal2-outline: 0 0 0 3px rgba(100, 150, 200, 0.5);--swal2-container-padding: 0.625em;--swal2-backdrop: rgba(0, 0, 0, 0.4);--swal2-backdrop-transition: background-color 0.15s;--swal2-width: 32em;--swal2-padding: 0 0 1.25em;--swal2-border: none;--swal2-border-radius: 0.3125rem;--swal2-background: white;--swal2-color: #545454;--swal2-show-animation: swal2-show 0.3s;--swal2-hide-animation: swal2-hide 0.15s forwards;--swal2-icon-zoom: 1;--swal2-icon-animations: true;--swal2-title-padding: 0.8em 1em 0;--swal2-html-container-padding: 1em 1.6em 0.3em;--swal2-input-border: 1px solid #d9d9d9;--swal2-input-border-radius: 0.1875em;--swal2-input-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px transparent;--swal2-input-background: transparent;--swal2-input-transition: border-color 0.2s, box-shadow 0.2s;--swal2-input-hover-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px transparent;--swal2-input-focus-border: 1px solid #b4dbed;--swal2-input-focus-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px rgba(100, 150, 200, 0.5);--swal2-progress-step-background: #add8e6;--swal2-validation-message-background: #f0f0f0;--swal2-validation-message-color: #666;--swal2-footer-border-color: #eee;--swal2-footer-background: transparent;--swal2-footer-color: inherit;--swal2-timer-progress-bar-background: rgba(0, 0, 0, 0.3);--swal2-close-button-position: initial;--swal2-close-button-inset: auto;--swal2-close-button-font-size: 2.5em;--swal2-close-button-color: #ccc;--swal2-close-button-transition: color 0.2s, box-shadow 0.2s;--swal2-close-button-outline: initial;--swal2-close-button-box-shadow: inset 0 0 0 3px transparent;
Line truncated
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"api_base_url": "/api/v1",
|
||||
"profiles_api_base_url": "/profiles-api",
|
||||
"refresh_interval": 30000
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>OpenVPN Controller</title>
|
||||
<script type="module" crossorigin src="/assets/index-DQu6UtRL.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/assets/vendor-charts-Bcjh2pZL.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/vendor-ui-jlFFG6nm.js">
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-Mq5XawTO.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,4 @@
|
||||
<svg width="119" height="119" viewBox="0 0 119 119" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M78.8326 58.0426C78.8765 48.6428 71.4389 40.699 61.5235 39.5555C51.6081 38.4119 42.3519 44.4304 39.982 53.5619C37.6121 62.6934 42.8784 72.049 52.2379 75.3346L44.6584 113.322H73.7264L66.2799 75.2595C73.8362 72.5045 78.8207 65.6679 78.8326 58.0426Z" fill="white"/>
|
||||
<path d="M118.249 57.7933C117.583 25.6833 91.3083 0 59.1246 0C26.9408 0 0.665851 25.6833 3.09067e-08 57.7933C-0.000675955 78.6062 11.0875 97.8498 29.1129 108.319L32.9103 83.2079C27.0781 76.837 23.8452 68.5192 23.8473 59.8902C24.3594 40.8148 40.0026 25.6167 59.1246 25.6167C78.2465 25.6167 93.8897 40.8148 94.4018 59.8902C94.405 68.5881 91.1238 76.9678 85.2123 83.3594L88.9843 108.395C107.107 97.9657 118.266 78.67 118.249 57.7933Z" fill="#ED7F22"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 828 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
Reference in new issue
Block a user