@cxxi-lab/hubbyware-sdk 3.3.0 → 3.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cxxi-lab/hubbyware-sdk",
3
- "version": "3.3.0",
3
+ "version": "3.5.0",
4
4
  "description": "The contract of Hubbyware's hubbies: the SDK a hubby builds on (provided by the host app at run time), and the SDK of the hubbies running isolated in their frame. Formerly @cxxi-lab/hub-sdk.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // @cxxi-lab/hubbyware-sdk 3.3.0: generated by app/scripts/emit-sdk-types.mjs from app/src/sdk — do not edit.
1
+ // @cxxi-lab/hubbyware-sdk 3.5.0: generated by app/scripts/emit-sdk-types.mjs from app/src/sdk — do not edit.
2
2
  import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
3
3
  import { ComponentType, HTMLInputTypeAttribute, MouseEventHandler, ReactNode, TdHTMLAttributes, ThHTMLAttributes } from 'react';
4
4
 
@@ -46,6 +46,8 @@ export interface VpnInfo {
46
46
  port: number | null;
47
47
  error: string | null;
48
48
  endpoint: string | null;
49
+ /** the hubby the tunnel runs for (its config); older shells don't say */
50
+ hubby?: string | null;
49
51
  }
50
52
  export type UpdatePhase = "available" | "downloading" | "verifying" | "installing" | "error";
51
53
  export interface UpdateState {
@@ -355,6 +357,12 @@ export interface PlatformCapabilities {
355
357
  companion: boolean;
356
358
  /** integrated WireGuard tunnel controllable from the UI */
357
359
  vpn: boolean;
360
+ /**
361
+ * the tunnel carries only the webviews of the hubby using it (desktop: per session), the rest of
362
+ * the app going direct; false: it carries the whole app while it runs (Android: the WebView's
363
+ * proxy is the process's), so the hubby waits for it
364
+ */
365
+ vpnPerWebview?: boolean;
358
366
  /** hubbies hidden behind a reveal shortcut (Privacy) */
359
367
  privateMode: boolean;
360
368
  /** in-app self-update */
@@ -432,14 +440,30 @@ export interface Platform {
432
440
  setMuted(value: boolean): void;
433
441
  onMutedChange(cb: (value: boolean) => void): Unsubscribe;
434
442
  getVpnStatus(): Promise<VpnInfo>;
435
- startVpn(): Promise<void>;
443
+ /** Starts the tunnel for a hubby, with its config (none named: the first hubby going out through the VPN). */
444
+ startVpn(hubby?: string): Promise<void>;
436
445
  stopVpn(): Promise<void>;
437
446
  onVpnStatusChange(cb: (info: VpnInfo) => void): Unsubscribe;
438
- replaceVpnConfig(): Promise<{
447
+ /** Picks a WireGuard config file for a hubby (none named: the first going out through the VPN). */
448
+ replaceVpnConfig(hubby?: string): Promise<{
439
449
  ok: boolean;
440
450
  path: string | null;
441
451
  error?: string;
442
452
  }>;
453
+ /**
454
+ * A hubby's VPN config, kept by the shell (server docs/plan-reseau-vpn.md): only whether there is
455
+ * one and its endpoint; the config itself never comes back to the web side.
456
+ */
457
+ getVpnConfig(hubby: string): Promise<{
458
+ configured: boolean;
459
+ endpoint: string | null;
460
+ }>;
461
+ /** Saves a hubby's WireGuard config (pasted); its tunnel, running, restarts with it. */
462
+ setVpnConfig(hubby: string, text: string): Promise<{
463
+ ok: boolean;
464
+ error?: string;
465
+ }>;
466
+ removeVpnConfig(hubby: string): Promise<void>;
443
467
  /** Opens the Settings window, on a screen when given (e.g. 'security'). */
444
468
  openSettings(target?: string): Promise<void>;
445
469
  /** In the Settings window: a screen another window asked for. */
@@ -682,13 +706,6 @@ export declare function Amount({ hubby, children, className }: {
682
706
  children: ReactNode;
683
707
  className?: string;
684
708
  }): import("react").JSX.Element;
685
- /**
686
- * The server's base URL. Given the path called, the routes of the hubbies reached through the VPN
687
- * (their data, their capabilities, their media: as they declare, core/hubby/declarations.ts) go to
688
- * the name only reachable through it (prod): the desktop routes that name through the tunnel, the
689
- * phone routes everything through it in private mode. Development: one local server.
690
- */
691
- export declare function getApiBaseUrl(path?: string): string;
692
709
  export declare function fetchSettings<T = Record<string, unknown>>(scope: string): Promise<T>;
693
710
  export declare function updateSettings<T = Record<string, unknown>>(scope: string, values: Partial<T>): Promise<T>;
694
711
  /** Standard JSON envelopes returned by the hub API. */
@@ -1030,6 +1047,22 @@ export declare function api<T>(path: string, options?: RequestInit, retry?: bool
1030
1047
  * body and carry the token — and resolves once the server closes it.
1031
1048
  */
1032
1049
  export declare function apiStream(path: string, options: RequestInit, onEvent: StreamEventHandler, retry?: boolean): Promise<void>;
1050
+ /**
1051
+ * The server's base URL, for the URLs a hubby hands an <img>, a <video>, a player (signed media).
1052
+ * The same for every path (`path`: kept for the hubbies passing it).
1053
+ */
1054
+ export declare function getApiBaseUrl(_path?: string): string;
1055
+ /**
1056
+ * The partition of the hubby's <webview>s (desktop): its own session, its sites' cookies and storage
1057
+ * apart from the other hubbies', going out through the VPN when it declares so (server
1058
+ * docs/plan-reseau-vpn.md). `<webview partition={webviewPartition} …>`.
1059
+ */
1060
+ export declare const webviewPartition: string;
1061
+ /**
1062
+ * For a hubby going out through the VPN: whether its tunnel is up, so its webviews and players can
1063
+ * load (until then the shell blocks them: render them once this is true).
1064
+ */
1065
+ export declare function useTunnelReady(): boolean;
1033
1066
  /** Applies the website integration (cookies, CDN referer) of a URL's site before a webview or the native player loads it. */
1034
1067
  export declare function ensureIntegrationForUrl(rawUrl: string): Promise<void>;
1035
1068
  /**
package/version.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "3.3.0",
2
+ "version": "3.5.0",
3
3
  "compatible": []
4
4
  }