new api refactor setup

This commit is contained in:
bootunloader
2025-12-31 07:56:38 +02:00
parent 15f62eaebf
commit c91fed55bb
8 changed files with 345 additions and 35 deletions

View File

@@ -42,11 +42,10 @@ async function authenticateDB() {
async function ensureAuthenticated() {
try {
console.log("⏳ Ensuring authentication with SurrealDB...");
await db.query("RETURN 1");
} catch (error: any) {
if (error.status === 401) {
console.warn("⚠️ Token expired. Attempting reconnection...");
console.warn("⚠️ SurrealDB Auth token expired. Attempting reconnection...");
try {
// Full reconnection instead of just re-authentication
await db.close();

View File

@@ -3,10 +3,10 @@ export const constants = {
SESSION_EXPIRE_TIME_MS: 6 * 60 * 60 * 1000,
POST_SESSION_KEY: "postsession",
LAST_FETCHED_KEY: "LAST_FETCHED",
SCRAP_API_URL: "https://ritmugold.com:8443/lottery",
SCRAP_API_URL: "https://gamebooking24.com/lottery-api",
SCRAP_API_SESSION_KEY: "SRAJWT",
SCRAP_API_BASE_HEADERS: {
Host: "ritmugold.com:8443",
Host: "gamebooking24.com",
"Sec-Ch-Ua": '"Not/A)Brand";v="8", "Chromium";v="126"',
"Sec-Ch-Ua-Mobile": "?0",
"Sec-Ch-Ua-Platform": '"Windows"',
@@ -17,8 +17,8 @@ export const constants = {
"Accept-Language": "en-US,en;q=0.9",
"Access-Control-Allow-Origin": "*",
Accept: "application/json, text/plain, */*",
Origin: "https://www.ritmugold.com",
Referer: "https://www.ritmugold.com/",
Origin: "https://gamebooking24.com",
Referer: "https://gamebooking24.com/",
Priority: "u=1, i",
},
};
@@ -145,23 +145,9 @@ export const LEXICODE_MATHCER_PATTERNS = {
export const SCHEMES = {
normal: {
"1 digit": [
"a.+a",
"a.++a",
"a.+++a",
"+a.++a",
"+a.+++a",
"++a.+++a",
"a.+a.++a.+++a",
],
"1 digit": ["a.+a", "a.++a", "a.+++a", "+a.++a", "+a.+++a", "++a.+++a", "a.+a.++a.+++a"],
"2 digit": ["ab.+ab", "ab.++ab", "+ab.++ab", "ab.+ab.++ab"],
"3 digit": [
"abc.ab",
"abc.++ab",
"abc.+abc",
"abc.+ab.++ab",
"abc.+abc.ab.++ab",
],
"3 digit": ["abc.ab", "abc.++ab", "abc.+abc", "abc.+ab.++ab", "abc.+abc.ab.++ab"],
"4 digit": [
"abcd.ab",
"abcd.+ab",
@@ -179,19 +165,7 @@ export const SCHEMES = {
],
},
permutations: {
default: [
"ab",
"+ab",
"++ab",
"a+b",
"+a+b",
"a++b",
"abc",
"+abc",
"a+bc",
"ab+c",
"abcd",
],
default: ["ab", "+ab", "++ab", "a+b", "+a+b", "a++b", "abc", "+abc", "a+bc", "ab+c", "abcd"],
"2 digit": ["ab.+ab", "ab.++ab", "+ab.++ab", "ab.+ab.++ab"],
"3 digit": ["abc.ab", "abc.++ab", "abc.+abc", "abc.+abc.ab.++ab"],
"4 digit": [