3 Commits

Author SHA1 Message Date
Indrawan I.
67be3acc6e fix: proper error handler (#23)
* re use legacy errors

* 8.3.6-alpha
2026-05-14 09:56:52 +07:00
SNEK WAIFU
e92cb6ca8a ee 2026-05-14 08:09:23 +07:00
SNEK WAIFU
85a45cf575 eeee 2026-05-14 08:09:04 +07:00
3 changed files with 72 additions and 72 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "lustpress", "name": "lustpress",
"version": "8.3.4-alpha", "version": "8.3.6-alpha",
"description": "RESTful and experimental API for PH and other R18 websites", "description": "RESTful and experimental API for PH and other R18 websites",
"main": "src/index.ts", "main": "src/index.ts",
"scripts": { "scripts": {

View File

@@ -9,7 +9,7 @@ const keyv = process.env.REDIS_URL
: new Keyv(); : new Keyv();
keyv.on("error", (err) => console.log("Connection Error", err)); keyv.on("error", (err) => console.log("Connection Error", err));
const ttl = 1000 * 60 * 60 * Number(process.env.EXPIRE_CACHE); const ttl = 1000 * 60 * 60 * Number(process.env.EXPIRE_CACHE || "1");
const GEO_TIMEOUT_MS = 3000; const GEO_TIMEOUT_MS = 3000;
let cachedLastLocation: string | null = null; let cachedLastLocation: string | null = null;
@@ -88,7 +88,7 @@ class LustPress {
const domain = new URL(url).hostname; const domain = new URL(url).hostname;
const headers: Record<string, string> = { const headers: Record<string, string> = {
"User-Agent": isPornhub ? this.browserUA : this.useragent, "User-Agent": isPornhub ? this.browserUA : this.useragent
}; };
if (isPornhub) { if (isPornhub) {

View File

@@ -30,7 +30,6 @@ const app = new Elysia()
server: await lust.getServer(), server: await lust.getServer(),
version: pkg.version, version: pkg.version,
})) }))
.use(scrapeRoutes)
.onError(({ code, error, set }) => { .onError(({ code, error, set }) => {
if (code === "NOT_FOUND") { if (code === "NOT_FOUND") {
set.status = 404; set.status = 404;
@@ -60,6 +59,7 @@ const app = new Elysia()
stack: (error as Error).stack, stack: (error as Error).stack,
}; };
}) })
.use(scrapeRoutes) // reuse legacy error handling
.listen(process.env.PORT || 3000); .listen(process.env.PORT || 3000);
console.log( console.log(