CI / go (Server) (push) Failing after 4m38s
CI / go (Web-App) (push) Successful in 12m18s
Docs / build (push) Canceled after 0s
Docs / deploy (push) Canceled after 0s
CI / frontend (push) Failing after 7m49s
CI / desktop (ubuntu-latest) (push) Successful in 1h25m30s
CI / mobile (push) Failing after 5m14s
CI / docker (push) Successful in 39m26s
CI / desktop (macos-latest) (push) Canceled after 0s
CI / desktop (windows-latest) (push) Canceled after 0s
Databases (ADR-13 follow-ups):
- Relation properties link records to another database, on the same page
or on any page the reader can open (read live and read-only, like synced
pages). Cells list the linked titles; clicking one opens the record.
- Rollup properties work out counts, sums, averages, medians, min/max,
ranges, earliest/latest dates and checked counts over related records.
Neither is stored: views compute them before drawing (linked.ts), so they
follow both databases live, and rollups sort and filter as numbers.
- Exports (Markdown, HTML, PDF, Word) resolve them for same-page databases.
- A record opens as a full page at /p/<page>/r/<database>/<record>, with
"Open as full page" on the side panel and "Back to the page".
Edgeless mode (ADR-14 follow-ups):
- History previews show a version's canvas and count canvas changes.
- Comments can be anchored to canvas elements (anchor {element}); elements
with open threads show a badge that opens the thread.
- Workspaces choose how new pages open (workspaces.default_page_mode); the
per-device choice now defaults to following the workspace.
- Phones edit the canvas once a page is opened for editing; the page note
shows the page title.
Languages:
- The admin panel speaks English, Polish, German, French and Spanish, with
a picker sharing the web app's setting and a key parity test.
- The phone app speaks the same five, follows the phone's language (and
Android's per-app language setting), and has its own parity test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
186 lines
7.3 KiB
Vue
186 lines
7.3 KiB
Vue
<!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
|
|
<script setup lang="ts">
|
|
import type { OAuthProviderSettings } from "@docwell/api-client";
|
|
import { DwButton, DwCallout } from "@docwell/ui";
|
|
import { computed, ref, watch } from "vue";
|
|
import { useInstanceSettings } from "../settings";
|
|
|
|
// Who may create an account, and how people sign in.
|
|
const { settings, error, fields, saved, busy, save } = useInstanceSettings();
|
|
const signupEnabled = ref(true);
|
|
const domains = ref("");
|
|
const magicLink = ref(false);
|
|
|
|
type Name = OAuthProviderSettings["name"];
|
|
interface Row {
|
|
name: Name;
|
|
on: boolean;
|
|
clientId: string;
|
|
clientSecret: string;
|
|
// A stored secret exists (PocketBase never returns it).
|
|
hasSecret: boolean;
|
|
displayName: string;
|
|
authUrl: string;
|
|
tokenUrl: string;
|
|
userInfoUrl: string;
|
|
}
|
|
// Provider names are brands; where to register the app is translated (auth.consoles).
|
|
const known: { name: Name; label: string }[] = [
|
|
{ name: "google", label: "Google" },
|
|
{ name: "github", label: "GitHub" },
|
|
{ name: "microsoft", label: "Microsoft" },
|
|
{ name: "oidc", label: "OpenID Connect" },
|
|
];
|
|
const rows = ref<Row[]>([]);
|
|
|
|
// Where providers send people back (DOCWELL_WEB_URL/oauth/callback);
|
|
// register this address with each one.
|
|
const callback = computed(() => settings.value?.auth.callbackUrl ?? "");
|
|
|
|
watch(settings, (s) => {
|
|
if (!s) return;
|
|
signupEnabled.value = s.signup.enabled;
|
|
domains.value = s.signup.domains.join("\n");
|
|
magicLink.value = s.auth.magicLink;
|
|
rows.value = known.map(({ name }) => {
|
|
const p = s.auth.oauth2.find((x) => x.name === name);
|
|
return {
|
|
name,
|
|
on: !!p,
|
|
clientId: p?.clientId ?? "",
|
|
clientSecret: "",
|
|
hasSecret: !!p,
|
|
displayName: p?.displayName ?? "",
|
|
authUrl: p?.authUrl ?? "",
|
|
tokenUrl: p?.tokenUrl ?? "",
|
|
userInfoUrl: p?.userInfoUrl ?? "",
|
|
};
|
|
});
|
|
});
|
|
|
|
function submit() {
|
|
save({
|
|
signup: { enabled: signupEnabled.value, domains: domains.value.split(/[\s,;]+/).filter(Boolean) },
|
|
auth: {
|
|
magicLink: magicLink.value,
|
|
oauth2: rows.value
|
|
.filter((r) => r.on)
|
|
.map((r) => ({
|
|
name: r.name,
|
|
clientId: r.clientId.trim(),
|
|
...(r.clientSecret ? { clientSecret: r.clientSecret } : {}),
|
|
displayName: r.displayName.trim(),
|
|
authUrl: r.authUrl.trim(),
|
|
tokenUrl: r.tokenUrl.trim(),
|
|
userInfoUrl: r.userInfoUrl.trim(),
|
|
})),
|
|
},
|
|
});
|
|
}
|
|
|
|
const fieldError = (i: number, f: string) => {
|
|
// Validation errors name the entry by its position among the saved ones.
|
|
const on = rows.value.filter((r) => r.on);
|
|
const idx = on.indexOf(rows.value[i]!);
|
|
return idx < 0 ? "" : (fields.value[`auth.oauth2.${idx}.${f}`] ?? "");
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<h1 class="text-2xl font-semibold tracking-tight">{{ $t("auth.title") }}</h1>
|
|
<p class="mt-1 text-ink-muted">{{ $t("auth.hint") }}</p>
|
|
<DwCallout v-if="error" tone="danger" size="ui" class="mt-4">{{ error }}</DwCallout>
|
|
<DwCallout v-if="saved" tone="success" size="ui" class="mt-4">{{ $t("common.saved") }}</DwCallout>
|
|
|
|
<form v-if="settings" class="mt-6 max-w-xl space-y-6" @submit.prevent="submit">
|
|
<section class="dw-card space-y-4">
|
|
<h2 class="text-ui-lg">{{ $t("auth.signup") }}</h2>
|
|
<label class="flex items-start gap-3">
|
|
<input v-model="signupEnabled" type="checkbox" class="mt-1 accent-primary" data-testid="signup-enabled" />
|
|
<span>
|
|
<span class="font-medium">{{ $t("auth.anyone") }}</span>
|
|
<span class="block text-ui-sm text-ink-muted">{{ $t("auth.anyoneHint") }}</span>
|
|
</span>
|
|
</label>
|
|
<label class="flex flex-col gap-1.5">
|
|
<span class="text-ui-sm font-semibold">{{ $t("auth.domains") }}</span>
|
|
<textarea
|
|
v-model="domains"
|
|
rows="3"
|
|
class="dw-input font-mono"
|
|
placeholder="example.com"
|
|
data-testid="signup-domains"
|
|
/>
|
|
<span class="text-ui-sm text-ink-muted">{{ $t("auth.domainsHint") }}</span>
|
|
</label>
|
|
</section>
|
|
|
|
<section class="dw-card space-y-4">
|
|
<h2 class="text-ui-lg">{{ $t("auth.methods") }}</h2>
|
|
<p class="text-ui-md">{{ $t("auth.methodsHint") }}</p>
|
|
<label class="flex items-start gap-3">
|
|
<input v-model="magicLink" type="checkbox" class="mt-1 accent-primary" data-testid="magic-link" />
|
|
<span>
|
|
<span class="font-medium">{{ $t("auth.magicLink") }}</span>
|
|
<span class="block text-ui-sm text-ink-muted">{{ $t("auth.magicLinkHint") }}</span>
|
|
</span>
|
|
</label>
|
|
</section>
|
|
|
|
<section class="dw-card space-y-4" data-testid="oauth-providers">
|
|
<div>
|
|
<h2 class="text-ui-lg">{{ $t("auth.providers") }}</h2>
|
|
<p class="mt-1 text-ui-sm text-ink-muted">{{ $t("auth.providersHint") }}</p>
|
|
<code class="mt-1 block break-all rounded-sm bg-surface-sunken px-2 py-1 font-mono text-ui-sm">{{
|
|
callback
|
|
}}</code>
|
|
</div>
|
|
<fieldset v-for="(r, i) in rows" :key="r.name" class="space-y-3 border-t border-line pt-4 first:border-t-0">
|
|
<legend class="sr-only">{{ known[i]!.label }}</legend>
|
|
<label class="flex items-start gap-3">
|
|
<input v-model="r.on" type="checkbox" class="mt-1 accent-primary" :data-testid="`oauth-${r.name}`" />
|
|
<span>
|
|
<span class="font-medium">{{ known[i]!.label }}</span>
|
|
<span class="block text-ui-sm text-ink-muted">{{ $t(`auth.consoles.${r.name}`) }}</span>
|
|
</span>
|
|
</label>
|
|
<div v-if="r.on" class="grid gap-3 pl-7 sm:grid-cols-2">
|
|
<label class="flex flex-col gap-1.5">
|
|
<span class="text-ui-sm font-semibold">{{ $t("auth.clientId") }}</span>
|
|
<input v-model="r.clientId" class="dw-input" required />
|
|
<span v-if="fieldError(i, 'clientId')" class="text-ui-sm text-danger">{{ fieldError(i, "clientId") }}</span>
|
|
</label>
|
|
<label class="flex flex-col gap-1.5">
|
|
<span class="text-ui-sm font-semibold">{{ $t("auth.clientSecret") }}</span>
|
|
<input
|
|
v-model="r.clientSecret"
|
|
type="password"
|
|
autocomplete="new-password"
|
|
class="dw-input"
|
|
:placeholder="r.hasSecret ? $t('auth.secretSaved') : ''"
|
|
:required="!r.hasSecret"
|
|
/>
|
|
</label>
|
|
<template v-if="r.name === 'oidc'">
|
|
<label class="flex flex-col gap-1.5 sm:col-span-2">
|
|
<span class="text-ui-sm font-semibold">{{ $t("auth.buttonLabel") }}</span>
|
|
<input v-model="r.displayName" class="dw-input" :placeholder="$t('auth.singleSignOn')" />
|
|
</label>
|
|
<label
|
|
v-for="f in ['authUrl', 'tokenUrl', 'userInfoUrl'] as const"
|
|
:key="f"
|
|
class="flex flex-col gap-1.5 sm:col-span-2"
|
|
>
|
|
<span class="text-ui-sm font-semibold">{{ $t(`auth.${f}`) }}</span>
|
|
<input v-model="r[f]" type="url" class="dw-input font-mono" required placeholder="https://" />
|
|
<span v-if="fieldError(i, f)" class="text-ui-sm text-danger">{{ fieldError(i, f) }}</span>
|
|
</label>
|
|
</template>
|
|
</div>
|
|
</fieldset>
|
|
</section>
|
|
|
|
<DwButton type="submit" variant="primary" :disabled="busy">{{ $t("common.save") }}</DwButton>
|
|
</form>
|
|
</template>
|