@tinycloud/cli 1.3.2-beta.0 → 1.3.2-beta.1
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 +33 -6
- package/dist/index.js.map +1 -1
- package/dist/legacy-entry.js +22 -3
- package/dist/legacy-entry.js.map +1 -1
- package/package.json +1 -1
- package/skills/tc-cli/REFERENCE.md +3 -1
package/dist/legacy-entry.js
CHANGED
|
@@ -41374,6 +41374,14 @@ function shareCliError(error, operation = "publish") {
|
|
|
41374
41374
|
if (failure.kind === "upload-failed") {
|
|
41375
41375
|
return new CLIError("UPLOAD_FAILED", "share source upload failed; nothing was shared", 4);
|
|
41376
41376
|
}
|
|
41377
|
+
if (failure.kind === "decrypt-not-held") {
|
|
41378
|
+
return new CLIError(
|
|
41379
|
+
"PERMISSION_DENIED",
|
|
41380
|
+
"this sign-in can't create email-addressed shares: it has no permission to decrypt with the account's key. Nothing was shared.",
|
|
41381
|
+
5,
|
|
41382
|
+
{ hint: "Share it from https://share.tinycloud.xyz while signed in as the account owner, or ask the owner to share it. A link anyone can open works from this sign-in: --to anyone." }
|
|
41383
|
+
);
|
|
41384
|
+
}
|
|
41377
41385
|
}
|
|
41378
41386
|
if (error instanceof ShortLinkError) {
|
|
41379
41387
|
if (error.code === "not-found") return new CLIError("NOT_FOUND", "this short link has expired, was revoked, or never existed", 4);
|
|
@@ -41425,6 +41433,11 @@ function inputUrl(value, stdin) {
|
|
|
41425
41433
|
function resolveLink(link4, expectedOrigin) {
|
|
41426
41434
|
return shareServices.shortLinks?.resolve(link4, expectedOrigin) ?? resolveShortLink(link4, { expectedOrigin });
|
|
41427
41435
|
}
|
|
41436
|
+
function assertTrustedShareOrigin(link4, expectedOrigin) {
|
|
41437
|
+
if (URL.canParse(link4) && new URL(link4).origin !== expectedOrigin) {
|
|
41438
|
+
throw new ShareReceiveError("origin-mismatch", "share link origin is not the trusted Share origin");
|
|
41439
|
+
}
|
|
41440
|
+
}
|
|
41428
41441
|
var SHORT_LINK_WARNING = {
|
|
41429
41442
|
"rate-limited": "the short-link service is rate limiting this client",
|
|
41430
41443
|
capacity: "the short-link service is at capacity",
|
|
@@ -41451,8 +41464,11 @@ async function inspectShareInputOnce(value, stdin, expectedOrigin, dependencies
|
|
|
41451
41464
|
try {
|
|
41452
41465
|
parseNativeShareUrl(link4);
|
|
41453
41466
|
} catch {
|
|
41454
|
-
|
|
41467
|
+
const resolved = await resolveLink(link4, expectedOrigin);
|
|
41468
|
+
assertTrustedShareOrigin(resolved, expectedOrigin);
|
|
41469
|
+
return (dependencies.inspect ?? inspectShare)(resolved, { expectedOrigin });
|
|
41455
41470
|
}
|
|
41471
|
+
assertTrustedShareOrigin(link4, expectedOrigin);
|
|
41456
41472
|
throw new CLIError("UNSUPPORTED_LINK", "native bearer links are opaque; receive the link to verify access", 2);
|
|
41457
41473
|
}
|
|
41458
41474
|
function jsonOutput(options, command) {
|
|
@@ -41675,6 +41691,7 @@ function registerShareCommand(program) {
|
|
|
41675
41691
|
} catch {
|
|
41676
41692
|
}
|
|
41677
41693
|
if (nativeLink) {
|
|
41694
|
+
assertTrustedShareOrigin(link4, options.viewerOrigin);
|
|
41678
41695
|
if (shareServices.nativeReader === void 0) throw new CLIError("AUTH_REQUIRED", "native TinyCloud receive is not configured", 3);
|
|
41679
41696
|
const native = await shareServices.nativeReader(link4);
|
|
41680
41697
|
if (maxBytes !== void 0 && native.bytes.byteLength > maxBytes) throw new CLIError("MAX_BYTES_EXCEEDED", "shared content exceeds max-bytes", 7);
|
|
@@ -41687,7 +41704,9 @@ function registerShareCommand(program) {
|
|
|
41687
41704
|
else receiveHuman(output3);
|
|
41688
41705
|
return;
|
|
41689
41706
|
}
|
|
41690
|
-
const
|
|
41707
|
+
const resolved = await resolveLink(link4, options.viewerOrigin);
|
|
41708
|
+
assertTrustedShareOrigin(resolved, options.viewerOrigin);
|
|
41709
|
+
const result = await receiveShare(resolved, {
|
|
41691
41710
|
expectedOrigin: options.viewerOrigin,
|
|
41692
41711
|
...maxBytes === void 0 ? {} : { maxContentBlobBytes: maxBytes }
|
|
41693
41712
|
});
|
|
@@ -41716,7 +41735,7 @@ function registerShareCommand(program) {
|
|
|
41716
41735
|
if (shareServices.records === void 0) throw new CLIError("AUTH_REQUIRED", "sender history storage is not configured", 3);
|
|
41717
41736
|
const result = await listShares(shareServices.records);
|
|
41718
41737
|
if (json) writeJson2({ protocol: "tinycloud-share", version: 1, shares: result });
|
|
41719
|
-
else process.stdout.write(result.map((item) => `${item.shareId} ${item.target} ${item.expiresAt}`).join("\n") + (result.length ? "\n" : ""));
|
|
41738
|
+
else process.stdout.write(result.map((item) => `${item.shareId} ${item.target} ${item.expiresAt} ${item.revoked ? "revoked" : Date.parse(item.expiresAt) < Date.now() ? "expired" : "active"}`).join("\n") + (result.length ? "\n" : ""));
|
|
41720
41739
|
} catch (error) {
|
|
41721
41740
|
return handleError(shareCliError(error));
|
|
41722
41741
|
}
|