@cxxi-lab/hubbyware-sdk 3.3.0 → 3.4.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.4.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.4.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 {
@@ -432,14 +434,30 @@ export interface Platform {
432
434
  setMuted(value: boolean): void;
433
435
  onMutedChange(cb: (value: boolean) => void): Unsubscribe;
434
436
  getVpnStatus(): Promise<VpnInfo>;
435
- startVpn(): Promise<void>;
437
+ /** Starts the tunnel for a hubby, with its config (none named: the first hubby going out through the VPN). */
438
+ startVpn(hubby?: string): Promise<void>;
436
439
  stopVpn(): Promise<void>;
437
440
  onVpnStatusChange(cb: (info: VpnInfo) => void): Unsubscribe;
438
- replaceVpnConfig(): Promise<{
441
+ /** Picks a WireGuard config file for a hubby (none named: the first going out through the VPN). */
442
+ replaceVpnConfig(hubby?: string): Promise<{
439
443
  ok: boolean;
440
444
  path: string | null;
441
445
  error?: string;
442
446
  }>;
447
+ /**
448
+ * A hubby's VPN config, kept by the shell (server docs/plan-reseau-vpn.md): only whether there is
449
+ * one and its endpoint; the config itself never comes back to the web side.
450
+ */
451
+ getVpnConfig(hubby: string): Promise<{
452
+ configured: boolean;
453
+ endpoint: string | null;
454
+ }>;
455
+ /** Saves a hubby's WireGuard config (pasted); its tunnel, running, restarts with it. */
456
+ setVpnConfig(hubby: string, text: string): Promise<{
457
+ ok: boolean;
458
+ error?: string;
459
+ }>;
460
+ removeVpnConfig(hubby: string): Promise<void>;
443
461
  /** Opens the Settings window, on a screen when given (e.g. 'security'). */
444
462
  openSettings(target?: string): Promise<void>;
445
463
  /** In the Settings window: a screen another window asked for. */
@@ -682,13 +700,6 @@ export declare function Amount({ hubby, children, className }: {
682
700
  children: ReactNode;
683
701
  className?: string;
684
702
  }): 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
703
  export declare function fetchSettings<T = Record<string, unknown>>(scope: string): Promise<T>;
693
704
  export declare function updateSettings<T = Record<string, unknown>>(scope: string, values: Partial<T>): Promise<T>;
694
705
  /** Standard JSON envelopes returned by the hub API. */
@@ -1030,6 +1041,11 @@ export declare function api<T>(path: string, options?: RequestInit, retry?: bool
1030
1041
  * body and carry the token — and resolves once the server closes it.
1031
1042
  */
1032
1043
  export declare function apiStream(path: string, options: RequestInit, onEvent: StreamEventHandler, retry?: boolean): Promise<void>;
1044
+ /**
1045
+ * The server's base URL, for the URLs a hubby hands an <img>, a <video>, a player (signed media).
1046
+ * The same for every path (`path`: kept for the hubbies passing it).
1047
+ */
1048
+ export declare function getApiBaseUrl(_path?: string): string;
1033
1049
  /** Applies the website integration (cookies, CDN referer) of a URL's site before a webview or the native player loads it. */
1034
1050
  export declare function ensureIntegrationForUrl(rawUrl: string): Promise<void>;
1035
1051
  /**
package/version.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "3.3.0",
2
+ "version": "3.4.0",
3
3
  "compatible": []
4
4
  }