Run pre-commit hooks over existing codebase

Co-Authored-By: Ben Phelps <ben@phelps.io>
This commit is contained in:
shamoon
2023-10-17 23:26:55 -07:00
parent fa50bbad9c
commit 19c25713c4
387 changed files with 4785 additions and 4109 deletions

View File

@@ -10,7 +10,7 @@ const logger = createLogger(proxyName);
async function retrieveFromAPI(url, key) {
const headers = {
"content-type": "application/json",
"Authorization": `Bearer ${key}`
Authorization: `Bearer ${key}`,
};
const [status, , data] = await httpProxy(url, { headers });
@@ -48,17 +48,22 @@ export default async function audiobookshelfProxyHandler(req, res) {
const url = new URL(formatApiCall(apiURL, { endpoint, ...widget }));
const libraryData = await retrieveFromAPI(url, widget.key);
const libraryStats = await Promise.all(libraryData.libraries.map(async l => {
const stats = await retrieveFromAPI(new URL(formatApiCall(apiURL, { endpoint: `libraries/${l.id}/stats`, ...widget })), widget.key);
return {
...l,
stats
};
}));
const libraryStats = await Promise.all(
libraryData.libraries.map(async (l) => {
const stats = await retrieveFromAPI(
new URL(formatApiCall(apiURL, { endpoint: `libraries/${l.id}/stats`, ...widget })),
widget.key,
);
return {
...l,
stats,
};
}),
);
return res.status(200).send(libraryStats);
} catch (e) {
logger.error(e.message);
return res.status(500).send({error: {message: e.message}});
return res.status(500).send({ error: { message: e.message } });
}
}