fix(aiui): expose host wallpaper and package fresh production builds
This commit is contained in:
@@ -46,13 +46,14 @@ interface RateBucket {
|
|||||||
|
|
||||||
const rateBuckets = new Map<string, RateBucket>()
|
const rateBuckets = new Map<string, RateBucket>()
|
||||||
|
|
||||||
// Clean up stale buckets every 5 minutes
|
// Vite imports this module during builds too; cleanup must not keep the
|
||||||
|
// process alive once compilation has finished.
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
const now = Date.now()
|
const now = Date.now()
|
||||||
for (const [key, bucket] of rateBuckets) {
|
for (const [key, bucket] of rateBuckets) {
|
||||||
if (now > bucket.resetAt) rateBuckets.delete(key)
|
if (now > bucket.resetAt) rateBuckets.delete(key)
|
||||||
}
|
}
|
||||||
}, 5 * 60_000)
|
}, 5 * 60_000).unref()
|
||||||
|
|
||||||
function getClientIp(req: IncomingMessage): string {
|
function getClientIp(req: IncomingMessage): string {
|
||||||
return req.socket.remoteAddress ?? 'unknown'
|
return req.socket.remoteAddress ?? 'unknown'
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ const PWA_CACHE_VERSION = '2'
|
|||||||
// Only embedded when explicitly requested via ?embedded param
|
// Only embedded when explicitly requested via ?embedded param
|
||||||
const _embeddedFlag = new URLSearchParams(window.location.search).has('embedded')
|
const _embeddedFlag = new URLSearchParams(window.location.search).has('embedded')
|
||||||
;(window as unknown as Record<string, unknown>).__AIUI_EMBEDDED__ = _embeddedFlag
|
;(window as unknown as Record<string, unknown>).__AIUI_EMBEDDED__ = _embeddedFlag
|
||||||
|
document.documentElement.classList.toggle('aiui-embedded', _embeddedFlag)
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(import.meta.env.BASE_URL),
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
|
|||||||
@@ -57,12 +57,8 @@ body {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
/* Every page paints its own explicit background (bg-[#0a0a0a] / bg-[#faf9f6])
|
/* Standalone canvas fallback. Embedded mode overrides this below so
|
||||||
EXCEPT the embedded Chat page, which intentionally goes transparent so
|
Archy's wallpaper remains visible through the iframe. */
|
||||||
Archy's own dark chrome can show behind it (Chat.vue's iframe host). With
|
|
||||||
no background-color here, "transparent" fell through to the browser's
|
|
||||||
default white canvas instead. Match the theme's own dark/light default so
|
|
||||||
nothing above this ever needs to guess. */
|
|
||||||
background-color: #0a0a0a;
|
background-color: #0a0a0a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,6 +66,13 @@ html.light body {
|
|||||||
background-color: #faf9f6;
|
background-color: #faf9f6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The host owns the wallpaper when AIUI is embedded. The document canvas
|
||||||
|
must be transparent too, otherwise it hides the host behind ChatPage. */
|
||||||
|
html.aiui-embedded,
|
||||||
|
html.aiui-embedded body {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
/* ===== DARK MODE GLASSMORPHISM — from Archy ===== */
|
/* ===== DARK MODE GLASSMORPHISM — from Archy ===== */
|
||||||
|
|
||||||
@layer components {
|
@layer components {
|
||||||
|
|||||||
@@ -78,15 +78,17 @@ if [ -z "$FRONTEND_ARCHIVE" ]; then
|
|||||||
STAGING_DIR=$(mktemp -d -t archipelago-frontend.XXXXXX)
|
STAGING_DIR=$(mktemp -d -t archipelago-frontend.XXXXXX)
|
||||||
echo "Staging frontend archive in $STAGING_DIR..."
|
echo "Staging frontend archive in $STAGING_DIR..."
|
||||||
cp -r "$FRONTEND_DIST/." "$STAGING_DIR/"
|
cp -r "$FRONTEND_DIST/." "$STAGING_DIR/"
|
||||||
# Bake AIUI in so fresh installs pick it up. OTA already
|
# create-release.sh folds the freshly built AIUI into FRONTEND_DIST.
|
||||||
# carries-forward the existing aiui/ if the tarball lacks one
|
# Never overlay it with the older demo bundle (or nest aiui/aiui/).
|
||||||
# (update.rs:922), but including it here makes the tarball
|
if [ ! -f "$STAGING_DIR/aiui/index.html" ] || \
|
||||||
# the single source of truth instead of relying on a side-
|
[ ! -f "$STAGING_DIR/aiui/BUILD-INFO" ]; then
|
||||||
# effect of the in-place swap.
|
echo "Error: fresh AIUI payload missing from frontend dist" >&2
|
||||||
if [ -d "$PROJECT_ROOT/demo/aiui" ] && [ -f "$PROJECT_ROOT/demo/aiui/index.html" ]; then
|
exit 1
|
||||||
echo " Including AIUI from demo/aiui/"
|
|
||||||
cp -r "$PROJECT_ROOT/demo/aiui" "$STAGING_DIR/aiui"
|
|
||||||
fi
|
fi
|
||||||
|
grep -Fxq "commit=$(git -C "$PROJECT_ROOT" rev-parse HEAD)" "$STAGING_DIR/aiui/BUILD-INFO" || {
|
||||||
|
echo "Error: AIUI payload was not built from the current commit" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
# OTA bridge for nodes running older updaters: they only know how to
|
# OTA bridge for nodes running older updaters: they only know how to
|
||||||
# apply the backend binary and frontend archive. Carry host runtime
|
# apply the backend binary and frontend archive. Carry host runtime
|
||||||
# assets inside the frontend tarball; the new backend promotes them
|
# assets inside the frontend tarball; the new backend promotes them
|
||||||
|
|||||||
@@ -169,15 +169,11 @@ else
|
|||||||
fi
|
fi
|
||||||
cd "$PROJECT_ROOT"
|
cd "$PROJECT_ROOT"
|
||||||
|
|
||||||
# npm run build wipes web/dist — fold AIUI straight back in. The OTA tarball
|
# Build AIUI from the same source as the release. The checked-in demo bundle
|
||||||
# bakes it from demo/aiui independently, but build-iso-release.sh's
|
# can predate source fixes and must never overwrite the production payload.
|
||||||
# verify-artifacts guard checks web/dist/neode-ui/aiui and failed on two
|
bash "$SCRIPT_DIR/build-aiui.sh"
|
||||||
# consecutive releases (.127, .129) because this fold-in was manual.
|
|
||||||
if [ -d "$PROJECT_ROOT/demo/aiui" ] && [ -f "$PROJECT_ROOT/demo/aiui/index.html" ]; then
|
|
||||||
rm -rf "$PROJECT_ROOT/web/dist/neode-ui/aiui"
|
rm -rf "$PROJECT_ROOT/web/dist/neode-ui/aiui"
|
||||||
cp -r "$PROJECT_ROOT/demo/aiui" "$PROJECT_ROOT/web/dist/neode-ui/aiui"
|
cp -r "$PROJECT_ROOT/aiui/packages/app/dist" "$PROJECT_ROOT/web/dist/neode-ui/aiui"
|
||||||
echo " AIUI folded into web/dist from demo/aiui"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# npm run build can silently no-op (vue-tsc EACCES burned us before) — a stale
|
# npm run build can silently no-op (vue-tsc EACCES burned us before) — a stale
|
||||||
# dist would ship with a perfectly valid sha256. Require the freshly built
|
# dist would ship with a perfectly valid sha256. Require the freshly built
|
||||||
|
|||||||
Reference in New Issue
Block a user