support for nested files in themes, added /plugins

This commit is contained in:
booploops 2022-02-18 21:43:07 -08:00
parent 8675e0f46d
commit a42a88ad6c

View file

@ -262,9 +262,10 @@ export class BrowserWindow {
}
});
app.get("/themes/:theme/:file", (req, res) => {
app.get("/themes/:theme/*", (req, res) => {
const theme = req.params.theme.toLowerCase();
const file = req.params.file;
// @ts-ignore
const file = req.params[0];
const themePath = join(utils.getPath('srcPath'), "./renderer/themes/", theme);
const userThemePath = join(utils.getPath('themes'), theme);
if (existsSync(userThemePath)) {
@ -276,6 +277,18 @@ export class BrowserWindow {
}
});
app.get("/plugins/:plugin/*", (req, res) => {
const plugin = req.params.plugin;
// @ts-ignore
const file = req.params[0];
const pluginPath = join(utils.getPath('plugins'), plugin);
if (existsSync(pluginPath)) {
res.sendFile(join(pluginPath, file));
} else {
res.send(`// Plugin not found - ${pluginPath}`);
}
});
app.get("/audio.webm", (req, res) => {
try {
req.socket.setTimeout(Number.MAX_SAFE_INTEGER);