Spotnet (CONCEPT D29): - Index free.pt fully and import spots with their descriptions, categories and NZBs; a spot renames its release, since Spotnet names are more trustworthy than names derived from subjects. - Find passwords in spot descriptions too, and tell "needs a password we have" from "needs a password we don't have". Content inspection: - List the contents of 7z (.7z.001) archives, SFV sets, nicovideo uploads and other archive-like files; mark yEncBin .bin containers as encrypted. - Take real names from yEnc headers for randomly named files, and merge uploads that were split across posts. Storage (D31, D32): - Store segment lists zstd-compressed behind the FileStore accessor. - group:backfill indexes older headers at low priority and pauses when the NVMe or HDD part of the database gets too large. Grouping (D35, D36): - Lone header segments wait in staged_segments until a second segment of their file arrives, which drops the per-article junk binaries. - Counter grouping joins random-subject uploads by poster, [i/M] counter, part count and day. Search and maintenance (D33, D34): - A trigram-indexed search_text column, smaller indexes, estimated stats. - Passes that clean up nonsense names; weekly index maintenance; GC budgets per kind. - Web UI: grey out stale results while a search runs and cancel superseded requests. Count only up to 1,000 matches for the page, which made filter clicks take seconds (Newznab keeps the 10,000 cap). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
2.2 KiB
TypeScript
41 lines
2.2 KiB
TypeScript
import { test } from '@japa/runner'
|
|
import db from '@adonisjs/lucid/services/db'
|
|
import testUtils from '@adonisjs/core/services/test_utils'
|
|
import FileStore from '#services/FileStore'
|
|
import ContentService from '#services/ContentService'
|
|
|
|
let keys = 0
|
|
async function counterFile(name: string) {
|
|
const now = new Date()
|
|
const [r] = await db
|
|
.table('releases')
|
|
.insert({ release_key: `yenc${++keys}`.padEnd(40, 'y'), name, source: 'weak-stem', groups: '[]', first_seen_at: now, last_seen_at: now })
|
|
.returning('id')
|
|
const [{ id }] = await FileStore.insert([
|
|
{ filename: name, poster: 'bob@home.com', date: now.getTime(), parts: 2, size: 10, release_id: r.id, groups: '["alt.binaries.boneless"]',
|
|
segments: [{ number: 1, id: `${name}@nyuu`, size: 10 }], created_at: now, updated_at: now },
|
|
])
|
|
return db.from('files').where('id', id).first()
|
|
}
|
|
|
|
test.group('Names from the yEnc header', (group) => {
|
|
group.each.setup(() => testUtils.db().withGlobalTransaction())
|
|
|
|
test('random-named files take the yEnc name and gather in its release', async ({ assert }) => {
|
|
const a = await counterFile('P9BSPl59iDfQUVvXFeBVG4MDQaOTufds')
|
|
const b = await counterFile('Faoq6nlEaVlTzYyNA27sSfFm2KvLHOvD')
|
|
const nameFromYenc = (ContentService as any).nameFromYenc.bind(ContentService)
|
|
assert.equal(await nameFromYenc(a, null, 'Deep.Strike.S01E16.1080p.WEB.h264-GRP.part01.rar'), 'Deep.Strike.S01E16.1080p.WEB.h264-GRP.part01.rar')
|
|
await nameFromYenc(b, null, 'Deep.Strike.S01E16.1080p.WEB.h264-GRP.part02.rar')
|
|
const [fa, fb] = await Promise.all([db.from('files').where('id', a.id).first(), db.from('files').where('id', b.id).first()])
|
|
assert.equal(fa.release_id, fb.release_id)
|
|
assert.equal((await db.from('releases').where('id', fa.release_id).first()).name, 'Deep.Strike.S01E16.1080p.WEB.h264-GRP')
|
|
|
|
// A random yEnc name, or a file that has a real name already, stays as it is.
|
|
const c = await counterFile('Vg9QflfNLXVMPOWtK4KRJv474DadgTIF')
|
|
assert.isUndefined(await nameFromYenc(c, null, 'qTcrIl1qTo4Bx6El5c4RtTA4ZSqwd6tz'))
|
|
const d = await counterFile('Some.Release.part01.rar')
|
|
assert.isUndefined(await nameFromYenc(d, null, 'Other.Name.part01.rar'))
|
|
})
|
|
})
|