backpage
Advanced tools
Comparing version 0.0.1-25 to 0.0.1-26
@@ -19,1 +19,3 @@ import { Tunnel } from '../tunnel.js'; | ||
} | ||
export declare const CLOUD_READONLY_HASH_LENGTH = 32; | ||
export declare function getReadOnlyHashForToken(token: string): string; |
@@ -0,1 +1,2 @@ | ||
import { createHash } from 'crypto'; | ||
import { WebSocket } from 'ws'; | ||
@@ -40,3 +41,3 @@ import { Tunnel, WebSocketTunnelClient } from '../tunnel.js'; | ||
endpoint = endpoint.replace(/\/$/, ''); | ||
const url = `${endpoint}/${token}/${encodeURIComponent(name)}/`; | ||
const url = `${endpoint}/${getReadOnlyHashForToken(token)}/${encodeURIComponent(name)}/`; | ||
const urlObject = new URL(url); | ||
@@ -51,3 +52,3 @@ switch (urlObject.protocol) { | ||
this.url = url; | ||
this.wsURL = `${url.replace(/^http/, 'ws')}back`; | ||
this.wsURL = `${endpoint.replace(/^http/, 'ws')}/back/${token}/${encodeURIComponent(name)}/`; | ||
this.connect(); | ||
@@ -95,2 +96,9 @@ } | ||
} | ||
export const CLOUD_READONLY_HASH_LENGTH = 32; | ||
export function getReadOnlyHashForToken(token) { | ||
return createHash('sha1') | ||
.update(token) | ||
.digest('hex') | ||
.slice(0, CLOUD_READONLY_HASH_LENGTH); | ||
} | ||
//# sourceMappingURL=cloud-tunnel.js.map |
{ | ||
"name": "backpage", | ||
"version": "0.0.1-25", | ||
"version": "0.0.1-26", | ||
"description": "Naive static HTML streaming based on React for Node.js CLI applications.", | ||
@@ -58,2 +58,4 @@ "repository": "https://github.com/vilicvane/backpage.git", | ||
"eslint": "^8.56.0", | ||
"mobx": "^6.12.0", | ||
"mobx-react": "^9.1.0", | ||
"prettier": "^3.2.1", | ||
@@ -60,0 +62,0 @@ "react": "^18.2.0", |
@@ -0,1 +1,3 @@ | ||
import {createHash} from 'crypto'; | ||
import {WebSocket} from 'ws'; | ||
@@ -37,3 +39,3 @@ | ||
const url = `${endpoint}/${token}/${encodeURIComponent(name)}/`; | ||
const url = `${endpoint}/${getReadOnlyHashForToken(token)}/${encodeURIComponent(name)}/`; | ||
@@ -51,3 +53,3 @@ const urlObject = new URL(url); | ||
this.url = url; | ||
this.wsURL = `${url.replace(/^http/, 'ws')}back`; | ||
this.wsURL = `${endpoint.replace(/^http/, 'ws')}/back/${token}/${encodeURIComponent(name)}/`; | ||
@@ -109,1 +111,10 @@ this.connect(); | ||
} | ||
export const CLOUD_READONLY_HASH_LENGTH = 32; | ||
export function getReadOnlyHashForToken(token: string): string { | ||
return createHash('sha1') | ||
.update(token) | ||
.digest('hex') | ||
.slice(0, CLOUD_READONLY_HASH_LENGTH); | ||
} |
Sorry, the diff of this file is not supported yet
209243
4247
11