Skip to content

Commit

Permalink
sameorgun
Browse files Browse the repository at this point in the history
  • Loading branch information
RedNotSus committed Nov 16, 2024
1 parent 109fca3 commit 5d8a64f
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ app.post("/api/chat", async (req, res) => {
Authorization: `Bearer ${process.env.API_KEY}`,
"Content-Type": "application/json",
},
},
}
);
if (response.status === 429) {
switchModel();
Expand All @@ -102,7 +102,7 @@ app.post("/api/chat", async (req, res) => {
Authorization: `Bearer ${process.env.API_KEY}`,
"Content-Type": "application/json",
},
},
}
);
const aiResponse = response.data.choices[0].message.content;
conversation.push({ role: "assistant", content: aiResponse });
Expand Down Expand Up @@ -177,7 +177,7 @@ app.post("/api/signUp", async (req, res) => {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
},
}
);

if (!captchaVerifyResponse.data.success) {
Expand All @@ -197,7 +197,7 @@ app.post("/api/signUp", async (req, res) => {
Authorization: process.env.workerAUTH,
"Content-Type": "application/json",
},
},
}
);

res.status(200).json(response.data);
Expand Down Expand Up @@ -226,7 +226,7 @@ app.post("/api/login", async (req, res) => {
Authorization: process.env.workerAUTH,
"Content-Type": "application/json",
},
},
}
);

res.status(200).json(response.data);
Expand All @@ -252,7 +252,7 @@ app.post("/api/checkPremium", async (req, res) => {
Authorization: process.env.workerAUTH,
"Content-Type": "application/json",
},
},
}
);

res.status(200).json(response.data);
Expand Down Expand Up @@ -280,7 +280,7 @@ app.post("/api/uploadSave", async (req, res) => {
Authorization: process.env.workerAUTH,
"Content-Type": "application/json",
},
},
}
);

res.status(200).json(response.data);
Expand All @@ -306,14 +306,19 @@ app.post("/api/readSave", async (req, res) => {
Authorization: process.env.workerAUTH,
"Content-Type": "application/json",
},
},
}
);

res.status(200).json(response.data);
} catch (error) {
res.status(500).json({ error: error });
}
});

app.use((req, res, next) => {
res.setHeader("X-Frame-Options", "SAMEORIGIN");
next();
});
app.use(express.static(path.join(__dirname, "static")));

const routes = [
Expand Down Expand Up @@ -349,7 +354,7 @@ async function fetchDataFromGithub(
res,
next,
baseUrl,
secondaryUrl = null,
secondaryUrl = null
) {
function isAFile(urlString) {
return urlString.trim().split("/").pop().length !== 0;
Expand Down

0 comments on commit 5d8a64f

Please sign in to comment.