Search and the web interface use the prober's findings
- Search matches a word in the name or the inner name (trigram index on inner_name, partial, built concurrently); "Readable names" includes releases with an inner name. - unlocked=1 (chip "No password") leaves out passworded releases. - Results carry passworded and innerName: a Password badge, the inner name under the release name. - The release view: Inside and Inspected facts, a passworded notice, and Contents (per probed article its yEnc name, kind, type, encryption and the names inside) from release_inspections. - Newznab: the password attribute from the prober; an obfuscated release with an inner name is included, titled by it (without its extension). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5ab5399b43
commit
92480174b9
8 files changed
+177
-16
No files matched your search
@@ -80,4 +80,37 @@ test.group('Releases API', (group) => {
|
||||
assert.include((await client.get('/api?t=get&id=999999')).text(), 'code="300"')
|
||||
assert.include((await client.get('/api?t=nope')).text(), 'code="202"')
|
||||
})
|
||||
|
||||
test("the prober's findings: inner names in search and Newznab titles, passworded filtered and marked", async ({ client, assert }) => {
|
||||
const [g] = await db.table('groups').insert({ name: GROUP, priority: 1 }).returning('id')
|
||||
const [n] = await db.table('nodes').insert({ name: 'api-node' }).returning('id')
|
||||
const [r] = await db.table('ranges').insert({ group_id: g.id, start_id: 1, end_id: 1000, next_id: 1, status: 'leased', node_id: n.id }).returning('id')
|
||||
const indexer = new RangeIndexer({ group: GROUP, start: 1, end: 1000, rules: { ...DEFAULT_RULES, samplePercent: 0, droppedSignatures: [], priorities: { [GROUP]: 1 } } })
|
||||
indexer.add([...file('Some.Show.S01E01.1080p.WEB.mkv', 'Some.Show.S01E01.1080p.WEB [1/1]', 2, 100), ...file('Other.Movie.2024.2160p.BluRay.x265.mkv', 'Other.Movie.2024.2160p.BluRay.x265 [1/1]', 1, 300)], 1001)
|
||||
indexer.finish()
|
||||
await BatchStore.store(Number(r.id), Number(n.id), indexer.take())
|
||||
const show = await db.from('releases').where('name', 'ilike', '%show%').firstOrFail()
|
||||
const movie = await db.from('releases').where('name', 'ilike', '%movie%').firstOrFail()
|
||||
// As the prober leaves them: the movie's archive is encrypted, the show holds a differently named file.
|
||||
await db.from('releases').where('id', movie.id).update({ passworded: true, inspected_at: new Date() })
|
||||
await db.from('releases').where('id', show.id).update({ passworded: false, inner_name: 'Hidden.Gem.2023.mkv', readable: false, inspected_at: new Date() })
|
||||
await db.table('release_inspections').insert({ release_id: show.id, candidate_id: 1, kind: 'archive', result: JSON.stringify({ yencName: 'x.rar', size: 1, type: 'rar5', names: ['Hidden.Gem.2023.mkv'], entries: 1, passworded: false }) })
|
||||
|
||||
const byInner = (await client.get('/api/v1/releases?q=hidden gem')).body() as { releases: { id: number; innerName: string }[] }
|
||||
assert.deepEqual(byInner.releases.map((x) => [x.id, x.innerName]), [[Number(show.id), 'Hidden.Gem.2023.mkv']])
|
||||
// Readable by its inner name.
|
||||
const readable = (await client.get('/api/v1/releases?readable=1')).body() as { releases: { id: number }[] }
|
||||
assert.lengthOf(readable.releases, 2)
|
||||
const unlocked = (await client.get('/api/v1/releases?unlocked=1')).body() as { releases: { id: number; passworded: boolean }[] }
|
||||
assert.deepEqual(unlocked.releases.map((x) => x.id), [Number(show.id)])
|
||||
|
||||
const detail = (await client.get(`/api/v1/releases/${show.id}`)).body() as any
|
||||
assert.equal(detail.innerName, 'Hidden.Gem.2023.mkv')
|
||||
assert.deepEqual(detail.inspections.map((i: any) => [i.kind, i.names]), [['archive', ['Hidden.Gem.2023.mkv']]])
|
||||
|
||||
const key = process.env.NEWZNAB_API_KEY
|
||||
const feed = (await client.get(`/api?t=search&q=&apikey=${key ?? ''}`)).text()
|
||||
assert.include(feed, '<title>Hidden.Gem.2023</title>')
|
||||
assert.match(feed, /Other Movie 2024[^]*?name="password" value="1"/)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user