pubblue 0.4.1 → 0.4.2
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.
|
@@ -10,6 +10,10 @@ import * as fs from "fs";
|
|
|
10
10
|
import * as net from "net";
|
|
11
11
|
import * as path from "path";
|
|
12
12
|
var OFFER_TIMEOUT_MS = 1e4;
|
|
13
|
+
var NOT_CONNECTED_WRITE_ERROR = "No browser connected. Ask the user to open the tunnel URL first, then retry.";
|
|
14
|
+
function getTunnelWriteReadinessError(isConnected) {
|
|
15
|
+
return isConnected ? null : NOT_CONNECTED_WRITE_ERROR;
|
|
16
|
+
}
|
|
13
17
|
async function startDaemon(config) {
|
|
14
18
|
const { tunnelId, apiClient, socketPath, infoPath } = config;
|
|
15
19
|
const ndc = await import("node-datachannel");
|
|
@@ -237,6 +241,8 @@ async function startDaemon(config) {
|
|
|
237
241
|
switch (req.method) {
|
|
238
242
|
case "write": {
|
|
239
243
|
const channel = req.params.channel || CHANNELS.CHAT;
|
|
244
|
+
const readinessError = getTunnelWriteReadinessError(connected);
|
|
245
|
+
if (readinessError) return { ok: false, error: readinessError };
|
|
240
246
|
const msg = req.params.msg;
|
|
241
247
|
const binaryBase64 = typeof req.params.binaryBase64 === "string" ? req.params.binaryBase64 : void 0;
|
|
242
248
|
const dc = channels.get(channel);
|
|
@@ -338,5 +344,6 @@ function generateOffer(peer, timeoutMs) {
|
|
|
338
344
|
}
|
|
339
345
|
|
|
340
346
|
export {
|
|
347
|
+
getTunnelWriteReadinessError,
|
|
341
348
|
startDaemon
|
|
342
349
|
};
|
package/dist/index.js
CHANGED
|
@@ -227,7 +227,7 @@ function registerTunnelCommands(program2) {
|
|
|
227
227
|
const socketPath = getSocketPath(result.tunnelId);
|
|
228
228
|
const infoPath = tunnelInfoPath(result.tunnelId);
|
|
229
229
|
if (opts.foreground) {
|
|
230
|
-
const { startDaemon } = await import("./tunnel-daemon-
|
|
230
|
+
const { startDaemon } = await import("./tunnel-daemon-K7Z7FUFN.js");
|
|
231
231
|
console.log(`Tunnel started: ${result.url}`);
|
|
232
232
|
console.log(`Tunnel ID: ${result.tunnelId}`);
|
|
233
233
|
console.log(`Expires: ${new Date(result.expiresAt).toISOString()}`);
|
|
@@ -579,7 +579,7 @@ function readFile(filePath) {
|
|
|
579
579
|
basename: path3.basename(resolved)
|
|
580
580
|
};
|
|
581
581
|
}
|
|
582
|
-
program.name("pubblue").description("Publish static content and get shareable URLs").version("0.4.
|
|
582
|
+
program.name("pubblue").description("Publish static content and get shareable URLs").version("0.4.2");
|
|
583
583
|
program.command("configure").description("Configure the CLI with your API key").option("--api-key <key>", "Your API key (less secure: appears in shell history)").option("--api-key-stdin", "Read API key from stdin").action(async (opts) => {
|
|
584
584
|
try {
|
|
585
585
|
const apiKey = await resolveConfigureApiKey(opts);
|
package/package.json
CHANGED