diff --git a/app/js/app.config.js b/app/js/app.config.js index ae5f6d842a96abb8c21d8feaa719322c89e11cf4..fefb4b3c74d4d9e161d743e29dc9ba77ae5be998 100644 --- a/app/js/app.config.js +++ b/app/js/app.config.js @@ -60,6 +60,17 @@ module.exports = () => { } }; + window.openModule = function openWindow(path, options, callback) { + const url = window.location.origin + '/modules' + path + if (window.gui) { + // Duniter Desktop + window.gui.Window.open(url, options, callback); + } else { + // Browser + window.open(url, '_blank '); + } + }; + window.openExternal = function openExternal(url) { if (window.gui) { window.gui.Shell.openExternal(url); diff --git a/index.js b/index.js index 30a29e7f2eb75a58332b158cbc507f9a52b8ce32..faed8caf259a612c7d3aac21599d74050a2f400d 100644 --- a/index.js +++ b/index.js @@ -89,7 +89,9 @@ module.exports = { for (const dep of uiDeps) { // Eventual HTTP routing if (dep.required.duniterUI.route) { - dep.required.duniterUI.route(app, server, conf, program, params) + const subApp = express() + dep.required.duniterUI.route(subApp, server, conf, program, params) + app.use('/modules/', subApp) } }