tangled
alpha
login
or
join now
nekomimi.pet
/
wisp.place-monorepo
88
fork
atom
Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol.
wisp.place
88
fork
atom
overview
issues
9
pulls
pipelines
fix objectObject
nekomimi.pet
1 month ago
6247e223
36b19a19
+10
-5
3 changed files
expand all
collapse all
unified
split
bun.lock
packages
@wispplace
fs-utils
package.json
src
tree.ts
+1
bun.lock
···
189
189
"version": "1.0.0",
190
190
"dependencies": {
191
191
"@atproto/api": "^0.18.17",
192
192
+
"@wispplace/atproto-utils": "workspace:*",
192
193
"@wispplace/lexicons": "workspace:*",
193
194
},
194
195
},
+1
packages/@wispplace/fs-utils/package.json
···
33
33
},
34
34
"dependencies": {
35
35
"@atproto/api": "^0.18.17",
36
36
+
"@wispplace/atproto-utils": "workspace:*",
36
37
"@wispplace/lexicons": "workspace:*"
37
38
}
38
39
}
+8
-5
packages/@wispplace/fs-utils/src/tree.ts
···
1
1
import type { BlobRef } from "@atproto/api";
2
2
import type { Directory, Entry, File } from "@wispplace/lexicons/types/place/wisp/fs";
3
3
+
import { extractBlobCid } from "@wispplace/atproto-utils";
3
4
4
5
export interface UploadedFile {
5
6
name: string;
···
256
257
collectFileCidsFromEntries(node.entries, currentPath, fileCids);
257
258
} else if ('type' in node && node.type === 'file' && 'blob' in node) {
258
259
const fileNode = node as File;
259
259
-
if (fileNode.blob && fileNode.blob.ref) {
260
260
-
const ref = fileNode.blob.ref;
261
261
-
// Handle both CID instances (CBOR/firehose) and IPLD link objects { $link } (JSON API)
262
262
-
const cid = (typeof ref === 'object' && '$link' in ref) ? (ref as { $link: string }).$link : ref.toString();
263
263
-
fileCids[currentPath] = cid;
260
260
+
if (fileNode.blob) {
261
261
+
const cid = extractBlobCid(fileNode.blob);
262
262
+
if (cid) {
263
263
+
fileCids[currentPath] = cid;
264
264
+
} else {
265
265
+
console.warn(`[collectFileCids] Could not extract CID for file: ${currentPath}`);
266
266
+
}
264
267
}
265
268
}
266
269
}