From fbb050c59ca28f9d2a21d468843b3c8bbda4f064 Mon Sep 17 00:00:00 2001 From: Silberengel Date: Sat, 14 Feb 2026 08:49:11 +0100 Subject: [PATCH] bug-fixes for the build and profile badge --- Dockerfile | 4 +- package-lock.json | 4 +- package.json | 2 +- public/healthz.json | 8 ---- scripts/generate-healthz.js | 2 +- src/app.d.ts | 1 + src/lib/components/layout/ProfileBadge.svelte | 45 ++++++++++++++++-- src/lib/services/version-manager.ts | 30 ++++++++---- src/routes/about/+page.svelte | 4 +- src/routes/changelog.yaml/+server.ts | 12 ++--- src/routes/healthz.json/+server.ts | 4 +- src/vite-env.d.ts | 1 + {public => static}/aither.png | Bin .../apple-touch-icon-114x114.png | Bin .../apple-touch-icon-120x120.png | Bin .../apple-touch-icon-144x144.png | Bin .../apple-touch-icon-152x152.png | Bin .../apple-touch-icon-180x180.png | Bin {public => static}/apple-touch-icon-57x57.png | Bin {public => static}/apple-touch-icon-60x60.png | Bin {public => static}/apple-touch-icon-72x72.png | Bin {public => static}/apple-touch-icon-76x76.png | Bin {public => static}/changelog.yaml | 2 + {public => static}/favicon.ico | Bin static/healthz.json | 8 ++++ {public => static}/icons/arrow-left.svg | 0 {public => static}/icons/bookmark.svg | 0 {public => static}/icons/check.svg | 0 {public => static}/icons/chevron-down.svg | 0 {public => static}/icons/chevron-up.svg | 0 {public => static}/icons/code.svg | 0 {public => static}/icons/copy.svg | 0 {public => static}/icons/database.svg | 0 {public => static}/icons/download.svg | 0 {public => static}/icons/edit.svg | 0 {public => static}/icons/eye.svg | 0 {public => static}/icons/file-text.svg | 0 {public => static}/icons/heart.svg | 0 {public => static}/icons/highlight.svg | 0 {public => static}/icons/image.svg | 0 {public => static}/icons/key.svg | 0 {public => static}/icons/link.svg | 0 {public => static}/icons/log-in.svg | 0 {public => static}/icons/log-out.svg | 0 {public => static}/icons/message-square.svg | 0 {public => static}/icons/moon.svg | 0 {public => static}/icons/plus.svg | 0 {public => static}/icons/radio.svg | 0 {public => static}/icons/search.svg | 0 {public => static}/icons/send.svg | 0 {public => static}/icons/settings.svg | 0 {public => static}/icons/share.svg | 0 {public => static}/icons/smile.svg | 0 {public => static}/icons/sun.svg | 0 {public => static}/icons/trash.svg | 0 {public => static}/icons/upload.svg | 0 {public => static}/icons/user.svg | 0 {public => static}/icons/video.svg | 0 {public => static}/icons/volume.svg | 0 {public => static}/icons/x.svg | 0 {public => static}/icons/zap.svg | 0 {public => static}/og-image.png | Bin svelte.config.js | 2 +- vite.config.js | 28 ----------- vite.config.js.map | 1 - vite.config.ts | 20 +++++++- 66 files changed, 112 insertions(+), 66 deletions(-) delete mode 100644 public/healthz.json rename {public => static}/aither.png (100%) rename {public => static}/apple-touch-icon-114x114.png (100%) rename {public => static}/apple-touch-icon-120x120.png (100%) rename {public => static}/apple-touch-icon-144x144.png (100%) rename {public => static}/apple-touch-icon-152x152.png (100%) rename {public => static}/apple-touch-icon-180x180.png (100%) rename {public => static}/apple-touch-icon-57x57.png (100%) rename {public => static}/apple-touch-icon-60x60.png (100%) rename {public => static}/apple-touch-icon-72x72.png (100%) rename {public => static}/apple-touch-icon-76x76.png (100%) rename {public => static}/changelog.yaml (92%) rename {public => static}/favicon.ico (100%) create mode 100644 static/healthz.json rename {public => static}/icons/arrow-left.svg (100%) rename {public => static}/icons/bookmark.svg (100%) rename {public => static}/icons/check.svg (100%) rename {public => static}/icons/chevron-down.svg (100%) rename {public => static}/icons/chevron-up.svg (100%) rename {public => static}/icons/code.svg (100%) rename {public => static}/icons/copy.svg (100%) rename {public => static}/icons/database.svg (100%) rename {public => static}/icons/download.svg (100%) rename {public => static}/icons/edit.svg (100%) rename {public => static}/icons/eye.svg (100%) rename {public => static}/icons/file-text.svg (100%) rename {public => static}/icons/heart.svg (100%) rename {public => static}/icons/highlight.svg (100%) rename {public => static}/icons/image.svg (100%) rename {public => static}/icons/key.svg (100%) rename {public => static}/icons/link.svg (100%) rename {public => static}/icons/log-in.svg (100%) rename {public => static}/icons/log-out.svg (100%) rename {public => static}/icons/message-square.svg (100%) rename {public => static}/icons/moon.svg (100%) rename {public => static}/icons/plus.svg (100%) rename {public => static}/icons/radio.svg (100%) rename {public => static}/icons/search.svg (100%) rename {public => static}/icons/send.svg (100%) rename {public => static}/icons/settings.svg (100%) rename {public => static}/icons/share.svg (100%) rename {public => static}/icons/smile.svg (100%) rename {public => static}/icons/sun.svg (100%) rename {public => static}/icons/trash.svg (100%) rename {public => static}/icons/upload.svg (100%) rename {public => static}/icons/user.svg (100%) rename {public => static}/icons/video.svg (100%) rename {public => static}/icons/volume.svg (100%) rename {public => static}/icons/x.svg (100%) rename {public => static}/icons/zap.svg (100%) rename {public => static}/og-image.png (100%) delete mode 100644 vite.config.js delete mode 100644 vite.config.js.map diff --git a/Dockerfile b/Dockerfile index 646a4ad..2623a20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,8 +25,8 @@ RUN npm ci --only=production && npm cache clean --force # Copy built application from builder stage COPY --from=builder /app/build ./build -# Copy public directory (for static assets like changelog.yaml, healthz.json) -COPY --from=builder /app/public ./public +# Copy static directory (for static assets like changelog.yaml, healthz.json) +COPY --from=builder /app/static ./static # Copy entrypoint script COPY docker-entrypoint.sh /usr/local/bin/ diff --git a/package-lock.json b/package-lock.json index c07e2aa..112806b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "aitherboard", - "version": "0.3.1", + "version": "0.3.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "aitherboard", - "version": "0.3.1", + "version": "0.3.2", "license": "MIT", "dependencies": { "@codemirror/autocomplete": "^6.20.0", diff --git a/package.json b/package.json index dc633b9..d4b1c54 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aitherboard", - "version": "0.3.1", + "version": "0.3.2", "type": "module", "author": "silberengel@gitcitadel.com", "description": "A decentralized messageboard built on the Nostr protocol.", diff --git a/public/healthz.json b/public/healthz.json deleted file mode 100644 index 7211eda..0000000 --- a/public/healthz.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "status": "ok", - "service": "aitherboard", - "version": "0.3.1", - "buildTime": "2026-02-14T07:05:05.090Z", - "gitCommit": "unknown", - "timestamp": 1771052705090 -} \ No newline at end of file diff --git a/scripts/generate-healthz.js b/scripts/generate-healthz.js index e61e0f6..31182b0 100644 --- a/scripts/generate-healthz.js +++ b/scripts/generate-healthz.js @@ -25,7 +25,7 @@ const healthz = { timestamp: Date.now() }; -const outputPath = join(process.cwd(), 'public', 'healthz.json'); +const outputPath = join(process.cwd(), 'static', 'healthz.json'); writeFileSync(outputPath, JSON.stringify(healthz, null, 2)); console.log('Generated healthz.json'); diff --git a/src/app.d.ts b/src/app.d.ts index ca37e7b..9c81243 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -17,6 +17,7 @@ interface ImportMetaEnv { readonly VITE_DEFAULT_RELAYS?: string; readonly VITE_ZAP_THRESHOLD?: string; readonly VITE_THREAD_TIMEOUT_DAYS?: string; + readonly VITE_APP_VERSION?: string; } interface ImportMeta { diff --git a/src/lib/components/layout/ProfileBadge.svelte b/src/lib/components/layout/ProfileBadge.svelte index 55edeba..383f7f6 100644 --- a/src/lib/components/layout/ProfileBadge.svelte +++ b/src/lib/components/layout/ProfileBadge.svelte @@ -137,13 +137,14 @@ } }); - // Always show NIP-05 if it exists (it's a verified identifier, different from display name) + // Show NIP-05 if it exists (it's a verified identifier, different from display name) + // Note: NIP-05 is automatically hidden when inline={true} to avoid breaking sentence flow let shouldShowNip05 = $derived.by(() => { return !!(profile?.nip05 && profile.nip05.length > 0); }); - + {#if !inline || pictureOnly} {#if profile?.picture && !imageError} {@const compressedPictureUrl = (() => { @@ -202,7 +203,7 @@ {profile?.name || shortenedNpub} - {#if !hideNip05 && shouldShowNip05 && profile?.nip05} + {#if !hideNip05 && !inline && shouldShowNip05 && profile?.nip05} {profile.nip05[0]} @@ -226,6 +227,18 @@ box-sizing: border-box !important; display: inline-flex !important; flex-shrink: 1 !important; + align-items: flex-start; /* Default: align to top for non-inline badges */ + vertical-align: top; /* Default vertical alignment */ + } + + /* For inline badges in text, align to text bottom for proper text flow */ + .profile-badge.inline-badge { + vertical-align: text-bottom; /* Align to bottom of text line */ + line-height: 1; /* Minimal line-height to prevent extra spacing */ + align-items: flex-end; /* Align flex items to bottom */ + margin: 0; /* Remove any margin */ + padding: 0; /* Remove any padding */ + gap: 0; /* Remove gap for inline badges */ } .profile-badge-content { @@ -233,6 +246,21 @@ max-width: 100% !important; width: 100% !important; box-sizing: border-box !important; + display: flex; + flex-direction: column; + } + + /* For inline badges, ensure content aligns properly */ + .profile-badge.inline-badge .profile-badge-content { + line-height: 1; + margin: 0; + padding: 0; + } + + .profile-badge.inline-badge .nip05-container { + line-height: 1; + margin: 0; + padding: 0; } .nip05-container { @@ -250,6 +278,17 @@ text-overflow: ellipsis !important; flex-shrink: 1 !important; min-width: 0 !important; + line-height: inherit; /* Match surrounding text line-height */ + vertical-align: baseline; /* Align to text baseline */ + } + + /* For inline badges, ensure name aligns properly with text */ + .profile-badge.inline-badge .profile-name { + line-height: 1; /* Match parent line-height exactly */ + vertical-align: baseline; + display: inline; /* Inline for proper text flow */ + margin: 0; + padding: 0; } .profile-badge:hover { diff --git a/src/lib/services/version-manager.ts b/src/lib/services/version-manager.ts index ec9e8d5..de26e84 100644 --- a/src/lib/services/version-manager.ts +++ b/src/lib/services/version-manager.ts @@ -38,18 +38,22 @@ export async function getAppVersion(): Promise { } // Fallback version (should match package.json) - // Try to read from package.json if available (for dev mode) + // Try to read from Vite environment variable (injected at build time from package.json) try { if (typeof window !== 'undefined') { - // In browser, we can't read package.json directly, so use fallback - cachedVersion = '0.2.1'; // Update this to match package.json version + // Use version from Vite env variable (set at build time from package.json) + const envVersion = import.meta.env.VITE_APP_VERSION; + if (envVersion && typeof envVersion === 'string') { + cachedVersion = envVersion; + } } } catch (error) { // Ignore } if (!cachedVersion) { - cachedVersion = '0.2.1'; // Fallback to current package.json version + // Final fallback - should match current package.json version + cachedVersion = import.meta.env.VITE_APP_VERSION || ''; } return cachedVersion; } @@ -78,7 +82,7 @@ export async function getBuildTimestamp(): Promise { * Get the current app version synchronously (uses cached value or fallback) */ export function getAppVersionSync(): string { - return cachedVersion || '0.2.1'; + return cachedVersion || import.meta.env.VITE_APP_VERSION || ''; } /** @@ -100,12 +104,15 @@ export function getStoredBuildTimestamp(): number | null { /** * Check if a new version is available - * In development, checks build timestamp; in production, checks version string + * In development, checks both version string and build timestamp; in production, checks version string */ export async function isNewVersionAvailable(): Promise { const stored = getStoredVersion(); if (!stored) return true; // First time user + // Get current version first + const current = await getAppVersion(); + // Check if we're in development mode (dev server typically runs on localhost or 127.0.0.1) const isDevelopment = typeof window !== 'undefined' && (window.location.hostname === 'localhost' || @@ -114,7 +121,15 @@ export async function isNewVersionAvailable(): Promise { window.location.port === '5173'); if (isDevelopment) { - // In development, check build timestamp + // In development, check both version string AND build timestamp + // This ensures version changes are detected even if timestamp is the same + const versionChanged = stored !== current; + + if (versionChanged) { + return true; // Version changed, definitely a new version + } + + // If version is the same, check timestamp (for hot reloads during development) const currentTimestamp = await getBuildTimestamp(); const storedTimestamp = getStoredBuildTimestamp(); @@ -125,7 +140,6 @@ export async function isNewVersionAvailable(): Promise { return true; } else { // In production, check version string - const current = await getAppVersion(); return stored !== current; } } diff --git a/src/routes/about/+page.svelte b/src/routes/about/+page.svelte index ee96d16..bc873ac 100644 --- a/src/routes/about/+page.svelte +++ b/src/routes/about/+page.svelte @@ -6,7 +6,7 @@ import { getAppVersion } from '../../lib/services/version-manager.js'; import { getAllVersions, loadChangelog } from '../../lib/services/changelog.js'; - let appVersion = $state('0.3.1'); + let appVersion = $state(null); let allVersions = $state([]); let changelog = $state>({}); let loadingChangelog = $state(true); @@ -71,7 +71,7 @@

Version Information

- Current Version: {appVersion} + Current Version: {appVersion || 'Loading...'}

diff --git a/src/routes/changelog.yaml/+server.ts b/src/routes/changelog.yaml/+server.ts index 5f5e66c..f885c89 100644 --- a/src/routes/changelog.yaml/+server.ts +++ b/src/routes/changelog.yaml/+server.ts @@ -5,14 +5,14 @@ import type { RequestHandler } from '@sveltejs/kit'; export const GET: RequestHandler = async () => { try { // Try multiple possible locations for changelog.yaml - // 1. In public directory (development) - // 2. In build/client (production - where SvelteKit copies public files) - // 3. In the copied public directory (Docker) + // 1. In static directory (development) + // 2. In build/client (production - where SvelteKit copies static files) + // 3. In the copied static directory (Docker) const possiblePaths = [ - join(process.cwd(), 'public', 'changelog.yaml'), + join(process.cwd(), 'static', 'changelog.yaml'), join(process.cwd(), 'build', 'client', 'changelog.yaml'), - join(process.cwd(), '..', 'public', 'changelog.yaml'), - '/app/public/changelog.yaml' // Docker container path + join(process.cwd(), '..', 'static', 'changelog.yaml'), + '/app/static/changelog.yaml' // Docker container path ]; let changelogContent: string | null = null; diff --git a/src/routes/healthz.json/+server.ts b/src/routes/healthz.json/+server.ts index 615d7ac..44dafe6 100644 --- a/src/routes/healthz.json/+server.ts +++ b/src/routes/healthz.json/+server.ts @@ -4,8 +4,8 @@ import type { RequestHandler } from './$types'; export const GET: RequestHandler = async () => { try { - // Try to read from public/healthz.json (generated at build time) - const healthzPath = join(process.cwd(), 'public', 'healthz.json'); + // Try to read from static/healthz.json (generated at build time) + const healthzPath = join(process.cwd(), 'static', 'healthz.json'); const healthzContent = readFileSync(healthzPath, 'utf-8'); const healthz = JSON.parse(healthzContent); diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index 6fc2700..c71e8c7 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -4,6 +4,7 @@ interface ImportMetaEnv { readonly VITE_DEFAULT_RELAYS?: string; readonly VITE_ZAP_THRESHOLD?: string; readonly VITE_THREAD_TIMEOUT_DAYS?: string; + readonly VITE_APP_VERSION?: string; } interface ImportMeta { diff --git a/public/aither.png b/static/aither.png similarity index 100% rename from public/aither.png rename to static/aither.png diff --git a/public/apple-touch-icon-114x114.png b/static/apple-touch-icon-114x114.png similarity index 100% rename from public/apple-touch-icon-114x114.png rename to static/apple-touch-icon-114x114.png diff --git a/public/apple-touch-icon-120x120.png b/static/apple-touch-icon-120x120.png similarity index 100% rename from public/apple-touch-icon-120x120.png rename to static/apple-touch-icon-120x120.png diff --git a/public/apple-touch-icon-144x144.png b/static/apple-touch-icon-144x144.png similarity index 100% rename from public/apple-touch-icon-144x144.png rename to static/apple-touch-icon-144x144.png diff --git a/public/apple-touch-icon-152x152.png b/static/apple-touch-icon-152x152.png similarity index 100% rename from public/apple-touch-icon-152x152.png rename to static/apple-touch-icon-152x152.png diff --git a/public/apple-touch-icon-180x180.png b/static/apple-touch-icon-180x180.png similarity index 100% rename from public/apple-touch-icon-180x180.png rename to static/apple-touch-icon-180x180.png diff --git a/public/apple-touch-icon-57x57.png b/static/apple-touch-icon-57x57.png similarity index 100% rename from public/apple-touch-icon-57x57.png rename to static/apple-touch-icon-57x57.png diff --git a/public/apple-touch-icon-60x60.png b/static/apple-touch-icon-60x60.png similarity index 100% rename from public/apple-touch-icon-60x60.png rename to static/apple-touch-icon-60x60.png diff --git a/public/apple-touch-icon-72x72.png b/static/apple-touch-icon-72x72.png similarity index 100% rename from public/apple-touch-icon-72x72.png rename to static/apple-touch-icon-72x72.png diff --git a/public/apple-touch-icon-76x76.png b/static/apple-touch-icon-76x76.png similarity index 100% rename from public/apple-touch-icon-76x76.png rename to static/apple-touch-icon-76x76.png diff --git a/public/changelog.yaml b/static/changelog.yaml similarity index 92% rename from public/changelog.yaml rename to static/changelog.yaml index 06501ed..5351357 100644 --- a/public/changelog.yaml +++ b/static/changelog.yaml @@ -1,4 +1,6 @@ versions: + '0.3.2': + - 'Expanded /repos to handle GitLab, Gitea, and OneDev repositories' '0.3.1': - 'Media attachments rendering in all feeds and views' - 'NIP-92/NIP-94 image tags support' diff --git a/public/favicon.ico b/static/favicon.ico similarity index 100% rename from public/favicon.ico rename to static/favicon.ico diff --git a/static/healthz.json b/static/healthz.json new file mode 100644 index 0000000..434f84c --- /dev/null +++ b/static/healthz.json @@ -0,0 +1,8 @@ +{ + "status": "ok", + "service": "aitherboard", + "version": "0.3.2", + "buildTime": "2026-02-14T07:34:30.130Z", + "gitCommit": "unknown", + "timestamp": 1771054470130 +} \ No newline at end of file diff --git a/public/icons/arrow-left.svg b/static/icons/arrow-left.svg similarity index 100% rename from public/icons/arrow-left.svg rename to static/icons/arrow-left.svg diff --git a/public/icons/bookmark.svg b/static/icons/bookmark.svg similarity index 100% rename from public/icons/bookmark.svg rename to static/icons/bookmark.svg diff --git a/public/icons/check.svg b/static/icons/check.svg similarity index 100% rename from public/icons/check.svg rename to static/icons/check.svg diff --git a/public/icons/chevron-down.svg b/static/icons/chevron-down.svg similarity index 100% rename from public/icons/chevron-down.svg rename to static/icons/chevron-down.svg diff --git a/public/icons/chevron-up.svg b/static/icons/chevron-up.svg similarity index 100% rename from public/icons/chevron-up.svg rename to static/icons/chevron-up.svg diff --git a/public/icons/code.svg b/static/icons/code.svg similarity index 100% rename from public/icons/code.svg rename to static/icons/code.svg diff --git a/public/icons/copy.svg b/static/icons/copy.svg similarity index 100% rename from public/icons/copy.svg rename to static/icons/copy.svg diff --git a/public/icons/database.svg b/static/icons/database.svg similarity index 100% rename from public/icons/database.svg rename to static/icons/database.svg diff --git a/public/icons/download.svg b/static/icons/download.svg similarity index 100% rename from public/icons/download.svg rename to static/icons/download.svg diff --git a/public/icons/edit.svg b/static/icons/edit.svg similarity index 100% rename from public/icons/edit.svg rename to static/icons/edit.svg diff --git a/public/icons/eye.svg b/static/icons/eye.svg similarity index 100% rename from public/icons/eye.svg rename to static/icons/eye.svg diff --git a/public/icons/file-text.svg b/static/icons/file-text.svg similarity index 100% rename from public/icons/file-text.svg rename to static/icons/file-text.svg diff --git a/public/icons/heart.svg b/static/icons/heart.svg similarity index 100% rename from public/icons/heart.svg rename to static/icons/heart.svg diff --git a/public/icons/highlight.svg b/static/icons/highlight.svg similarity index 100% rename from public/icons/highlight.svg rename to static/icons/highlight.svg diff --git a/public/icons/image.svg b/static/icons/image.svg similarity index 100% rename from public/icons/image.svg rename to static/icons/image.svg diff --git a/public/icons/key.svg b/static/icons/key.svg similarity index 100% rename from public/icons/key.svg rename to static/icons/key.svg diff --git a/public/icons/link.svg b/static/icons/link.svg similarity index 100% rename from public/icons/link.svg rename to static/icons/link.svg diff --git a/public/icons/log-in.svg b/static/icons/log-in.svg similarity index 100% rename from public/icons/log-in.svg rename to static/icons/log-in.svg diff --git a/public/icons/log-out.svg b/static/icons/log-out.svg similarity index 100% rename from public/icons/log-out.svg rename to static/icons/log-out.svg diff --git a/public/icons/message-square.svg b/static/icons/message-square.svg similarity index 100% rename from public/icons/message-square.svg rename to static/icons/message-square.svg diff --git a/public/icons/moon.svg b/static/icons/moon.svg similarity index 100% rename from public/icons/moon.svg rename to static/icons/moon.svg diff --git a/public/icons/plus.svg b/static/icons/plus.svg similarity index 100% rename from public/icons/plus.svg rename to static/icons/plus.svg diff --git a/public/icons/radio.svg b/static/icons/radio.svg similarity index 100% rename from public/icons/radio.svg rename to static/icons/radio.svg diff --git a/public/icons/search.svg b/static/icons/search.svg similarity index 100% rename from public/icons/search.svg rename to static/icons/search.svg diff --git a/public/icons/send.svg b/static/icons/send.svg similarity index 100% rename from public/icons/send.svg rename to static/icons/send.svg diff --git a/public/icons/settings.svg b/static/icons/settings.svg similarity index 100% rename from public/icons/settings.svg rename to static/icons/settings.svg diff --git a/public/icons/share.svg b/static/icons/share.svg similarity index 100% rename from public/icons/share.svg rename to static/icons/share.svg diff --git a/public/icons/smile.svg b/static/icons/smile.svg similarity index 100% rename from public/icons/smile.svg rename to static/icons/smile.svg diff --git a/public/icons/sun.svg b/static/icons/sun.svg similarity index 100% rename from public/icons/sun.svg rename to static/icons/sun.svg diff --git a/public/icons/trash.svg b/static/icons/trash.svg similarity index 100% rename from public/icons/trash.svg rename to static/icons/trash.svg diff --git a/public/icons/upload.svg b/static/icons/upload.svg similarity index 100% rename from public/icons/upload.svg rename to static/icons/upload.svg diff --git a/public/icons/user.svg b/static/icons/user.svg similarity index 100% rename from public/icons/user.svg rename to static/icons/user.svg diff --git a/public/icons/video.svg b/static/icons/video.svg similarity index 100% rename from public/icons/video.svg rename to static/icons/video.svg diff --git a/public/icons/volume.svg b/static/icons/volume.svg similarity index 100% rename from public/icons/volume.svg rename to static/icons/volume.svg diff --git a/public/icons/x.svg b/static/icons/x.svg similarity index 100% rename from public/icons/x.svg rename to static/icons/x.svg diff --git a/public/icons/zap.svg b/static/icons/zap.svg similarity index 100% rename from public/icons/zap.svg rename to static/icons/zap.svg diff --git a/public/og-image.png b/static/og-image.png similarity index 100% rename from public/og-image.png rename to static/og-image.png diff --git a/svelte.config.js b/svelte.config.js index 7f39c07..e94896b 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -18,7 +18,7 @@ const config = { handleUnseenRoutes: 'ignore', handleHttpError: ({ path, referrer, message }) => { // Ignore 404s for static assets during prerendering - // These will be available at runtime from the public directory + // These will be available at runtime from the static directory if (path === '/favicon.ico' || path === '/og-image.png') { return; } diff --git a/vite.config.js b/vite.config.js deleted file mode 100644 index 539084f..0000000 --- a/vite.config.js +++ /dev/null @@ -1,28 +0,0 @@ -import { sveltekit } from '@sveltejs/kit/vite'; -import { defineConfig } from 'vite'; -import { execSync } from 'child_process'; -export default defineConfig({ - plugins: [ - sveltekit(), - { - name: 'generate-healthz', - buildStart() { - try { - execSync('node scripts/generate-healthz.js', { stdio: 'inherit' }); - } - catch (error) { - console.warn('Failed to generate healthz.json:', error); - } - } - } - ], - server: { - port: 5173, - strictPort: false - }, - build: { - target: 'esnext', - sourcemap: true - } -}); -//# sourceMappingURL=vite.config.js.map \ No newline at end of file diff --git a/vite.config.js.map b/vite.config.js.map deleted file mode 100644 index 8dcc85e..0000000 --- a/vite.config.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"vite.config.js","sourceRoot":"","sources":["vite.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,eAAe,YAAY,CAAC;IAC1B,OAAO,EAAE;QACP,SAAS,EAAE;QACX;YACE,IAAI,EAAE,kBAAkB;YACxB,UAAU;gBACR,IAAI,CAAC;oBACH,QAAQ,CAAC,kCAAkC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;gBACrE,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,IAAI,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;gBAC1D,CAAC;YACH,CAAC;SACF;KACF;IACD,MAAM,EAAE;QACN,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,KAAK;KAClB;IACD,KAAK,EAAE;QACL,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,IAAI;KAChB;CACF,CAAC,CAAC"} \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index 7b1e2bf..28efce6 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,9 +3,26 @@ import { defineConfig } from 'vite'; import { execSync } from 'child_process'; import { SvelteKitPWA } from '@vite-pwa/sveltekit'; import compression from 'vite-plugin-compression'; +import { readFileSync } from 'fs'; +import { join } from 'path'; + +// Read version from package.json for environment variable injection +function getPackageVersion(): string { + try { + const packageJsonPath = join(process.cwd(), 'package.json'); + const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')); + return packageJson.version || '0.3.2'; + } catch { + return '0.3.2'; + } +} export default defineConfig({ - publicDir: 'public', + publicDir: 'static', + define: { + // Inject version from package.json at build time + 'import.meta.env.VITE_APP_VERSION': JSON.stringify(getPackageVersion()), + }, plugins: [ sveltekit(), compression({ @@ -23,6 +40,7 @@ export default defineConfig({ registerType: 'autoUpdate', workbox: { globPatterns: ['**/*.{js,css,html,ico,png,svg,woff,woff2,webp,avif}'], + maximumFileSizeToCacheInBytes: 3 * 1024 * 1024, // 3 MB to handle large chunks runtimeCaching: [ { urlPattern: /^https:\/\/.*\.(?:png|jpg|jpeg|svg|gif|webp|avif)$/i,