shiplocal 0.1.2 → 0.1.3
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/dist/index.js +8 -5
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4071,7 +4071,7 @@ var DEFAULT_TUNNEL_PORT = 3e3;
|
|
|
4071
4071
|
// ../shared/dist/protocol.js
|
|
4072
4072
|
var TUNNEL_WS_PATH = "/tunnel";
|
|
4073
4073
|
var DEFAULT_TUNNEL_EXPIRY_MS = 2 * 60 * 60 * 1e3;
|
|
4074
|
-
var MAX_BODY_BYTES =
|
|
4074
|
+
var MAX_BODY_BYTES = 50 * 1024 * 1024;
|
|
4075
4075
|
var headersSchema = external_exports.record(external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]));
|
|
4076
4076
|
var registerMessageSchema = external_exports.object({
|
|
4077
4077
|
type: external_exports.literal("register"),
|
|
@@ -4168,7 +4168,7 @@ var STRIP_RESPONSE_HEADERS = /* @__PURE__ */ new Set([
|
|
|
4168
4168
|
"content-encoding",
|
|
4169
4169
|
"content-length"
|
|
4170
4170
|
]);
|
|
4171
|
-
function sanitizeRequestHeaders(headers) {
|
|
4171
|
+
function sanitizeRequestHeaders(headers, localPort) {
|
|
4172
4172
|
const result = {};
|
|
4173
4173
|
for (const [key, value] of Object.entries(headers)) {
|
|
4174
4174
|
const lower = key.toLowerCase();
|
|
@@ -4177,6 +4177,7 @@ function sanitizeRequestHeaders(headers) {
|
|
|
4177
4177
|
}
|
|
4178
4178
|
result[key] = value;
|
|
4179
4179
|
}
|
|
4180
|
+
result["host"] = `localhost:${String(localPort)}`;
|
|
4180
4181
|
return result;
|
|
4181
4182
|
}
|
|
4182
4183
|
function sanitizeResponseHeaders(headers) {
|
|
@@ -4200,7 +4201,7 @@ async function forwardToLocal(localPort, message) {
|
|
|
4200
4201
|
port: localPort,
|
|
4201
4202
|
method: message.method,
|
|
4202
4203
|
path: pathWithQuery,
|
|
4203
|
-
headers: sanitizeRequestHeaders(message.headers)
|
|
4204
|
+
headers: sanitizeRequestHeaders(message.headers, localPort)
|
|
4204
4205
|
}, (res) => {
|
|
4205
4206
|
const chunks = [];
|
|
4206
4207
|
let totalSize = 0;
|
|
@@ -4358,7 +4359,9 @@ function createTunnelClient(options) {
|
|
|
4358
4359
|
ws.close();
|
|
4359
4360
|
}
|
|
4360
4361
|
}
|
|
4361
|
-
const socket = new WebSocket(toWebSocketUrl(options.serverUrl)
|
|
4362
|
+
const socket = new WebSocket(toWebSocketUrl(options.serverUrl), {
|
|
4363
|
+
maxPayload: 64 * 1024 * 1024
|
|
4364
|
+
});
|
|
4362
4365
|
ws = socket;
|
|
4363
4366
|
socket.on("open", () => {
|
|
4364
4367
|
socket.send(JSON.stringify({
|
|
@@ -4528,7 +4531,7 @@ function isLocalPortOpen(port, timeoutMs = 2e3) {
|
|
|
4528
4531
|
|
|
4529
4532
|
// src/index.ts
|
|
4530
4533
|
var program = new Command();
|
|
4531
|
-
program.name("shiplocal").description("Share localhost with clients in seconds").version("0.1.
|
|
4534
|
+
program.name("shiplocal").description("Share localhost with clients in seconds").version("0.1.3");
|
|
4532
4535
|
program.command("login").description("Authenticate with ShipLocal Cloud").action(async () => {
|
|
4533
4536
|
const rl = createInterface({ input, output });
|
|
4534
4537
|
const apiUrl = await resolveApiUrlAsync();
|