Phase 0 foundation for Docwell, an open-source knowledge base: - Database: PocketBase v0.40.6 with initial schema migrations; users is the built-in auth collection, plus a hook for token checks and env-driven app URL/SMTP settings - Server: Go API (health, version, auth endpoints forwarded to PocketBase, admin user list) with an embedded Vue admin panel - Web-App: Go static server and Vue/Tailwind app with Tiptap editor, sign-in, sign-up, password reset and email verification (EN/PL) - Desktop-App: Wails v3 host reusing the web app - Phone-App: Flutter app with sign-in - Shared packages (editor, ui, api-client), OpenAPI spec, Docker compose (separate services and all-in-one), GitHub Actions CI - Docs: feature inventory and architecture/build plan Licensed under AGPL-3.0-or-later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
/// <reference path="../pb_data/types.d.ts" />
|
|
|
|
// Token check used by docwell-server: returns the "users" record that owns the
|
|
// bearer token, or 401. Unlike auth-refresh, it does not issue a new token.
|
|
routerAdd(
|
|
"GET",
|
|
"/api/docwell/auth/verify",
|
|
(e) => {
|
|
e.auth.ignoreEmailVisibility(true);
|
|
return e.json(200, e.auth);
|
|
},
|
|
$apis.requireAuth("users"),
|
|
);
|
|
|
|
// Instance settings come from the environment and are applied on every start,
|
|
// so changing an env var and restarting is enough.
|
|
onBootstrap((e) => {
|
|
e.next();
|
|
|
|
const env = (key, def) => $os.getenv(key) || def;
|
|
const settings = e.app.settings();
|
|
|
|
settings.meta.appName = env("DOCWELL_APP_NAME", "Docwell");
|
|
settings.meta.appURL = env("DOCWELL_WEB_URL", "http://localhost:3000");
|
|
settings.meta.senderName = settings.meta.appName;
|
|
settings.meta.senderAddress = env("DOCWELL_MAIL_FROM", "no-reply@docwell.localhost");
|
|
|
|
const smtpHost = env("DOCWELL_SMTP_HOST", "");
|
|
settings.smtp.enabled = smtpHost !== "";
|
|
if (smtpHost) {
|
|
settings.smtp.host = smtpHost;
|
|
settings.smtp.port = parseInt(env("DOCWELL_SMTP_PORT", "587"), 10);
|
|
settings.smtp.username = env("DOCWELL_SMTP_USERNAME", "");
|
|
settings.smtp.password = env("DOCWELL_SMTP_PASSWORD", "");
|
|
settings.smtp.tls = env("DOCWELL_SMTP_TLS", "false") === "true";
|
|
}
|
|
|
|
e.app.save(settings);
|
|
});
|