+ );
+}
+
+/**
+ * MirrorView - Mirror a blob to another server
*/
function MirrorView({
sourceUrl,
@@ -797,7 +1074,7 @@ function MirrorView({
}
/**
- * DeleteView - Delete a blob from a server (placeholder)
+ * DeleteView - Delete a blob from a server
*/
function DeleteView({
sha256,
diff --git a/src/lib/blossom-parser.ts b/src/lib/blossom-parser.ts
index afa8816..7a20c58 100644
--- a/src/lib/blossom-parser.ts
+++ b/src/lib/blossom-parser.ts
@@ -3,33 +3,33 @@
*
* Parses arguments for the blossom command with subcommands:
* - servers: Show/manage user's Blossom server list
- * - check : Check if a server is online
- * - upload : Upload a file (handled by UI file picker)
+ * - upload: Upload a file (handled by UI file picker)
* - list [pubkey]: List blobs for a user
+ * - blob [server]: View a specific blob
* - mirror : Mirror a blob to another server
+ * - delete : Delete a blob from a server
*/
import { nip19 } from "nostr-tools";
export type BlossomSubcommand =
| "servers"
- | "check"
| "upload"
| "list"
+ | "blob"
| "mirror"
| "delete";
export interface BlossomCommandResult {
subcommand: BlossomSubcommand;
- // For 'check' subcommand
+ // For 'blob' and 'delete' subcommands
+ sha256?: string;
serverUrl?: string;
// For 'list' subcommand
pubkey?: string;
// For 'mirror' subcommand
sourceUrl?: string;
targetServer?: string;
- // For 'delete' subcommand
- sha256?: string;
}
/**
@@ -91,9 +91,9 @@ function resolvePubkey(
*
* Usage:
* blossom servers - Show your Blossom servers
- * blossom check - Check server health
* blossom upload - Open upload dialog
* blossom list [pubkey] - List blobs (defaults to $me)
+ * blossom blob [server] - View blob details
* blossom mirror - Mirror blob to server
* blossom delete - Delete blob from server
*/
@@ -113,16 +113,6 @@ export function parseBlossomCommand(
case "server":
return { subcommand: "servers" };
- case "check": {
- if (args.length < 2) {
- throw new Error("Server URL required. Usage: blossom check ");
- }
- return {
- subcommand: "check",
- serverUrl: normalizeServerUrl(args[1]),
- };
- }
-
case "upload":
return { subcommand: "upload" };
@@ -149,6 +139,24 @@ export function parseBlossomCommand(
};
}
+ case "blob":
+ case "view": {
+ if (args.length < 2) {
+ throw new Error(
+ "SHA256 hash required. Usage: blossom blob [server]",
+ );
+ }
+ const sha256 = args[1].toLowerCase();
+ if (!/^[0-9a-f]{64}$/.test(sha256)) {
+ throw new Error("Invalid SHA256 hash. Must be 64 hex characters.");
+ }
+ return {
+ subcommand: "blob",
+ sha256,
+ serverUrl: args[2] ? normalizeServerUrl(args[2]) : undefined,
+ };
+ }
+
case "mirror": {
if (args.length < 3) {
throw new Error(
@@ -186,9 +194,9 @@ export function parseBlossomCommand(
Available subcommands:
servers Show your configured Blossom servers
- check Check if a server is online
upload Open file upload dialog
list [pubkey] List blobs (defaults to your account)
+ blob [server] View blob details
mirror Mirror a blob to another server
delete Delete a blob from a server`,
);
diff --git a/src/types/man.ts b/src/types/man.ts
index 0fb814e..1f5fbec 100644
--- a/src/types/man.ts
+++ b/src/types/man.ts
@@ -528,10 +528,6 @@ export const manPages: Record = {
description:
"Show your configured Blossom servers from kind 10063 event",
},
- {
- flag: "check ",
- description: "Check if a Blossom server is online and responsive",
- },
{
flag: "upload",
description:
@@ -542,6 +538,11 @@ export const manPages: Record = {
description:
"List blobs uploaded by a user (defaults to your account). Supports npub, hex, or $me",
},
+ {
+ flag: "blob [server]",
+ description:
+ "View details and preview of a specific blob by its SHA256 hash",
+ },
{
flag: "mirror ",
description: "Mirror a blob from a URL to another Blossom server",
@@ -554,11 +555,11 @@ export const manPages: Record = {
examples: [
"blossom Show your Blossom servers",
"blossom servers Show your Blossom servers",
- "blossom check cdn.satellite.earth Check if server is online",
"blossom upload Open file upload dialog",
"blossom list List your uploaded blobs",
"blossom list $me List your uploaded blobs",
"blossom list npub1... List blobs for another user",
+ "blossom blob abc123... View blob details",
"blossom mirror https://... cdn.example.com Mirror blob to server",
],
seeAlso: ["profile"],