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

[fix] Install modules through a POST HTTP request instead of GET

parent da65d1af
No related branches found
No related tags found
No related merge requests found
......@@ -181,8 +181,8 @@ module.exports = (angular) => {
uiModules: getResource('/webmin/plug/ui_modules'),
uiGetMenuInjection: (moduleName) => getResource('/webmin/plug/ui_modules/inject/' + moduleName)(),
checkAccess: getResource('/webmin/plug/check_access'),
addPackage: (pkg) => getResource('/webmin/plug/add/' + encodeURIComponent(pkg), null, 60000)(),
removePackage: (pkg) => getResource('/webmin/plug/rem/' + encodeURIComponent(pkg))()
addPackage: (pkg) => postResource('/webmin/plug/add/')({ pkg }),
removePackage: (pkg) => postResource('/webmin/plug/rem/')({ pkg })
}
}
}
......
......@@ -595,7 +595,7 @@ function WebAdmin (duniterServer, startServices, stopServices, listDuniterUIPlug
})
this.plugAdd = (req) => co(function*() {
const module = req.params.package
const module = req.body.pkg
if (module.match(/^file:/)) {
const resolvedPath = path.resolve(module.replace('file:', ''))
const installed = listDuniterUIPlugins()
......@@ -614,7 +614,7 @@ function WebAdmin (duniterServer, startServices, stopServices, listDuniterUIPlug
})
this.plugRemove = (req) => co(function*() {
const module = req.params.package
const module = req.body.pkg
yield requirePlugin().duniter.methods.npmRemove(module, null, path.resolve('./'))
return true
})
......
......@@ -39,8 +39,8 @@ module.exports = {
handleRequest(app.get.bind(app), '/webmin/plug/ui_modules', webminCtrl.plugUiModulesList);
handleRequest(app.get.bind(app), '/webmin/plug/ui_modules/inject/:package', webminCtrl.plugUiModulesGetInjection);
handleRequest(app.get.bind(app), '/webmin/plug/check_access', webminCtrl.plugCheckAccess);
handleRequest(app.get.bind(app), '/webmin/plug/add/:package', webminCtrl.plugAdd);
handleRequest(app.get.bind(app), '/webmin/plug/rem/:package', webminCtrl.plugRemove);
handleRequest(app.post.bind(app), '/webmin/plug/add', webminCtrl.plugAdd);
handleRequest(app.post.bind(app), '/webmin/plug/rem', webminCtrl.plugRemove);
handleFileRequest(app.get.bind(app),'/webmin/data/duniter_export', webminCtrl.exportData);
handleRequest(app.post.bind(app), '/webmin/data/duniter_import', webminCtrl.importData);
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment