mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-16 09:49:49 +00:00
append service name to cache keys
This commit is contained in:
parent
702dbd8a82
commit
91d8e56471
6 changed files with 46 additions and 41 deletions
|
@ -25,12 +25,12 @@ export default async function transmissionProxyHandler(req, res) {
|
|||
return res.status(400).json({ error: "Invalid proxy service type" });
|
||||
}
|
||||
|
||||
let headers = cache.get(headerCacheKey);
|
||||
let headers = cache.get(`${headerCacheKey}.${service}`);
|
||||
if (!headers) {
|
||||
headers = {
|
||||
"content-type": "application/json",
|
||||
}
|
||||
cache.put(headerCacheKey, headers);
|
||||
cache.put(`${headerCacheKey}.${service}`, headers);
|
||||
}
|
||||
|
||||
const url = new URL(formatApiCall(widgets[widget.type].api, { endpoint, ...widget }));
|
||||
|
@ -55,7 +55,7 @@ export default async function transmissionProxyHandler(req, res) {
|
|||
if (status === 409) {
|
||||
logger.debug("Transmission is rejecting the request, but returning a CSRF token");
|
||||
headers[csrfHeaderName] = responseHeaders[csrfHeaderName];
|
||||
cache.put(headerCacheKey, headers);
|
||||
cache.put(`${headerCacheKey}.${service}`, headers);
|
||||
|
||||
// retry the request, now with the CSRF token
|
||||
[status, contentType, data, responseHeaders] = await httpProxy(url, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue