Skip to content

Commit

Permalink
fix infinitecache
Browse files Browse the repository at this point in the history
  • Loading branch information
skysthelimitt committed Sep 26, 2024
1 parent 2feafe3 commit 2044ee8
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 3 deletions.
52 changes: 52 additions & 0 deletions html/ai.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html class="sl-theme-dark" lang="en">
<head>
<!-- initialize theme vars
https://coolors.co/10002b-240046-3c096c-5a189a-7b2cbf-9d4edd-c77dff-e0aaff -->

<!-- initialize externals -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script src=" https://cdn.jsdelivr.net/npm/[email protected]/dist/js.cookie.min.js "></script>

<!-- initialize my stuff -->
<script src="/js/all.min.js"></script>
<script src="/js/main.js"></script>

<link rel="stylesheet" href="/style.css" />

<!-- seo + other things -->
<title>AI | Selenite</title>
<link rel="icon" href="/favicon.ico" />
</head>
<alerts> </alerts>
<body id="noscroll">
<header>
<a href="/index.html">Home</a>
<a href="/bookmarklets.html">Bookmarklets</a>
<a href="/projects.html">Games</a>
<a href="/apps.html">Apps</a>
<a href="/settings.html">Settings</a>
<a id="blank" href="#">Open Blank</a>
<a href="/u/" class="usericon"><img src="/img/user.svg" /></a>
</header>
<script></script>
<main>
<chat>
<div class="messagebox">
<input type="text" placeholder="Send a message..." class="chatbox">
<button class="sendmsg"></button>
<message class="user">skibidi</message>
<message class="bot">toilet</message>
</div>
</chat>
</main>
<footer class="noscroll">
<a href="https://gitlab.com/skysthelimit.dev/selenite">Source</a>
<a href="https://discord.gg/7jyufnwJNf">Discord</a>
<a href="/suggest.html">Suggestions & Bugs</a>
<a href="/contact.html">Contact</a>
<a href="/support.html">Donate</a>
<a href="/about.html">About</a>
</footer>
</body>
</html>
17 changes: 14 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,22 @@ app.get("/api/infinite/get", async (req, res, next) => {
data = { item: search2.result_item, emoji: search2.result_emoji, new: false };
success = true;
}
if(success) {
res.send(data);
return;
}
data = await infiniteCraft(req.query[1], req.query[2]);
try {
let parse = JSON.parse(data);
let keys = Object.keys(parse);
if (keys.indexOf("item") > -1 && keys.indexOf("emoji") > -1) {
success = true;
parse.new = true;
data = parse;
infiniteCache.create({ 1: req.query[1], 2: req.query[2], result_item: data.item, result_emoji: data.emoji });
}
} catch {
data = {"item": "N/A", "emoji": "N/A"}
}
res.send(data);
}
});
app.use("/api/account/load", async (req, res, next) => {
Expand Down Expand Up @@ -191,6 +193,16 @@ app.use("/admin", async (req, res, next) => {
next();
}
});
app.use("/ai", async (req, res, next) => {
if ((await isAdmin(req.cookies.token)) && (await verifyCookie(req.cookies.token))) {
res
.type("text/html")
.status(200)
.send(await fs.readFile(`./html/ai.html`));
} else {
next();
}
});
app.use("/", express.static("./selenite", { extensions: ["html"] }));
app.use("/data/:id/:file", async (req, res) => {
const id = path.basename(req.params.id);
Expand Down Expand Up @@ -281,7 +293,6 @@ app.post("/api/admin/ban", async (req, res) => {
let status = await banUser(req.body.name, req.body.reason, req.cookies.token);
res.status(200).send(status);
});

const server = app.listen(port, () => {
console.log(log.success("Express is online."));
console.log("- " + log.info("http://localhost:" + port));
Expand Down

0 comments on commit 2044ee8

Please sign in to comment.