2024-12-03 19:33:43 +00:00
|
|
|
import { Elysia } from 'elysia';
|
2025-10-14 18:53:40 +00:00
|
|
|
import { staticPlugin } from '@elysiajs/static'
|
2024-12-03 19:33:43 +00:00
|
|
|
|
|
|
|
|
import latest from '@/router/latest'
|
|
|
|
|
import search from '@/router/search'
|
|
|
|
|
import transparency from '@/router/transparency'
|
|
|
|
|
import video from '@/router/video'
|
|
|
|
|
import websocket from '@/router/websocket'
|
2025-10-14 18:53:40 +00:00
|
|
|
import html from '@/router/html'
|
2024-12-03 19:33:43 +00:00
|
|
|
|
|
|
|
|
const app = new Elysia()
|
|
|
|
|
app.use(latest)
|
|
|
|
|
app.use(search)
|
|
|
|
|
app.use(transparency)
|
|
|
|
|
app.use(video)
|
|
|
|
|
app.use(websocket)
|
2025-10-14 18:53:40 +00:00
|
|
|
app.use(html)
|
2025-11-16 10:08:02 +00:00
|
|
|
app.onRequest(({ set, url }: any) => {
|
|
|
|
|
set.headers['Onion-Location'] = 'http://tubey5btlzxkcjpxpj2c7irrbhvgu3noouobndafuhbw4i5ndvn4v7qd.onion/' + url.split('/').at(-1)
|
2025-10-14 18:53:40 +00:00
|
|
|
})
|
2024-12-03 19:33:43 +00:00
|
|
|
|
|
|
|
|
process.on('uncaughtException', err => {
|
|
|
|
|
console.log(err)
|
|
|
|
|
})
|
|
|
|
|
|
2025-10-14 18:53:40 +00:00
|
|
|
app.use(staticPlugin({ prefix: '/' }))
|
2024-12-03 19:33:43 +00:00
|
|
|
app.listen(1337);
|
|
|
|
|
console.log(
|
|
|
|
|
`api is running at ${app.server?.hostname}:${app.server?.port}`
|
|
|
|
|
);
|