AI-native design editor. Open-source Figma alternative.
refactor: put Cloud links on their server's own address and move rooms to /rooms (#1422)
Danila Poyarkov0c942ff78e62
diff --git a/README.md b/README.mdindex a1ad27062..a785e4d8c 100644--- a/README.md+++ b/README.md@@ -203,7 +203,7 @@ For documentation-aware agents, the docs site publishes [llms.txt](https://openpShare a link to co-edit in real time. No server, no account — peers connect directly via WebRTC.1. Click the share button in the top-right panel-2. Share the generated link (`app.openpencil.dev/share/<room-id>`)+2. Share the generated link (`app.openpencil.dev/rooms/<room-id>`)3. Collaborators see your cursor, selection, and edits in real time4. Click a peer's avatar to follow their viewport5. Click the headphones beside the avatars to start or join the room's voice calldiff --git a/changes/1422/changed.md b/changes/1422/changed.mdnew file mode 100644index 000000000..993102e07--- /dev/null+++ b/changes/1422/changed.md@@ -0,0 +1 @@+- Collaboration room links use `/rooms/<room-id>` instead of `/share/<room-id>`; room links copied before this change no longer open.diff --git a/desktop/src/launch/links.rs b/desktop/src/launch/links.rsindex aa8c55449..37c579a69 100644--- a/desktop/src/launch/links.rs+++ b/desktop/src/launch/links.rs@@ -15,8 +15,8 @@ pub struct DeepLinkJoin {}/// An OpenPencil Cloud invitation or a document shared by link, from-/// `openpencil://cloud/<invitations|share>/<id>?server=<url>#<secret>`: the same path, server, and-/// secret as the web link on the server's editor address.+/// `openpencil://cloud?url=<link>#<secret>`: the web link on its server, `/<invitations|share>/<id>`,+/// with its secret in the deep link's fragment. The server is the web link's origin.#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)]pub struct CloudLink {pub kind: CloudLinkKind,@@ -89,9 +89,25 @@ fn parse_join_url(url: &Url) -> Result<DeepLinkJoin, DeepLinkError> {}/// Invitation and share IDs are UUIDs, and their secrets 32 to 128 hex characters (the Cloud-/// sharing contract); the server must be an `http` or `https` address without credentials.+/// sharing contract); the web link must be an `http` or `https` address without credentials,+/// query, or fragment.fn parse_cloud_url(url: &Url) -> Option<CloudLink> {- let mut segments = url.path_segments()?;+ if !matches!(url.path(), "" | "/") {+ return None;+ }+ let link = url+ .query_pairs()+ .find(|(key, _)| key == "url")+ .and_then(|(_, value)| Url::parse(&value).ok())+ .filter(|link| {+ matches!(link.scheme(), "http" | "https")+ && link.host_str().is_some()+ && link.username().is_empty()+ && link.password().is_none()+ && link.query().is_none()+ && link.fragment().is_none()+ })?;+ let mut segments = link.path_segments()?;let kind = match segments.next()? {"invitations" => CloudLinkKind::Invitations,"share" => CloudLinkKind::Share,@@ -105,21 +121,10 @@ fn parse_cloud_url(url: &Url) -> Option<CloudLink> {.fragment().filter(|secret| is_secret(secret))?.to_owned();- let server = url- .query_pairs()- .find(|(key, _)| key == "server")- .and_then(|(_, value)| Url::parse(&value).ok())- .filter(|server| {- matches!(server.scheme(), "http" | "https")- && server.host_str().is_some()- && server.username().is_empty()- && server.password().is_none()- })?- .to_string();Some(CloudLink {kind,id,- server,+ server: link.origin().ascii_serialization(),secret,})}@@ -234,47 +239,48 @@ mod tests {fn cloud_links_carry_kind_id_server_and_secret() {assert_eq!(cloud(&format!(- "openpencil://cloud/invitations/{CLOUD_ID}?server=https%3A%2F%2Fcloud.example.com#{CLOUD_SECRET}"+ "openpencil://cloud?url=https%3A%2F%2Fcloud.example.com%2Finvitations%2F{CLOUD_ID}#{CLOUD_SECRET}")),Ok(DeepLink::Cloud(CloudLink {kind: CloudLinkKind::Invitations,id: CLOUD_ID.into(),- server: "https://cloud.example.com/".into(),+ server: "https://cloud.example.com".into(),secret: CLOUD_SECRET.into(),})));assert!(matches!(cloud(&format!(- "openpencil://cloud/share/{CLOUD_ID}?server=http%3A%2F%2F192.168.1.20%3A3000#{CLOUD_SECRET}"+ "openpencil://cloud?url=http%3A%2F%2F192.168.1.20%3A3000%2Fshare%2F{CLOUD_ID}#{CLOUD_SECRET}")),- Ok(DeepLink::Cloud(CloudLink {- kind: CloudLinkKind::Share,- ..- }))+ Ok(DeepLink::Cloud(CloudLink { kind: CloudLinkKind::Share, ref server, .. }))+ if server == "http://192.168.1.20:3000"));- // The editor builds links with ufo, which leaves `:` in a query value as it is.+ // The editor builds links with ufo, which leaves `:` and `/` in a query value as they are.assert!(matches!(cloud(&format!(- "openpencil://cloud/share/{CLOUD_ID}?server=https:%2F%2Fcloud.example.com#{CLOUD_SECRET}"+ "openpencil://cloud?url=https://cloud.example.com/share/{CLOUD_ID}#{CLOUD_SECRET}")),- Ok(DeepLink::Cloud(CloudLink { ref server, .. })) if server == "https://cloud.example.com/"+ Ok(DeepLink::Cloud(CloudLink { ref server, .. })) if server == "https://cloud.example.com"));}#[test]fn cloud_links_refuse_anything_else() {- let server = "server=https%3A%2F%2Fcloud.example.com";+ let site = "https%3A%2F%2Fcloud.example.com";for url in [- format!("openpencil://cloud/documents/{CLOUD_ID}?{server}#{CLOUD_SECRET}"),- format!("openpencil://cloud/share/not-a-uuid?{server}#{CLOUD_SECRET}"),- format!("openpencil://cloud/share/{CLOUD_ID}/extra?{server}#{CLOUD_SECRET}"),- format!("openpencil://cloud/share/{CLOUD_ID}?{server}"),- format!("openpencil://cloud/share/{CLOUD_ID}?{server}#short"),- format!("openpencil://cloud/share/{CLOUD_ID}?{server}#{}", "g".repeat(64)),- format!("openpencil://cloud/share/{CLOUD_ID}#{CLOUD_SECRET}"),- format!("openpencil://cloud/share/{CLOUD_ID}?server=file%3A%2F%2F%2Fetc#{CLOUD_SECRET}"),+ format!("openpencil://cloud?url={site}%2Fdocuments%2F{CLOUD_ID}#{CLOUD_SECRET}"),+ format!("openpencil://cloud?url={site}%2Fshare%2Fnot-a-uuid#{CLOUD_SECRET}"),+ format!("openpencil://cloud?url={site}%2Fshare%2F{CLOUD_ID}%2Fextra#{CLOUD_SECRET}"),+ format!("openpencil://cloud?url={site}%2Fshare%2F{CLOUD_ID}"),+ format!("openpencil://cloud?url={site}%2Fshare%2F{CLOUD_ID}#short"),+ format!("openpencil://cloud?url={site}%2Fshare%2F{CLOUD_ID}#{}", "g".repeat(64)),+ format!("openpencil://cloud?url={site}%2Fshare%2F{CLOUD_ID}%3Fx%3D1#{CLOUD_SECRET}"),+ format!("openpencil://cloud?url={site}%2Fshare%2F{CLOUD_ID}%23{CLOUD_SECRET}"),+ format!("openpencil://cloud/share/{CLOUD_ID}?url={site}%2Fshare%2F{CLOUD_ID}#{CLOUD_SECRET}"),+ format!("openpencil://cloud#{CLOUD_SECRET}"),+ format!("openpencil://cloud?url=file%3A%2F%2F%2Fshare%2F{CLOUD_ID}#{CLOUD_SECRET}"),format!(- "openpencil://cloud/share/{CLOUD_ID}?server=https%3A%2F%2Fa%3Ab%40cloud.example.com#{CLOUD_SECRET}"+ "openpencil://cloud?url=https%3A%2F%2Fa%3Ab%40cloud.example.com%2Fshare%2F{CLOUD_ID}#{CLOUD_SECRET}"),] {assert_eq!(cloud(&url), Err(DeepLinkError::BadCloudLink), "{url}");diff --git a/desktop/src/system/opener.rs b/desktop/src/system/opener.rsindex 19f63313d..679398789 100644--- a/desktop/src/system/opener.rs+++ b/desktop/src/system/opener.rs@@ -64,7 +64,7 @@ mod tests {#[test]fn opens_web_and_mail_links_only() {- assert!(external_url("https://cloud.example.com/cloud/device?user_code=ABCD").is_ok());+ assert!(external_url("https://cloud.example.com/auth/device?user_code=ABCD").is_ok());assert!(external_url("http://192.168.1.20:3000/account").is_ok());assert!(external_url("mailto:[email protected]").is_ok());for url in [diff --git a/packages/cloud/AGENTS.md b/packages/cloud/AGENTS.mdindex b6cdd0ddd..b7e6f7e6e 100644--- a/packages/cloud/AGENTS.md+++ b/packages/cloud/AGENTS.md@@ -26,7 +26,7 @@ Optional, self-hostable backend; the design is in `packages/docs/development/clo## Portal-- The portal's pages live in the app (`cloud.html`, `src/views/cloud/`, `src/components/cloud-portal/`); this package owns only their paths (`src/contract/portal.ts`) and serving them beside the editor (`src/runtime/site/server.ts`). Links the server sends to people point at portal paths on `publicURL`; only the editor itself is on `appURL`, which defaults to `publicURL` (`src/admin/enrollment/email.ts`).+- The portal's pages live in the app (`cloud.html`, `src/views/cloud/`, `src/components/cloud-portal/`); this package owns only their paths (`src/contract/portal.ts`) and serving them beside the editor (`src/runtime/site/server.ts`). Links the server sends to people point at `publicURL`, its editor and portal alike (`src/contract/links.ts`, `src/admin/enrollment/email.ts`).## Configurationdiff --git a/packages/cloud/deploy/openpencil-cloud.example.toml b/packages/cloud/deploy/openpencil-cloud.example.tomlindex 7b11d1d0d..a1f65fd0d 100644--- a/packages/cloud/deploy/openpencil-cloud.example.toml+++ b/packages/cloud/deploy/openpencil-cloud.example.toml@@ -4,9 +4,8 @@ schema_version = 2mode = "self-hosted"public_url = "http://localhost:8787"indexing = "deny"-# The server serves the editor itself. Name another editor only when people use one elsewhere,-# and trust every editor origin besides public_url.-# app_url = "https://editor.example.com"+# The server serves the editor itself, and its links point there. Trust any other editor origin+# that connects to it, such as a development build.# trusted_origins = ["https://editor.example.com"]# The editor works with files on the device without signing in; false asks everyone to sign in.local_editor = truediff --git a/packages/cloud/src/admin/email/service.ts b/packages/cloud/src/admin/email/service.tsindex 7afc40c26..c05371296 100644--- a/packages/cloud/src/admin/email/service.ts+++ b/packages/cloud/src/admin/email/service.ts@@ -17,7 +17,7 @@ const ENROLLMENT_MESSAGE_STATUS: Partial<Record<string, EnrollmentStatus>> = {export function createAdminEmailService(database: Kysely<CloudDatabase>,email?: TransactionalEmailService,- links: { appURL: string; portalURL: string } = { appURL: '', portalURL: '' }+ links: { publicURL: string } = { publicURL: '' }) {return {async list(limit = 100) {@@ -82,8 +82,8 @@ export function createAdminEmailService(name: enrollment.name ?? 'there',actionURL:kind === 'enrollment-approved'- ? links.appURL- : new URL('/auth/sign-in', links.portalURL).href+ ? links.publicURL+ : new URL('/auth/sign-in', links.publicURL).href}},transactiondiff --git a/packages/cloud/src/admin/enrollment/email.ts b/packages/cloud/src/admin/enrollment/email.tsindex 26ec6c2aa..0290e8093 100644--- a/packages/cloud/src/admin/enrollment/email.ts+++ b/packages/cloud/src/admin/enrollment/email.ts@@ -5,10 +5,11 @@ import type { Transaction } from 'kysely'import type { EnrollmentStatus } from './service'export type EnrollmentEmailOptions = {- /** The editor, where an approved account goes next. */- appURL: string- /** The server's own pages, where people sign in and administrators review requests. */- portalURL: string+ /**+ * The server's address: its editor, where an approved account goes next, and its own pages,+ * where people sign in and administrators review requests.+ */+ publicURL: stringadminRecipients: string[]email?: TransactionalEmailService}@@ -24,7 +25,7 @@ export async function enqueueEnrollmentRequested(idempotencyKey: `enrollment-requested/${input.enrollmentId}/${input.revision}`,kind: 'enrollment-requested',recipientEmail: input.email,- payload: { name: input.name, actionURL: new URL('/auth/sign-in', options.portalURL).href }+ payload: { name: input.name, actionURL: new URL('/auth/sign-in', options.publicURL).href }},transaction)@@ -38,7 +39,7 @@ export async function enqueueEnrollmentRequested(requesterEmail: input.email,requesterName: input.name,reason: input.reason,- actionURL: new URL('/admin/requests', options.portalURL).href+ actionURL: new URL('/admin/requests', options.publicURL).href}},transaction@@ -67,8 +68,8 @@ export async function enqueueEnrollmentReview(name: input.name,actionURL:input.status === 'approved'- ? options.appURL- : new URL('/auth/sign-in', options.portalURL).href+ ? options.publicURL+ : new URL('/auth/sign-in', options.publicURL).href}},transactiondiff --git a/packages/cloud/src/admin/enrollment/service.ts b/packages/cloud/src/admin/enrollment/service.tsindex b3ba09de7..532481ddc 100644--- a/packages/cloud/src/admin/enrollment/service.ts+++ b/packages/cloud/src/admin/enrollment/service.ts@@ -72,7 +72,7 @@ export function normalizeEnrollmentEmail(value: string): string {export function createEnrollmentService(database: Kysely<CloudDatabase>,- emailOptions: EnrollmentEmailOptions = { appURL: '', portalURL: '', adminRecipients: [] }+ emailOptions: EnrollmentEmailOptions = { publicURL: '', adminRecipients: [] }) {const statusForEmail = async (email: string): Promise<EnrollmentStatus | null> => {const row = await databasediff --git a/packages/cloud/src/client/auth/navigation.ts b/packages/cloud/src/client/auth/navigation.tsindex 470e0cf01..8119ea386 100644--- a/packages/cloud/src/client/auth/navigation.ts+++ b/packages/cloud/src/client/auth/navigation.ts@@ -1,16 +1,14 @@-import type { CloudDiscovery } from '#cloud/contract'+import { cloudServerOrigin, type CloudDiscovery } from '#cloud/contract'import { withoutFragment, withQuery } from 'ufo'import type { CloudSocialProvider } from './client'-/** The instance owns authentication; only its configured editor may receive the return. */+/** The instance owns authentication; only its own editor may receive the return. */export function cloudEditorReturnURL(discovery: CloudDiscovery, value: string): string {- if (!discovery.appURL) throw new Error('This instance does not advertise a public editor URL')- const editor = new URL(discovery.appURL)const destination = new URL(value)if (- !['https:', 'http:'].includes(editor.protocol) ||- destination.origin !== editor.origin ||+ !['https:', 'http:'].includes(destination.protocol) ||+ destination.origin !== cloudServerOrigin(discovery) ||destination.username ||destination.password) {diff --git a/packages/cloud/src/contract/discovery.ts b/packages/cloud/src/contract/discovery.tsindex 5fbc14e06..8b82ee6f9 100644--- a/packages/cloud/src/contract/discovery.ts+++ b/packages/cloud/src/contract/discovery.ts@@ -59,7 +59,6 @@ export const cloudDiscoverySchema = v.object({deployment: cloudDeploymentSchema,apiURL: v.pipe(v.string(), v.url()),authURL: v.pipe(v.string(), v.url()),- appURL: v.optional(v.pipe(v.string(), v.url())),/** Whether the server's own editor works with files on this device without signing in. */localEditor: v.optional(v.boolean(), true),authentication: cloudAuthenticationSchema,@@ -72,6 +71,11 @@ export const cloudDiscoverySchema = v.object({})export type CloudDiscovery = v.InferOutput<typeof cloudDiscoverySchema>+/** The server's own address, where its editor and pages are, from its auth API's. */+export function cloudServerOrigin(discovery: CloudDiscovery): string {+ return new URL(discovery.authURL).origin+}+export function parseCloudDiscovery(input: unknown): CloudDiscovery {return v.parse(cloudDiscoverySchema, input)}diff --git a/packages/cloud/src/contract/index.ts b/packages/cloud/src/contract/index.tsindex eb77f635d..19760bba9 100644--- a/packages/cloud/src/contract/index.ts+++ b/packages/cloud/src/contract/index.ts@@ -52,6 +52,7 @@ export {cloudDiscoverySchema,cloudEditorVersionSchema,cloudListingSchema,+ cloudServerOrigin,parseCloudDiscovery,type CloudAuthentication,type CloudCapabilities,@@ -189,7 +190,9 @@ export {cloudDocumentURL,cloudInvitationURL,cloudShareURL,- type CloudLinkKind+ parseCloudLinkPath,+ type CloudLinkKind,+ type CloudLinkPathKind} from './links'export { CLOUD_PORTAL_PAGE_ROOTS, isCloudPortalPage } from './portal'export * from './versions'diff --git a/packages/cloud/src/contract/links.ts b/packages/cloud/src/contract/links.tsindex 87e946c19..5adfad696 100644--- a/packages/cloud/src/contract/links.ts+++ b/packages/cloud/src/contract/links.ts@@ -3,74 +3,78 @@ import { encodeParam, parseURL, withFragment, withQuery } from 'ufo'/** The two kinds of Cloud link that carry a secret: invitations and documents shared by link. */export type CloudLinkKind = 'invitations' | 'share'+/** Every kind of Cloud link: those that carry a secret, and a document's address for members. */+export type CloudLinkPathKind = CloudLinkKind | 'documents'++const CLOUD_LINK_PATH = /^\/(invitations|share|documents)\/([^/]+)$/+/**- * A link on an instance's public editor, `appURL`, naming the server it belongs to. Canonical- * links come from the owning instance, never the caller's window; a secret travels in the- * fragment, so it never reaches access logs or `Referer` headers.+ * A link on the server's own editor. The server is the link's own address, so the link needs+ * nothing else to name it; a secret travels in the fragment, so it never reaches access logs or+ * `Referer` headers.*/-function editorLink(- appURL: string | undefined,+function serverLink(+ serverURL: string,path: string,- query: Record<string, string | undefined>,+ query: Record<string, string | undefined> = {},secret?: string): string {- if (!appURL) throw new Error('This instance does not advertise a public editor URL')- const { protocol, host } = parseURL(appURL)+ const { protocol, host } = parseURL(serverURL)if (protocol !== 'https:' && protocol !== 'http:') {- throw new Error('The public editor URL must use HTTP or HTTPS')+ throw new Error('A Cloud server address must use HTTP or HTTPS')}const link = withQuery(`${protocol}//${host}${path}`, query)return secret ? withFragment(link, secret) : link}-/** An invitation to a document or a workspace, `/cloud/invitations/:id?server=…#token`. */-export function cloudInvitationURL(- appURL: string | undefined,- serverURL: string,- invitationId: string,- token: string-): string {- return editorLink(- appURL,- `/cloud/invitations/${encodeParam(invitationId)}`,- { server: serverURL },- token- )+/** An invitation to a document or a workspace, `/invitations/:id#token`. */+export function cloudInvitationURL(serverURL: string, invitationId: string, token: string): string {+ return serverLink(serverURL, `/invitations/${encodeParam(invitationId)}`, {}, token)}-/** A document shared by link, `/cloud/share/:id?server=…#secret`. */-export function cloudShareURL(- appURL: string | undefined,- serverURL: string,- shareId: string,- secret: string-): string {- return editorLink(appURL, `/cloud/share/${encodeParam(shareId)}`, { server: serverURL }, secret)+/** A document shared by link, `/share/:id#secret`. */+export function cloudShareURL(serverURL: string, shareId: string, secret: string): string {+ return serverLink(serverURL, `/share/${encodeParam(shareId)}`, {}, secret)}/**- * A document's address for its members, `/cloud/documents/:id?server=…`, or one of its versions- * with `&version=…`. It carries no secret: whoever opens it signs in, and the server decides.+ * A document's address for its members, `/documents/:id`, or one of its versions with+ * `?version=…`. It carries no secret: whoever opens it signs in, and the server decides.*/export function cloudDocumentURL(- appURL: string | undefined,serverURL: string,documentId: string,versionId: string | null = null): string {- return editorLink(appURL, cloudDocumentPath(documentId), {- server: serverURL,+ return serverLink(serverURL, cloudDocumentPath(documentId), {version: versionId ?? undefined})}export function cloudDocumentPath(documentId: string): string {- return `/cloud/documents/${encodeParam(documentId)}`+ return `/documents/${encodeParam(documentId)}`+}++/**+ * The kind and ID of a Cloud link's path, or null for any other path. The ID is decoded; a broken+ * escape such as `%E0` is no link.+ */+export function parseCloudLinkPath(+ pathname: string+): { kind: CloudLinkPathKind; id: string } | null {+ const [, kind, id] = pathname.match(CLOUD_LINK_PATH) ?? []+ if ((kind !== 'invitations' && kind !== 'share' && kind !== 'documents') || !id) return null+ try {+ return { kind, id: decodeURIComponent(id) }+ } catch {+ return null+ }}/**- * The desktop app's form of a Cloud link, `openpencil://cloud/<kind>/<id>?server=…#secret`, which- * `desktop/src/launch/links.rs` validates before the editor sees it.+ * The desktop app's form of a Cloud link, `openpencil://cloud?url=<link>#secret`: the web link,+ * whose address names the server, with its secret kept in the fragment.+ * `desktop/src/launch/links.rs` validates it before the editor sees it.*/export function cloudDesktopLinkURL(kind: CloudLinkKind,@@ -78,8 +82,6 @@ export function cloudDesktopLinkURL(serverURL: string,secret: string): string {- return withFragment(- withQuery(`openpencil://cloud/${kind}/${encodeParam(id)}`, { server: serverURL }),- secret- )+ const link = serverLink(serverURL, `/${kind}/${encodeParam(id)}`)+ return withFragment(withQuery('openpencil://cloud', { url: link }), secret)}diff --git a/packages/cloud/src/contract/portal.ts b/packages/cloud/src/contract/portal.tsindex dd892970d..8e6a5ef87 100644--- a/packages/cloud/src/contract/portal.ts+++ b/packages/cloud/src/contract/portal.ts@@ -1,16 +1,10 @@/*** The pages a Cloud server shows on its own address, apart from the editor: the welcome page for- * visitors who are not signed in, sign-in, desktop sign-in approval, account settings, and the+ * visitors who are not signed in, sign-in and desktop sign-in approval, account settings, and the* administration console. Every runtime serves the portal's `cloud.html` at and below these* paths, and the editor's `index.html` at the root and at any other page the API does not answer.*/-export const CLOUD_PORTAL_PAGE_ROOTS = [- '/welcome',- '/auth',- '/cloud/device',- '/account',- '/admin'-] as const+export const CLOUD_PORTAL_PAGE_ROOTS = ['/welcome', '/auth', '/account', '/admin'] as constexport function isCloudPortalPage(path: string): boolean {return CLOUD_PORTAL_PAGE_ROOTS.some((root) => path === root || path.startsWith(`${root}/`))diff --git a/packages/cloud/src/server/app.ts b/packages/cloud/src/server/app.tsindex 042c5210c..042d4f5e9 100644--- a/packages/cloud/src/server/app.ts+++ b/packages/cloud/src/server/app.ts@@ -170,22 +170,19 @@ export function createCloudApp(services: CloudServices) {const workspaces = createWorkspaceService(services.database)const workspaceMembers = createWorkspaceMemberService(services.database, {email: services.transactionalEmail,- publicURL: services.config.publicURL,- appURL: services.config.appURL ?? services.config.publicURL+ publicURL: services.config.publicURL})const enrollment =services.enrollment ??createEnrollmentService(services.database, {- appURL: services.config.appURL ?? services.config.publicURL,- portalURL: services.config.publicURL,+ publicURL: services.config.publicURL,adminRecipients: services.config.enrollmentAdminNotificationEmails,email: services.transactionalEmail})const admin = createCloudAdminRoutes({email: createAdminEmailService(services.database, services.transactionalEmail, {- appURL: services.config.appURL ?? services.config.publicURL,- portalURL: services.config.publicURL+ publicURL: services.config.publicURL}),enrollment,users: createAdminUserService(services.database, services.auth, {@@ -229,7 +226,6 @@ export function createCloudApp(services: CloudServices) {outbox: services.invitationOutbox,continuationSecret: services.config.authSecret,publicURL: services.config.publicURL,- appURL: services.config.appURL ?? services.config.publicURL,policy,deploymentMode: services.config.deployment,workspaceInvitations: workspaceMembersdiff --git a/packages/cloud/src/server/auth/factory.ts b/packages/cloud/src/server/auth/factory.tsindex b147adcfa..c06ff8155 100644--- a/packages/cloud/src/server/auth/factory.ts+++ b/packages/cloud/src/server/auth/factory.ts@@ -290,7 +290,7 @@ export function createBetterAuthAdapter(// Device authorization returns opaque database session tokens, not signed cookies.bearer(),deviceAuthorization({- verificationUri: new URL('/cloud/device', config.publicURL).href,+ verificationUri: new URL('/auth/device', config.publicURL).href,validateClient: (clientId) => clientId.startsWith('openpencil-desktop:')})],diff --git a/packages/cloud/src/server/auth/runtime.ts b/packages/cloud/src/server/auth/runtime.tsindex 8a19bdbcc..bc9cbc2e4 100644--- a/packages/cloud/src/server/auth/runtime.ts+++ b/packages/cloud/src/server/auth/runtime.ts@@ -14,8 +14,7 @@ export function createCloudAuthenticationRuntime(options: Pick<CloudAuthRuntimeOptions, 'runInBackground' | 'validateSchema'> = {}) {const enrollment = createEnrollmentService(database, {- appURL: config.appURL ?? config.publicURL,- portalURL: config.publicURL,+ publicURL: config.publicURL,adminRecipients: config.enrollmentAdminNotificationEmails,})diff --git a/packages/cloud/src/server/config/deployment.ts b/packages/cloud/src/server/config/deployment.tsindex e1c8276eb..aa5184338 100644--- a/packages/cloud/src/server/config/deployment.ts+++ b/packages/cloud/src/server/config/deployment.ts@@ -116,7 +116,6 @@ export function parseCloudDeploymentConfig(return parseCloudServerConfig({deployment: config.deployment.mode,publicURL: config.deployment.public_url,- appURL: config.deployment.app_url,indexingPolicy: config.deployment.indexing,trustedOrigins: config.deployment.trusted_origins,localEditor: config.deployment.local_editor,diff --git a/packages/cloud/src/server/config/public.ts b/packages/cloud/src/server/config/public.tsindex fc5c6f739..047e0d14b 100644--- a/packages/cloud/src/server/config/public.ts+++ b/packages/cloud/src/server/config/public.ts@@ -48,7 +48,6 @@ export function cloudDiscoveryFromConfig(config: CloudServerConfig): CloudDiscovdeployment: config.deployment,apiURL: withoutTrailingSlash(new URL('/api', config.publicURL).href),authURL: withoutTrailingSlash(new URL('/api/auth', config.publicURL).href),- appURL: config.appURL ?? config.publicURL,localEditor: config.localEditor,authentication,capabilities: {diff --git a/packages/cloud/src/server/config/schema.ts b/packages/cloud/src/server/config/schema.tsindex 30c55699d..51fc2e3d8 100644--- a/packages/cloud/src/server/config/schema.ts+++ b/packages/cloud/src/server/config/schema.ts@@ -34,7 +34,6 @@ const optionalTextSchema = v.optional(v.pipe(v.string(), v.trim(), v.minLength(1const rawCloudServerConfigSchema = v.object({deployment: v.picklist(['official', 'self-hosted']),publicURL: httpURLSchema,- appURL: v.optional(httpURLSchema),listingMinimumEditorVersion: v.optional(cloudEditorVersionSchema),relayURL: v.optional(websocketURLSchema),technicalLimits: v.optional(@@ -257,14 +256,6 @@ function validateObjectStorageConfig(config: CloudServerConfig): void {export function parseCloudServerConfig(input: unknown): CloudServerConfig {const config = v.parse(rawCloudServerConfigSchema, input)- if (- config.appURL &&- !config.trustedOrigins.some(- (origin) => new URL(origin).origin === new URL(config.appURL ?? '').origin- )- ) {- throw new CloudConfigError('Cloud app URL must be included in trusted origins')- }validateAuthenticationConfig(config)validateEmailConfig(config)validateServiceConfig(config)@@ -347,7 +338,6 @@ export const cloudDeploymentConfigSchema = v.strictObject({deployment: v.strictObject({mode: v.picklist(['official', 'self-hosted']),public_url: urlSchema,- app_url: v.optional(urlSchema),indexing: v.optional(v.picklist(['allow', 'deny']), 'deny'),trusted_origins: v.optional(v.array(urlSchema), []),// The server's editor works with files on this device without signing in to the server.diff --git a/packages/cloud/src/server/sharing/invitations/service.ts b/packages/cloud/src/server/sharing/invitations/service.tsindex dc743f052..f18fe1466 100644--- a/packages/cloud/src/server/sharing/invitations/service.ts+++ b/packages/cloud/src/server/sharing/invitations/service.ts@@ -46,7 +46,6 @@ export type InvitationServiceOptions = {delivery?: InvitationDeliveryoutbox?: InvitationOutboxpublicURL?: string- appURL?: string}export function createInvitationService(@@ -131,7 +130,7 @@ export function createInvitationService(const token = randomHex(INVITATION_SECRET_BYTES)const expiresAt = new Date(Date.now() + INVITATION_LIFETIME_MS)const deliveryContext =- (options.delivery || options.outbox) && options.publicURL && options.appURL+ (options.delivery || options.outbox) && options.publicURL? await Promise.all([database.selectFrom('user')@@ -146,8 +145,8 @@ export function createInvitationService(]): nullconst acceptanceURL =- deliveryContext && options.publicURL && options.appURL- ? cloudInvitationURL(options.appURL, options.publicURL, id, token)+ deliveryContext && options.publicURL+ ? cloudInvitationURL(options.publicURL, id, token): nullconst message =deliveryContext && acceptanceURLdiff --git a/packages/cloud/src/server/sharing/service.ts b/packages/cloud/src/server/sharing/service.tsindex ec561ac31..8ae832db9 100644--- a/packages/cloud/src/server/sharing/service.ts+++ b/packages/cloud/src/server/sharing/service.ts@@ -21,7 +21,6 @@ export type DocumentSharingServiceOptions = {delivery?: InvitationDeliveryoutbox?: InvitationOutboxpublicURL?: string- appURL?: stringpolicy?: CloudPolicydeploymentMode?: 'official' | 'self-hosted'workspaceInvitations?: WorkspaceInvitationResolverdiff --git a/packages/cloud/src/server/workspaces/members.ts b/packages/cloud/src/server/workspaces/members.tsindex 232d74198..968a85611 100644--- a/packages/cloud/src/server/workspaces/members.ts+++ b/packages/cloud/src/server/workspaces/members.ts@@ -80,7 +80,6 @@ export class WorkspaceInvitationInvalidError extends Error {export type WorkspaceMemberServiceOptions = {email?: TransactionalEmailServicepublicURL: string- appURL: string}function invitationContract(row: {@@ -164,7 +163,7 @@ export function createWorkspaceMemberService(}function acceptanceURL(invitationId: string, token: string): string {- return cloudInvitationURL(options.appURL, options.publicURL, invitationId, token)+ return cloudInvitationURL(options.publicURL, invitationId, token)}return {diff --git a/packages/cloud/tests/client/auth/client.test.ts b/packages/cloud/tests/client/auth/client.test.tsindex 21b735a05..dfec8891e 100644--- a/packages/cloud/tests/client/auth/client.test.ts+++ b/packages/cloud/tests/client/auth/client.test.ts@@ -13,7 +13,6 @@ const discovery = parseCloudDiscovery({deployment: 'self-hosted' as const,apiURL: 'https://cloud.example.com/api',authURL: 'https://cloud.example.com/api/auth',- appURL: 'https://app.example.com',authentication: { socialProviders: ['google' as const], enterpriseSSO: false },capabilities: { documents: true, workspaces: true, collaboration: true }})diff --git a/packages/cloud/tests/client/auth/navigation.test.ts b/packages/cloud/tests/client/auth/navigation.test.tsindex a93667896..9ae300776 100644--- a/packages/cloud/tests/client/auth/navigation.test.ts+++ b/packages/cloud/tests/client/auth/navigation.test.ts@@ -8,15 +8,13 @@ const discovery: CloudDiscovery = {deployment: 'self-hosted',apiURL: 'https://cloud.example/api',authURL: 'https://cloud.example/api/auth',- appURL: 'https://editor.example',localEditor: true,authentication: { socialProviders: [], enterpriseSSO: false, enrollmentMode: 'open' },capabilities: { documents: true, workspaces: true, collaboration: true }}test('email-only instance owns sign-in and preserves an opaque invitation continuation', () => {- const target =- 'https://editor.example/cloud/invitations/id?continuation=opaque&server=https%3A%2F%2Fcloud.example'+ const target = 'https://cloud.example/invitations/id?continuation=opaque'const login = new URL(cloudSignInURL(discovery, target))expect(login.origin).toBe('https://cloud.example')expect(login.pathname).toBe('/auth/sign-in')@@ -28,19 +26,17 @@ test('email-only instance owns sign-in and preserves an opaque invitation contintest('return navigation rejects foreign origins and userinfo and strips fragment secrets', () => {for (const value of ['https://evil.example',- 'https://editor.example.evil.example',- 'https://user:[email protected]',+ 'https://editor.example',+ 'https://cloud.example.evil.example',+ 'https://user:[email protected]',// eslint-disable-next-line no-script-url -- Reject script URLs at the untrusted navigation boundary.'javascript:alert(1)']) {expect(() => cloudEditorReturnURL(discovery, value)).toThrow()}- expect(cloudEditorReturnURL(discovery, 'https://editor.example/storage#secret')).toBe(- 'https://editor.example/storage'+ expect(cloudEditorReturnURL(discovery, 'https://cloud.example/storage#secret')).toBe(+ 'https://cloud.example/storage')- expect(() =>- cloudSignInURL({ ...discovery, appURL: undefined }, 'https://editor.example')- ).toThrow()})test('a chosen provider rides along only when the server offers it', () => {@@ -48,14 +44,14 @@ test('a chosen provider rides along only when the server offers it', () => {...discovery,authentication: { ...discovery.authentication, socialProviders: ['google' as const] }}- const google = new URL(cloudSignInURL(social, 'https://editor.example/', 'google'))+ const google = new URL(cloudSignInURL(social, 'https://cloud.example/', 'google'))expect(google.searchParams.get('provider')).toBe('google')- const apple = new URL(cloudSignInURL(social, 'https://editor.example/', 'apple'))+ const apple = new URL(cloudSignInURL(social, 'https://cloud.example/', 'apple'))expect(apple.searchParams.has('provider')).toBe(false)})test('authentication continuation stays on the issuing origin', () => {- expect(cloudRedirectPath('/cloud/device?user_code=ABCD')).toBe('/cloud/device?user_code=ABCD')+ expect(cloudRedirectPath('/auth/device?user_code=ABCD')).toBe('/auth/device?user_code=ABCD')for (const input of ['//evil.example','/\\evil.example',diff --git a/packages/cloud/tests/client/device-authorization.test.ts b/packages/cloud/tests/client/device-authorization.test.tsindex 9d54bb4b2..1645480bd 100644--- a/packages/cloud/tests/client/device-authorization.test.ts+++ b/packages/cloud/tests/client/device-authorization.test.ts@@ -9,7 +9,6 @@ const discovery: CloudDiscovery = {deployment: 'self-hosted',apiURL: 'https://cloud.example.com/api',authURL: 'https://cloud.example.com/api/auth',- appURL: 'https://app.example.com',localEditor: true,authentication: { socialProviders: [], enterpriseSSO: false, enrollmentMode: 'open' },capabilities: { documents: true, workspaces: true, collaboration: true }@@ -19,8 +18,8 @@ function authorization(expiresIn = 600): CloudDeviceAuthorization {return {device_code: 'device-code',user_code: 'ABCD-EFGH',- verification_uri: 'https://cloud.example.com/cloud/device',- verification_uri_complete: 'https://cloud.example.com/cloud/device?user_code=ABCDEFGH',+ verification_uri: 'https://cloud.example.com/auth/device',+ verification_uri_complete: 'https://cloud.example.com/auth/device?user_code=ABCDEFGH',expires_in: expiresIn,interval: 1}diff --git a/packages/cloud/tests/client/discovery.test.ts b/packages/cloud/tests/client/discovery.test.tsindex b7bf82008..cbba97a17 100644--- a/packages/cloud/tests/client/discovery.test.ts+++ b/packages/cloud/tests/client/discovery.test.ts@@ -8,7 +8,6 @@ const discovery = {deployment: 'official' as const,apiURL: 'https://cloud.openpencil.dev/api',authURL: 'https://cloud.openpencil.dev/api/auth',- appURL: 'https://app.openpencil.dev',localEditor: true,authentication: {socialProviders: ['apple' as const, 'google' as const],diff --git a/packages/cloud/tests/client/email-auth.test.ts b/packages/cloud/tests/client/email-auth.test.tsindex aed5cb481..4acea5e50 100644--- a/packages/cloud/tests/client/email-auth.test.ts+++ b/packages/cloud/tests/client/email-auth.test.ts@@ -13,7 +13,6 @@ const discovery = parseCloudDiscovery({deployment: 'self-hosted' as const,apiURL: 'https://cloud.example.com/api',authURL: 'https://cloud.example.com/api/auth',- appURL: 'https://app.example.com',authentication: {socialProviders: [],emailPassword: { signIn: true, signUp: true, minimumPasswordLength: 8 },diff --git a/packages/cloud/tests/contract/discovery.test.ts b/packages/cloud/tests/contract/discovery.test.tsindex 45ef3ee49..805be58b4 100644--- a/packages/cloud/tests/contract/discovery.test.ts+++ b/packages/cloud/tests/contract/discovery.test.ts@@ -7,7 +7,6 @@ const discovery = {deployment: 'self-hosted' as const,apiURL: 'https://pencil.example.com/api',authURL: 'https://pencil.example.com/api/auth',- appURL: 'https://app.example.com',localEditor: true,authentication: {socialProviders: ['google' as const],diff --git a/packages/cloud/tests/contract/links.test.ts b/packages/cloud/tests/contract/links.test.tsindex d2f168548..c21f6adfd 100644--- a/packages/cloud/tests/contract/links.test.ts+++ b/packages/cloud/tests/contract/links.test.ts@@ -4,62 +4,58 @@ import {cloudDesktopLinkURL,cloudDocumentURL,cloudInvitationURL,- cloudShareURL+ cloudShareURL,+ parseCloudLinkPath} from '#cloud/contract'-const appURL = 'https://editor.company.example'+const server = 'https://company.example'-test('sharing uses the owning public editor without requiring browser globals', () => {- const url = new URL(cloudShareURL(appURL, 'https://company.example', 'share-id', 'secret'))- expect(url.origin).toBe('https://editor.company.example')- expect(url.pathname).toBe('/cloud/share/share-id')- expect(url.searchParams.get('server')).toBe('https://company.example')+test('a shared link is on the server itself and carries its secret in the fragment', () => {+ const url = new URL(cloudShareURL(server, 'share-id', 'secret'))+ expect(url.origin).toBe('https://company.example')+ expect(url.pathname).toBe('/share/share-id')+ expect(url.search).toBe('')expect(url.hash).toBe('#secret')- expect(url.search).not.toContain('secret')})-test('sharing rejects absent or non-web editor URLs', () => {- expect(() => cloudShareURL(undefined, 'https://company.example', 'id', 'secret')).toThrow()- expect(() =>- cloudShareURL('tauri://localhost', 'https://company.example', 'id', 'secret')- ).toThrow()+test('links refuse a server address that is not on the web', () => {+ expect(() => cloudShareURL('tauri://localhost', 'id', 'secret')).toThrow()})-test('a document or version address names its server and carries no secret', () => {- const document = new URL(cloudDocumentURL(appURL, 'https://company.example', 'doc-id'))- expect(document.origin).toBe('https://editor.company.example')- expect(document.pathname).toBe('/cloud/documents/doc-id')- expect(document.searchParams.get('server')).toBe('https://company.example')- expect(document.searchParams.has('version')).toBe(false)+test('a document or version address carries no secret', () => {+ const document = new URL(cloudDocumentURL(server, 'doc-id'))+ expect(document.origin).toBe('https://company.example')+ expect(document.pathname).toBe('/documents/doc-id')+ expect(document.search).toBe('')expect(document.hash).toBe('')- const version = new URL(- cloudDocumentURL(appURL, 'https://company.example', 'doc-id', 'version-id')- )+ const version = new URL(cloudDocumentURL(server, 'doc-id', 'version-id'))expect(version.searchParams.get('version')).toBe('version-id')- const anchored = 'https://editor.company.example/#welcome'- expect(new URL(cloudDocumentURL(anchored, 'https://company.example', 'doc-id')).hash).toBe('')+ expect(new URL(cloudDocumentURL('https://company.example/#welcome', 'doc-id')).hash).toBe('')})-test('an invitation names its server and carries its token in the fragment', () => {- const url = new URL(- cloudInvitationURL(appURL, 'https://company.example', 'invitation/id', 'token')- )- expect(url.origin).toBe('https://editor.company.example')- expect(url.pathname).toBe('/cloud/invitations/invitation%2Fid')- expect(url.searchParams.get('server')).toBe('https://company.example')+test('an invitation carries its token in the fragment', () => {+ const url = new URL(cloudInvitationURL(server, 'invitation/id', 'token'))+ expect(url.origin).toBe('https://company.example')+ expect(url.pathname).toBe('/invitations/invitation%2Fid')+ expect(url.search).toBe('')expect(url.hash).toBe('#token')- expect(url.search).not.toContain('token')})-test('desktop links keep the web link path, server, and secret under the app scheme', () => {- const url = new URL(- cloudDesktopLinkURL('invitations', 'invitation-id', 'https://company.example', 'secret')- )+test('link paths name their kind and decoded ID', () => {+ expect(parseCloudLinkPath('/share/s%201')).toEqual({ kind: 'share', id: 's 1' })+ expect(parseCloudLinkPath('/invitations/abc')).toEqual({ kind: 'invitations', id: 'abc' })+ expect(parseCloudLinkPath('/documents/abc')).toEqual({ kind: 'documents', id: 'abc' })+ for (const path of ['/rooms/abc', '/share/abc/more', '/share/', '/share/%E0%A4', '/']) {+ expect(parseCloudLinkPath(path)).toBeNull()+ }+})++test('desktop links carry the web link under the app scheme, with the secret in the fragment', () => {+ const url = new URL(cloudDesktopLinkURL('invitations', 'invitation-id', server, 'secret'))expect(url.protocol).toBe('openpencil:')expect(url.host).toBe('cloud')- expect(url.pathname).toBe('/invitations/invitation-id')- expect(url.searchParams.get('server')).toBe('https://company.example')+ expect(url.searchParams.get('url')).toBe('https://company.example/invitations/invitation-id')expect(url.hash).toBe('#secret')})diff --git a/packages/cloud/tests/contract/portal.test.ts b/packages/cloud/tests/contract/portal.test.tsindex 987d0261a..f2a34bb86 100644--- a/packages/cloud/tests/contract/portal.test.ts+++ b/packages/cloud/tests/contract/portal.test.ts@@ -7,7 +7,7 @@ describe('Cloud portal pages', () => {for (const path of ['/welcome','/auth/sign-in',- '/cloud/device',+ '/auth/device','/account','/account/pending','/admin',@@ -20,12 +20,13 @@ describe('Cloud portal pages', () => {for (const path of ['/','/demo',- '/cloud/documents/abc',+ '/documents/abc',+ '/share/abc','/api/auth/sign-in/email','/.well-known/openpencil-cloud','/accounts','/administrator',- '/cloud/devices'+ '/authors'])expect(isCloudPortalPage(path)).toBe(false)})diff --git a/packages/cloud/tests/e2e/cloudflare/checks.ts b/packages/cloud/tests/e2e/cloudflare/checks.tsindex 6dd89e9df..5d898ff08 100644--- a/packages/cloud/tests/e2e/cloudflare/checks.ts+++ b/packages/cloud/tests/e2e/cloudflare/checks.ts@@ -143,7 +143,7 @@ for (const path of ['/health', '/ready', '/.well-known/openpencil']) {for (const [path, title] of [['/auth/sign-in', 'OpenPencil Cloud'],['/', 'OpenPencil'],- ['/cloud/documents/missing', 'OpenPencil']+ ['/documents/missing', 'OpenPencil']]) {const page = await fetch(`${base}${path}`, { headers: { Accept: 'text/html' } })check(diff --git a/packages/cloud/tests/integration/admin/email/service.test.ts b/packages/cloud/tests/integration/admin/email/service.test.tsindex 48f49d9c6..1d7e6a906 100644--- a/packages/cloud/tests/integration/admin/email/service.test.ts+++ b/packages/cloud/tests/integration/admin/email/service.test.ts@@ -7,7 +7,7 @@ import {AdminDomainError} from '#cloud/server'-const CLOUD_LINKS = { appURL: 'https://cloud.example.com', portalURL: 'https://cloud.example.com' }+const CLOUD_LINKS = { publicURL: 'https://cloud.example.com' }describe('admin email regeneration', () => {test('regenerates an enrollment message from authoritative enrollment state', async () => {diff --git a/packages/cloud/tests/integration/admin/enrollment/service.test.ts b/packages/cloud/tests/integration/admin/enrollment/service.test.tsindex 350505eb8..53fe92630 100644--- a/packages/cloud/tests/integration/admin/enrollment/service.test.ts+++ b/packages/cloud/tests/integration/admin/enrollment/service.test.ts@@ -62,8 +62,7 @@ describe('Cloud enrollment integration', () => {from: '[email protected]'})const enrollment = createEnrollmentService(runtime.database, {- appURL: 'https://cloud.example.com',- portalURL: 'https://cloud.example.com',+ publicURL: 'https://cloud.example.com',adminRecipients: ['[email protected]'],})diff --git a/packages/cloud/tests/integration/server/app.test.ts b/packages/cloud/tests/integration/server/app.test.tsindex 590662543..0cb2ebd36 100644--- a/packages/cloud/tests/integration/server/app.test.ts+++ b/packages/cloud/tests/integration/server/app.test.ts@@ -368,7 +368,6 @@ describe('createCloudApp', () => {deployment: 'self-hosted',apiURL: 'https://pencil.example.com/api',authURL: 'https://pencil.example.com/api/auth',- appURL: 'https://pencil.example.com',localEditor: true,authentication: {socialProviders: ['google'],diff --git a/packages/cloud/tests/integration/server/auth/device-authorization.test.ts b/packages/cloud/tests/integration/server/auth/device-authorization.test.tsindex 2dd1c1550..97de49d72 100644--- a/packages/cloud/tests/integration/server/auth/device-authorization.test.ts+++ b/packages/cloud/tests/integration/server/auth/device-authorization.test.ts@@ -11,11 +11,10 @@ import { signOutFromCloud } from '#cloud/client'import { parseCloudDiscovery } from '#cloud/contract'import * as v from 'valibot'-test('email-only desktop authorization stays on its issuing instance with a separate editor', async () => {+test('email-only desktop authorization stays on its issuing instance', async () => {const fixture = await createAccountAuthenticationFixture({config: {...accountAuthenticationConfig,- appURL: 'https://editor.example.com',trustedOrigins: ['https://editor.example.com']}})@@ -37,7 +36,7 @@ test('email-only desktop authorization stays on its issuing instance with a sepaverification_uri_complete: v.string()}))- expect(authorization.verification_uri).toBe('https://cloud.example.com/cloud/device')+ expect(authorization.verification_uri).toBe('https://cloud.example.com/auth/device')expect(new URL(authorization.verification_uri_complete).origin).toBe('https://cloud.example.com')diff --git a/packages/cloud/tests/integration/server/auth/email-password.test.ts b/packages/cloud/tests/integration/server/auth/email-password.test.tsindex 0308e9198..204d20c89 100644--- a/packages/cloud/tests/integration/server/auth/email-password.test.ts+++ b/packages/cloud/tests/integration/server/auth/email-password.test.ts@@ -38,8 +38,7 @@ async function runtime(authenticationEmail?: AuthenticationEmailService) {from: config.emailFrom ?? ''})const enrollment = createEnrollmentService(databaseRuntime.database, {- appURL: config.publicURL,- portalURL: config.publicURL,+ publicURL: config.publicURL,adminRecipients: [],})diff --git a/packages/cloud/tests/integration/server/email/service.test.ts b/packages/cloud/tests/integration/server/email/service.test.tsindex d7b8f06b5..e79d6dd60 100644--- a/packages/cloud/tests/integration/server/email/service.test.ts+++ b/packages/cloud/tests/integration/server/email/service.test.ts@@ -9,7 +9,7 @@ const invitation = {documentName: 'Homepage',permission: 'view' as const,expiresAt: '2026-01-08T00:00:00.000Z',- acceptanceURL: 'https://app.example.com/cloud/invitations/id#secret-token'+ acceptanceURL: 'https://cloud.example.com/invitations/id#secret-token'}describe('transactional email outbox', () => {diff --git a/packages/cloud/tests/integration/server/sharing/invitations/service.test.ts b/packages/cloud/tests/integration/server/sharing/invitations/service.test.tsindex 6e6a5c075..e85d116ba 100644--- a/packages/cloud/tests/integration/server/sharing/invitations/service.test.ts+++ b/packages/cloud/tests/integration/server/sharing/invitations/service.test.ts@@ -51,7 +51,6 @@ describe('document sharing invitations integration', () => {})const sharing = createDocumentSharingService(context.runtime.database, {publicURL: 'https://cloud.example.com',- appURL: 'https://app.example.com',delivery: {async sendDocumentInvitation(message) {delivered.push(message)@@ -79,9 +78,9 @@ describe('document sharing invitations integration', () => {expiresAt: created.invitation.expiresAt,recipientHint: 'pe****@example.com'})- expect(deliveryURL.origin).toBe('https://app.example.com')- expect(deliveryURL.pathname).toBe(`/cloud/invitations/${created.invitation.id}`)- expect(deliveryURL.searchParams.get('server')).toBe('https://cloud.example.com')+ expect(deliveryURL.origin).toBe('https://cloud.example.com')+ expect(deliveryURL.pathname).toBe(`/invitations/${created.invitation.id}`)+ expect(deliveryURL.search).toBe('')expect(deliveryURL.hash).toBe(`#${created.token}`)const stored = await context.runtime.database.selectFrom('documentInvitation')@@ -108,7 +107,6 @@ describe('document sharing invitations integration', () => {})const sharing = createDocumentSharingService(context.runtime.database, {publicURL: 'https://cloud.example.com',- appURL: 'https://app.example.com',outbox: createInvitationOutbox(email)})const created = await sharing.createInvitation(OWNER_ID, context.documentId, {@@ -178,7 +176,6 @@ describe('document sharing invitations integration', () => {})const sharing = createDocumentSharingService(context.runtime.database, {publicURL: 'https://cloud.example.com',- appURL: 'https://app.example.com',delivery: {async sendDocumentInvitation() {throw new Error('SMTP unavailable')diff --git a/packages/cloud/tests/integration/server/workspaces/members.test.ts b/packages/cloud/tests/integration/server/workspaces/members.test.tsindex 8f1a55608..716b55c42 100644--- a/packages/cloud/tests/integration/server/workspaces/members.test.ts+++ b/packages/cloud/tests/integration/server/workspaces/members.test.ts@@ -14,7 +14,6 @@ import * as v from 'valibot'const config = parseCloudServerConfig({deployment: 'self-hosted',publicURL: 'https://cloud.example.com',- appURL: 'https://app.example.com',trustedOrigins: ['https://app.example.com'],databaseURL: 'postgresql://test:test@localhost/test',authSecret: 'integration-test-secret-at-least-32-characters',@@ -96,8 +95,8 @@ describe('workspace members', () => {)expect(invited.invitation).toMatchObject({ email: '[email protected]', role: 'editor' })const link = new URL(invited.acceptanceURL)- expect(link.origin).toBe('https://app.example.com')- expect(link.pathname).toBe(`/cloud/invitations/${invited.invitation.id}`)+ expect(link.origin).toBe('https://cloud.example.com')+ expect(link.pathname).toBe(`/invitations/${invited.invitation.id}`)const token = link.hash.slice(1)const listed = await responseJSON(diff --git a/packages/cloud/tests/runtime/node/email.test.ts b/packages/cloud/tests/runtime/node/email.test.tsindex a9a75dbfd..e0ebe27fc 100644--- a/packages/cloud/tests/runtime/node/email.test.ts+++ b/packages/cloud/tests/runtime/node/email.test.ts@@ -8,8 +8,7 @@ const payload = {documentName: 'Homepage',permission: 'edit' as const,expiresAt: '2026-01-08T00:00:00.000Z',- acceptanceURL:- 'https://app.example.com/cloud/invitations/invitation-id?server=https%3A%2F%2Fcloud.example.com#secret-token'+ acceptanceURL: 'https://cloud.example.com/invitations/invitation-id#secret-token'}describe('transactional email delivery', () => {diff --git a/packages/cloud/tests/runtime/node/workspace-invitation-email.test.ts b/packages/cloud/tests/runtime/node/workspace-invitation-email.test.tsindex 6a912a82e..179011c79 100644--- a/packages/cloud/tests/runtime/node/workspace-invitation-email.test.ts+++ b/packages/cloud/tests/runtime/node/workspace-invitation-email.test.ts@@ -4,7 +4,7 @@ import { renderTransactionalEmail } from '#cloud/email'describe('workspace invitation email', () => {test('names the workspace, the inviter, and what joining lets the person do', async () => {- const acceptanceURL = 'https://app.example.com/cloud/invitations/id?server=x#secret'+ const acceptanceURL = 'https://cloud.example.com/invitations/id#secret'const rendered = await renderTransactionalEmail({kind: 'workspace-invitation',payload: {diff --git a/packages/cloud/tests/runtime/site/server.test.ts b/packages/cloud/tests/runtime/site/server.test.tsindex 10c01ce12..2d55026a5 100644--- a/packages/cloud/tests/runtime/site/server.test.ts+++ b/packages/cloud/tests/runtime/site/server.test.ts@@ -33,7 +33,7 @@ const navigate = (path: string) => request(path, { headers: { Accept: 'text/htmldescribe('Cloud server', () => {test('serves the portal at portal paths, never framed and never cached', async () => {- const page = await request('/cloud/device?user_code=ABCD')+ const page = await request('/auth/device?user_code=ABCD')expect(await page.text()).toContain('Portal')expect(page.headers.get('Content-Security-Policy')).toBe("frame-ancestors 'none'")expect(page.headers.get('Cache-Control')).toBe('no-cache')@@ -42,7 +42,7 @@ describe('Cloud server', () => {})test('serves the editor at the root and at any other page, never framed', async () => {- for (const path of ['/', '/demo', '/cloud/documents/abc?server=x']) {+ for (const path of ['/', '/demo', '/documents/abc', '/share/abc']) {const page = await navigate(path)expect(await page.text()).toContain('Editor')expect(page.headers.get('Content-Security-Policy')).toBe("frame-ancestors 'none'")diff --git a/packages/cloud/tests/server/config/deployment.test.ts b/packages/cloud/tests/server/config/deployment.test.tsindex e04a1a170..309c021d3 100644--- a/packages/cloud/tests/server/config/deployment.test.ts+++ b/packages/cloud/tests/server/config/deployment.test.ts@@ -15,7 +15,6 @@ schema_version = 2[deployment]mode = "self-hosted"public_url = "https://cloud.example.com"-app_url = "https://app.example.com"trusted_origins = ["https://app.example.com"][authentication.enrollment]diff --git a/packages/docs/de/programmable/collaboration.md b/packages/docs/de/programmable/collaboration.mdindex 86b4a57f5..d62c6fe07 100644--- a/packages/docs/de/programmable/collaboration.md+++ b/packages/docs/de/programmable/collaboration.md@@ -10,7 +10,7 @@ Mehrere Personen können dasselbe Dokument gleichzeitig bearbeiten. Die Teilnehm## Raum teilen1. Schaltfläche „Teilen“ oben rechts öffnen.-2. **Diese Datei teilen** wählen – der Link `app.openpencil.dev/share/<room-id>` wird kopiert.+2. **Diese Datei teilen** wählen – der Link `app.openpencil.dev/rooms/<room-id>` wird kopiert.3. Link an die anderen Teilnehmer senden.Nur „Teilen“ bringt ein Dokument in einen Raum: Der Tab, aus dem Sie teilen, wird zum Tab des Raums und bleibt mit seiner Datei verbunden. Jede Person mit dem Link kann beitreten.diff --git a/packages/docs/development/cloud.md b/packages/docs/development/cloud.mdindex a6b4ea3cb..614c9ab6b 100644--- a/packages/docs/development/cloud.md+++ b/packages/docs/development/cloud.md@@ -92,11 +92,11 @@ keeps on its own, and versions someone named (`document_version`, one per revisia version is named, renamed, or turned back into an autosave, or a save adds a checkpoint, theserver sends `versions` to the document's rooms and every open history loads it again; peerscannot send it.-- A document's address is `/cloud/documents/:id?server=…`, with `&version=…` for a version; the- editor keeps the address bar on the active tab's document and the version it shows, and a- version's Copy link builds the address on the server's advertised editor URL. The address carries- no secret: opening it signs in to the named server, one the app already knows or the official one,- and the server's access rules decide. Fetching a version returns the version with its download, so+- A document's address is `/documents/:id` on its server, with `?version=…` for a version; the+ editor keeps the address bar on the active tab's document and the version it shows when the+ document is on the server serving the editor, and a version's Copy link builds the address on the+ document's server. The address carries no secret: opening it signs in to the server at that+ address, one the app already knows or the official one, and the server's access rules decide. Fetching a version returns the version with its download, soa link can show it without paging the history.- The cleanup worker compacts saves that are neither current nor a version once they are a day old,a batch at a time, and returns the bytes of files nothing else uses to the workspace's usage. A@@ -116,7 +116,7 @@ Documents granted to someone outside their own workspaces are listed for them seclient can show what was shared with them.Workspace administrators invite people by email with a role. Workspace invitations use the same-`/cloud/invitations/:id` link as document invitations: preview and accept look for a workspace+`/invitations/:id` link as document invitations: preview and accept look for a workspaceinvitation first and fall back to a document one, so email, the desktop handoff, and the editor'sinvitation dialog serve both. A workspace with members always keeps an administrator.@@ -409,8 +409,8 @@ continuations through OAuth stay document-only; the editor keeps a pending invit**2026-10 · Cloud links hand off to the desktop app through `openpencil://cloud`.** Links stay webaddresses on the server's editor, so they work for anyone; the web editor on a computer offers the-desktop app, which gets the same path, server, and secret as `openpencil://cloud/<kind>/<id>`.-The native side checks the ID, secret, and server before the editor sees a link. The secret is+desktop app, which gets the web link as `openpencil://cloud?url=<link>#<secret>`. The native side+checks the link, ID, and secret before the editor sees it. The secret isvisible in the launch arguments to other processes on the same computer; pasting links into theapp would avoid that at the cost of a manual step for everyone.@@ -449,3 +449,10 @@ signs in through the server's pages and its session, with no device code and nopage meets visitors who are not signed in, and the editor stays usable without an account, as itis on app.openpencil.dev, which can then redirect there. Keeping the editor only on a separatestatic host left a signed-in person on account settings with no way to their files.++**2026-10 · Links name their server by their own address.** A document is `/documents/:id`, a+shared link `/share/:id`, and an invitation `/invitations/:id` on the server that holds them, with+no `server` parameter and no `/cloud` prefix, and the server has no separate editor address to+send them to. Peer-to-peer rooms move to `/rooms/:id` so "share" names a shared document. The+cost is that a browser editor at any other address cannot keep a Cloud document in its address+bar; every server serves its own editor, and the desktop app gets links through `openpencil://`.diff --git a/packages/docs/pl/programmable/collaboration.md b/packages/docs/pl/programmable/collaboration.mdindex 005c470a3..ea2128449 100644--- a/packages/docs/pl/programmable/collaboration.md+++ b/packages/docs/pl/programmable/collaboration.md@@ -10,7 +10,7 @@ Kilka osób może jednocześnie edytować jeden dokument. Uczestnicy łączą si## Udostępnianie pokoju1. Kliknij przycisk „Udostępnij” w prawym górnym rogu.-2. Kliknij **Udostępnij ten plik** — odnośnik `app.openpencil.dev/share/<room-id>` zostanie skopiowany.+2. Kliknij **Udostępnij ten plik** — odnośnik `app.openpencil.dev/rooms/<room-id>` zostanie skopiowany.3. Wyślij go innym uczestnikom.Tylko udostępnienie umieszcza dokument w pokoju: karta, z której udostępniasz, staje się kartą pokoju i pozostaje powiązana ze swoim plikiem. Dołączyć może każda osoba znająca odnośnik.diff --git a/packages/docs/programmable/collaboration.md b/packages/docs/programmable/collaboration.mdindex 6de614d0b..4e98aa691 100644--- a/packages/docs/programmable/collaboration.md+++ b/packages/docs/programmable/collaboration.md@@ -10,7 +10,7 @@ Edit designs together in real time. Peers connect directly — no server relays## Sharing a Room1. Click the share button in the top-right corner-2. Click **Share this file** — the link (`app.openpencil.dev/share/<room-id>`) is copied+2. Click **Share this file** — the link (`app.openpencil.dev/rooms/<room-id>`) is copied3. Send it to your collaboratorsOnly Share puts a document into a room: the tab you share from becomes the room's tab and stays tied to its file. Anyone with the link can join.diff --git a/packages/docs/reference/self-hosting-cloud.md b/packages/docs/reference/self-hosting-cloud.mdindex 7cbc15886..bea27018f 100644--- a/packages/docs/reference/self-hosting-cloud.md+++ b/packages/docs/reference/self-hosting-cloud.md@@ -44,7 +44,7 @@ The server serves the editor at its own address. Visitors who are not signed inFor a server only its members use, set `deployment.local_editor = false`: the welcome page then offers only signing in, and every editor page asks for it. To keep shared links to members too, turn off `guest_view`, `guest_edit`, and `guest_presence` under `[entitlements.sharing]`; links then open after signing in to the server.-To send links to an editor at another address instead, set `deployment.app_url` to it and list its origin in `deployment.trusted_origins`. People sign in there by approving a code, as in the desktop app, which connects to the server directly either way.+Links the server sends point at its own address: `/documents/<id>` for a document, `/share/<id>` for a shared link, and `/invitations/<id>` for an invitation. An editor at another address, such as a development build, can still connect when its origin is in `deployment.trusted_origins`; people sign in there by approving a code, as in the desktop app.## Reverse proxydiff --git a/packages/docs/ru/programmable/collaboration.md b/packages/docs/ru/programmable/collaboration.mdindex 17245ab1c..eeb29a507 100644--- a/packages/docs/ru/programmable/collaboration.md+++ b/packages/docs/ru/programmable/collaboration.md@@ -10,7 +10,7 @@ description: Одновременное редактирование напря## Отправка ссылки1. Нажмите кнопку «Поделиться» в правом верхнем углу.-2. Нажмите **Поделиться файлом** — ссылка `app.openpencil.dev/share/<room-id>` будет скопирована.+2. Нажмите **Поделиться файлом** — ссылка `app.openpencil.dev/rooms/<room-id>` будет скопирована.3. Отправьте её другим участникам.Документ попадает в комнату только через «Поделиться»: вкладка, из которой вы делитесь, становится вкладкой комнаты и остаётся связанной со своим файлом. Присоединиться может любой, у кого есть ссылка.diff --git a/src/app/cloud-portal/site.ts b/src/app/cloud-portal/site.tsindex 2fa7d256b..7bbf7015f 100644--- a/src/app/cloud-portal/site.ts+++ b/src/app/cloud-portal/site.ts@@ -6,7 +6,7 @@ import {discoverCloud,type CloudPortalClient} from '@open-pencil/cloud/client'-import type { CloudAccountStatus } from '@open-pencil/cloud/contract'+import { parseCloudLinkPath, type CloudAccountStatus } from '@open-pencil/cloud/contract'/*** A Cloud server serves the editor to signed-in people and, where the server allows the local@@ -15,16 +15,14 @@ import type { CloudAccountStatus } from '@open-pencil/cloud/contract'*/export const WELCOME_PATH = '/welcome'-const CLOUD_LINK_PATH = /^\/cloud\/(documents|share|invitations)\/[^/]+$/-/*** Whether an address is a link to a document, a shared file, or an invitation, which sign in on- * their own: it names its server, and a shared file or invitation carries its secret.+ * their own; a shared file or invitation carries its secret.*/export function isCloudLink(url: URL): boolean {- const [, kind] = url.pathname.match(CLOUD_LINK_PATH) ?? []- if (!kind || !url.searchParams.get('server')) return false- return kind === 'documents' || url.hash.length > 1+ const path = parseCloudLinkPath(url.pathname)+ if (!path) return false+ return path.kind === 'documents' || url.hash.length > 1}/** Whether this browser chose to use the server's editor without an account. */diff --git a/src/app/cloud/documents/link.ts b/src/app/cloud/documents/link.tsindex 4908cbfb9..c88e6a314 100644--- a/src/app/cloud/documents/link.ts+++ b/src/app/cloud/documents/link.ts@@ -2,7 +2,11 @@ import { useSessionStorage } from '@vueuse/core'import * as v from 'valibot'import { ref, watch } from 'vue'-import { cloudDocumentPath, cloudDocumentURL } from '@open-pencil/cloud/contract'+import {+ cloudDocumentPath,+ cloudDocumentURL,+ parseCloudLinkPath+} from '@open-pencil/cloud/contract'import { cloudMessages } from '@open-pencil/vue/i18n'import type { EditorStore } from '@/app/editor/session'@@ -12,21 +16,19 @@ import { IS_BROWSER } from '@/constants'import { cloudSignedIn, openCloudConnect } from '../connect/flow'import { cloudServerHost, normalizeCloudServerURL } from '../servers/address'-import { cloudServerForLink, findCloudServer } from '../servers/store'+import { cloudServerForLink, findCloudServer, isCloudSiteServer } from '../servers/store'import { cloudAPIClient, cloudConnection } from '../sessions/connection'import { CLOUD_STORAGE_PROVIDER_ID } from '../sessions/token'import { openVersionHistory, previewVersion, versionHistoryOf } from '../versions/history'import { isCloudBinding } from './status'/**- * A document's address for its members, `/cloud/documents/:id?server=…`, with `&version=…` for+ * A document's address for its members, `/documents/:id` on its server, with `?version=…` for* one of its versions. Unlike invitations and share links it carries no secret: the server* decides whether whoever signs in may open it.*/export type CloudDocumentLink = { documentId: string; server: string; versionId: string | null }-const CLOUD_DOCUMENT_PATH = /^\/cloud\/documents\/([^/]+)$/-const linkSchema = v.object({documentId: v.string(),server: v.string(),@@ -38,26 +40,17 @@ const stored = IS_BROWSER? useSessionStorage<string | null>('open-pencil:cloud-document-link', null): ref<string | null>(null)-/** The document link a web address carries, if it is one. */+/** The document link a web address carries, if it is one; its server is the address's own. */export function readCloudDocumentLink(url: URL): CloudDocumentLink | null {- const [, id] = url.pathname.match(CLOUD_DOCUMENT_PATH) ?? []- const server = url.searchParams.get('server')- if (!id || !server) return null- try {- return {- documentId: decodeURIComponent(id),- server,- versionId: url.searchParams.get('version')- }- } catch {- // A broken escape such as `%E0` is no link; it must not stop the app from starting.- return null- }+ const path = parseCloudLinkPath(url.pathname)+ if (path?.kind !== 'documents') return null+ return { documentId: path.id, server: url.origin, versionId: url.searchParams.get('version') }}/*** What the tab of `store` has at its address: its Cloud document, and the version shown in place- * of it. Null for anything else, or while signed out of its server.+ * of it. Null for anything else, and for a document of any server but the one serving this+ * editor, whose address could not name it.*/export function cloudDocumentAddress(store: EditorStore@@ -65,21 +58,16 @@ export function cloudDocumentAddress(const history = versionHistoryOf(store)const binding = (history?.store ?? store).getStorageBinding()if (!binding || !isCloudBinding(binding) || !binding.profileId) return null- const server = findCloudServer(binding.profileId)- if (!server) return null+ if (!isCloudSiteServer(binding.profileId)) return nullconst version = history?.preview?.version.id- return {- path: cloudDocumentPath(binding.documentId),- query: version ? { server: server.url, version } : { server: server.url }- }+ return { path: cloudDocumentPath(binding.documentId), query: version ? { version } : {} }}-/** Where links to the document in `store` go: its server, while that advertises an editor. */+/** Where links to the Cloud document in `store` go: its server. */function linkTarget(store: EditorStore) {const binding = (versionHistoryOf(store)?.store ?? store).getStorageBinding()const server = binding?.profileId ? findCloudServer(binding.profileId) : null- const discovery = server ? cloudConnection(server.id).discovery : null- return binding && server && discovery?.appURL ? { binding, server, discovery } : null+ return binding && server ? { binding, server } : null}/** Whether versions of the document in `store` can be linked to. */@@ -91,8 +79,7 @@ export function canLinkToVersions(store: EditorStore): boolean {export function cloudVersionLinkURL(store: EditorStore, versionId: string): string | null {const target = linkTarget(store)if (!target) return null- const { binding, server, discovery } = target- return cloudDocumentURL(discovery.appURL, server.url, binding.documentId, versionId)+ return cloudDocumentURL(target.server.url, target.binding.documentId, versionId)}/**diff --git a/src/app/cloud/invitations/flow.ts b/src/app/cloud/invitations/flow.tsindex 8b97221c0..865141b1e 100644--- a/src/app/cloud/invitations/flow.ts+++ b/src/app/cloud/invitations/flow.ts@@ -105,7 +105,7 @@ export async function checkCloudInvitation(): Promise<void> {cloudInvitationState.value = signedInServer() ? 'ready' : 'sign-in'}-/** Opens an invitation link: `/cloud/invitations/:id?server=…#token`. */+/** Opens an invitation link: `/invitations/:id#token` on its server. */export function beginCloudInvitation(id: string, server: string, token: string): void {stored.value = JSON.stringify({ id, server, token } satisfies PendingInvitation)cloudInvitationOpen.value = truediff --git a/src/app/cloud/links.ts b/src/app/cloud/links.tsindex 009ba4c3a..b266397d3 100644--- a/src/app/cloud/links.ts+++ b/src/app/cloud/links.ts@@ -2,7 +2,11 @@ import { useSessionStorage } from '@vueuse/core'import * as v from 'valibot'import { ref, watch } from 'vue'-import { cloudDesktopLinkURL, type CloudLinkKind } from '@open-pencil/cloud/contract'+import {+ cloudDesktopLinkURL,+ parseCloudLinkPath,+ type CloudLinkKind+} from '@open-pencil/cloud/contract'import { useViewportKind } from '@open-pencil/vue/editor/viewport-kind'import { cloudMessages } from '@open-pencil/vue/i18n'@@ -18,14 +22,12 @@ import { cloudServerForLink, findCloudServer } from './servers/store'import { openCloudShareLink } from './sharing/link'/**- * An invitation, `/cloud/invitations/:id?server=…#token`, or a document shared by link,- * `/cloud/share/:id?server=…#secret`. The desktop app gets the same link as- * `openpencil://cloud/<kind>/<id>?server=…#secret`.+ * An invitation, `/invitations/:id#token`, or a document shared by link, `/share/:id#secret`, on+ * the server they belong to. The desktop app gets the same link as+ * `openpencil://cloud?url=<link>#secret`.*/export type CloudLink = { kind: CloudLinkKind; id: string; server: string; secret: string }-const CLOUD_LINK_PATH = /^\/cloud\/(invitations|share)\/([^/]+)$/-/** Desktop events and commands for `openpencil://cloud` links (`desktop/src/launch/mod.rs`). */const CLOUD_LINKS_EVENT = 'open-cloud-links'const TAKE_PENDING_CLOUD_LINKS = 'take_pending_cloud_links'@@ -37,18 +39,12 @@ const cloudLinkSchema = v.object({secret: v.string()})-/** The Cloud link a web address carries, if it is one. */+/** The Cloud link a web address carries, if it is one; its server is the address's own. */export function readCloudLink(url: URL): CloudLink | null {- const [, kind, id] = url.pathname.match(CLOUD_LINK_PATH) ?? []- const server = url.searchParams.get('server')+ const path = parseCloudLinkPath(url.pathname)const secret = url.hash.slice(1)- if ((kind !== 'invitations' && kind !== 'share') || !id || !server || !secret) return null- try {- return { kind, id: decodeURIComponent(id), server, secret }- } catch {- // A broken escape such as `%E0` is no link; it must not stop the app from starting.- return null- }+ if (!path || path.kind === 'documents' || !secret) return null+ return { kind: path.kind, id: path.id, server: url.origin, secret }}/** Hands a Cloud link to the desktop app; the browser asks before it opens the app. */diff --git a/src/app/cloud/sessions/sign-in.ts b/src/app/cloud/sessions/sign-in.tsindex 2f64ae11d..5cd91ace9 100644--- a/src/app/cloud/sessions/sign-in.ts+++ b/src/app/cloud/sessions/sign-in.ts@@ -3,7 +3,7 @@ import { withoutFragment } from 'ufo'import { ref } from 'vue'import { cloudSignInURL, type CloudSocialProvider } from '@open-pencil/cloud/client'-import type { CloudDiscovery } from '@open-pencil/cloud/contract'+import { cloudServerOrigin, type CloudDiscovery } from '@open-pencil/cloud/contract'import { IS_BROWSER, IS_TAURI } from '@/constants'@@ -18,8 +18,8 @@ const pendingSignIn = IS_BROWSER* else — the desktop app, another editor address — approves a code instead.*/export function cloudSignInRoute(discovery: CloudDiscovery): 'redirect' | 'device' {- if (IS_TAURI || !discovery.appURL) return 'device'- return new URL(discovery.appURL).origin === globalThis.location.origin ? 'redirect' : 'device'+ if (IS_TAURI) return 'device'+ return cloudServerOrigin(discovery) === globalThis.location.origin ? 'redirect' : 'device'}export type CloudSignInMethod = CloudSocialProvider | 'email'diff --git a/src/app/cloud/sharing/document.ts b/src/app/cloud/sharing/document.tsindex 5e2b941a4..fa7dfa90e 100644--- a/src/app/cloud/sharing/document.ts+++ b/src/app/cloud/sharing/document.ts@@ -183,5 +183,5 @@ export async function cloudLinkURL(target: Target): Promise<string | null> {const share = activeShare(await target.client.listDocumentShares(target.documentId))if (!share) return nullconst secret = await readShareSecret(target.server.id, share.id)- return secret ? cloudShareURL(target.discovery.appURL, target.server.url, share.id, secret) : null+ return secret ? cloudShareURL(target.server.url, share.id, secret) : null}diff --git a/src/app/collab/room/id.ts b/src/app/collab/room/id.tsindex 6cdece2c6..8b80d7d6e 100644--- a/src/app/collab/room/id.ts+++ b/src/app/collab/room/id.ts@@ -13,13 +13,13 @@ export function isRoomId(value: string): boolean {}/**- * The room ID in what someone pasted: a bare ID or a share link, with any query, hash, or+ * The room ID in what someone pasted: a bare ID or a room link, with any query, hash, or* trailing slash. Null when it is not a room ID, so a mistyped link never joins another room.*/export function parseRoomInput(text: string): string | null {let candidate = text.trim()- const shareIndex = candidate.lastIndexOf('/share/')- if (shareIndex !== -1) candidate = candidate.slice(shareIndex + '/share/'.length)+ const roomIndex = candidate.lastIndexOf('/rooms/')+ if (roomIndex !== -1) candidate = candidate.slice(roomIndex + '/rooms/'.length)candidate = candidate.split(/[?#]/)[0] ?? ''candidate = candidate.replace(/\/+$/, '')return isRoomId(candidate) ? candidate : nulldiff --git a/src/app/tabs/address.ts b/src/app/tabs/address.tsindex ea33faced..b2ddcad53 100644--- a/src/app/tabs/address.ts+++ b/src/app/tabs/address.ts@@ -8,19 +8,19 @@ import { activeRoom } from '@/app/collab/rooms'import { activeTab } from './index'-export const SHARE_ROUTE_PREFIX = '/share/'-const CLOUD_DOCUMENT_PREFIX = '/cloud/documents/'+export const ROOM_ROUTE_PREFIX = '/rooms/'+const CLOUD_DOCUMENT_PREFIX = '/documents/'/** The query a Cloud document's address adds, and leaving it takes away. */-const CLOUD_DOCUMENT_QUERY = ['server', 'version']+const CLOUD_DOCUMENT_QUERY = ['version']export type TabAddress = { path: string; query: LocationQuery }-export function shareRoutePath(roomId: string): string {- return `${SHARE_ROUTE_PREFIX}${roomId}`+export function roomRoutePath(roomId: string): string {+ return `${ROOM_ROUTE_PREFIX}${roomId}`}/**- * The address for the active tab: its Cloud document's, its shared room's link, or `/` after+ * The address for the active tab: its Cloud document's, its room's link, or `/` after* leaving either. A Cloud document's room is the server's relay channel, so its ID never goes in* the address. On `opening`, a document address stays for startup to open.*/@@ -32,8 +32,8 @@ export function tabAddressFor(): TabAddress {const query = omit(current.query, CLOUD_DOCUMENT_QUERY)if (cloud) return { path: cloud.path, query: { ...query, ...cloud.query } }- if (roomId && isRoomId(roomId)) return { path: shareRoutePath(roomId), query }- if (current.path.startsWith(SHARE_ROUTE_PREFIX)) return { path: '/', query }+ if (roomId && isRoomId(roomId)) return { path: roomRoutePath(roomId), query }+ if (current.path.startsWith(ROOM_ROUTE_PREFIX)) return { path: '/', query }if (current.path.startsWith(CLOUD_DOCUMENT_PREFIX) && !opening) return { path: '/', query }return current}diff --git a/src/cloud/router.ts b/src/cloud/router.tsindex 1b2d142ff..b06b16272 100644--- a/src/cloud/router.ts+++ b/src/cloud/router.ts@@ -63,7 +63,7 @@ export function createCloudPortalRouter(context: PortalContext) {meta: { account: true }},{- path: '/cloud/device',+ path: '/auth/device',name: 'device',component: () => import('@/views/cloud/DeviceView.vue'),meta: { account: true }diff --git a/src/constants.ts b/src/constants.tsindex 4af52c124..9cebd791d 100644--- a/src/constants.ts+++ b/src/constants.ts@@ -116,7 +116,7 @@ export function releaseNotesURL(version: string): string {export function getShareURL(roomId: string): string {const base = IS_TAURI || !IS_BROWSER ? WEB_APP_ORIGIN : window.location.origin- return `${base}/share/${roomId}`+ return `${base}/rooms/${roomId}`}export const PEER_COLORS: Color[] = [diff --git a/src/router.ts b/src/router.tsindex 36b53b3ee..97997200c 100644--- a/src/router.ts+++ b/src/router.ts@@ -17,12 +17,13 @@ const router = createRouter({}},{ path: '/demo', component: WorkspaceView, meta: { demo: true } },- { path: '/share/:roomId', component: WorkspaceView },+ // A peer-to-peer room, joined by its ID.+ { path: '/rooms/:roomId', component: WorkspaceView },// Cloud invitations and links; the app takes their secret out of the address on start.- { path: '/cloud/invitations/:invitationId', component: WorkspaceView },- { path: '/cloud/share/:shareId', component: WorkspaceView },+ { path: '/invitations/:invitationId', component: WorkspaceView },+ { path: '/share/:shareId', component: WorkspaceView },// A Cloud document, or one of its versions, for whoever signs in with access to it.- { path: '/cloud/documents/:documentId', component: WorkspaceView }+ { path: '/documents/:documentId', component: WorkspaceView }]})diff --git a/src/views/WorkspaceView.vue b/src/views/WorkspaceView.vueindex 49a59c503..34bef95b7 100644--- a/src/views/WorkspaceView.vue+++ b/src/views/WorkspaceView.vue@@ -181,7 +181,7 @@ function openDocumentPaths(): string[] {* Drops the link params through the router, not through `history` directly: the router* keeps its own copy of the current URL in `history.state` and re-applies it on the next* navigation, which would put `file` and `node` back into the entry. Route and hash are- * preserved, so the link works on `/`, `/share/:id` and `/demo` alike.+ * preserved, so the link works on `/`, `/rooms/:id` and `/demo` alike.*/function stripWebLinkParams(): void {void router.replace({diff --git a/src/views/cloud/SignInView.vue b/src/views/cloud/SignInView.vueindex 31debbbc5..8062e0c1d 100644--- a/src/views/cloud/SignInView.vue+++ b/src/views/cloud/SignInView.vue@@ -24,7 +24,7 @@ const emailPassword = computed(() => {return { signUp: credentials.signUp, minimumPasswordLength: credentials.minimumPasswordLength }})const returnsTo = computed(() => {- if (redirect.value.startsWith('/cloud/device')) return 'desktop'+ if (redirect.value.startsWith('/auth/device')) return 'desktop'if (redirect.value.startsWith('/auth/return')) return 'editor'return null})diff --git a/tests/app/cloud-portal/navigation.test.ts b/tests/app/cloud-portal/navigation.test.tsindex 6786c9c89..e73b3dbb3 100644--- a/tests/app/cloud-portal/navigation.test.ts+++ b/tests/app/cloud-portal/navigation.test.ts@@ -43,9 +43,9 @@ describe('portal access rules', () => {})test('account pages ask for a session and come back after it', () => {- expect(portalDestination(target('/cloud/device', { account: true }), null)).toEqual({+ expect(portalDestination(target('/auth/device', { account: true }), null)).toEqual({name: 'sign-in',- query: { redirect: '/cloud/device' }+ query: { redirect: '/auth/device' }})})diff --git a/tests/app/cloud-portal/site.test.ts b/tests/app/cloud-portal/site.test.tsindex b8e0fe1cf..fce3129e5 100644--- a/tests/app/cloud-portal/site.test.ts+++ b/tests/app/cloud-portal/site.test.ts@@ -49,17 +49,17 @@ describe('Cloud server editor pages', () => {test('welcome everyone without an account where the server turns the local editor off', () => {expect(visit('/', null, { localEditor: false, choseLocalEditor: true })).toBe('/welcome')expect(visit('/demo', null, { localEditor: false })).toBe('/welcome')- expect(visit('/share/room', account('pending'), { localEditor: false })).toBe('/welcome')+ expect(visit('/rooms/room', account('pending'), { localEditor: false })).toBe('/welcome')})test('tell links, which sign in on their own, from look-alike addresses', () => {const link = (address: string) => isCloudLink(new URL(address, 'https://cloud.example'))- expect(link('/cloud/documents/a?server=https://cloud.example')).toBe(true)- expect(link('/cloud/share/b?server=https://cloud.example#secret')).toBe(true)- expect(link('/cloud/invitations/c?server=https://cloud.example#token')).toBe(true)- expect(link('/cloud/share/b?server=https://cloud.example')).toBe(false)- expect(link('/cloud/documents/a')).toBe(false)- expect(link('/cloud/share/b/c?server=x#secret')).toBe(false)+ expect(link('/documents/a')).toBe(true)+ expect(link('/share/b#secret')).toBe(true)+ expect(link('/invitations/c#token')).toBe(true)+ expect(link('/share/b')).toBe(false)+ expect(link('/share/b/c#secret')).toBe(false)+ expect(link('/rooms/b#secret')).toBe(false)})test('open the editor when the server cannot say, since the editor works without it', () => {diff --git a/tests/app/cloud/documents/link.test.ts b/tests/app/cloud/documents/link.test.tsindex 3990cefc3..52977d4e9 100644--- a/tests/app/cloud/documents/link.test.ts+++ b/tests/app/cloud/documents/link.test.ts@@ -7,23 +7,19 @@ const SERVER = 'https://cloud.example.com'const DOCUMENT = '1413785f-37aa-4935-8bfb-e2cd81a035cf'describe('Cloud document links', () => {- test('an address names the document, its server, and the version it shows', () => {- const base = `https://openpencil.dev/cloud/documents/${DOCUMENT}?server=${SERVER}`+ test('an address names the document and the version it shows; its own address is the server', () => {+ const base = `${SERVER}/documents/${DOCUMENT}`expect(readCloudDocumentLink(new URL(base))).toEqual({documentId: DOCUMENT,server: SERVER,versionId: null})- expect(readCloudDocumentLink(new URL(`${base}&version=v1`))?.versionId).toBe('v1')+ expect(readCloudDocumentLink(new URL(`${base}?version=v1`))?.versionId).toBe('v1')})- test('an address without a server or with a broken escape is no link', () => {- expect(- readCloudDocumentLink(new URL(`https://openpencil.dev/cloud/documents/${DOCUMENT}`))- ).toBeNull()- expect(- readCloudDocumentLink(new URL(`https://openpencil.dev/cloud/documents/%E0?server=${SERVER}`))- ).toBeNull()- expect(readCloudDocumentLink(new URL(`https://openpencil.dev/?server=${SERVER}`))).toBeNull()+ test('another address or a broken escape is no link', () => {+ expect(readCloudDocumentLink(new URL(`${SERVER}/documents/%E0`))).toBeNull()+ expect(readCloudDocumentLink(new URL(`${SERVER}/share/${DOCUMENT}`))).toBeNull()+ expect(readCloudDocumentLink(new URL(`${SERVER}/`))).toBeNull()})})diff --git a/tests/app/cloud/links.test.ts b/tests/app/cloud/links.test.tsindex 4e2b8698c..fb972b95a 100644--- a/tests/app/cloud/links.test.ts+++ b/tests/app/cloud/links.test.ts@@ -8,40 +8,40 @@ import { readCloudLink } from '@/app/cloud/links'const SERVER = 'https://cloud.example.com'describe('Cloud links', () => {- test('a web link names its kind, id, server, and secret', () => {- expect(- readCloudLink(new URL(`https://app.example.com/cloud/invitations/abc?server=${SERVER}#token`))- ).toEqual({ kind: 'invitations', id: 'abc', server: SERVER, secret: 'token' })- expect(- readCloudLink(new URL(`https://app.example.com/cloud/share/s%201?server=${SERVER}#secret`))- ).toEqual({ kind: 'share', id: 's 1', server: SERVER, secret: 'secret' })+ test('a web link names its kind, id, and secret, and its own address is the server', () => {+ expect(readCloudLink(new URL(`${SERVER}/invitations/abc#token`))).toEqual({+ kind: 'invitations',+ id: 'abc',+ server: SERVER,+ secret: 'token'+ })+ expect(readCloudLink(new URL(`${SERVER}/share/s%201#secret`))).toEqual({+ kind: 'share',+ id: 's 1',+ server: SERVER,+ secret: 'secret'+ })})test('other addresses and links missing a part are not Cloud links', () => {for (const address of [- 'https://app.example.com/',- `https://app.example.com/cloud/documents/abc?server=${SERVER}#secret`,- `https://app.example.com/cloud/share/abc/more?server=${SERVER}#secret`,- 'https://app.example.com/cloud/share/abc#secret',- `https://app.example.com/cloud/share/abc?server=${SERVER}`,- `https://app.example.com/cloud/share/%E0%A4?server=${SERVER}#secret`+ `${SERVER}/`,+ `${SERVER}/documents/abc#secret`,+ `${SERVER}/rooms/abc#secret`,+ `${SERVER}/share/abc/more#secret`,+ `${SERVER}/share/abc`,+ `${SERVER}/share/%E0%A4#secret`]) {expect(readCloudLink(new URL(address))).toBeNull()}})- test('the desktop form of a web link reads back as the same link', () => {- const web = readCloudLink(- new URL(`https://app.example.com/cloud/share/abc?server=${SERVER}#secret`)- )+ test('the desktop form of a web link carries the same link', () => {+ const web = readCloudLink(new URL(`${SERVER}/share/abc#secret`))if (!web) throw new Error('Expected a Cloud link')const desktop = new URL(cloudDesktopLinkURL(web.kind, web.id, web.server, web.secret))- expect([desktop.protocol, desktop.host, desktop.pathname]).toEqual([- 'openpencil:',- 'cloud',- '/share/abc'- ])- expect(desktop.searchParams.get('server')).toBe(SERVER)+ expect([desktop.protocol, desktop.host]).toEqual(['openpencil:', 'cloud'])+ expect(desktop.searchParams.get('url')).toBe(`${SERVER}/share/abc`)expect(desktop.hash).toBe('#secret')})})diff --git a/tests/app/cloud/sessions/device.test.ts b/tests/app/cloud/sessions/device.test.tsindex be7dd2bab..534fa5125 100644--- a/tests/app/cloud/sessions/device.test.ts+++ b/tests/app/cloud/sessions/device.test.ts@@ -13,8 +13,8 @@ const discovery = cloudDiscoveryFixture()const authorization = {device_code: 'device',user_code: 'ABCD-EFGH',- verification_uri: 'https://cloud.example/cloud/device',- verification_uri_complete: 'https://cloud.example/cloud/device?user_code=ABCD-EFGH',+ verification_uri: 'https://cloud.example/auth/device',+ verification_uri_complete: 'https://cloud.example/auth/device?user_code=ABCD-EFGH',expires_in: 900,interval: 5}diff --git a/tests/app/collab/room/id.test.ts b/tests/app/collab/room/id.test.tsindex 5542bc082..7fa715de9 100644--- a/tests/app/collab/room/id.test.ts+++ b/tests/app/collab/room/id.test.ts@@ -5,14 +5,14 @@ import { parseRoomInput } from '@/app/collab/room/id'const ROOM = 'abcdefghijklmnopqrstuvwxyz012345'describe('room links and IDs', () => {- test('reads the room ID from a bare ID or a share link, whatever surrounds it', () => {+ test('reads the room ID from a bare ID or a room link, whatever surrounds it', () => {for (const input of [ROOM,` ${ROOM} `,- `https://app.openpencil.dev/share/${ROOM}`,- `https://app.openpencil.dev/share/${ROOM}/`,- `https://app.openpencil.dev/share/${ROOM}?test#layers`,- `open-pencil.localhost/share/${ROOM}#x`+ `https://app.openpencil.dev/rooms/${ROOM}`,+ `https://app.openpencil.dev/rooms/${ROOM}/`,+ `https://app.openpencil.dev/rooms/${ROOM}?test#layers`,+ `open-pencil.localhost/rooms/${ROOM}#x`]) {expect(parseRoomInput(input)).toBe(ROOM)}@@ -25,7 +25,7 @@ describe('room links and IDs', () => {ROOM.slice(1),`${ROOM}0`,ROOM.toUpperCase(),- `https://app.openpencil.dev/share/${ROOM.slice(0, 31)}!`,+ `https://app.openpencil.dev/rooms/${ROOM.slice(0, 31)}!`,`https://app.openpencil.dev/demo`]) {expect(parseRoomInput(input)).toBeNull()diff --git a/tests/app/tabs/address.test.ts b/tests/app/tabs/address.test.tsindex 2c94e0568..a2094b69b 100644--- a/tests/app/tabs/address.test.ts+++ b/tests/app/tabs/address.test.ts@@ -5,30 +5,27 @@ import { tabAddressFor } from '@/app/tabs/address'const roomId = 'abcdefghijklmnopqrstuvwxyz012345'const cloudRoomId = 'cloud:1413785f-37aa-4935-8bfb-e2cd81a035cf:0'const home = { path: '/', query: {} }-const document = {- path: '/cloud/documents/1413785f-37aa-4935-8bfb-e2cd81a035cf',- query: { server: 'https://cloud.example.com' }-}+const document = { path: '/documents/1413785f-37aa-4935-8bfb-e2cd81a035cf', query: {} }describe('tab address', () => {- test('shows a shared room as its share link', () => {- expect(tabAddressFor(roomId, null, home).path).toBe(`/share/${roomId}`)+ test('shows a room as its link', () => {+ expect(tabAddressFor(roomId, null, home).path).toBe(`/rooms/${roomId}`)})- test('takes a document’s server and version off when a room’s tab comes up', () => {+ test('takes a document’s version off when a room’s tab comes up', () => {const shown = {path: document.path,query: { ...document.query, version: 'v1', cloud: 'preview' }}expect(tabAddressFor(roomId, null, shown)).toEqual({- path: `/share/${roomId}`,+ path: `/rooms/${roomId}`,query: { cloud: 'preview' }})})test('shows a Cloud document at its address, not its room', () => {expect(tabAddressFor(cloudRoomId, document, home)).toEqual(document)- expect(tabAddressFor(cloudRoomId, null, { path: `/share/${roomId}`, query: {} }).path).toBe('/')+ expect(tabAddressFor(cloudRoomId, null, { path: `/rooms/${roomId}`, query: {} }).path).toBe('/')})test('names the version shown, keeping the rest of the query', () => {@@ -41,8 +38,8 @@ describe('tab address', () => {).toEqual(document)})- test('leaves a share link or a document for the home address when the tab has neither', () => {- expect(tabAddressFor(null, null, { path: `/share/${roomId}`, query: {} }).path).toBe('/')+ test('leaves a room or a document for the home address when the tab has neither', () => {+ expect(tabAddressFor(null, null, { path: `/rooms/${roomId}`, query: {} }).path).toBe('/')expect(tabAddressFor(null, null, { path: document.path, query: document.query })).toEqual(home)expect(tabAddressFor(null, null, { path: '/demo', query: {} }).path).toBe('/demo')})diff --git a/tests/e2e/collab/rooms.spec.ts b/tests/e2e/collab/rooms.spec.tsindex 0dfc3d042..a4f0b5748 100644--- a/tests/e2e/collab/rooms.spec.ts+++ b/tests/e2e/collab/rooms.spec.ts@@ -8,7 +8,7 @@ import {ROOM_ID,SECOND_ROOM_ID,share,- shareLinkPath,+ roomLinkPath,startRelay,type Peer} from '#tests/helpers/collab/room'@@ -42,7 +42,7 @@ test('a share link opens the room in its own tab, waiting until someone with itlet host: Peer | null = nulllet guest: Peer | null = nulltry {- guest = await createPeer(browser, 'Guest', relay.url, { path: shareLinkPath() })+ guest = await createPeer(browser, 'Guest', relay.url, { path: roomLinkPath() })const screen = guest.page.getByTestId('room-screen')// It connects and looks for people before it says nobody who has the file is here.await expect(screen).toHaveAttribute('data-status', /^(connecting|looking)$/)@@ -67,7 +67,7 @@ test('a share link opens the room in its own tab, waiting until someone with itawait expect(screen).toHaveCount(0)await expect.poll(() => roomStatus(guest as Peer)).toBe('live')await expect.poll(() => layerName((guest as Peer).page, nodeId)).toBe('Shared card')- await expect(guest.page).toHaveURL(new RegExp(`/share/${ROOM_ID}\\?`))+ await expect(guest.page).toHaveURL(new RegExp(`/rooms/${ROOM_ID}\\?`))expect(collaborationErrors(guest)).toEqual([])} finally {await closeAll([guest, host], relay)@@ -88,7 +88,7 @@ test('joining from a document opens a new tab and leaves that document alone', aguest = await createPeer(browser, 'Guest', relay.url)const ownNode = await addRectangle(guest.page, 'My own work')await guest.page.getByTestId('collab-share-button').click()- await guest.page.getByTestId('collab-join-input').fill(`https://example.test/share/${ROOM_ID}/`)+ await guest.page.getByTestId('collab-join-input').fill(`https://example.test/rooms/${ROOM_ID}/`)await guest.page.getByTestId('collab-join-room-button').click()await expect.poll(() => layerName((guest as Peer).page, hostNode)).toBe('Room card')@@ -98,7 +98,7 @@ test('joining from a document opens a new tab and leaves that document alone', aawait guest.page.getByTestId('tabbar-tab').first().click()await expect.poll(() => layerName((guest as Peer).page, ownNode)).toBe('My own work')expect(await roomStatus(guest)).toBeNull()- await expect(guest.page).not.toHaveURL(/\/share\//)+ await expect(guest.page).not.toHaveURL(/\/rooms\//)await expect.poll(() => host?.page.evaluate(() => window.openPencil?.test?.collab?.peerCount())).toBe(1)@@ -114,7 +114,7 @@ test('a pasted link that is not a room says so and joins nothing', async ({ browtry {guest = await createPeer(browser, 'Guest', relay.url)await guest.page.getByTestId('collab-share-button').click()- await guest.page.getByTestId('collab-join-input').fill('https://example.test/share/nope')+ await guest.page.getByTestId('collab-join-input').fill('https://example.test/rooms/nope')await guest.page.getByTestId('collab-join-room-button').click()await expect(guest.page.getByTestId('collab-join-error')).toBeVisible()await expect(guest.page.getByTestId('tabbar-tab')).toHaveCount(1)@@ -134,7 +134,7 @@ test('reloading a room tab rejoins it, and leaving keeps an unsaved copy', asyncconst nodeId = await addRectangle(host.page, 'Kept card')await share(host)- guest = await createPeer(browser, 'Guest', relay.url, { path: shareLinkPath() })+ guest = await createPeer(browser, 'Guest', relay.url, { path: roomLinkPath() })await expect.poll(() => layerName((guest as Peer).page, nodeId)).toBe('Kept card')await guest.page.reload()@@ -149,7 +149,7 @@ test('reloading a room tab rejoins it, and leaving keeps an unsaved copy', asyncexpect(await guest.page.evaluate(() => window.openPencil?.getStore?.().hasUnsavedChanges())).toBe(true)- await expect(guest.page).not.toHaveURL(/\/share\//)+ await expect(guest.page).not.toHaveURL(/\/rooms\//)await expect.poll(() => host?.page.evaluate(() => window.openPencil?.test?.collab?.peerCount())).toBe(0)@@ -175,7 +175,7 @@ test('two room tabs stay live at once, each syncing with its own room', async ({const inRoomA = await addRectangle(guest.page, 'For A')await connect(guest, SECOND_ROOM_ID)await expect.poll(() => roomStatus(guest as Peer)).toBe('live')- await expect(guest.page).toHaveURL(new RegExp(`/share/${SECOND_ROOM_ID}\\?`))+ await expect(guest.page).toHaveURL(new RegExp(`/rooms/${SECOND_ROOM_ID}\\?`))await expect.poll(() => layerName((hostA as Peer).page, inRoomA)).toBe('For A')expect(await layerName(hostB.page, inRoomA)).toBeUndefined()@@ -200,7 +200,7 @@ test("a guest's page list shows which page the sharer is on, and who is there onhost = await createPeer(browser, 'Host', relay.url)await addRectangle(host.page, 'Card')await share(host)- guest = await createPeer(browser, 'Guest', relay.url, { path: shareLinkPath() })+ guest = await createPeer(browser, 'Guest', relay.url, { path: roomLinkPath() })await expect(guest.page.getByTestId('room-screen')).toHaveCount(0, { timeout: 15_000 })// A real pointer over the canvas, as people move it, not the test hook.diff --git a/tests/e2e/native/cloud-links.spec.ts b/tests/e2e/native/cloud-links.spec.tsindex 30ddcbed5..4a1667a1f 100644--- a/tests/e2e/native/cloud-links.spec.ts+++ b/tests/e2e/native/cloud-links.spec.ts@@ -2,7 +2,7 @@ import { strict as assert } from 'node:assert'import { invokeNative } from '#tests/helpers/tauri/invoke'-const SIGN_IN_URL = 'https://cloud.example.test/cloud/device?user_code=ABCD-EFGH'+const SIGN_IN_URL = 'https://cloud.example.test/auth/device?user_code=ABCD-EFGH'const INVITATION = '0b6f4f9e-3c1a-4d7e-9a52-6f1c2d3e4f50'// Shaped like a share secret, 64 hex characters, and obviously not one.const SECRET = 'ab'.repeat(32)@@ -10,7 +10,7 @@ const SECRET = 'ab'.repeat(32)const SERVER = 'http://127.0.0.1:9'function invitationLink(secret: string): string {- return `openpencil://cloud/invitations/${INVITATION}?server=${encodeURIComponent(SERVER)}#${secret}`+ return `openpencil://cloud?url=${encodeURIComponent(`${SERVER}/invitations/${INVITATION}`)}#${secret}`}describe('native Cloud links', () => {diff --git a/tests/helpers/cloud/discovery.ts b/tests/helpers/cloud/discovery.tsindex 759e8457c..9dec22b5f 100644--- a/tests/helpers/cloud/discovery.ts+++ b/tests/helpers/cloud/discovery.ts@@ -1,16 +1,12 @@import { CLOUD_PROTOCOL_VERSION, type CloudDiscovery } from '@open-pencil/cloud/contract'-/** A Cloud server's discovery at `origin`, with email sign-in and an editor at `appURL`. */-export function cloudDiscoveryFixture(- origin = 'https://cloud.example.com',- appURL = 'https://app.example.com'-): CloudDiscovery {+/** A Cloud server's discovery at `origin`, with email sign-in. */+export function cloudDiscoveryFixture(origin = 'https://cloud.example.com'): CloudDiscovery {return {protocolVersion: CLOUD_PROTOCOL_VERSION,deployment: 'self-hosted',apiURL: `${origin}/api`,authURL: `${origin}/api/auth`,- appURL,localEditor: true,authentication: {socialProviders: ['google'],diff --git a/tests/helpers/collab/room.ts b/tests/helpers/collab/room.tsindex df5cf64b8..ccb049d12 100644--- a/tests/helpers/collab/room.ts+++ b/tests/helpers/collab/room.ts@@ -108,8 +108,8 @@ export function relayURLFor(path: string, relayURL: string): string {return `${path}?test&collabTransport=test&collabRelay=${encodeURIComponent(relayURL)}`}-export function shareLinkPath(roomId = ROOM_ID): string {- return `/share/${roomId}`+export function roomLinkPath(roomId = ROOM_ID): string {+ return `/rooms/${roomId}`}/**diff --git a/tests/integration/cloud/service-worker.test.ts b/tests/integration/cloud/service-worker.test.tsindex 1275a6311..25abf75f6 100644--- a/tests/integration/cloud/service-worker.test.ts+++ b/tests/integration/cloud/service-worker.test.ts@@ -16,7 +16,14 @@ describe('editor service worker on a Cloud server', () => {})test('serves the editor’s own pages offline', () => {- for (const path of ['/', '/demo', '/share/abc', '/cloud/documents/abc', '/cloud/share/abc']) {+ for (const path of [+ '/',+ '/demo',+ '/rooms/abc',+ '/documents/abc',+ '/share/abc',+ '/invitations/abc'+ ]) {expect(servedByEditor(path)).toBe(true)}})diff --git a/tools/dev/cloud/src/config.ts b/tools/dev/cloud/src/config.tsindex 9563cf64a..699435851 100644--- a/tools/dev/cloud/src/config.ts+++ b/tools/dev/cloud/src/config.ts@@ -16,7 +16,6 @@ export function localCloudDeployment(endpoints: LocalCloudEndpoints): CloudDeplodeployment: {mode: 'self-hosted',public_url: endpoints.cloudURL,- app_url: endpoints.editorURL,indexing: 'deny',trusted_origins: [endpoints.editorURL, endpoints.cloudURL]},diff --git a/tools/dev/cloud/tests/config.test.ts b/tools/dev/cloud/tests/config.test.tsindex ca0326700..b382b7942 100644--- a/tools/dev/cloud/tests/config.test.ts+++ b/tools/dev/cloud/tests/config.test.ts@@ -26,7 +26,6 @@ describe('local Cloud development configuration', () => {expect(config).toMatchObject({deployment: 'self-hosted',publicURL: 'https://feature.cloud.open-pencil.localhost',- appURL: 'https://feature.open-pencil.localhost',trustedOrigins: ['https://feature.open-pencil.localhost','https://feature.cloud.open-pencil.localhost'diff --git a/vite/pwa.ts b/vite/pwa.tsindex 1a78668bb..5fbdbf100 100644--- a/vite/pwa.ts+++ b/vite/pwa.ts@@ -9,7 +9,7 @@ export const NOT_EDITOR_PAGES = [/^\/oauth\//,/^\/api\//,/^\/\.well-known\//,- /^\/(?:welcome|auth|cloud\/device|account|admin)(?:\/|$)/+ /^\/(?:welcome|auth|account|admin)(?:\/|$)/]export function openPencilPwaPlugin() {