mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-12 11:01:52 +00:00
Fixed multi-device batch upload.
This commit is contained in:
parent
3dc616151a
commit
317a8ac8d7
2 changed files with 3 additions and 4 deletions
|
@ -175,7 +175,7 @@
|
||||||
"welcomePicture": { "type": "string", "description": "Name of the PNG or JPEG file that will be shown on the login screen. Put this file in the meshcentral-data folder and place the file name here." },
|
"welcomePicture": { "type": "string", "description": "Name of the PNG or JPEG file that will be shown on the login screen. Put this file in the meshcentral-data folder and place the file name here." },
|
||||||
"hide": { "type": "integer", "default": 0 },
|
"hide": { "type": "integer", "default": 0 },
|
||||||
"footer": { "type": "string", "default": null, "description": "This is a HTML string displayed at the bottom of the web page when a user is logged in." },
|
"footer": { "type": "string", "default": null, "description": "This is a HTML string displayed at the bottom of the web page when a user is logged in." },
|
||||||
"loginfooter": { "type": "string", "default": null "description": "This is a HTML string displayed at the bottom of the web page when a user is not logged in." },
|
"loginfooter": { "type": "string", "default": null, "description": "This is a HTML string displayed at the bottom of the web page when a user is not logged in." },
|
||||||
"certUrl": {
|
"certUrl": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "uri",
|
"format": "uri",
|
||||||
|
|
|
@ -3274,7 +3274,6 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||||
function handleUploadFileBatch(req, res) {
|
function handleUploadFileBatch(req, res) {
|
||||||
const domain = checkUserIpAddress(req, res);
|
const domain = checkUserIpAddress(req, res);
|
||||||
if (domain == null) { return; }
|
if (domain == null) { return; }
|
||||||
if (domain.userQuota == -1) { res.sendStatus(401); return; }
|
|
||||||
var authUserid = null;
|
var authUserid = null;
|
||||||
if ((req.session != null) && (typeof req.session.userid == 'string')) { authUserid = req.session.userid; }
|
if ((req.session != null) && (typeof req.session.userid == 'string')) { authUserid = req.session.userid; }
|
||||||
const multiparty = require('multiparty');
|
const multiparty = require('multiparty');
|
||||||
|
@ -3290,7 +3289,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||||
|
|
||||||
// Get the user
|
// Get the user
|
||||||
const user = obj.users[authUserid];
|
const user = obj.users[authUserid];
|
||||||
if ((user == null) || (user.siteadmin & 8) == 0) { res.sendStatus(401); return; } // Check if we have file rights
|
if (user == null) { parent.debug('web', 'Batch upload error, invalid user.'); res.sendStatus(401); return; } // Check if user exists
|
||||||
|
|
||||||
// Get fields
|
// Get fields
|
||||||
if ((fields == null) || (fields.nodeIds == null) || (fields.nodeIds.length != 1)) { res.sendStatus(404); return; }
|
if ((fields == null) || (fields.nodeIds == null) || (fields.nodeIds.length != 1)) { res.sendStatus(404); return; }
|
||||||
|
@ -3300,7 +3299,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||||
if ((fields.overwriteFiles != null) && (fields.overwriteFiles.length == 1) && (fields.overwriteFiles[0] == 'on')) { cmd.overwrite = true; }
|
if ((fields.overwriteFiles != null) && (fields.overwriteFiles.length == 1) && (fields.overwriteFiles[0] == 'on')) { cmd.overwrite = true; }
|
||||||
if ((fields.createFolder != null) && (fields.createFolder.length == 1) && (fields.createFolder[0] == 'on')) { cmd.createFolder = true; }
|
if ((fields.createFolder != null) && (fields.createFolder.length == 1) && (fields.createFolder[0] == 'on')) { cmd.createFolder = true; }
|
||||||
|
|
||||||
// Check if we have al least one target path
|
// Check if we have at least one target path
|
||||||
if ((cmd.windowsPath == null) && (cmd.linuxPath == null)) {
|
if ((cmd.windowsPath == null) && (cmd.linuxPath == null)) {
|
||||||
parent.debug('web', 'Batch upload error, invalid fields: ' + JSON.stringify(fields));
|
parent.debug('web', 'Batch upload error, invalid fields: ' + JSON.stringify(fields));
|
||||||
res.send('');
|
res.send('');
|
||||||
|
|
Loading…
Reference in a new issue