Merge branch '30852_chatbot_chatgpt' into 'master'
30852_chatbot_chatgpt See merge request !104
Showing
1 changed file
with
10 additions
and
1 deletions
| ... | @@ -346,6 +346,7 @@ async function runOpensource(req, res) { | ... | @@ -346,6 +346,7 @@ async function runOpensource(req, res) { |
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | async function authenticate(params) { | 348 | async function authenticate(params) { |
| 349 | console.log("349", params) | ||
| 349 | let data = await fetch(`${hostapi}/e/authenticate/v2`, { | 350 | let data = await fetch(`${hostapi}/e/authenticate/v2`, { |
| 350 | method: "POST", | 351 | method: "POST", |
| 351 | headers: { | 352 | headers: { |
| ... | @@ -354,10 +355,12 @@ async function authenticate(params) { | ... | @@ -354,10 +355,12 @@ async function authenticate(params) { |
| 354 | body: JSON.stringify(params), | 355 | body: JSON.stringify(params), |
| 355 | referrer: "https://chatgpt.ai-pro.org" | 356 | referrer: "https://chatgpt.ai-pro.org" |
| 356 | }); | 357 | }); |
| 358 | console.log("358", data); | ||
| 357 | return await data.json(); | 359 | return await data.json(); |
| 358 | } | 360 | } |
| 359 | 361 | ||
| 360 | async function getLimitedUsage(params) { | 362 | async function getLimitedUsage(params) { |
| 363 | console.log("363", params) | ||
| 361 | let data = await fetch(`${hostapi}/e/get-usage`, { | 364 | let data = await fetch(`${hostapi}/e/get-usage`, { |
| 362 | method: "POST", | 365 | method: "POST", |
| 363 | headers: { | 366 | headers: { |
| ... | @@ -366,9 +369,11 @@ async function getLimitedUsage(params) { | ... | @@ -366,9 +369,11 @@ async function getLimitedUsage(params) { |
| 366 | body: JSON.stringify(params), | 369 | body: JSON.stringify(params), |
| 367 | referrer: "https://chatgpt.ai-pro.org" | 370 | referrer: "https://chatgpt.ai-pro.org" |
| 368 | }); | 371 | }); |
| 372 | console.log("372", data); | ||
| 369 | return await data.json(); | 373 | return await data.json(); |
| 370 | } | 374 | } |
| 371 | async function getUsage(params) { | 375 | async function getUsage(params) { |
| 376 | console.log("376", params) | ||
| 372 | let data = await fetch(`${hostapi}/e/get-chat-usage`, { | 377 | let data = await fetch(`${hostapi}/e/get-chat-usage`, { |
| 373 | method: "POST", | 378 | method: "POST", |
| 374 | headers: { | 379 | headers: { |
| ... | @@ -377,9 +382,11 @@ async function getUsage(params) { | ... | @@ -377,9 +382,11 @@ async function getUsage(params) { |
| 377 | body: JSON.stringify(params), | 382 | body: JSON.stringify(params), |
| 378 | referrer: "https://chatgpt.ai-pro.org" | 383 | referrer: "https://chatgpt.ai-pro.org" |
| 379 | }); | 384 | }); |
| 385 | console.log("373", data); | ||
| 380 | return await data.json(); | 386 | return await data.json(); |
| 381 | } | 387 | } |
| 382 | async function setUsage(params) { | 388 | async function setUsage(params) { |
| 389 | console.log("389", params) | ||
| 383 | fetch(`${hostapi}/e/set-usage`, { | 390 | fetch(`${hostapi}/e/set-usage`, { |
| 384 | method: "POST", | 391 | method: "POST", |
| 385 | headers: { | 392 | headers: { |
| ... | @@ -390,6 +397,7 @@ async function setUsage(params) { | ... | @@ -390,6 +397,7 @@ async function setUsage(params) { |
| 390 | }); | 397 | }); |
| 391 | } | 398 | } |
| 392 | async function setChatUsage(params) { | 399 | async function setChatUsage(params) { |
| 400 | console.log("400", params) | ||
| 393 | fetch(`${hostapi}/e/set-chat-usage`, { | 401 | fetch(`${hostapi}/e/set-chat-usage`, { |
| 394 | method: "POST", | 402 | method: "POST", |
| 395 | headers: { | 403 | headers: { |
| ... | @@ -401,13 +409,14 @@ async function setChatUsage(params) { | ... | @@ -401,13 +409,14 @@ async function setChatUsage(params) { |
| 401 | } | 409 | } |
| 402 | 410 | ||
| 403 | async function validation (aiwp_app_id, req, res) { | 411 | async function validation (aiwp_app_id, req, res) { |
| 404 | const aiwp_logged_in = req.cookies[user_secret_id] ? decodeURIComponent(req.cookies[user_secret_id]) : "asdasd"; | 412 | const aiwp_logged_in = req.cookies[user_secret_id] ? decodeURIComponent(req.cookies[user_secret_id]) : ""; |
| 405 | const limit = req.cookies["WcvYPABR"] ? parseInt(req.cookies["WcvYPABR"].replace(/\D/g, '')) : -1; | 413 | const limit = req.cookies["WcvYPABR"] ? parseInt(req.cookies["WcvYPABR"].replace(/\D/g, '')) : -1; |
| 406 | let IS_FREE_USER = false; | 414 | let IS_FREE_USER = false; |
| 407 | let TRIED_USAGE = 0; | 415 | let TRIED_USAGE = 0; |
| 408 | 416 | ||
| 409 | if (aiwp_logged_in) { | 417 | if (aiwp_logged_in) { |
| 410 | let auth = await authenticate({ "aiwp_logged_in": aiwp_logged_in, "user_event_data": {}, "user_event": "endpoint" }); | 418 | let auth = await authenticate({ "aiwp_logged_in": aiwp_logged_in, "user_event_data": {}, "user_event": "endpoint" }); |
| 419 | console.log(auth) | ||
| 411 | if (!auth.success) { | 420 | if (!auth.success) { |
| 412 | IS_FREE_USER = true; | 421 | IS_FREE_USER = true; |
| 413 | if (auth.is_restrict) { | 422 | if (auth.is_restrict) { | ... | ... |
-
Please register or sign in to post a comment