Conversation
| "0123456789abcdef0123456789abcdef01234567" | ||
| ); | ||
|
|
||
| expect(normalizeInfoHash("AERUKZ4JVPG66AJDIVTYTK6N54ASGRLH")).toBe( |
There was a problem hiding this comment.
we would never see this kind of info hash. what is this?
| test("extracts hash from magnet", () => { | ||
| expect(infoHashFromMagnet("magnet:?xt=urn:btih:0123456789abcdef0123456789abcdef01234567")).toBe( | ||
| "0123456789abcdef0123456789abcdef01234567" | ||
| ); | ||
| expect(infoHashFromMagnet("https://example.com")).toBeNull(); | ||
| }); |
There was a problem hiding this comment.
remove all code that deals with magnet links. our code does not need to handle magnet links.
| test("computes info hash from torrent bytes", () => { | ||
| const payload = Buffer.from("d8:announce13:http://t/4:infod4:name4:test12:piece lengthi16384e6:lengthi10e6:pieces20:12345678901234567890ee", "ascii"); | ||
| expect(infoHashFromTorrentBytes(payload)).toBe("800f59e21e8f1129643a478cd402b4180f410435"); | ||
| }); |
There was a problem hiding this comment.
we shouldn't really need to compute info hash from the actual info dict either. it will always be present on Torznab items
| const transcodeStatusPath = path.join(dataDir, "transcode-status.json"); | ||
| const libraryIndexPath = path.join(dataDir, "library-index.json"); | ||
| const probeCachePath = path.join(dataDir, "probe-cache.json"); |
There was a problem hiding this comment.
the data currently in these json files - we should store it in the sqlite database.
| for (const media of mediaList) { | ||
| const query = `${book.title} ${book.author}`.trim(); | ||
| const results = await runSearch(settings, { query, media }); | ||
| for (const result of results.slice(0, 3)) { |
There was a problem hiding this comment.
why do we just blindly snatch all top 3 search results?
| throw new Error("Unsupported info hash format"); | ||
| } | ||
|
|
||
| export function infoHashFromMagnet(url: string): string | null { |
There was a problem hiding this comment.
magnets are out of scope. remove
| if (trimmed.length === 32 && /^[a-zA-Z2-7]+$/.test(trimmed)) { | ||
| return Buffer.from(base32ToBytes(trimmed)).toString("hex"); | ||
| } |
There was a problem hiding this comment.
base 32 info hashes are not a thing.
| @@ -0,0 +1,156 @@ | |||
| import { createHash } from "node:crypto"; | |||
There was a problem hiding this comment.
I think we should take a dep on bencode.
| if (!authorizeRequest(request, settings)) { | ||
| return new Response("Unauthorized", { | ||
| status: 401, | ||
| headers: { "WWW-Authenticate": 'Bearer realm="kindling"' }, |
There was a problem hiding this comment.
remove all references to "kindling" - the reason we implemented it inside podible is because this is what I want podible to be.
Summary
PLAN.mdcapturing goals, architecture, data model, job semantics, jobs, APIs, integrations, and testing expectations for the Kindling backend rewriteTesting