Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions modules_meshcore/scripttask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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']);
Expand Down Expand Up @@ -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 = '';
Expand Down Expand Up @@ -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 = '';
Expand Down
2 changes: 1 addition & 1 deletion scripttask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion views/user.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}
Expand Down Expand Up @@ -1020,3 +1020,4 @@ function redrawScriptTree() {

</script>
</html>