From 75a9ce1ce097a2cf49c7a303c57e75be3f660c98 Mon Sep 17 00:00:00 2001 From: panreyes Date: Fri, 24 Oct 2025 21:11:31 +0200 Subject: [PATCH 1/3] Corrected typo to avoid being able to create a job from a folder --- views/user.handlebars | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/views/user.handlebars b/views/user.handlebars index f69a731..058d140 100644 --- a/views/user.handlebars +++ b/views/user.handlebars @@ -359,7 +359,7 @@ function goRun() { var selScript = document.querySelectorAll('.liselected'); if (selScript.length) { var scriptId = selScript[0].getAttribute('x-data-id'); - if (scriptId == selScript[0].getAttribute('x-folder-id')) + if (scriptId == selScript[0].getAttribute('x-data-folder')) { parent.setDialogMode(2, "Oops!", 1, null, 'Please select a script. A folder is currently selected.'); } @@ -1020,3 +1020,4 @@ function redrawScriptTree() { + From 425412e27452a309105a9bc03452cc5e6bda4aa4 Mon Sep 17 00:00:00 2001 From: panreyes Date: Fri, 24 Oct 2025 21:16:27 +0200 Subject: [PATCH 2/3] Add suffix 'tmp_st_' to script file names --- modules_meshcore/scripttask.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules_meshcore/scripttask.js b/modules_meshcore/scripttask.js index 3143a4a..feab779 100644 --- a/modules_meshcore/scripttask.js +++ b/modules_meshcore/scripttask.js @@ -150,8 +150,8 @@ function runPowerShell(sObj, jObj) { const fs = require('fs'); var rand = Math.random().toString(32).replace('0.', ''); - var oName = 'st' + rand + '.txt'; - var pName = 'st' + rand + '.ps1'; + var oName = 'tmp_st_' + rand + '.txt'; + var pName = 'tmp_st_' + rand + '.ps1'; var pwshout = '', pwsherr = '', cancontinue = false; try { fs.writeFileSync(pName, sObj.content); @@ -221,8 +221,8 @@ function runPowerShellNonWin(sObj, jObj) { dbg('Path chosen is: ' + path); path = path + '/'; - var oName = 'st' + rand + '.txt'; - var pName = 'st' + rand + '.ps1'; + var oName = 'tmp_st_' + rand + '.txt'; + var pName = 'tmp_st_' + rand + '.ps1'; var pwshout = '', pwsherr = '', cancontinue = false; try { var childp = require('child_process').execFile('/bin/sh', ['sh']); @@ -298,8 +298,8 @@ function runBat(sObj, jObj) { } const fs = require('fs'); var rand = Math.random().toString(32).replace('0.', ''); - var oName = 'st' + rand + '.txt'; - var pName = 'st' + rand + '.bat'; + var oName = 'tmp_st_' + rand + '.txt'; + var pName = 'tmp_st_' + rand + '.bat'; try { fs.writeFileSync(pName, sObj.content); var outstr = '', errstr = ''; @@ -372,8 +372,8 @@ function runBash(sObj, jObj) { //child.execFile(process.env['windir'] + '\\system32\\cmd.exe', ['/c', 'RunDll32.exe user32.dll,LockWorkStation'], { type: 1 }); var rand = Math.random().toString(32).replace('0.', ''); - var oName = 'st' + rand + '.txt'; - var pName = 'st' + rand + '.sh'; + var oName = 'tmp_st_' + rand + '.txt'; + var pName = 'tmp_st_' + rand + '.sh'; try { fs.writeFileSync(path + pName, sObj.content); var outstr = '', errstr = ''; From 1ab23c3096c31ee6e0fd8eebb5d1282738a4feff Mon Sep 17 00:00:00 2001 From: panreyes Date: Fri, 24 Oct 2025 21:22:35 +0200 Subject: [PATCH 3/3] Download script: Added script type and TXT extensions This helps to: - Identify script types easier - Avoid issues with browsers and antivirus --- scripttask.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripttask.js b/scripttask.js index 609e720..b3c7f88 100644 --- a/scripttask.js +++ b/scripttask.js @@ -137,7 +137,7 @@ module.exports.scripttask = function (parent) { .then(found => { if (found.length != 1) { res.sendStatus(401); return; } var file = found[0]; - res.setHeader('Content-disposition', 'attachment; filename=' + file.name); + res.setHeader('Content-disposition', 'attachment; filename=' + file.name + "." + file.filetype + ".txt"); res.setHeader('Content-type', 'text/plain'); //var fs = require('fs'); res.send(file.content);