Files
usenet-indexer/start/routes.ts
T
Daan MeijerandClaude Opus 5.5 41859636d3
Test and deploy / test (push) Successful in 1m28s
Test and deploy / deploy (push) Successful in 2m5s
Seed relay: nodes get their headers through the seed API
The seed API keeps a pool of NNTP connections (SEED_NNTP_CONNECTIONS) and
serves GET /api/v1/seed/ranges/:id/chunk?from=&to= for leased ranges:
the gzip stream the news server sent, passed on unopened. seed:node fetches
that way by default (SEED_FETCH=relay), so a node needs only a token and
SEED_CONNECTIONS; SEED_FETCH=direct keeps its own NNTP connections. All
fetching then comes from the indexer's IP (the account allows two).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 15:24:39 +02:00

65 lines
2.4 KiB
TypeScript

/*
|--------------------------------------------------------------------------
| Routes file
|--------------------------------------------------------------------------
|
| The routes file is used for defining the HTTP routes.
|
*/
import { middleware } from '#start/kernel'
import router from '@adonisjs/core/services/router'
import { controllers } from '#generated/controllers'
const ReleasesController = () => import('#controllers/releases_controller')
const NewznabController = () => import('#controllers/newznab_controller')
const SeedController = () => import('#controllers/seed_controller')
// Newznab API for Prowlarr / Sonarr / Radarr ("Generic Newznab", API path /api).
router.get('/api', [NewznabController, 'handle'])
// Web interface: public/index.html is served by the static middleware at "/".
router
.group(() => {
router.get('releases', [ReleasesController, 'index'])
router.get('releases/:id', [ReleasesController, 'show']).where('id', router.matchers.number())
router.get('releases/:id/nzb', [ReleasesController, 'nzb']).where('id', router.matchers.number())
router.get('releases/:id/image', [ReleasesController, 'image']).where('id', router.matchers.number())
router.get('stats', [ReleasesController, 'stats'])
})
.prefix('/api/v1')
router
.group(() => {
router
.group(() => {
router.post('signup', [controllers.NewAccount, 'store'])
router.post('login', [controllers.AccessTokens, 'store'])
})
.prefix('auth')
.as('auth')
router
.group(() => {
router.get('profile', [controllers.Profile, 'show'])
router.post('logout', [controllers.AccessTokens, 'destroy'])
})
.prefix('account')
.as('profile')
.use(middleware.auth())
})
.prefix('/api/v1')
// Seed API for remote seeding nodes (CONCEPT.md D38); the only routes traefik exposes publicly.
router
.group(() => {
router.post('lease', [SeedController, 'lease'])
router.post('ranges/:id/batches', [SeedController, 'batch']).where('id', router.matchers.number())
router.get('ranges/:id/chunk', [SeedController, 'chunk']).where('id', router.matchers.number())
router.post('ranges/:id/done', [SeedController, 'done']).where('id', router.matchers.number())
router.post('ranges/:id/release', [SeedController, 'release']).where('id', router.matchers.number())
router.get('status', [SeedController, 'status'])
})
.prefix('/api/v1/seed')
.use(middleware.seedNode())