@fkn/lib 0.9.56 → 0.9.58
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/{account-generation-D3jlXBbM.js → account-generation-2ZvMy2tZ.js} +1 -1
- package/{account-generation-DkrSMafa.cjs → account-generation-DIsOqkSQ.cjs} +1 -1
- package/{account-storage-C1VL6fpb.cjs → account-storage-CPTct4Vz.cjs} +1 -1
- package/{account-storage-BBL440_m.js → account-storage-Cmzz-67T.js} +2 -2
- package/account.cjs +1 -1
- package/account.d.ts +1 -1
- package/account.js +2 -2
- package/{api-BSpQkgnM.d.ts → api-BD_XUANc.d.ts} +28 -1
- package/{api-DEfkbHGB.js → api-C-N5AVos.js} +77 -74
- package/api-ibGqkmtA.cjs +3 -0
- package/api.cjs +1 -1
- package/api.d.ts +2 -2
- package/api.js +1 -1
- package/cloud/dns.d.ts +1 -1
- package/cloud/fetch.cjs +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/fetch.js +1 -1
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.js +1 -1
- package/cloud/net.d.ts +1 -1
- package/{cloud-DTpFBbBH.js → cloud-B6B2XcRU.js} +205 -184
- package/{cloud-BslRIoKs.d.ts → cloud-BEoUa04G.d.ts} +3 -3
- package/cloud-C0hcBrFd.cjs +1 -0
- package/cloud.cjs +1 -1
- package/cloud.d.ts +3 -3
- package/cloud.js +2 -2
- package/{contract-DFycgFJK.d.ts → contract-B8Rqx5BD.d.ts} +47 -4
- package/contract.cjs +1 -1
- package/contract.d.ts +3 -3
- package/contract.js +2 -2
- package/dgram.cjs +1 -1
- package/dgram.d.ts +10 -5
- package/dgram.js +64 -60
- package/dns.cjs +1 -1
- package/dns.d.ts +1 -1
- package/dns.js +1 -1
- package/extension-AidgSVhb.js +101 -0
- package/{extension-kE9yzbkW.d.ts → extension-C_eOfEjv.d.ts} +3 -2
- package/extension-M8bUhlML.cjs +1 -0
- package/extension.cjs +1 -1
- package/extension.d.ts +3 -3
- package/extension.js +1 -1
- package/fs/promises.cjs +1 -1
- package/fs/promises.js +1 -1
- package/{fs-C7ByWYF9.cjs → fs-BlRxCJQW.cjs} +1 -1
- package/{fs-gryDP9qw.js → fs-C_RmxWk9.js} +2 -2
- package/fs.cjs +1 -1
- package/fs.js +2 -2
- package/http.cjs +1 -1
- package/http.d.ts +4 -1
- package/http.js +2 -1
- package/{index-BQ5OZQhf.d.ts → index-C5DdoMGo.d.ts} +38 -1
- package/index.cjs +1 -1
- package/index.d.ts +7 -5
- package/index.js +53 -51
- package/{net-eEjhJ0AE.d.ts → net-CvJwokcz.d.ts} +14 -7
- package/net.cjs +1 -1
- package/net.d.ts +1 -1
- package/net.js +52 -46
- package/package.json +1 -1
- package/packages.cjs +1 -1
- package/packages.d.ts +1 -1
- package/packages.js +1 -1
- package/proxy-C1RlnrDC.js +61 -0
- package/proxy-CII2NFYV.cjs +1 -0
- package/{proxy-8hIHeEHD.d.ts → proxy-z0Y8IgW7.d.ts} +2 -2
- package/relay-choice-BGwXRC5d.js +14 -0
- package/relay-choice-BmXlqfD2.d.ts +28 -0
- package/relay-choice-JC_JJY_M.cjs +1 -0
- package/rooms.cjs +1 -1
- package/rooms.d.ts +1 -1
- package/rooms.js +1 -1
- package/storage.cjs +1 -1
- package/storage.d.ts +1 -1
- package/storage.js +3 -3
- package/api-BmaUJUUp.cjs +0 -3
- package/cloud-C_EPPfe_.cjs +0 -1
- package/extension-C13d41tq.js +0 -95
- package/extension-DA_Fx3Lx.cjs +0 -1
- package/proxy-Blzm-Dc1.cjs +0 -1
- package/proxy-C2HY5Ybc.js +0 -60
package/http.cjs
CHANGED
|
@@ -6,4 +6,4 @@ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{val
|
|
|
6
6
|
\r
|
|
7
7
|
`,`latin1`)),this.finished=!0,t.length===0){e();return}this._writeToSocket(n.Buffer.concat(t),e)}end(e,t,n){if(e!=null&&typeof e!=`function`&&!this._bodyWritten&&!this.headersSent&&!this.chunkedEncoding&&!this.hasHeader(`content-length`)){let n=typeof t==`string`?t:void 0;this.setHeader(`Content-Length`,_(e,n).length)}return super.end(e,t,n)}_headBlock},b=class extends y{statusCode=200;statusMessage;_writeHeadCalled=!1;sendDate=!0;req;socket;_keepAlive=!0;constructor(e){super(),this.req=e,this.socket=e.socket}_shouldSendBody(){if(this.req.method===`HEAD`)return!1;let e=this.statusCode;return!(e>=100&&e<200||e===204||e===304)}writeHead(e,t,n){if(this._writeHeadCalled||this.headersSent)throw f(Error(`Cannot render headers after they are sent to the client`),`ERR_HTTP_HEADERS_SENT`);this._writeHeadCalled=!0,this.statusCode=e;let r=n;if(typeof t==`string`?this.statusMessage=t:t!=null&&(r=t),Array.isArray(r)){let e=Array.isArray(r[0])?r:Array.from({length:Math.floor(r.length/2)},(e,t)=>[r[t*2],r[t*2+1]]);for(let[t,n]of e)n!==void 0&&this._appendHeader(t,n)}else if(r)for(let[e,t]of Object.entries(r))t!==void 0&&this.setHeader(e,t);return this}_appendHeader(e,t){let n=this.getHeader(e);if(n===void 0)this.setHeader(e,t);else{let r=[...Array.isArray(n)?n:[n],...Array.isArray(t)?t:[t]].map(String);this.setHeader(e,r)}}_implicitHeader(){let e=this.statusMessage??s[this.statusCode]??`unknown`;this.sendDate&&!this.hasHeader(`date`)&&this.setHeader(`Date`,new Date().toUTCString()),this.hasHeader(`connection`)||this.setHeader(`Connection`,this._keepAlive?`keep-alive`:`close`),this._headBlock=this._storeHeader(`HTTP/1.1 ${this.statusCode} ${e}`)}writeContinue(){this._writeToSocket(n.Buffer.from(`HTTP/1.1 100 Continue\r
|
|
8
8
|
\r
|
|
9
|
-
`,`latin1`),()=>{})}setTimeout(e,t){return this.socket?.setTimeout(e,t),this}},x=(...e)=>{let t={},n={},r,i=[...e],a=i.shift();if(typeof a==`string`||a instanceof URL){let e=typeof a==`string`?new URL(a):a;t={protocol:e.protocol,hostname:e.hostname,host:e.hostname,port:e.port,path:`${e.pathname}${e.search}`,auth:e.username?`${e.username}:${e.password}`:void 0};let o=i.shift();typeof o==`function`?r=o:o&&typeof o==`object`&&(n=o,r=i.shift())}else a&&typeof a==`object`&&(n=a,r=i.shift());return{options:{...t,...n},callback:r}},S=class extends y{method;path;host;protocol;socket;get connection(){return this.socket}res=null;aborted=!1;_aborted=!1;constructor(e,r){super(),this.method=(e.method??`GET`).toUpperCase(),this.path=e.path??`/`,this.protocol=e.protocol??`http:`;let i=e.hostname??e.host??`localhost`;this.host=i;let a=Number(e.port??(this.protocol===`https:`?443:80));if(r&&this.once(`response`,r),e.headers)for(let[t,n]of Object.entries(e.headers))n!==void 0&&this.setHeader(t,n);if(!this.hasHeader(`host`)){let e=this.protocol===`https:`&&a===443||this.protocol!==`https:`&&a===80;this.setHeader(`Host`,e?i:`${i}:${a}`)}e.auth&&!this.hasHeader(`authorization`)&&this.setHeader(`Authorization`,`Basic ${n.Buffer.from(e.auth).toString(`base64`)}`),this.socket=new t.Socket,this.emit(`socket`,this.socket),this.socket.on(`error`,e=>{this._aborted||this.emit(`error`,e)}),this._attachResponseParser(),this.socket.connect({host:i,port:a},()=>{this.emit(`connect`)})}_shouldSendBody(){return this.method!==`GET`&&this.method!==`HEAD`&&this.method!==`DELETE`}_implicitHeader(){this._headBlock=this._storeHeader(`${this.method} ${this.path} HTTP/1.1`)}_attachResponseParser(){let e=new v(this.socket),t=new g(`response`,{onHeaders:n=>{e._applyHead(n),this.method===`HEAD`&&(t.skipBody=!0),this.res=e,this.emit(`response`,e)},onBody:t=>{e.push(n.Buffer.from(t))},onComplete:()=>{e.complete=!0,e.push(null)}});this.socket.on(`data`,e=>{this._aborted||t.execute(e)}),this.socket.on(`end`,()=>{t.finish()}),this.socket.on(`close`,()=>{this.emit(`close`)})}abort(){this._aborted||(this._aborted=!0,this.aborted=!0,this.emit(`abort`),this.socket.destroy())}destroy(e){return this._aborted?this:(this._aborted=!0,this.socket.destroy(e),super.destroy(e),this)}end(e,t,n){return this._aborted?this:super.end(e,t,n)}_writeToSocket(e,t){if(this._aborted){t();return}super._writeToSocket(e,t)}setTimeout(e,t){return this.socket.setTimeout(e,t),this}setNoDelay(e){this.socket.setNoDelay(e)}setSocketKeepAlive(e,t){this.socket.setKeepAlive(e,t)}},C=class extends t.Server{constructor(e,t){let n={},r=t;typeof e==`function`?r=e:e&&(n=e),super(n),r&&this.on(`request`,r),this.on(`connection`,e=>this._handleConnection(e))}_handleConnection(e){let t=null,r=new g(`request`,{onHeaders:n=>{t=new v(e),t._applyHead(n),n.method===`HEAD`&&(r.skipBody=!0);let i=new b(t),a=String(n.headers.connection??``).toLowerCase();i._keepAlive=n.httpVersionMinor>=1?a!==`close`:a===`keep-alive`,i.on(`finish`,()=>{i._keepAlive||e.end()}),this.emit(`request`,t,i)},onBody:e=>{t?.push(n.Buffer.from(e))},onComplete:()=>{t&&(t.complete=!0,t.push(null)),t=null}});e.on(`data`,e=>r.execute(e)),e.on(`end`,()=>{r.finish(),t&&t.push(null)}),e.on(`error`,t=>this.emit(`clientError`,t,e))}},w=new Proxy(C,{apply:(e,t,n)=>new e(...n)}),T=class{maxSockets;maxFreeSockets;keepAlive;options;constructor(e={}){this.options=e,this.keepAlive=!!e.keepAlive,this.maxSockets=e.maxSockets??1/0,this.maxFreeSockets=e.maxFreeSockets??256}getName(e={}){return`${e.host??`localhost`}:${e.port??``}:${e.localAddress??``}`}destroy(){}},E=new T,D=(...e)=>{let{options:t,callback:n}=x(...e);return new S(t,n)},O=(...e)=>{let t=D(...e);return t.end(),t},k=(e,t)=>new w(e,t),A={METHODS:o,STATUS_CODES:s,Agent:T,globalAgent:E,Server:w,ServerResponse:b,IncomingMessage:v,ClientRequest:S,OutgoingMessage:y,createServer:k,request:D,get:O};exports.Agent=T,exports.ClientRequest=S,exports.HTTPParser=g,exports.IncomingMessage=v,exports.METHODS=o,exports.STATUS_CODES=s,exports.Server=w,exports.ServerResponse=b,exports._default=A,exports.default=A,exports.createServer=k,exports.get=O,exports.globalAgent=E,exports.request=D,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
|
|
9
|
+
`,`latin1`),()=>{})}setTimeout(e,t){return this.socket?.setTimeout(e,t),this}},x=(...e)=>{let t={},n={},r,i=[...e],a=i.shift();if(typeof a==`string`||a instanceof URL){let e=typeof a==`string`?new URL(a):a;t={protocol:e.protocol,hostname:e.hostname,host:e.hostname,port:e.port,path:`${e.pathname}${e.search}`,auth:e.username?`${e.username}:${e.password}`:void 0};let o=i.shift();typeof o==`function`?r=o:o&&typeof o==`object`&&(n=o,r=i.shift())}else a&&typeof a==`object`&&(n=a,r=i.shift());return{options:{...t,...n},callback:r}},S=class extends y{method;path;host;protocol;socket;get connection(){return this.socket}res=null;aborted=!1;_aborted=!1;constructor(e,r){super(),this.method=(e.method??`GET`).toUpperCase(),this.path=e.path??`/`,this.protocol=e.protocol??`http:`;let i=e.hostname??e.host??`localhost`;this.host=i;let a=Number(e.port??(this.protocol===`https:`?443:80));if(r&&this.once(`response`,r),e.headers)for(let[t,n]of Object.entries(e.headers))n!==void 0&&this.setHeader(t,n);if(!this.hasHeader(`host`)){let e=this.protocol===`https:`&&a===443||this.protocol!==`https:`&&a===80;this.setHeader(`Host`,e?i:`${i}:${a}`)}e.auth&&!this.hasHeader(`authorization`)&&this.setHeader(`Authorization`,`Basic ${n.Buffer.from(e.auth).toString(`base64`)}`),this.socket=new t.Socket,this.emit(`socket`,this.socket),this.socket.on(`error`,e=>{this._aborted||this.emit(`error`,e)}),this._attachResponseParser(),this.socket.connect({host:i,port:a,relay:e.relay},()=>{this.emit(`connect`)})}_shouldSendBody(){return this.method!==`GET`&&this.method!==`HEAD`&&this.method!==`DELETE`}_implicitHeader(){this._headBlock=this._storeHeader(`${this.method} ${this.path} HTTP/1.1`)}_attachResponseParser(){let e=new v(this.socket),t=new g(`response`,{onHeaders:n=>{e._applyHead(n),this.method===`HEAD`&&(t.skipBody=!0),this.res=e,this.emit(`response`,e)},onBody:t=>{e.push(n.Buffer.from(t))},onComplete:()=>{e.complete=!0,e.push(null)}});this.socket.on(`data`,e=>{this._aborted||t.execute(e)}),this.socket.on(`end`,()=>{t.finish()}),this.socket.on(`close`,()=>{this.emit(`close`)})}abort(){this._aborted||(this._aborted=!0,this.aborted=!0,this.emit(`abort`),this.socket.destroy())}destroy(e){return this._aborted?this:(this._aborted=!0,this.socket.destroy(e),super.destroy(e),this)}end(e,t,n){return this._aborted?this:super.end(e,t,n)}_writeToSocket(e,t){if(this._aborted){t();return}super._writeToSocket(e,t)}setTimeout(e,t){return this.socket.setTimeout(e,t),this}setNoDelay(e){this.socket.setNoDelay(e)}setSocketKeepAlive(e,t){this.socket.setKeepAlive(e,t)}},C=class extends t.Server{constructor(e,t){let n={},r=t;typeof e==`function`?r=e:e&&(n=e),super(n),r&&this.on(`request`,r),this.on(`connection`,e=>this._handleConnection(e))}_handleConnection(e){let t=null,r=new g(`request`,{onHeaders:n=>{t=new v(e),t._applyHead(n),n.method===`HEAD`&&(r.skipBody=!0);let i=new b(t),a=String(n.headers.connection??``).toLowerCase();i._keepAlive=n.httpVersionMinor>=1?a!==`close`:a===`keep-alive`,i.on(`finish`,()=>{i._keepAlive||e.end()}),this.emit(`request`,t,i)},onBody:e=>{t?.push(n.Buffer.from(e))},onComplete:()=>{t&&(t.complete=!0,t.push(null)),t=null}});e.on(`data`,e=>r.execute(e)),e.on(`end`,()=>{r.finish(),t&&t.push(null)}),e.on(`error`,t=>this.emit(`clientError`,t,e))}},w=new Proxy(C,{apply:(e,t,n)=>new e(...n)}),T=class{maxSockets;maxFreeSockets;keepAlive;options;constructor(e={}){this.options=e,this.keepAlive=!!e.keepAlive,this.maxSockets=e.maxSockets??1/0,this.maxFreeSockets=e.maxFreeSockets??256}getName(e={}){return`${e.host??`localhost`}:${e.port??``}:${e.localAddress??``}`}destroy(){}},E=new T,D=(...e)=>{let{options:t,callback:n}=x(...e);return new S(t,n)},O=(...e)=>{let t=D(...e);return t.end(),t},k=(e,t)=>new w(e,t),A={METHODS:o,STATUS_CODES:s,Agent:T,globalAgent:E,Server:w,ServerResponse:b,IncomingMessage:v,ClientRequest:S,OutgoingMessage:y,createServer:k,request:D,get:O};exports.Agent=T,exports.ClientRequest=S,exports.HTTPParser=g,exports.IncomingMessage=v,exports.METHODS=o,exports.STATUS_CODES=s,exports.Server=w,exports.ServerResponse=b,exports._default=A,exports.default=A,exports.createServer=k,exports.get=O,exports.globalAgent=E,exports.request=D,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
|
package/http.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as RelayChoice } from "./index-C5DdoMGo.js";
|
|
2
|
+
import { n as Socket, t as Server$1 } from "./net-CvJwokcz.js";
|
|
2
3
|
import { Buffer } from "buffer";
|
|
3
4
|
import { Stream } from "stream";
|
|
4
5
|
import { IncomingHttpHeaders, OutgoingHttpHeaders, RequestOptions } from "http";
|
|
@@ -119,6 +120,8 @@ export interface ClientRequestArgs extends RequestOptions {
|
|
|
119
120
|
hostname?: string;
|
|
120
121
|
port?: number | string;
|
|
121
122
|
path?: string;
|
|
123
|
+
/** the relays the request's socket may go through (`RelayChoice`); Node ignores it */
|
|
124
|
+
relay?: RelayChoice;
|
|
122
125
|
}
|
|
123
126
|
export declare class ClientRequest extends OutgoingMessage {
|
|
124
127
|
method: string;
|
package/http.js
CHANGED
|
@@ -1572,6 +1572,37 @@ type AttachFrameOptions = {
|
|
|
1572
1572
|
* by the cloud render proxy only; call cloud.attachFrame`.
|
|
1573
1573
|
*/
|
|
1574
1574
|
blank?: BlankPage;
|
|
1575
|
+
/**
|
|
1576
|
+
* The relays the attachment may go through on the cloud render proxy (`RelayChoice`), resolved to
|
|
1577
|
+
* one at attach and kept for the attachment's life; `relayOf(frame)` names it. Without it the frame
|
|
1578
|
+
* follows the app's default relay. Ignored on the extension, as `cookies: 'native'` has no relay.
|
|
1579
|
+
*/
|
|
1580
|
+
relay?: RelayChoice;
|
|
1581
|
+
};
|
|
1582
|
+
/**
|
|
1583
|
+
* Which relays a call through the FKN cloud may go through: `fetch` and `cloud.fetch` take it in their
|
|
1584
|
+
* init, `net`, `dgram` and `http` in the options objects Node defines, `attachFrame` in its options.
|
|
1585
|
+
* Every field narrows the set and the user's relay preference orders what is left, so the preference
|
|
1586
|
+
* still applies whenever the choice allows it; a choice never changes it. Without `relay` a call goes
|
|
1587
|
+
* through the default relay: the user's pinned one, else the fastest.
|
|
1588
|
+
*
|
|
1589
|
+
* With `region` or `exclude`, a relay that cannot be reached is walked past to the next one left,
|
|
1590
|
+
* never to one outside the choice. `id` is that relay and no other, tried even when it failed moments
|
|
1591
|
+
* ago. A choice no relay can serve, and any choice on an FKN page too old to choose, is refused with
|
|
1592
|
+
* `RelayUnavailableError` before anything is sent.
|
|
1593
|
+
*
|
|
1594
|
+
* Ids are opaque: take them from `relayOf()`, never from source code. A `cloud.fetch` retried through
|
|
1595
|
+
* another relay can be answered from the cache the relays share, so a retry that must reach the site
|
|
1596
|
+
* again varies its request. Only the cloud backend reads this: the extension, the desktop and a
|
|
1597
|
+
* `'native'` frame reach the network from the user's own address, and `relayOf()` answers undefined.
|
|
1598
|
+
*/
|
|
1599
|
+
type RelayChoice = {
|
|
1600
|
+
/** this relay and no other: an id `relayOf()` answered earlier */
|
|
1601
|
+
id?: string;
|
|
1602
|
+
/** any relay of this directory region, such as `'eu'` or `'asia'` */
|
|
1603
|
+
region?: string;
|
|
1604
|
+
/** any relay but these, typically every one a call already went through */
|
|
1605
|
+
exclude?: readonly string[];
|
|
1575
1606
|
};
|
|
1576
1607
|
/** Where `attachFrame`'s `blank` option presents its empty page. */
|
|
1577
1608
|
type BlankPage = {
|
|
@@ -1622,6 +1653,12 @@ type AttachWindowOptions = {
|
|
|
1622
1653
|
* `reason` over `MAX_REASON_LENGTH` characters is a TypeError before the window opens.
|
|
1623
1654
|
*/
|
|
1624
1655
|
permissions?: CategoryRequest[];
|
|
1656
|
+
/**
|
|
1657
|
+
* The relays the attachment may go through on the cloud render proxy (`RelayChoice`), resolved to
|
|
1658
|
+
* one at attach and kept for the attachment's life; `relayOf(frame)` names it. Without it the frame
|
|
1659
|
+
* follows the app's default relay. Ignored on the extension, as `cookies: 'native'` has no relay.
|
|
1660
|
+
*/
|
|
1661
|
+
relay?: RelayChoice;
|
|
1625
1662
|
};
|
|
1626
1663
|
/**
|
|
1627
1664
|
* The Frame of an attachment that lives in its own window.
|
|
@@ -1768,4 +1805,4 @@ declare const ATTACH_FRAME_EVENT_KEY = "FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY
|
|
|
1768
1805
|
*/
|
|
1769
1806
|
declare const attachFrame: AttachFrameFunction;
|
|
1770
1807
|
//#endregion
|
|
1771
|
-
export {
|
|
1808
|
+
export { Gate as $, WindowFrame as A, CATEGORIES as B, FrameWindowRefusal as C, RelayChoice as D, Locator as E, CategoryRequest as F, RemoteVideoElement as G, PermissionCategory as H, LegacyPermissionRequest as I, createVideoElementHandle as J, VideoElementState as K, PermissionGrant as L, createFrame as M, gotoPermission as N, StorageState as O, CategoryGrant as P, Executor as Q, PermissionRequest as R, FrameWindowOptions as S, GotoOptions as T, handleRevivableModules as U, CategoryMeta as V, BoxedVideoElement as W, revive as X, isType as Y, type as Z, FrameEventMap as _, AttachCookies as a, FramePostMessageOptions as b, BlankPage as c, CookieMatchWire as d, GateTools as et, Frame as f, FrameEventListener as g, FrameDocumentEvent as h, AddScriptTagOptions as i, attachFramePermission as j, StorageStateCookie as k, ClearCookiesOptions as l, FrameBackendEvent as m, attachFrame as n, SelectorPart as nt, AttachFrameOptions as o, FrameBackend as p, box as q, AttachFrameFunction as r, AttachWindowOptions as s, ATTACH_FRAME_EVENT_KEY as t, OperationRequest as tt, ClearCookiesWire as u, FrameLocator as v, FrameWindowRefusedError as w, FrameWindowBlockedError as x, FrameMessageEvent as y, permissions as z };
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-BiQ6cOZ7.cjs"),n=require("./extension-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-BiQ6cOZ7.cjs"),n=require("./extension-M8bUhlML.cjs"),r=require("./api-ibGqkmtA.cjs"),i=require("./busy-BXbVH595.cjs"),a=require("./contract.cjs"),o=require("./relay-choice-JC_JJY_M.cjs"),s=require("./cloud-C0hcBrFd.cjs"),c=require("./dns.cjs"),l=require("./net.cjs"),u=require("./dgram.cjs"),d=require("./http.cjs"),f=require("./desktop.cjs"),p=require("./account.cjs"),m=require("./fs-BlRxCJQW.cjs"),h=require("./opfs.cjs"),g=require("./packages.cjs"),_=require("./rooms.cjs"),v=require("./storage.cjs"),y=require("./connect-button-BpXDs7tw.cjs");let b=require("osra");var x=1e4,S=150,C=()=>new Promise(e=>{if(t.rt())return e(!0);let n,r=setTimeout(()=>i(t.rt()),x),i=t=>{clearTimeout(n),clearTimeout(r),o.disconnect(),document.removeEventListener(`readystatechange`,s),e(t)},a=()=>{clearTimeout(n),n=setTimeout(()=>i(t.rt()),S)},o=new MutationObserver(()=>{t.rt()&&i(!0)}),s=()=>{document.readyState===`complete`&&!t.rt()&&a()};o.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,s),document.readyState===`complete`&&a()}),w=(async e=>{let{kind:n,cookies:r}=t.o(e);if(n===`window`){let n=e;return r===`native`?t.a(n):s.i(n)}let i=e;return r===`native`?T(i):s.i(i)}),T=async e=>(s.a(e),await C(),t.a(e)),E=`https://fkn.app`,D=async(e,t)=>{if(typeof window>`u`)throw Error(`FKN @fkn/lib: relayWorker must be called from the main thread`);let n=await r.f;if(!n)throw Error(`FKN @fkn/lib: relayWorker found no FKN transport in this realm`);r.d(),i.r(`relayed worker`,t?.unregisterSignal);let a=n.emit instanceof MessagePort?{}:{originA:t?.originA??E,originB:t?.originB??`*`};(0,b.relay)(n,e,{key:`fkn-api`,...a,unregisterSignal:t?.unregisterSignal})},O=async()=>typeof window>`u`?!1:(await r.o).connect.prompt(location.origin).catch(()=>!1),k=async()=>typeof window>`u`?null:(await r.o).relay.prompt().catch(()=>null),A=new Set,j=e=>(A.add(e),()=>{A.delete(e)}),M=()=>{if(A.size===0)return!1;for(let e of[...A])try{e()}catch{}return!0},N=(e,t)=>{if(typeof e?.onUpdateTaken==`function`)return Promise.resolve(e.onUpdateTaken(t))},P=e.t({applyUpdate:()=>q,busyReasons:()=>K,onUpdate:()=>V,onUpdateTaken:()=>H,updateReady:()=>F}),F=async()=>typeof window>`u`?!1:r.o.then(e=>e.shell?.updateReady()).then(e=>e===!0).catch(()=>!1),I=new Set,L=!1,R=()=>{L=!0;for(let e of[...I])try{e()}catch{}},z=0,B=()=>{let e=r.c();e&&I.size!==0&&z!==e.epoch&&(z=e.epoch,L=!1,Promise.resolve(e.remote.shell?.onUpdate(R)).catch(()=>{z===e.epoch&&(z=0)}))};typeof window<`u`&&r.u(B);var V=async e=>{if(typeof window>`u`)return()=>{};if(I.add(e),L)try{e()}catch{}return B(),()=>{I.delete(e)}},H=e=>typeof window>`u`?()=>{}:j(e),U=0,W=!1,G=()=>{if(!M()&&!W){W=!0;try{location.reload()}catch{}}};typeof window<`u`&&r.u(()=>{let e=r.c();if(!e||U===e.epoch)return;U=e.epoch;let t=N(e.remote.shell,G);if(!t){U=0;return}t.catch(()=>{U===e.epoch&&(U=0)})});var K=()=>i.n(),q=async()=>typeof window>`u`?!1:r.o.then(e=>e.shell?.applyUpdate()).then(e=>e===!0).catch(()=>!1);exports.ATTACH_FRAME_EVENT_KEY=t.i,exports.BACKGROUND_STOPPED=n.a,exports.CATEGORIES=t.w,exports.EXTENSION_ABI=t.st,exports.ExtensionOperationUnsupportedError=t.ct,exports.ExtensionOutdatedError=t.lt,exports.FORGEABLE_HEADERS=t.Q,exports.FrameWindowBlockedError=t.g,exports.FrameWindowRefusedError=t._,exports.LOCATOR_DENIED=t.A,exports.LOCATOR_ERROR=t.F,exports.LOCATOR_INVALID=t.L,exports.LOCATOR_UNSUPPORTED=t.D,exports.MAX_REASON_LENGTH=t.X,exports.PERMISSION_DENIED=t.t,exports.RELAY_UNAVAILABLE=a.RELAY_UNAVAILABLE,exports.REQUIRED_EXTENSION_ABI=t.ut,exports.TimeoutError=t.E,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return p.t}}),exports.assertAttachableFrameUrl=t.x,exports.assertFetchableUrl=t.U,exports.assertForgeableHeaders=t.$,exports.assertLockdownApplicable=t.S,exports.assertOneCookieIdentity=t.et,exports.attachFrame=w,exports.attachFramePermission=t.v,exports.box=t.pt,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return s.n}}),exports.connect=O,exports.connectButtonUrl=y.t,exports.cookies=t.V,exports.createFrame=t.y,exports.createVideoElementHandle=t.mt,Object.defineProperty(exports,"desktop",{enumerable:!0,get:function(){return f.t}}),Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return u.t}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return c.t}}),Object.defineProperty(exports,"extension",{enumerable:!0,get:function(){return n.t}}),exports.fetch=n.n,exports.fetchCredentialedPermission=t.G,exports.fetchLocalPermission=t.K,exports.fetchPermission=t.q,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return m.u}}),exports.gotoPermission=t.b,exports.handleRevivableModules=t.ft,exports.hasForgedCookie=t.tt,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return d.t}}),exports.isBackgroundStopped=n.o,exports.isBlockedFetchUrl=t.J,exports.isBlockedFrameUrl=t.C,exports.isExtensionExposed=t.rt,exports.isLocalNetworkUrl=t.Y,exports.isLocatorDenied=t.I,exports.isLocatorInvalid=t.M,exports.isLocatorUnsupported=t.O,exports.isPermissionDenied=t.n,exports.isRelayUnavailable=o.n,exports.isTerminalError=t.P,exports.isType=t.ht,exports.modifyRequestHeadersPermission=t.R,Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return l.t}}),Object.defineProperty(exports,"opfs",{enumerable:!0,get:function(){return h.t}}),Object.defineProperty(exports,"packages",{enumerable:!0,get:function(){return g.t}}),exports.permissions=t.r,exports.promptInstall=n.i,exports.promptRelay=k,exports.readCookiePermission=t.H,exports.readExtensionHandshake=t.it,exports.relayOf=o.r,exports.relayWorker=D,exports.removeRequestHeaderRule=t.z,exports.revive=t.gt,Object.defineProperty(exports,"rooms",{enumerable:!0,get:function(){return _.t}}),exports.setMissingExtensionHandler=t.at,exports.setRequestHeaderRule=t.B,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"storage",{enumerable:!0,get:function(){return v.t}}),exports.supportsOperation=t.dt,exports.type=t._t,exports.waitForExtensionExposure=t.ot;
|
package/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as isLocatorDenied, A as setRequestHeaderRule, B as fetchLocalPermission, C as assertAttachableFrameUrl, D as RequestHeaderRule, E as HeaderOperation, F as FetchInit, G as assertForgeableHeaders, H as isBlockedFetchUrl, I as ProxyFetchRequest, J as LOCATOR_DENIED, K as assertOneCookieIdentity, L as assertFetchableUrl, M as SiteCookie, N as cookies, O as modifyRequestHeadersPermission, P as readCookiePermission, Q as TimeoutError, S as MAX_REASON_LENGTH, T as isBlockedFrameUrl, U as isLocalNetworkUrl, V as fetchPermission, W as FORGEABLE_HEADERS, X as LOCATOR_INVALID, Y as LOCATOR_ERROR, Z as LOCATOR_UNSUPPORTED, _ as BackgroundStoppedError, b as PermissionDeniedError, c as setMissingExtensionHandler, d as ExtensionHandshake, et as isLocatorInvalid, f as ExtensionOperationUnsupportedError, g as BACKGROUND_STOPPED, h as supportsOperation, i as promptInstall, j as CookieDetails, k as removeRequestHeaderRule, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, n as fetch, nt as isTerminalError, o as isExtensionExposed, p as ExtensionOutdatedError, q as hasForgedCookie, s as readExtensionHandshake, t as extension_d_exports, tt as isLocatorUnsupported, u as EXTENSION_ABI, v as isBackgroundStopped, w as assertLockdownApplicable, x as isPermissionDenied, y as PERMISSION_DENIED, z as fetchCredentialedPermission } from "./extension-
|
|
1
|
+
import { $ as Gate, A as WindowFrame, B as CATEGORIES, C as FrameWindowRefusal, D as RelayChoice, E as Locator, F as CategoryRequest, G as RemoteVideoElement, H as PermissionCategory, I as LegacyPermissionRequest, J as createVideoElementHandle, K as VideoElementState, L as PermissionGrant, M as createFrame, N as gotoPermission, O as StorageState, P as CategoryGrant, Q as Executor, R as PermissionRequest, S as FrameWindowOptions, T as GotoOptions, U as handleRevivableModules, V as CategoryMeta, W as BoxedVideoElement, X as revive, Y as isType, Z as type, _ as FrameEventMap, a as AttachCookies, b as FramePostMessageOptions, c as BlankPage, d as CookieMatchWire, et as GateTools, f as Frame, g as FrameEventListener, h as FrameDocumentEvent, i as AddScriptTagOptions, j as attachFramePermission, k as StorageStateCookie, l as ClearCookiesOptions, m as FrameBackendEvent, nt as SelectorPart, o as AttachFrameOptions, p as FrameBackend, q as box, r as AttachFrameFunction, s as AttachWindowOptions, t as ATTACH_FRAME_EVENT_KEY, tt as OperationRequest, u as ClearCookiesWire, v as FrameLocator, w as FrameWindowRefusedError, x as FrameWindowBlockedError, y as FrameMessageEvent, z as permissions } from "./index-C5DdoMGo.js";
|
|
2
|
+
import { $ as isLocatorDenied, A as setRequestHeaderRule, B as fetchLocalPermission, C as assertAttachableFrameUrl, D as RequestHeaderRule, E as HeaderOperation, F as FetchInit, G as assertForgeableHeaders, H as isBlockedFetchUrl, I as ProxyFetchRequest, J as LOCATOR_DENIED, K as assertOneCookieIdentity, L as assertFetchableUrl, M as SiteCookie, N as cookies, O as modifyRequestHeadersPermission, P as readCookiePermission, Q as TimeoutError, S as MAX_REASON_LENGTH, T as isBlockedFrameUrl, U as isLocalNetworkUrl, V as fetchPermission, W as FORGEABLE_HEADERS, X as LOCATOR_INVALID, Y as LOCATOR_ERROR, Z as LOCATOR_UNSUPPORTED, _ as BackgroundStoppedError, b as PermissionDeniedError, c as setMissingExtensionHandler, d as ExtensionHandshake, et as isLocatorInvalid, f as ExtensionOperationUnsupportedError, g as BACKGROUND_STOPPED, h as supportsOperation, i as promptInstall, j as CookieDetails, k as removeRequestHeaderRule, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, n as fetch, nt as isTerminalError, o as isExtensionExposed, p as ExtensionOutdatedError, q as hasForgedCookie, s as readExtensionHandshake, t as extension_d_exports, tt as isLocatorUnsupported, u as EXTENSION_ABI, v as isBackgroundStopped, w as assertLockdownApplicable, x as isPermissionDenied, y as PERMISSION_DENIED, z as fetchCredentialedPermission } from "./extension-C_eOfEjv.js";
|
|
3
|
+
import { K as RELAY_UNAVAILABLE } from "./contract-B8Rqx5BD.js";
|
|
3
4
|
import { t as account_d_exports } from "./account.js";
|
|
4
|
-
import { n as cloud_d_exports } from "./cloud-
|
|
5
|
+
import { n as cloud_d_exports } from "./cloud-BEoUa04G.js";
|
|
5
6
|
import { t as dns_d_exports } from "./dns.js";
|
|
6
|
-
import {
|
|
7
|
+
import { i as relayOf, n as RelayUnavailableError, r as isRelayUnavailable } from "./relay-choice-BmXlqfD2.js";
|
|
8
|
+
import { s as net_d_exports } from "./net-CvJwokcz.js";
|
|
7
9
|
import { t as dgram_d_exports } from "./dgram.js";
|
|
8
10
|
import { t as http_d_exports } from "./http.js";
|
|
9
11
|
import { t as desktop_d_exports } from "./desktop.js";
|
|
@@ -128,4 +130,4 @@ declare const busyReasons: () => string[];
|
|
|
128
130
|
*/
|
|
129
131
|
declare const applyUpdate: () => Promise<boolean>;
|
|
130
132
|
//#endregion
|
|
131
|
-
export { ATTACH_FRAME_EVENT_KEY, AddScriptTagOptions, AttachCookies, AttachFrameOptions, AttachWindowOptions, BACKGROUND_STOPPED, type BackgroundStoppedError, BlankPage, BoxedVideoElement, CATEGORIES, CategoryGrant, type CategoryMeta, CategoryRequest, ClearCookiesOptions, ClearCookiesWire, CookieDetails, CookieMatchWire, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, FrameBackendEvent, FrameDocumentEvent, FrameEventListener, FrameEventMap, FrameLocator, FrameMessageEvent, FramePostMessageOptions, FrameWindowBlockedError, FrameWindowOptions, FrameWindowRefusal, FrameWindowRefusedError, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_INVALID, LOCATOR_UNSUPPORTED, LegacyPermissionRequest, Locator, MAX_REASON_LENGTH, type OperationRequest, PERMISSION_DENIED, type PermissionCategory, type PermissionDeniedError, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, StorageState, StorageStateCookie, TimeoutError, VideoElementState, WindowFrame, account_d_exports as account, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFramePermission, box, cloud_d_exports as cloud, connectButtonUrl, cookies, createFrame, createVideoElementHandle, desktop_d_exports as desktop, dgram_d_exports as dgram, dns_d_exports as dns, extension_d_exports as extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, index_d_exports as fs, gotoPermission, handleRevivableModules, hasForgedCookie, http_d_exports as http, isBackgroundStopped, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorInvalid, isLocatorUnsupported, isPermissionDenied, isTerminalError, isType, modifyRequestHeadersPermission, net_d_exports as net, index_d_exports$1 as opfs, packages_d_exports as packages, permissions, promptInstall, readCookiePermission, readExtensionHandshake, removeRequestHeaderRule, revive, rooms_d_exports as rooms, setMissingExtensionHandler, setRequestHeaderRule, shell_d_exports as shell, storage_d_exports as storage, supportsOperation, type, waitForExtensionExposure };
|
|
133
|
+
export { ATTACH_FRAME_EVENT_KEY, AddScriptTagOptions, AttachCookies, AttachFrameOptions, AttachWindowOptions, BACKGROUND_STOPPED, type BackgroundStoppedError, BlankPage, BoxedVideoElement, CATEGORIES, CategoryGrant, type CategoryMeta, CategoryRequest, ClearCookiesOptions, ClearCookiesWire, CookieDetails, CookieMatchWire, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, FrameBackendEvent, FrameDocumentEvent, FrameEventListener, FrameEventMap, FrameLocator, FrameMessageEvent, FramePostMessageOptions, FrameWindowBlockedError, FrameWindowOptions, FrameWindowRefusal, FrameWindowRefusedError, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_INVALID, LOCATOR_UNSUPPORTED, LegacyPermissionRequest, Locator, MAX_REASON_LENGTH, type OperationRequest, PERMISSION_DENIED, type PermissionCategory, type PermissionDeniedError, PermissionGrant, PermissionRequest, ProxyFetchRequest, RELAY_UNAVAILABLE, REQUIRED_EXTENSION_ABI, RelayChoice, type RelayUnavailableError, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, StorageState, StorageStateCookie, TimeoutError, VideoElementState, WindowFrame, account_d_exports as account, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFramePermission, box, cloud_d_exports as cloud, connectButtonUrl, cookies, createFrame, createVideoElementHandle, desktop_d_exports as desktop, dgram_d_exports as dgram, dns_d_exports as dns, extension_d_exports as extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, index_d_exports as fs, gotoPermission, handleRevivableModules, hasForgedCookie, http_d_exports as http, isBackgroundStopped, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorInvalid, isLocatorUnsupported, isPermissionDenied, isRelayUnavailable, isTerminalError, isType, modifyRequestHeadersPermission, net_d_exports as net, index_d_exports$1 as opfs, packages_d_exports as packages, permissions, promptInstall, readCookiePermission, readExtensionHandshake, relayOf, removeRequestHeaderRule, revive, rooms_d_exports as rooms, setMissingExtensionHandler, setRequestHeaderRule, shell_d_exports as shell, storage_d_exports as storage, supportsOperation, type, waitForExtensionExposure };
|
package/index.js
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { $ as t, A as n, B as r, C as i, D as a, E as o, F as
|
|
3
|
-
import { a as me, i as he, n as ge, o as _e, t as ve } from "./extension-
|
|
4
|
-
import { c as H, d as ye, f as
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { t as De } from "./
|
|
10
|
-
import { t as Oe } from "./
|
|
11
|
-
import { t as ke } from "./
|
|
12
|
-
import { t as Ae } from "./
|
|
13
|
-
import {
|
|
14
|
-
import { t as Me } from "./
|
|
15
|
-
import {
|
|
16
|
-
import { t as Pe } from "./
|
|
17
|
-
import { t as Fe } from "./
|
|
18
|
-
import { t as Ie } from "./
|
|
19
|
-
import {
|
|
2
|
+
import { $ as t, A as n, B as r, C as i, D as a, E as o, F as ee, G as te, H as ne, I as re, J as ie, K as ae, L as s, M as c, O as oe, P as se, Q as ce, R as le, S as ue, U as de, V as fe, X as l, Y as u, _ as d, _t as f, a as p, at as m, b as h, ct as g, dt as _, et as v, ft as y, g as b, gt as x, ht as S, i as C, it as w, lt as T, mt as E, n as D, o as O, ot as k, pt as A, q as j, r as M, rt as N, st as P, t as F, tt as I, ut as L, v as R, w as z, x as B, y as V, z as pe } from "./lib-BGAmzIcU.js";
|
|
3
|
+
import { a as me, i as he, n as ge, o as _e, t as ve } from "./extension-AidgSVhb.js";
|
|
4
|
+
import { c as H, d as ye, f as U, o as W, u as G } from "./api-C-N5AVos.js";
|
|
5
|
+
import { n as be, r as xe } from "./busy-DsMWrSzc.js";
|
|
6
|
+
import { RELAY_UNAVAILABLE as Se } from "./contract.js";
|
|
7
|
+
import { n as Ce, r as we } from "./relay-choice-BGwXRC5d.js";
|
|
8
|
+
import { a as Te, i as K, n as Ee } from "./cloud-B6B2XcRU.js";
|
|
9
|
+
import { t as De } from "./dns.js";
|
|
10
|
+
import { t as Oe } from "./net.js";
|
|
11
|
+
import { t as ke } from "./dgram.js";
|
|
12
|
+
import { t as Ae } from "./http.js";
|
|
13
|
+
import { t as je } from "./desktop.js";
|
|
14
|
+
import { t as Me } from "./account.js";
|
|
15
|
+
import { u as Ne } from "./fs-C_RmxWk9.js";
|
|
16
|
+
import { t as Pe } from "./opfs.js";
|
|
17
|
+
import { t as Fe } from "./packages.js";
|
|
18
|
+
import { t as Ie } from "./rooms.js";
|
|
19
|
+
import { t as Le } from "./storage.js";
|
|
20
|
+
import { t as Re } from "./connect-button-DtsN3X1J.js";
|
|
21
|
+
import { relay as ze } from "osra";
|
|
20
22
|
//#region src/frame.ts
|
|
21
|
-
var
|
|
23
|
+
var Be = 1e4, Ve = 150, He = () => new Promise((e) => {
|
|
22
24
|
if (N()) return e(!0);
|
|
23
|
-
let t, n = setTimeout(() => r(N()),
|
|
25
|
+
let t, n = setTimeout(() => r(N()), Be), r = (r) => {
|
|
24
26
|
clearTimeout(t), clearTimeout(n), a.disconnect(), document.removeEventListener("readystatechange", o), e(r);
|
|
25
27
|
}, i = () => {
|
|
26
|
-
clearTimeout(t), t = setTimeout(() => r(N()),
|
|
28
|
+
clearTimeout(t), t = setTimeout(() => r(N()), Ve);
|
|
27
29
|
}, a = new MutationObserver(() => {
|
|
28
30
|
N() && r(!0);
|
|
29
31
|
}), o = () => {
|
|
@@ -33,57 +35,57 @@ var Re = 1e4, ze = 150, Be = () => new Promise((e) => {
|
|
|
33
35
|
attributes: !0,
|
|
34
36
|
attributeFilter: ["data-fkn-extension"]
|
|
35
37
|
}), document.addEventListener("readystatechange", o), document.readyState === "complete" && i();
|
|
36
|
-
}),
|
|
38
|
+
}), Ue = (async (e) => {
|
|
37
39
|
let { kind: t, cookies: n } = O(e);
|
|
38
40
|
if (t === "window") {
|
|
39
41
|
let t = e;
|
|
40
|
-
return n === "native" ? p(t) :
|
|
42
|
+
return n === "native" ? p(t) : K(t);
|
|
41
43
|
}
|
|
42
44
|
let r = e;
|
|
43
|
-
return n === "native" ?
|
|
44
|
-
}),
|
|
45
|
+
return n === "native" ? We(r) : K(r);
|
|
46
|
+
}), We = async (e) => (Te(e), await He(), p(e)), Ge = "https://fkn.app", Ke = async (e, t) => {
|
|
45
47
|
if (typeof window > "u") throw Error("FKN @fkn/lib: relayWorker must be called from the main thread");
|
|
46
|
-
let n = await
|
|
48
|
+
let n = await U;
|
|
47
49
|
if (!n) throw Error("FKN @fkn/lib: relayWorker found no FKN transport in this realm");
|
|
48
|
-
ye(),
|
|
50
|
+
ye(), xe("relayed worker", t?.unregisterSignal);
|
|
49
51
|
let r = n.emit instanceof MessagePort ? {} : {
|
|
50
|
-
originA: t?.originA ??
|
|
52
|
+
originA: t?.originA ?? Ge,
|
|
51
53
|
originB: t?.originB ?? "*"
|
|
52
54
|
};
|
|
53
|
-
|
|
55
|
+
ze(n, e, {
|
|
54
56
|
key: "fkn-api",
|
|
55
57
|
...r,
|
|
56
58
|
unregisterSignal: t?.unregisterSignal
|
|
57
59
|
});
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
}),
|
|
61
|
-
if (
|
|
62
|
-
for (let e of [...
|
|
60
|
+
}, qe = async () => typeof window > "u" ? !1 : (await W).connect.prompt(location.origin).catch(() => !1), Je = async () => typeof window > "u" ? null : (await W).relay.prompt().catch(() => null), q = /* @__PURE__ */ new Set(), Ye = (e) => (q.add(e), () => {
|
|
61
|
+
q.delete(e);
|
|
62
|
+
}), Xe = () => {
|
|
63
|
+
if (q.size === 0) return !1;
|
|
64
|
+
for (let e of [...q]) try {
|
|
63
65
|
e();
|
|
64
66
|
} catch {}
|
|
65
67
|
return !0;
|
|
66
|
-
},
|
|
68
|
+
}, Ze = (e, t) => {
|
|
67
69
|
if (typeof e?.onUpdateTaken == "function") return Promise.resolve(e.onUpdateTaken(t));
|
|
68
|
-
},
|
|
69
|
-
applyUpdate: () =>
|
|
70
|
-
busyReasons: () =>
|
|
71
|
-
onUpdate: () =>
|
|
72
|
-
onUpdateTaken: () =>
|
|
73
|
-
updateReady: () =>
|
|
74
|
-
}),
|
|
70
|
+
}, Qe = /* @__PURE__ */ e({
|
|
71
|
+
applyUpdate: () => at,
|
|
72
|
+
busyReasons: () => it,
|
|
73
|
+
onUpdate: () => tt,
|
|
74
|
+
onUpdateTaken: () => nt,
|
|
75
|
+
updateReady: () => $e
|
|
76
|
+
}), $e = async () => typeof window > "u" ? !1 : W.then((e) => e.shell?.updateReady()).then((e) => e === !0).catch(() => !1), J = /* @__PURE__ */ new Set(), Y = !1, et = () => {
|
|
75
77
|
Y = !0;
|
|
76
78
|
for (let e of [...J]) try {
|
|
77
79
|
e();
|
|
78
80
|
} catch {}
|
|
79
81
|
}, X = 0, Z = () => {
|
|
80
82
|
let e = H();
|
|
81
|
-
e && J.size !== 0 && X !== e.epoch && (X = e.epoch, Y = !1, Promise.resolve(e.remote.shell?.onUpdate(
|
|
83
|
+
e && J.size !== 0 && X !== e.epoch && (X = e.epoch, Y = !1, Promise.resolve(e.remote.shell?.onUpdate(et)).catch(() => {
|
|
82
84
|
X === e.epoch && (X = 0);
|
|
83
85
|
}));
|
|
84
86
|
};
|
|
85
|
-
typeof window < "u" &&
|
|
86
|
-
var
|
|
87
|
+
typeof window < "u" && G(Z);
|
|
88
|
+
var tt = async (e) => {
|
|
87
89
|
if (typeof window > "u") return () => {};
|
|
88
90
|
if (J.add(e), Y) try {
|
|
89
91
|
e();
|
|
@@ -91,19 +93,19 @@ var Qe = async (e) => {
|
|
|
91
93
|
return Z(), () => {
|
|
92
94
|
J.delete(e);
|
|
93
95
|
};
|
|
94
|
-
},
|
|
95
|
-
if (!
|
|
96
|
+
}, nt = (e) => typeof window > "u" ? () => {} : Ye(e), Q = 0, $ = !1, rt = () => {
|
|
97
|
+
if (!Xe() && !$) {
|
|
96
98
|
$ = !0;
|
|
97
99
|
try {
|
|
98
100
|
location.reload();
|
|
99
101
|
} catch {}
|
|
100
102
|
}
|
|
101
103
|
};
|
|
102
|
-
typeof window < "u" &&
|
|
104
|
+
typeof window < "u" && G(() => {
|
|
103
105
|
let e = H();
|
|
104
106
|
if (!e || Q === e.epoch) return;
|
|
105
107
|
Q = e.epoch;
|
|
106
|
-
let t =
|
|
108
|
+
let t = Ze(e.remote.shell, rt);
|
|
107
109
|
if (!t) {
|
|
108
110
|
Q = 0;
|
|
109
111
|
return;
|
|
@@ -112,6 +114,6 @@ typeof window < "u" && W(() => {
|
|
|
112
114
|
Q === e.epoch && (Q = 0);
|
|
113
115
|
});
|
|
114
116
|
});
|
|
115
|
-
var
|
|
117
|
+
var it = () => be(), at = async () => typeof window > "u" ? !1 : W.then((e) => e.shell?.applyUpdate()).then((e) => e === !0).catch(() => !1);
|
|
116
118
|
//#endregion
|
|
117
|
-
export { C as ATTACH_FRAME_EVENT_KEY, me as BACKGROUND_STOPPED, z as CATEGORIES, P as EXTENSION_ABI, g as ExtensionOperationUnsupportedError, T as ExtensionOutdatedError, ce as FORGEABLE_HEADERS, b as FrameWindowBlockedError, d as FrameWindowRefusedError, n as LOCATOR_DENIED,
|
|
119
|
+
export { C as ATTACH_FRAME_EVENT_KEY, me as BACKGROUND_STOPPED, z as CATEGORIES, P as EXTENSION_ABI, g as ExtensionOperationUnsupportedError, T as ExtensionOutdatedError, ce as FORGEABLE_HEADERS, b as FrameWindowBlockedError, d as FrameWindowRefusedError, n as LOCATOR_DENIED, ee as LOCATOR_ERROR, s as LOCATOR_INVALID, a as LOCATOR_UNSUPPORTED, l as MAX_REASON_LENGTH, F as PERMISSION_DENIED, Se as RELAY_UNAVAILABLE, L as REQUIRED_EXTENSION_ABI, o as TimeoutError, Me as account, B as assertAttachableFrameUrl, de as assertFetchableUrl, t as assertForgeableHeaders, ue as assertLockdownApplicable, v as assertOneCookieIdentity, Ue as attachFrame, R as attachFramePermission, A as box, Ee as cloud, qe as connect, Re as connectButtonUrl, fe as cookies, V as createFrame, E as createVideoElementHandle, je as desktop, ke as dgram, De as dns, ve as extension, ge as fetch, te as fetchCredentialedPermission, ae as fetchLocalPermission, j as fetchPermission, Ne as fs, h as gotoPermission, y as handleRevivableModules, I as hasForgedCookie, Ae as http, _e as isBackgroundStopped, ie as isBlockedFetchUrl, i as isBlockedFrameUrl, N as isExtensionExposed, u as isLocalNetworkUrl, re as isLocatorDenied, c as isLocatorInvalid, oe as isLocatorUnsupported, D as isPermissionDenied, Ce as isRelayUnavailable, se as isTerminalError, S as isType, le as modifyRequestHeadersPermission, Oe as net, Pe as opfs, Fe as packages, M as permissions, he as promptInstall, Je as promptRelay, ne as readCookiePermission, w as readExtensionHandshake, we as relayOf, Ke as relayWorker, pe as removeRequestHeaderRule, x as revive, Ie as rooms, m as setMissingExtensionHandler, r as setRequestHeaderRule, Qe as shell, Le as storage, _ as supportsOperation, f as type, k as waitForExtensionExposure };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as RelayChoice } from "./index-C5DdoMGo.js";
|
|
2
|
+
import { Bt as TcpSocketListenerResult, Ht as TcpSocketResult, X as Resolvers } from "./contract-B8Rqx5BD.js";
|
|
2
3
|
import { o as TcpSocketOption } from "./wire-Fk5pJaoy.js";
|
|
3
|
-
import "./api-
|
|
4
|
+
import "./api-BD_XUANc.js";
|
|
5
|
+
import { t as RelayOption } from "./relay-choice-BmXlqfD2.js";
|
|
4
6
|
import { AddressInfo, ListenOptions, Server, ServerOpts, Socket, SocketConnectOpts, SocketConstructorOpts } from "net";
|
|
7
|
+
import { BindOptions } from "dgram";
|
|
5
8
|
import { DuplexOptions, Stream } from "stream";
|
|
6
9
|
import { EventEmitter } from "events";
|
|
7
|
-
import { BindOptions } from "dgram";
|
|
8
10
|
//#region src/webvpn/utils.d.ts
|
|
9
11
|
declare const isIPv4: (input: string) => boolean;
|
|
10
12
|
declare const isIPv6: (input: string) => boolean;
|
|
@@ -29,6 +31,8 @@ declare class Socket$2 extends Stream.Duplex implements Socket {
|
|
|
29
31
|
reader: ReadableStreamDefaultReader<Uint8Array>;
|
|
30
32
|
writer: WritableStreamDefaultWriter<Uint8Array>;
|
|
31
33
|
}) | undefined>;
|
|
34
|
+
/** the relay serving this socket once it is connected, read through `relayOf` */
|
|
35
|
+
_relay?: string;
|
|
32
36
|
constructor(options?: SocketConstructorOpts & DuplexOptions & {
|
|
33
37
|
connection?: ReturnType<WebVpnTcpSocket>;
|
|
34
38
|
});
|
|
@@ -39,7 +43,7 @@ declare class Socket$2 extends Stream.Duplex implements Socket {
|
|
|
39
43
|
}) | undefined>;
|
|
40
44
|
_read(size: number): void;
|
|
41
45
|
_write(chunk: Uint8Array, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
|
|
42
|
-
connect(options: SocketConnectOpts, connectionListener?: (() => void) | undefined): this;
|
|
46
|
+
connect(options: SocketConnectOpts & RelayOption, connectionListener?: (() => void) | undefined): this;
|
|
43
47
|
connect(port: number, host: string, connectionListener?: (() => void) | undefined): this;
|
|
44
48
|
connect(port: number, connectionListener?: (() => void) | undefined): this;
|
|
45
49
|
connect(path: string, connectionListener?: (() => void) | undefined): this;
|
|
@@ -91,7 +95,10 @@ declare class Server$1 extends EventEmitter implements Server {
|
|
|
91
95
|
port: number;
|
|
92
96
|
};
|
|
93
97
|
_webVPNTcpSocketListenerPromise?: Promise<Awaited<ReturnType<WebVpnTcpSocketListener>> | undefined>;
|
|
94
|
-
|
|
98
|
+
_relayChoice?: RelayChoice;
|
|
99
|
+
/** the relay serving this server once it is listening, read through `relayOf` */
|
|
100
|
+
_relay?: string;
|
|
101
|
+
constructor(options?: ServerOpts & EventEmitterOptions & RelayOption & {
|
|
95
102
|
connection?: ReturnType<WebVpnTcpSocketListener>;
|
|
96
103
|
}, connectionListener?: (socket: Socket$2) => void);
|
|
97
104
|
_busyRelease?: () => void;
|
|
@@ -125,9 +132,9 @@ declare class Server$1 extends EventEmitter implements Server {
|
|
|
125
132
|
listening: boolean;
|
|
126
133
|
[Symbol.asyncDispose](): Promise<void>;
|
|
127
134
|
}
|
|
128
|
-
declare const connect: (options: SocketConnectOpts, connectionListener?: () => void) => Socket$2;
|
|
135
|
+
declare const connect: (options: SocketConnectOpts & RelayOption, connectionListener?: () => void) => Socket$2;
|
|
129
136
|
declare const createConnection: typeof connect;
|
|
130
|
-
declare const createServer: (options?: ServerOpts | ((socket: Socket$2) => void), connectionListener?: (socket: Socket$2) => void) => Server$1;
|
|
137
|
+
declare const createServer: (options?: (ServerOpts & RelayOption) | ((socket: Socket$2) => void), connectionListener?: (socket: Socket$2) => void) => Server$1;
|
|
131
138
|
declare const _default: {
|
|
132
139
|
Socket: typeof Socket$2;
|
|
133
140
|
Server: typeof Server$1;
|
package/net.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-ibGqkmtA.cjs"),n=require("./busy-BXbVH595.cjs"),r=require("./relay-choice-JC_JJY_M.cjs"),i=require("./utils-BpHmMkIR.cjs");require("./wire.cjs");let a=require("stream"),o=require("events");var s=e.t({Server:()=>l,Socket:()=>c,_default:()=>p,connect:()=>u,createConnection:()=>d,createServer:()=>f,default:()=>p,isIP:()=>i.t,isIPv4:()=>i.n,isIPv6:()=>i.r}),c=class extends a.Stream.Duplex{_localAddress;_remoteAddress;_webVPNTcpSocketPromise;_relay;constructor(e){if(e?.fd!==void 0)throw Error(`FKN WebVPN does not support file descriptors`);super(e),e?.connection&&this.__webvpn_tcp_socket_init__(e.connection)}_busyRelease;__webvpn_tcp_socket_init__(e,t){return this._busyRelease??=n.t(`tcp socket`),t&&(this._localAddress={address:t.localAddress,family:t.localFamily,port:t.localPort},this._remoteAddress={address:t.remoteAddress,family:t.remoteFamily,port:t.remotePort},this._relay=t.relay),this._webVPNTcpSocketPromise=e.then(e=>{let t=e.dataReadableStream.getReader(),n=e.dataWritableStream.getWriter();return this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},this._remoteAddress={address:e.remoteAddress,family:e.remoteFamily,port:e.remotePort},this._relay=e.relay,{...e,reader:t,writer:n}}).catch(e=>{this.emit(`error`,e)}),this._webVPNTcpSocketPromise.then(e=>{if(!e){this._busyRelease?.();return}this.emit(`connect`)}),this._webVPNTcpSocketPromise}_read(e){if(!this._webVPNTcpSocketPromise)throw Error(`Socket not connected`);this._webVPNTcpSocketPromise.then(e=>{if(!e){this.push(null);return}e.reader.read().then(({value:e,done:t})=>{if(t){this.push(null);return}this._restartTimeoutTimer(),this.push(e)}).catch(e=>{this.destroy(e)})})}_write(e,t,n){if(!this._webVPNTcpSocketPromise){n(Error(`Socket not connected`));return}this._webVPNTcpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not connected`);await t.writer.ready,await t.writer.write(e),this._restartTimeoutTimer(),n()}).catch(n)}connect(...e){let n=i.o(...e),{relay:a}=n,o=this.__webvpn_tcp_socket_init__(t.s(`an outbound tcp socket`).then(e=>(a!==void 0&&r.t(e,`net.connect`),e.cloud.webvpn.tcpSocket({remoteAddress:n.host??`localhost`,remotePort:n.port,relay:a}))));return n.callback&&o.then(e=>{e&&n.callback.call(this)}),this}_final(e){if(!this._webVPNTcpSocketPromise){e();return}this._webVPNTcpSocketPromise.then(async e=>{e&&await e.writer.close()}).then(()=>e(),t=>e(t))}_destroy(e,t){if(this._timeoutTimer&&clearTimeout(this._timeoutTimer),this._busyRelease?.(),!this._webVPNTcpSocketPromise){t(e);return}this._webVPNTcpSocketPromise.then(async e=>{e&&await(this._resetRequested?e.resetAndDestroy():e.destroy())}).then(()=>t(e),()=>t(e))}destroySoon(){if(this.writableFinished){this.destroy();return}this.once(`finish`,()=>this.destroy()),this.end()}_resetRequested=!1;resetAndDestroy(){return this._resetRequested=!0,this.destroy(),this}_timeoutMs;_timeoutTimer;_restartTimeoutTimer(){this._timeoutTimer&&clearTimeout(this._timeoutTimer),this._timeoutMs&&(this._timeoutTimer=setTimeout(()=>this.emit(`timeout`),this._timeoutMs))}setTimeout(e,t){return t&&this.on(`timeout`,t),this._timeoutMs=e,this._restartTimeoutTimer(),this}setNoDelay(e){let t=e??!0;return this._setTcpOption({type:0,value:t}),this}setKeepAlive(e,t){let n=e??!1,r=t!==void 0&&t>0?Math.max(1,Math.round(t/1e3)):0;return this._setTcpOption({type:2,enabled:n,initialDelaySeconds:r}),this}setSendBufferSize(e){return this._setTcpOption({type:3,value:e}),this}setRecvBufferSize(e){return this._setTcpOption({type:4,value:e}),this}_typeOfService;getTypeOfService(){return this._typeOfService??0}setTypeOfService(e){return this._typeOfService=e,this}_setTcpOption(e){if(!this._webVPNTcpSocketPromise){this.emit(`error`,Error(`Cannot set socket option before connect`));return}this._webVPNTcpSocketPromise.then(async t=>{if(t)try{await t.setOption(e)}catch(e){this.emit(`error`,e)}})}write(e,t,...n){return super.write(e,t,...n)}address(){return this._localAddress??{}}unref(){return this}ref(){return this}autoSelectFamilyAttemptedAddresses;bufferSize;bytesRead;bytesWritten;connecting;pending;get localAddress(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.address}get localPort(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.port}get localFamily(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.family}readyState;get remoteAddress(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.address}get remotePort(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.port}get remoteFamily(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.family}timeout},l=class extends o.EventEmitter{_localAddress;_webVPNTcpSocketListenerPromise;_relayChoice;_relay;constructor(e,t){super(e),this._relayChoice=e?.relay,t&&this.on(`connection`,t),e?.connection&&this.__webvpn_tcp_socket_listener_init__(e.connection)}_busyRelease;__webvpn_tcp_socket_listener_init__(e){return this._busyRelease??=n.t(`tcp server`),this._webVPNTcpSocketListenerPromise=e.then(e=>(this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},this._relay=e.relay,e)).catch(e=>{this.emit(`error`,e)}),this._webVPNTcpSocketListenerPromise.then(e=>{if(!e){this._busyRelease?.();return}this.emit(`listening`)}),this._webVPNTcpSocketListenerPromise}listen(...e){let n=i.o(...e);this._closeEmitted=!1;let a=e=>{let t=new c;t.__webvpn_tcp_socket_init__(Promise.resolve(e),e),this.emit(`connection`,t)},o=e=>{this._localAddress=void 0;try{e&&this.listenerCount(`error`)>0&&this.emit(`error`,e)}finally{this._emitClose()}},s=this._relayChoice,l=e=>t.s(`a tcp listener`).then(t=>(s!==void 0&&r.t(t,`net.createServer`),t.cloud.webvpn.tcpSocketListener({localAddress:e,localPort:n.port,onConnection:a,onClose:o,relay:s}))),u=n.host?l(n.host):l(`::`).catch(()=>l(`0.0.0.0`)),d=this.__webvpn_tcp_socket_listener_init__(u);return n.callback&&d.then(e=>{e&&n.callback.call(this)}),this}_closeEmitted=!1;_emitClose(){this._closeEmitted||(this._closeEmitted=!0,this._busyRelease?.(),this.emit(`close`))}close(e){return this._webVPNTcpSocketListenerPromise&&this._webVPNTcpSocketListenerPromise.then(async t=>{if(t)try{await t.close(),this._localAddress=void 0,this._emitClose(),e&&e()}catch(t){this._localAddress=void 0,this._emitClose(),e&&e(t)}}),this}address(){return this._localAddress??null}getConnections(e){throw Error(`Method not implemented.`)}ref(){return this}unref(){return this}maxConnections;connections;listening;async[Symbol.asyncDispose](){}},u=(e,t)=>new c().connect(e,t),d=u,f=(e,t)=>{typeof e==`function`&&(t=e,e=void 0);let n=new l(e);return t&&n.on(`connection`,t),n},p={Socket:c,Server:l,connect:u,createConnection:d,createServer:f,isIP:i.t,isIPv4:i.n,isIPv6:i.r};exports.Server=l,exports.Socket=c,exports._default=p,exports.default=p,exports.connect=u,exports.createConnection=d,exports.createServer=f,exports.isIP=i.t,exports.isIPv4=i.n,exports.isIPv6=i.r,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|
package/net.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "./net-
|
|
1
|
+
import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "./net-CvJwokcz.js";
|
|
2
2
|
export { Server, Socket, _default, _default as default, connect, createConnection, createServer, isIP, isIPv4, isIPv6 };
|