From a42a88ad6c2ecb6e0e4b738482759452adf1da53 Mon Sep 17 00:00:00 2001 From: booploops <49113086+booploops@users.noreply.github.com> Date: Fri, 18 Feb 2022 21:43:07 -0800 Subject: [PATCH] support for nested files in themes, added /plugins --- src/main/base/browserwindow.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/base/browserwindow.ts b/src/main/base/browserwindow.ts index 6a0a69e6..ef87242b 100644 --- a/src/main/base/browserwindow.ts +++ b/src/main/base/browserwindow.ts @@ -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)) { @@ -275,6 +276,18 @@ export class BrowserWindow { res.send(`// File not found - ${userThemePath}`); } }); + + 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 {