support for nested files in themes, added /plugins
This commit is contained in:
parent
8675e0f46d
commit
a42a88ad6c
1 changed files with 15 additions and 2 deletions
|
@ -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 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 themePath = join(utils.getPath('srcPath'), "./renderer/themes/", theme);
|
||||||
const userThemePath = join(utils.getPath('themes'), theme);
|
const userThemePath = join(utils.getPath('themes'), theme);
|
||||||
if (existsSync(userThemePath)) {
|
if (existsSync(userThemePath)) {
|
||||||
|
@ -275,6 +276,18 @@ export class BrowserWindow {
|
||||||
res.send(`// File not found - ${userThemePath}`);
|
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) => {
|
app.get("/audio.webm", (req, res) => {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue