From 6243ee7205f82d0ffcd2ca529c94ee1c24735a60 Mon Sep 17 00:00:00 2001 From: Yonle Date: Sun, 31 May 2026 23:15:10 +0700 Subject: [PATCH] chore: [AquaNet] update README, move userbox config to .env, and add check before build (#223) Signed-off-by: Yonle --- AquaNet/.env.example | 8 +++++++- AquaNet/README.md | 23 ++++++++++++++++++----- AquaNet/buildcheck.js | 9 +++++++++ AquaNet/package.json | 4 ++-- AquaNet/src/libs/config.ts | 6 ++---- 5 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 AquaNet/buildcheck.js diff --git a/AquaNet/.env.example b/AquaNet/.env.example index 942cf409..4305f6e6 100644 --- a/AquaNet/.env.example +++ b/AquaNet/.env.example @@ -1,14 +1,20 @@ VITE_AQUA_HOST=https://aquadx.net/aqua + +# Link to datas (eg, songid, information, etc). +# Leave this as is if you do not have the data. VITE_DATA_HOST=https://aquadx.net VITE_AQUA_CONNECTION=aquadx.hydev.org - VITE_TURNSTILE_SITE_KEY=0x4AAAAAAASGA2KQEIelo9P9 VITE_DISCORD_INVITE=https://discord.gg/FNgveqFF7s VITE_TELEGRAM_INVITE=https://t.me/+zBL4RZdyfvUzZGU1 VITE_QQ_INVITE=https://qm.qq.com/q/dpYmGoVHnG VITE_GITHUB_REPOSITORY=https://github.com/MewoLab/AquaDX +# Documentation for Userbox mode can be found in `docs/aquabox-url-mode.md` +# Please note that if this is set, it must be manually unset by users in Chuni Settings -> Update Userbox -> Switch to URL mode -> (empty value) -> Enter key +VITE_USERBOX_DEFAULT_URL= + # the following is used at some case where custom access code QR code URL has been done. # example: # https://aquadx.net/cards/#accesskey=.... diff --git a/AquaNet/README.md b/AquaNet/README.md index 88e6bfb9..f005864c 100644 --- a/AquaNet/README.md +++ b/AquaNet/README.md @@ -9,12 +9,25 @@ This project uses Svelte (NOT SvelteKit) + TypeScript + Sass, built using Vite. ### Running locally -First, you would need to install Node.js and bun. -Then, you would need to start your testing AquaDX server and configure the `aqua_host` in `src/libs/config.ts` to use your URL. -Please leave `data_host` unchanged if you're not sure what it is. -Finally, run: +You will need to have Node.js (or equivalent) and `pnpm` installed, Start by installing dependencies by running: +``` +pnpm install +``` -```shell +Then, you would need to start your testing AquaDX server and configure the `VITE_AQUA_HOST` in `.env` (copy `.env.example` file to `.env`) to use your URL. +Please leave `VITE_DATA_HOST` unchanged if you're not sure what it is. + +Finally, run: +``` +pnpm run dev +``` +### Running locally (with bun) + +Alternatively, If you prefer [Bun](https://bun.sh), You can do the same as above. +Start by configuring the `VITE_AQUA_HOST` in `.env` (copy `.env.example` file to `.env`) to use your URL. + +and finally: +``` bun install bun run dev ``` diff --git a/AquaNet/buildcheck.js b/AquaNet/buildcheck.js new file mode 100644 index 00000000..d94a29be --- /dev/null +++ b/AquaNet/buildcheck.js @@ -0,0 +1,9 @@ +import { existsSync } from "fs" + +if (!existsSync(".env")) { + console.error(" I did not see .env being here. You sure it was there?") + console.error(" Copy .env.example to .env, edit .env, and try again.\n") + process.exit(1) +} + +process.exit(0) diff --git a/AquaNet/package.json b/AquaNet/package.json index 55f89bb1..2302c428 100644 --- a/AquaNet/package.json +++ b/AquaNet/package.json @@ -4,8 +4,8 @@ "version": "1.0.0", "type": "module", "scripts": { - "dev": "vite", - "build": "vite build", + "dev": "node buildcheck.js && vite", + "build": "node buildcheck.js && vite build", "preview": "vite preview", "check": "svelte-check --tsconfig ./tsconfig.json", "lint": "eslint . --ext ts,tsx,svelte --max-warnings 0 --fix" diff --git a/AquaNet/src/libs/config.ts b/AquaNet/src/libs/config.ts index a668266c..1e6f4a1e 100644 --- a/AquaNet/src/libs/config.ts +++ b/AquaNet/src/libs/config.ts @@ -20,9 +20,7 @@ export const DEFAULT_PFP = '/assets/imgs/no_profile.png' // Key name for access key scanned from QR code export const ACCESSCODE_QKEY = import.meta.env.VITE_ACCESSCODE_QKEY || "accesskey" -// Documentation for Userbox mode can be found in `docs/aquabox-url-mode.md` -// Please note that if this is set, it must be manually unset by users in Chuni Settings -> Update Userbox -> Switch to URL mode -> (empty value) -> Enter key -export const USERBOX_DEFAULT_URL = "" +export const USERBOX_DEFAULT_URL = import.meta.env.VITE_USERBOX_DEFAULT_URL || "" export const HAS_USERBOX_ASSETS = true @@ -48,4 +46,4 @@ export const CHU3_MATCHINGS: ChusanMatchingOption[] = [ reflector: "http://reflector.naominet.live:18080/", coop: ["RinNET", "MysteriaNET"], }, -] \ No newline at end of file +]