Skip to content
Snippets Groups Projects
Commit d34148ad authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[enh] #918 Also inject local plugin if it exists

parent 249644e1
Branches
Tags
No related merge requests found
...@@ -190,5 +190,18 @@ function listPlugins(conditionTest) { ...@@ -190,5 +190,18 @@ function listPlugins(conditionTest) {
} }
} catch (e) {} } catch (e) {}
} }
// Special: self dependency (if local package is also a module)
if (pkgJSON.main) {
const dep = pkgJSON.name
const required = require(path.resolve('./' + pkgJSON.main))
if (required && conditionTest(required)) {
uiDependencies.push({
name: dep,
version: 'local',
locked: true,
required
})
}
}
return uiDependencies return uiDependencies
} }
...@@ -580,8 +580,13 @@ function WebAdmin (duniterServer, startServices, stopServices, listDuniterUIPlug ...@@ -580,8 +580,13 @@ function WebAdmin (duniterServer, startServices, stopServices, listDuniterUIPlug
this.plugUiModulesGetInjection = (req) => co(function*() { this.plugUiModulesGetInjection = (req) => co(function*() {
const module = req.params.package const module = req.params.package
const required = require(module) const plugins = listDuniterUIPlugins()
return required.duniterUI.inject || {} for (const plugin of plugins) {
if (plugin.name === module) {
return plugin.required.duniterUI.inject || {}
}
}
return {}
}) })
this.plugCheckAccess = (req) => requirePlugin().duniter.methods.canWrite() this.plugCheckAccess = (req) => requirePlugin().duniter.methods.canWrite()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment