Update
Showing
1 changed file
with
7 additions
and
10 deletions
| ... | @@ -66,9 +66,6 @@ const rateLimiter = rateLimit({ | ... | @@ -66,9 +66,6 @@ const rateLimiter = rateLimit({ |
| 66 | const app = express() | 66 | const app = express() |
| 67 | const port = 3080 | 67 | const port = 3080 |
| 68 | 68 | ||
| 69 | app.set('trust proxy', 1) | ||
| 70 | app.use(express.json()) | ||
| 71 | app.use(express.urlencoded({ extended: true })) | ||
| 72 | app.use(bodyParser.json()) | 69 | app.use(bodyParser.json()) |
| 73 | app.use(cors()) | 70 | app.use(cors()) |
| 74 | app.use(require('morgan')('dev')) | 71 | app.use(require('morgan')('dev')) |
| ... | @@ -82,11 +79,11 @@ const user_secret_id = process.env.USER_SECRET_ID || "aiwp_logged_in"; | ... | @@ -82,11 +79,11 @@ const user_secret_id = process.env.USER_SECRET_ID || "aiwp_logged_in"; |
| 82 | const aiwp_app_id = "chatbot+"; | 79 | const aiwp_app_id = "chatbot+"; |
| 83 | // Primary Open AI Route | 80 | // Primary Open AI Route |
| 84 | app.post('/api', async (req, res) => { | 81 | app.post('/api', async (req, res) => { |
| 85 | if(!req.get('origin') || (!req.get('origin').includes(req.get('host')))) { | 82 | // if(!req.get('origin') || (!req.get('origin').includes(req.get('host')))) { |
| 86 | res.status(401); | 83 | // res.status(401); |
| 87 | res.send('Method Not Allowed'); | 84 | // res.send('Method Not Allowed'); |
| 88 | return; | 85 | // return; |
| 89 | } | 86 | // } |
| 90 | const { message, currentModel, temperature } = req.body; | 87 | const { message, currentModel, temperature } = req.body; |
| 91 | 88 | ||
| 92 | if (currentModel == "gpt-3.5-turbo" || currentModel == "gpt-3.5-turbo-0301") { | 89 | if (currentModel == "gpt-3.5-turbo" || currentModel == "gpt-3.5-turbo-0301") { |
| ... | @@ -405,13 +402,13 @@ async function setChatUsage(params) { | ... | @@ -405,13 +402,13 @@ async function setChatUsage(params) { |
| 405 | } | 402 | } |
| 406 | 403 | ||
| 407 | async function validation (aiwp_app_id, req, res) { | 404 | async function validation (aiwp_app_id, req, res) { |
| 408 | const aiwp_logged_in = req.cookies[user_secret_id] ? decodeURIComponent(req.cookies[user_secret_id]) : ""; | 405 | const aiwp_logged_in = req.cookies[user_secret_id] ? decodeURIComponent(req.cookies[user_secret_id]) : "asdasd"; |
| 409 | const limit = req.cookies["WcvYPABR"] ? parseInt(req.cookies["WcvYPABR"].replace(/\D/g, '')) : -1; | 406 | const limit = req.cookies["WcvYPABR"] ? parseInt(req.cookies["WcvYPABR"].replace(/\D/g, '')) : -1; |
| 410 | let IS_FREE_USER = false; | 407 | let IS_FREE_USER = false; |
| 411 | let TRIED_USAGE = 0; | 408 | let TRIED_USAGE = 0; |
| 412 | 409 | ||
| 413 | if (aiwp_logged_in) { | 410 | if (aiwp_logged_in) { |
| 414 | let auth = await authenticate({ aiwp_logged_in, user_event_data: {}, user_event: 'endpoint' }); | 411 | let auth = await authenticate({ "aiwp_logged_in": aiwp_logged_in, "user_event_data": {}, "user_event": "endpoint" }); |
| 415 | if (!auth.success) { | 412 | if (!auth.success) { |
| 416 | IS_FREE_USER = true; | 413 | IS_FREE_USER = true; |
| 417 | if (auth.is_restrict) { | 414 | if (auth.is_restrict) { | ... | ... |
-
Please register or sign in to post a comment