Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .changeset/29314-mobile-app-connect-qr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
'@object-ui/app-shell': patch
'@object-ui/i18n': patch
'@object-ui/auth': patch
'@objectstack/platform-objects': minor
'@objectstack/spec': minor
'@objectstack/plugin-auth': minor
---

feat(console): a Mobile App page in the account app shows the code that connects the ObjectOS mobile app to this server

Clause-②: yes (widening) — a new account-app navigation entry and component (`account:mobile_app`), a new `mobileApp` namespace in the `@object-ui/i18n` packs, and a new optional `features.publicBaseUrl` served on `GET /api/v1/auth/config` (declared in `AuthFeaturesConfigSchema`, registered in `PUBLIC_AUTH_CONFIG_NON_FLAG_KEYS`, typed on `AuthPublicConfig`); nothing that worked before is refused
Metadata-protocol: added

The account app (avatar menu → Profile) gains a **Mobile App** entry after Profile. Its page shows a QR code that encodes `objectos://connect?server=<this server's public base URL, URL-encoded>`, the same link as copyable text, and one line saying the code holds only the server's address, never the account.

`GET /api/v1/auth/config` now serves `features.publicBaseUrl`: the base URL the auth layer builds every link from (`OS_AUTH_URL`, then `BETTER_AUTH_URL`, then `OS_BASE_URL`), with any sub-path mount, as an address only (scheme, host and path; a credential, query or fragment in the setting is never served). The page encodes that URL. The page normalises it the same way again before use, so the code carries the server's address and nothing else. The browser's own address is never used, because it can be an internal or proxied host. When that URL names `localhost` or a private address, or a public host on plain `http:` (the mobile app signs in through it, so it must be HTTPS), the page shows no code and says how to fix it: set `OS_AUTH_URL` on the server to its public `https://` address and restart it. A server that does not publish the field gets a page saying it does not offer this yet.

No app-store links are shown: no setting carries them today.
2 changes: 2 additions & 0 deletions content/docs/references/api/auth-endpoints.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const result = AuthEndpointSchema.parse(data);
| **admin** | `boolean` | optional | Admin plugin wired (forced on whenever SCIM is enabled), so creating and impersonating users is available; the console shows those actions only when it is true. Banning, unbanning, unlocking and setting a password answer without it, and whether the console offers those actions does not depend on it. Absent means not wired |
| **termsUrl** | `string` | optional | Terms-of-service link shown beneath the login and register cards: the trimmed OS_TERMS_URL value when set, otherwise the public ObjectStack terms page; absent when the operator set OS_TERMS_URL to an empty or blank (whitespace-only) value to suppress the link |
| **privacyUrl** | `string` | optional | Privacy-policy link shown beneath the login and register cards: the trimmed OS_PRIVACY_URL value when set, otherwise the public ObjectStack privacy page; absent when the operator set OS_PRIVACY_URL to an empty or blank (whitespace-only) value to suppress the link |
| **publicBaseUrl** | `string` | optional | This deployment's public base URL, the one the auth layer builds every link it hands out on: the configured baseUrl (OS_AUTH_URL, then BETTER_AUTH_URL, then OS_BASE_URL) with any sub-path it carries, https:// prepended to a bare host, and the loopback fallback when none is set. Served as an address only: scheme, host and path, with no trailing slash, credentials, query or fragment. The console encodes it in the mobile-app connect code, and refuses to when it names a loopback or private address or a public host on plain http. Absent when the configured value is not an absolute URL |

### Nested Shape: `AuthFeaturesConfig.organizationEditions[number]`

Expand Down Expand Up @@ -230,6 +231,7 @@ This schema accepts one of the following structures:
| **admin** | `boolean` | optional | Admin plugin wired (forced on whenever SCIM is enabled), so creating and impersonating users is available; the console shows those actions only when it is true. Banning, unbanning, unlocking and setting a password answer without it, and whether the console offers those actions does not depend on it. Absent means not wired |
| **termsUrl** | `string` | optional | Terms-of-service link shown beneath the login and register cards: the trimmed OS_TERMS_URL value when set, otherwise the public ObjectStack terms page; absent when the operator set OS_TERMS_URL to an empty or blank (whitespace-only) value to suppress the link |
| **privacyUrl** | `string` | optional | Privacy-policy link shown beneath the login and register cards: the trimmed OS_PRIVACY_URL value when set, otherwise the public ObjectStack privacy page; absent when the operator set OS_PRIVACY_URL to an empty or blank (whitespace-only) value to suppress the link |
| **publicBaseUrl** | `string` | optional | This deployment's public base URL, the one the auth layer builds every link it hands out on: the configured baseUrl (OS_AUTH_URL, then BETTER_AUTH_URL, then OS_BASE_URL) with any sub-path it carries, https:// prepended to a bare host, and the loopback fallback when none is set. Served as an address only: scheme, host and path, with no trailing slash, credentials, query or fragment. The console encodes it in the mobile-app connect code, and refuses to when it names a loopback or private address or a public host on plain http. Absent when the configured value is not an absolute URL |


---
Expand Down
7 changes: 4 additions & 3 deletions packages/cli/test/connect-agent-both-halves-wire.pin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,10 @@ describe('#17647 — Connect-an-Agent visibility: BOTH halves, over the wire', (
.toEqual(['nav_connect_agent']);
expect(groupChildren(account.body?.item, 'grp_account_developer'))
.toEqual(['nav_account_api_keys', 'nav_account_oauth_apps']);
// The whole served tree, counted: 12 authored ids (the AI Assistant
// slot among them) + the one contributed.
expect(navIds(account.body?.item)).toHaveLength(13);
// The whole served tree, counted: 13 authored ids (the AI Assistant
// slot among them) + the one contributed. (12 authored until the
// Mobile App entry, `nav_account_mobile_app`, joined after Profile.)
expect(navIds(account.body?.item)).toHaveLength(14);
// …and the entry's TARGET rode along, so the menu item resolves.
expect(JSON.stringify(account.body)).toContain('connect_agent');

Expand Down
34 changes: 34 additions & 0 deletions packages/platform-objects/src/apps/account-mobile-app-nav.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
//
// The account app's Mobile App entry sits right after Profile and targets the
// component the Console registers as `account:mobile_app` (the app-shell half
// of this pairing is pinned in `MobileAppPage.test.tsx`, which resolves the
// same ref through the component registry). A bare nav-count pin elsewhere
// shows that one id joined; this one shows which, where, and what it opens.
import { describe, it, expect } from 'vitest';
import { AppSchema } from '@objectstack/spec/ui';

import { ACCOUNT_APP } from './account.app.js';

type NavItem = { id?: string; type?: string; componentRef?: string; requiredPermissions?: unknown };

const topLevel = (): NavItem[] => (ACCOUNT_APP.navigation ?? []) as NavItem[];

describe("the account app's Mobile App entry", () => {
it('sits immediately after Profile', () => {
const ids = topLevel().map((item) => item.id);
const profile = ids.indexOf('nav_account_profile');
expect(profile, 'the account app lost its Profile entry').toBeGreaterThanOrEqual(0);
expect(ids[profile + 1]).toBe('nav_account_mobile_app');
});

it('opens the `account:mobile_app` component, ungated', () => {
const entry = topLevel().find((item) => item.id === 'nav_account_mobile_app');
expect(entry).toMatchObject({ type: 'component', componentRef: 'account:mobile_app' });
expect(entry?.requiredPermissions).toBeUndefined();
});

it('CONTROL: the app with the entry still parses as an App', () => {
expect(AppSchema.safeParse(ACCOUNT_APP).success).toBe(true);
});
});
11 changes: 11 additions & 0 deletions packages/platform-objects/src/apps/account.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ export const ACCOUNT_APP: App = {
componentRef: 'account:profile_card',
icon: 'user-circle',
},
// The QR code and link that connect the ObjectOS mobile app to this
// server, registered by the Console as `account:mobile_app`. Built from
// the server's published public base URL; every signed-in user may
// connect their own phone, so the entry carries no gate.
{
id: 'nav_account_mobile_app',
type: 'component',
label: 'Mobile App',
componentRef: 'account:mobile_app',
icon: 'smartphone',
},

// --- Inbox & work assigned to me -----------------------------------
// Notifications, approvals waiting on me, and the orgs I belong to.
Expand Down
1 change: 1 addition & 0 deletions packages/platform-objects/src/apps/translations/ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const ar: TranslationData = {
grp_account_developer: { label: 'المطوّر' },
grp_account_ai_assistant: { label: 'مساعد الذكاء الاصطناعي' },
nav_account_profile: { label: 'الملف الشخصي' },
nav_account_mobile_app: { label: 'تطبيق الجوال' },
nav_account_notifications: { label: 'الإشعارات' },
nav_account_approvals: { label: 'بانتظار موافقتي' },
nav_account_memberships: { label: 'مؤسساتي' },
Expand Down
1 change: 1 addition & 0 deletions packages/platform-objects/src/apps/translations/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const de: TranslationData = {
grp_account_developer: { label: 'Entwickler' },
grp_account_ai_assistant: { label: 'KI-Assistent' },
nav_account_profile: { label: 'Profil' },
nav_account_mobile_app: { label: 'Mobile-App' },
nav_account_notifications: { label: 'Benachrichtigungen' },
nav_account_approvals: { label: 'Meine ausstehenden Genehmigungen' },
nav_account_memberships: { label: 'Meine Organisationen' },
Expand Down
1 change: 1 addition & 0 deletions packages/platform-objects/src/apps/translations/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const en: TranslationData = {
grp_account_developer: { label: 'Developer' },
grp_account_ai_assistant: { label: 'AI Assistant' },
nav_account_profile: { label: 'Profile' },
nav_account_mobile_app: { label: 'Mobile App' },
nav_account_notifications: { label: 'Notifications' },
nav_account_approvals: { label: 'Approvals' },
nav_account_memberships: { label: 'My Organizations' },
Expand Down
1 change: 1 addition & 0 deletions packages/platform-objects/src/apps/translations/es-ES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const esES: TranslationData = {
grp_account_developer: { label: 'Desarrollador' },
grp_account_ai_assistant: { label: 'Asistente de IA' },
nav_account_profile: { label: 'Perfil' },
nav_account_mobile_app: { label: 'Aplicación móvil' },
nav_account_notifications: { label: 'Notificaciones' },
nav_account_approvals: { label: 'Aprobaciones pendientes' },
nav_account_memberships: { label: 'Mis organizaciones' },
Expand Down
1 change: 1 addition & 0 deletions packages/platform-objects/src/apps/translations/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const fr: TranslationData = {
grp_account_developer: { label: 'Développeur' },
grp_account_ai_assistant: { label: 'Assistant IA' },
nav_account_profile: { label: 'Profil' },
nav_account_mobile_app: { label: 'Application mobile' },
nav_account_notifications: { label: 'Notifications' },
nav_account_approvals: { label: 'Mes approbations en attente' },
nav_account_memberships: { label: 'Mes organisations' },
Expand Down
1 change: 1 addition & 0 deletions packages/platform-objects/src/apps/translations/ja-JP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const jaJP: TranslationData = {
grp_account_developer: { label: '開発者' },
grp_account_ai_assistant: { label: 'AI アシスタント' },
nav_account_profile: { label: 'プロフィール' },
nav_account_mobile_app: { label: 'モバイルアプリ' },
nav_account_notifications: { label: '通知' },
nav_account_approvals: { label: '承認待ち' },
nav_account_memberships: { label: '所属組織' },
Expand Down
1 change: 1 addition & 0 deletions packages/platform-objects/src/apps/translations/ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const ko: TranslationData = {
grp_account_developer: { label: '개발자' },
grp_account_ai_assistant: { label: 'AI 어시스턴트' },
nav_account_profile: { label: '프로필' },
nav_account_mobile_app: { label: '모바일 앱' },
nav_account_notifications: { label: '알림' },
nav_account_approvals: { label: '내 승인 대기' },
nav_account_memberships: { label: '내 조직' },
Expand Down
1 change: 1 addition & 0 deletions packages/platform-objects/src/apps/translations/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const ptBR: TranslationData = {
grp_account_developer: { label: 'Desenvolvedor' },
grp_account_ai_assistant: { label: 'Assistente de IA' },
nav_account_profile: { label: 'Perfil' },
nav_account_mobile_app: { label: 'Aplicativo móvel' },
nav_account_notifications: { label: 'Notificações' },
nav_account_approvals: { label: 'Minhas aprovações pendentes' },
nav_account_memberships: { label: 'Minhas organizações' },
Expand Down
1 change: 1 addition & 0 deletions packages/platform-objects/src/apps/translations/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const ru: TranslationData = {
grp_account_developer: { label: 'Разработчик' },
grp_account_ai_assistant: { label: 'ИИ-ассистент' },
nav_account_profile: { label: 'Профиль' },
nav_account_mobile_app: { label: 'Мобильное приложение' },
nav_account_notifications: { label: 'Уведомления' },
nav_account_approvals: { label: 'Ждут моего решения' },
nav_account_memberships: { label: 'Мои организации' },
Expand Down
1 change: 1 addition & 0 deletions packages/platform-objects/src/apps/translations/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const zhCN: TranslationData = {
grp_account_developer: { label: '开发者' },
grp_account_ai_assistant: { label: 'AI 助手' },
nav_account_profile: { label: '个人资料' },
nav_account_mobile_app: { label: '移动应用' },
nav_account_notifications: { label: '通知' },
nav_account_approvals: { label: '待我审批' },
nav_account_memberships: { label: '我的组织' },
Expand Down
1 change: 1 addition & 0 deletions packages/platform-objects/src/apps/translations/zh-Hant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const zhHant: TranslationData = {
grp_account_developer: { label: '開發者' },
grp_account_ai_assistant: { label: 'AI 助理' },
nav_account_profile: { label: '個人資料' },
nav_account_mobile_app: { label: '移動應用' },
nav_account_notifications: { label: '通知' },
nav_account_approvals: { label: '待我核准' },
nav_account_memberships: { label: '我的組織' },
Expand Down
3 changes: 3 additions & 0 deletions packages/plugins/plugin-auth/src/auth-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3241,6 +3241,9 @@ describe('AuthManager', () => {
developerEditionCreate: false,
privacyUrl: 'https://objectstack.ai/privacy',
termsUrl: 'https://objectstack.ai/terms',
// The configured base URL as an address, for the console's mobile-app
// connect code (which refuses this loopback one).
publicBaseUrl: 'http://localhost:3000',
});
});

Expand Down
7 changes: 7 additions & 0 deletions packages/plugins/plugin-auth/src/auth-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ import {
// with it.
import { buildPluginList, type PluginListHost } from './auth-manager-plugin-list.js';
import { resolveTurnstileKeys } from './turnstile-sign-up.js';
import { publicBaseUrlOf } from './public-base-url.js';
import { assertTrustedAppSchemes, registeredAppSchemesOf } from './one-time-token-handoff.js';
import type { MintScimConnectionCredentialInput, MintedScimConnectionCredential } from './scim-connection-service.js';
import type { OrganizationBoundaryJudge } from './scim-group-projection.js';
Expand Down Expand Up @@ -5868,6 +5869,7 @@ export class AuthManager {
};
const termsUrl = resolveLegalUrl(rawTermsUrl, DEFAULT_TERMS_URL);
const privacyUrl = resolveLegalUrl(rawPrivacyUrl, DEFAULT_PRIVACY_URL);
const publicBaseUrl = publicBaseUrlOf(this.getCanonicalOrigin());

const turnstileKeys = resolveTurnstileKeys();
const organizationEditions = this.resolveOrganizationEditions(request);
Expand Down Expand Up @@ -5958,6 +5960,11 @@ export class AuthManager {
...(directSignIn.enabled ? { localSignIn: directSignIn.localSignIn } : {}),
...(termsUrl ? { termsUrl } : {}),
...(privacyUrl ? { privacyUrl } : {}),
// The public base URL every emailed / OAuth link is built on
// (`getCanonicalOrigin`), reduced to its address, so the console's
// mobile-app connect code never reads `window.location` for it
// (registered in PUBLIC_AUTH_CONFIG_NON_FLAG_KEYS).
...(publicBaseUrl ? { publicBaseUrl } : {}),
// The PUBLIC Turnstile site key, served only when the sign-up challenge
// is wired (both keys set; the resolver `buildPluginList()` mounts the
// plugin from). The secret is never part of this payload.
Expand Down
Loading
Loading