@x-tech-laboratories/x-app 0.130.1 → 0.131.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -289,7 +289,7 @@ An app whose work needs a computer, such as one that runs programs on checkouts,
289
289
  through its main process (`app/server_fetch` does the rewriting).
290
290
  - **Sign-in from the config**: `admin_name` names the admin a bare hash in the accounts file signs in as, and
291
291
  `proxy_user_header` (with `trusted_proxies`, 127.0.0.1 and ::1 unless set) signs in whoever a reverse proxy on those
292
- addresses names; `define_app`'s `check_access` checks a user's access when an admin sets it, such as a list of grants.
292
+ addresses names; `define_app`'s `check_access` checks a user's access when an admin sets it, such as a list of grants, and its `account_prefs` names the preferences each user keeps on the server, as `server/account_prefs` serves them.
293
293
  - **Outside sites**: `outside: { hosts, headers }` names the sites the page reaches with `page().outside_fetch`, such
294
294
  as a video site's API, which a browser's cross-origin rules would block: the desktop sends each request from its main
295
295
  process with the answer streamed back, the server for a signed-in browser at `POST /api/outside`, and a phone with
@@ -8,6 +8,7 @@ import { type Bridge } from "../electron/bridge.ts";
8
8
  import type { FetchMethod, StreamCancelMethod, StreamChunk, StreamStartMethod } from "../electron/fetch.ts";
9
9
  import { type EventsBridge } from "../electron/events.ts";
10
10
  import type { History } from "../history.ts";
11
+ import type { AccountPrefsOptions } from "../server/account_prefs.ts";
11
12
  import type { ScopeSpec } from "../server/declared_tokens.ts";
12
13
  import { type LocalMcpMethods } from "../local_mcp_protocol.ts";
13
14
  import { type SettingSpec, type SettingsMethods, type SettingsStore, type SettingsStoreOptions } from "../settings.ts";
@@ -100,6 +101,7 @@ export interface AppOptions<Features extends readonly Feature[]> {
100
101
  phone?: "device" | "portal";
101
102
  roles?: readonly string[];
102
103
  check_access?: (value: unknown) => unknown;
104
+ account_prefs?: AccountPrefsOptions;
103
105
  sync?: boolean;
104
106
  declared_tokens?: {
105
107
  key: string;
@@ -192,6 +194,7 @@ export declare function define_app<const Features extends readonly Feature[]>(op
192
194
  phone?: "device" | "portal";
193
195
  roles?: readonly string[];
194
196
  check_access?: (value: unknown) => unknown;
197
+ account_prefs?: AccountPrefsOptions;
195
198
  sync?: boolean;
196
199
  declared_tokens?: {
197
200
  key: string;
@@ -264,6 +264,7 @@ export async function build_server(app, options) {
264
264
  // A token is refused the calls only the user at the page may make; a read-only one may make the calls that only read.
265
265
  call_of: calls_under("/api/call"),
266
266
  is_read_only: app.is_read_only,
267
+ prefs: app.account_prefs ?? null,
267
268
  page_only: app.page_only,
268
269
  });
269
270
  const { changes, database } = options;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-tech-laboratories/x-app",
3
- "version": "0.130.1",
3
+ "version": "0.131.0",
4
4
  "description": "Code the X-apps share: agents and their long runs, passwords and sign-in, the Fastify server pieces, durations, and the web page's helpers and widgets",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {