Download server/config.js from SSSAssist/Thoth: direct link, hf CLI and curl.
- Browser
- Download file 2.41 kB
-
https://huggingface.co/spaces/SSSAssist/Thoth/resolve/main/server/config.js
- Command line
-
hf download hf://spaces/SSSAssist/Thoth/server/config.js
-
curl -L -o config.js https://huggingface.co/spaces/SSSAssist/Thoth/resolve/main/server/config.js
2.41 kB
| import { existsSync, mkdirSync } from 'node:fs'; | |
| import path from 'node:path'; | |
| import { fileURLToPath } from 'node:url'; | |
| export const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); | |
| const envFile = path.join(ROOT, '.env'); | |
| if (existsSync(envFile)) process.loadEnvFile(envFile); | |
| const env = process.env; | |
| export const APP_NAME = env.APP_NAME || 'Thoth'; | |
| // Geliştirme betiği --port=3001 verir; böylece ortamdaki PORT (ör. Vite'ınki) API sunucusunu etkilemez. | |
| const portArg = process.argv.find((a) => a.startsWith('--port='))?.slice(7); | |
| export const PORT = Number(portArg || env.PORT || 3001); | |
| // Derleme yalıtılmadığı için varsayılan olarak yalnızca bu bilgisayardan erişilir (README: Güvenlik uyarısı). | |
| export const HOST = env.HOST || '127.0.0.1'; | |
| export const DATA_DIR = path.resolve(ROOT, env.DATA_DIR || 'data'); | |
| export const BUILD_DIR = path.join(DATA_DIR, 'derleme'); | |
| export const TECTONIC_CACHE_DIR = path.join(DATA_DIR, 'tectonic-cache'); | |
| export const BIN_DIR = path.join(ROOT, 'bin'); | |
| export const TEX_SUPPORT_DIR = path.join(ROOT, 'server', 'tex'); | |
| const bundled = (name) => path.join(BIN_DIR, process.platform === 'win32' ? `${name}.exe` : name); | |
| export const TECTONIC_BIN = env.TECTONIC_BIN || bundled('tectonic'); | |
| export const TEXFMT_BIN = env.TEXFMT_BIN || bundled('tex-fmt'); | |
| export const PANDOC_BIN = env.PANDOC_BIN || bundled('pandoc'); | |
| export const ALLOW_REGISTRATION = env.ALLOW_REGISTRATION !== 'false'; | |
| // Doluysa yalnızca bu e-postalar kayıt olabilir (virgülle ayrılmış). | |
| export const ALLOWED_EMAILS = (env.ALLOWED_EMAILS ?? '').split(',').map((e) => e.trim().toLowerCase()).filter(Boolean); | |
| export const COOKIE_SECURE = env.COOKIE_SECURE === 'true'; | |
| export const COMPILE_TIMEOUT_MS = Number(env.COMPILE_TIMEOUT_MS || 180_000); | |
| // "landlock": derleme, yalnızca kendi proje klasörünü görebilen bir kafeste (bin/kafes, Linux) çalışır. | |
| export const COMPILE_SANDBOX = env.COMPILE_SANDBOX || 'none'; | |
| export const KAFES_BIN = bundled('kafes'); | |
| export const ai = { | |
| anthropic: { | |
| enabled: Boolean(env.ANTHROPIC_API_KEY), | |
| model: env.ANTHROPIC_MODEL || 'claude-opus-5-5', | |
| }, | |
| openai: { | |
| enabled: Boolean(env.OPENAI_API_KEY), | |
| baseURL: env.OPENAI_BASE_URL || undefined, | |
| model: env.OPENAI_MODEL || 'gpt-5.2', | |
| }, | |
| }; | |
| for (const dir of [DATA_DIR, BUILD_DIR, TECTONIC_CACHE_DIR]) mkdirSync(dir, { recursive: true }); | |