diff --git a/src/accounting-app/app.ts b/src/accounting-app/app.ts index ea03522..6bcf423 100644 --- a/src/accounting-app/app.ts +++ b/src/accounting-app/app.ts @@ -54,7 +54,7 @@ export async function createAppInstance() { ].filter(Boolean) const router = createRouter({ - history: createWebHistory(), + history: createWebHistory(import.meta.env.BASE_URL), routes: [ // Record page is the home page in standalone mode { diff --git a/src/activities-app/app.ts b/src/activities-app/app.ts index 14f29c1..77da27d 100644 --- a/src/activities-app/app.ts +++ b/src/activities-app/app.ts @@ -50,7 +50,7 @@ export async function createAppInstance() { ].filter(Boolean) const router = createRouter({ - history: createWebHistory(), + history: createWebHistory(import.meta.env.BASE_URL), routes: [ // Activities page is the home page in standalone mode { diff --git a/vite.activities.config.ts b/vite.activities.config.ts index 59329b3..c7a4de8 100644 --- a/vite.activities.config.ts +++ b/vite.activities.config.ts @@ -33,9 +33,13 @@ function activitiesHtmlPlugin(): Plugin { /** * Vite config for the standalone Sortir activities app. - * Deployed to sortir.ariege.io + * + * Set VITE_BASE_PATH to deploy under a path prefix: + * VITE_BASE_PATH=/sortir/ → app.ariege.io/sortir/ (shared auth) + * (default: /) → sortir.ariege.io (standalone subdomain) */ export default defineConfig(({ mode }) => ({ + base: process.env.VITE_BASE_PATH || '/', plugins: [ activitiesHtmlPlugin(), vue(), @@ -65,8 +69,8 @@ export default defineConfig(({ mode }) => ({ background_color: '#ffffff', display: 'standalone', orientation: 'portrait-primary', - start_url: '/', - scope: '/', + start_url: process.env.VITE_BASE_PATH || '/', + scope: process.env.VITE_BASE_PATH || '/', id: 'sortir-activities', categories: ['social', 'entertainment', 'lifestyle'], lang: 'fr', diff --git a/vite.castle.config.ts b/vite.castle.config.ts index d652c46..4d928c2 100644 --- a/vite.castle.config.ts +++ b/vite.castle.config.ts @@ -33,8 +33,13 @@ function castleHtmlPlugin(): Plugin { /** * Vite config for the standalone Castle accounting app. + * + * Set VITE_BASE_PATH to deploy under a path prefix: + * VITE_BASE_PATH=/castle/ → app.ariege.io/castle/ (shared auth) + * (default: /) → castle.ariege.io (standalone subdomain) */ export default defineConfig(({ mode }) => ({ + base: process.env.VITE_BASE_PATH || '/', plugins: [ castleHtmlPlugin(), vue(), @@ -64,7 +69,7 @@ export default defineConfig(({ mode }) => ({ background_color: '#ffffff', display: 'standalone', orientation: 'portrait-primary', - start_url: '/', + start_url: process.env.VITE_BASE_PATH || '/', scope: '/', id: 'castle-accounting', categories: ['finance', 'business', 'productivity'],