first commit

This commit is contained in:
Web-serfer 2026-03-28 16:51:42 +05:00
commit 7c46ee6909
107 changed files with 5563 additions and 0 deletions

View file

@ -0,0 +1,20 @@
import PocketBase from 'pocketbase';
// Определяем, где мы запускаемся
const isServer = typeof window === 'undefined';
const isDocker = isServer && process.env.COOLIFY_CONTAINER_NAME !== undefined;
// Для сервера в Docker используем внутренний URL, для клиента - публичный
const pbUrl = isDocker
? 'http://pocketbase-f477mqb7lrkphmff7fdyloeh:8080' // Внутренняя сеть Docker
: (import.meta.env.PUBLIC_POCKETBASE_URL || 'http://localhost:8090');
export const pb = new PocketBase(pbUrl);
pb.autoCancellation = false;
export function getImageUrl(record, filename) {
const baseUrl = isDocker
? 'http://pocketbase-f477mqb7lrkphmff7fdyloeh:8080'
: (import.meta.env.PUBLIC_POCKETBASE_URL || 'http://localhost:8090');
return `${baseUrl}/api/files/${record.collectionId}/${record.id}/${filename}`;
}