Skip to content

Commit 26666fe

Browse files
new API puter.net.generateWispV1URL()
1 parent c8bed6e commit 26666fe

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/puter-js/src/index.js

+11
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,17 @@ window.puter = (function() {
339339
})).json());
340340
wispInfo.handler = new PWispHandler(wispServer, wispToken);
341341
this.net = {
342+
generateWispV1URL: async () => {
343+
const { token: wispToken, server: wispServer } = (await (await fetch(this.APIOrigin + '/wisp/relay-token/create', {
344+
method: 'POST',
345+
headers: {
346+
Authorization: `Bearer ${this.authToken}`,
347+
'Content-Type': 'application/json',
348+
},
349+
body: JSON.stringify({}),
350+
})).json());
351+
return `${wispServer}/${wispToken}/`
352+
},
342353
Socket: PSocket,
343354
tls: {
344355
TLSSocket: PTLSSocket

0 commit comments

Comments
 (0)