removed bare dev fallback routes, only support developmnet in

docker/podman
This commit is contained in:
Jakub Dorfman 2026-08-19 13:22:51 +02:00
parent 702d99b9ed
commit c7f6b30b87
13 changed files with 47 additions and 121 deletions

View file

@ -1,13 +0,0 @@
PUBLIC_POCKETBASE_URL=http://localhost:8080
POCKETBASE_INTERNAL_URL=http://pocketbase:80
ORIGIN=http://localhost:8080
# Stripe
STRIPE_SECRET_KEY=sk_test_...
PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
STRIPE_CURRENCY=eur
# PocketBase admin credentials (for server-side basket/checkout/webhook APIs)
POCKETBASE_ADMIN_EMAIL=admin@example.com
POCKETBASE_ADMIN_PASSWORD=changeme

View file

@ -1,42 +0,0 @@
# sv
Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
## Creating a project
If you're seeing this, you've probably already done this step. Congrats!
```sh
# create a new project
npx sv create my-app
```
To recreate this project with the same configuration:
```sh
# recreate this project
npx sv@0.15.3 create --template minimal --types ts --install npm app
```
## Developing
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
```sh
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
```
## Building
To create a production version of your app:
```sh
npm run build
```
You can preview the production build with `npm run preview`.
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.

11
app/package-lock.json generated
View file

@ -26,7 +26,6 @@
"uuid": "^14.0.0"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^7.0.1",
"@sveltejs/kit": "^2.57.0",
"@sveltejs/vite-plugin-svelte": "^7.0.0",
"@types/node": "^25.8.0",
@ -916,16 +915,6 @@
"acorn": "^8.9.0"
}
},
"node_modules/@sveltejs/adapter-auto": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/@sveltejs/adapter-auto/-/adapter-auto-7.0.1.tgz",
"integrity": "sha512-dvuPm1E7M9NI/+canIQ6KKQDU2AkEefEZ2Dp7cY6uKoPq9Z/PhOXABe526UdW2mN986gjVkuSLkOYIBnS/M2LQ==",
"dev": true,
"license": "MIT",
"peerDependencies": {
"@sveltejs/kit": "^2.0.0"
}
},
"node_modules/@sveltejs/adapter-node": {
"version": "5.5.4",
"resolved": "https://registry.npmjs.org/@sveltejs/adapter-node/-/adapter-node-5.5.4.tgz",

View file

@ -4,15 +4,12 @@
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"prepare": "svelte-kit sync || echo ''",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^7.0.1",
"@sveltejs/kit": "^2.57.0",
"@sveltejs/vite-plugin-svelte": "^7.0.0",
"@types/node": "^25.8.0",

View file

@ -5,7 +5,7 @@ import { createPocketBase } from '$lib/pb';
export const handle: Handle = async ({ event, resolve }) => {
event.locals.pb = createPocketBase(
event.request.headers.get('cookie') ?? '',
env.POCKETBASE_INTERNAL_URL || env.PUBLIC_POCKETBASE_URL || 'http://localhost:8080'
env.POCKETBASE_INTERNAL_URL
);
event.locals.user = event.locals.pb.authStore.record;

View file

@ -2,7 +2,7 @@ import PocketBase from 'pocketbase';
import { env } from '$env/dynamic/public';
import { browser } from '$app/environment';
export const pbUrl = env.PUBLIC_POCKETBASE_URL || 'http://localhost:8080';
export const pbUrl = env.PUBLIC_POCKETBASE_URL;
export function createPocketBase(authCookie?: string, url = pbUrl) {
const pb = new PocketBase(url);

View file

@ -5,7 +5,7 @@ let adminPb: PocketBase | null = null;
let authPromise: Promise<PocketBase> | null = null;
async function authenticate(): Promise<PocketBase> {
const url = env.POCKETBASE_INTERNAL_URL || env.PUBLIC_POCKETBASE_URL || 'http://localhost:8080';
const url = env.POCKETBASE_INTERNAL_URL;
const pb = new PocketBase(url);
pb.autoCancellation(false);

View file

@ -27,11 +27,10 @@ export const GET: RequestHandler = async ({ locals }) => {
for (const url of extractImageUrls(g)) allUrls.add(url);
}
// Fetch each image as base64
// Inside Docker, stored PUBLIC_POCKETBASE_URL (http://localhost:8080) doesn't resolve
// from the app container, so we translate to the internal URL for fetching.
const publicBase = env.PUBLIC_POCKETBASE_URL || 'http://localhost:8080';
const internalBase = env.POCKETBASE_INTERNAL_URL || publicBase;
// Fetch each image as base64. Stored image URLs are public (http://localhost:8080)
// but the app container must fetch them via the internal Docker network URL.
const publicBase = env.PUBLIC_POCKETBASE_URL!;
const internalBase = env.POCKETBASE_INTERNAL_URL!;
const images: Record<string, string> = {};
for (const url of allUrls) {

View file

@ -37,7 +37,7 @@ export const POST: RequestHandler = async ({ request, locals }) => {
formData.append('alt', filename.replace(/\.[^/.]+$/, '').replace(/[-_]/g, ' '));
const record = await locals.pb.collection('media').create(formData);
const publicUrl = env.PUBLIC_POCKETBASE_URL || 'http://localhost:8080';
const publicUrl = env.PUBLIC_POCKETBASE_URL;
const newUrl = `${publicUrl}/api/files/${record.collectionId}/${record.id}/${record.file}`;
keyToUrl.set(key, newUrl);

View file

@ -17,7 +17,7 @@ export const POST: RequestHandler = async ({ request, locals }) => {
try {
const record = await locals.pb.collection('media').create(uploadForm);
const publicUrl = env.PUBLIC_POCKETBASE_URL || 'http://localhost:8080';
const publicUrl = env.PUBLIC_POCKETBASE_URL;
const url = `${publicUrl}/api/files/${record.collectionId}/${record.id}/${record.file}`;
return json({ record, url });
} catch (e) {