Skip to content

Commit

Permalink
new API puter.net.generateWispV1URL()
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgrammerIn-wonderland authored and KernelDeimos committed Feb 5, 2025
1 parent c8bed6e commit 26666fe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/puter-js/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,17 @@ window.puter = (function() {
})).json());
wispInfo.handler = new PWispHandler(wispServer, wispToken);
this.net = {
generateWispV1URL: async () => {
const { token: wispToken, server: wispServer } = (await (await fetch(this.APIOrigin + '/wisp/relay-token/create', {
method: 'POST',
headers: {
Authorization: `Bearer ${this.authToken}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
})).json());
return `${wispServer}/${wispToken}/`
},
Socket: PSocket,
tls: {
TLSSocket: PTLSSocket
Expand Down

0 comments on commit 26666fe

Please sign in to comment.