mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 04:28:34 +01:00
add cache fixer :3
This commit is contained in:
parent
141f125ebb
commit
31542e19e2
1 changed files with 7 additions and 1 deletions
|
@ -76,7 +76,7 @@ const proxy = async (req, res) => {
|
||||||
|
|
||||||
console.log(`==> Proxying request`);
|
console.log(`==> Proxying request`);
|
||||||
|
|
||||||
let f = await fetch(url, {
|
let f = await fetch(url + `?cachefixer=${btoa(Date.now())}`, {
|
||||||
method: req.method,
|
method: req.method,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -101,6 +101,8 @@ const apiUrl = "https://returnyoutubedislikeapi.com/votes?videoId=";
|
||||||
const cache = {};
|
const cache = {};
|
||||||
|
|
||||||
app.get('/api', async (req, res) => {
|
app.get('/api', async (req, res) => {
|
||||||
|
|
||||||
|
try {
|
||||||
const cacheKey = req.query.v;
|
const cacheKey = req.query.v;
|
||||||
|
|
||||||
// Check if the result is already cached
|
// Check if the result is already cached
|
||||||
|
@ -121,6 +123,10 @@ app.get('/api', async (req, res) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
res.json({ data: engagement, cachedDate: new Date() });
|
res.json({ data: engagement, cachedDate: new Date() });
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue