b674f2da by Leff Tubat

Update

1 parent 7c2be8ae
Showing 1 changed file with 10 additions and 1 deletions
......@@ -346,6 +346,7 @@ async function runOpensource(req, res) {
}
async function authenticate(params) {
console.log("349", params)
let data = await fetch(`${hostapi}/e/authenticate/v2`, {
method: "POST",
headers: {
......@@ -354,10 +355,12 @@ async function authenticate(params) {
body: JSON.stringify(params),
referrer: "https://chatgpt.ai-pro.org"
});
console.log("358", data);
return await data.json();
}
async function getLimitedUsage(params) {
console.log("363", params)
let data = await fetch(`${hostapi}/e/get-usage`, {
method: "POST",
headers: {
......@@ -366,9 +369,11 @@ async function getLimitedUsage(params) {
body: JSON.stringify(params),
referrer: "https://chatgpt.ai-pro.org"
});
console.log("372", data);
return await data.json();
}
async function getUsage(params) {
console.log("376", params)
let data = await fetch(`${hostapi}/e/get-chat-usage`, {
method: "POST",
headers: {
......@@ -377,9 +382,11 @@ async function getUsage(params) {
body: JSON.stringify(params),
referrer: "https://chatgpt.ai-pro.org"
});
console.log("373", data);
return await data.json();
}
async function setUsage(params) {
console.log("389", params)
fetch(`${hostapi}/e/set-usage`, {
method: "POST",
headers: {
......@@ -390,6 +397,7 @@ async function setUsage(params) {
});
}
async function setChatUsage(params) {
console.log("400", params)
fetch(`${hostapi}/e/set-chat-usage`, {
method: "POST",
headers: {
......@@ -401,13 +409,14 @@ async function setChatUsage(params) {
}
async function validation (aiwp_app_id, req, res) {
const aiwp_logged_in = req.cookies[user_secret_id] ? decodeURIComponent(req.cookies[user_secret_id]) : "asdasd";
const aiwp_logged_in = req.cookies[user_secret_id] ? decodeURIComponent(req.cookies[user_secret_id]) : "";
const limit = req.cookies["WcvYPABR"] ? parseInt(req.cookies["WcvYPABR"].replace(/\D/g, '')) : -1;
let IS_FREE_USER = false;
let TRIED_USAGE = 0;
if (aiwp_logged_in) {
let auth = await authenticate({ "aiwp_logged_in": aiwp_logged_in, "user_event_data": {}, "user_event": "endpoint" });
console.log(auth)
if (!auth.success) {
IS_FREE_USER = true;
if (auth.is_restrict) {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!