diff --git a/config.json b/config.json index 00cd76a..2eab887 100644 --- a/config.json +++ b/config.json @@ -1,18 +1,18 @@ { "name": "ScriptTask", "shortName": "scripttask", - "version": "0.0.20", + "version": "0.0.21", "author": "Ryan Blenis", "description": "Script (PowerShell, BAT, Bash) runner for endpoints", "hasAdminPanel": false, - "homepage": "https://github.com/ryanblenis/MeshCentral-ScriptTask", - "changelogUrl": "https://raw.githubusercontent.com/ryanblenis/MeshCentral-ScriptTask/master/changelog.md", - "configUrl": "https://raw.githubusercontent.com/ryanblenis/MeshCentral-ScriptTask/master/config.json", - "downloadUrl": "https://github.com/ryanblenis/MeshCentral-ScriptTask/archive/master.zip", + "homepage": "https://github.com/fud18/MeshCentral-ScriptTask", + "changelogUrl": "https://raw.githubusercontent.com/fud18/MeshCentral-ScriptTask/master/changelog.md", + "configUrl": "https://raw.githubusercontent.com/fud18/MeshCentral-ScriptTask/master/config.json", + "downloadUrl": "https://github.com/fud18/MeshCentral-ScriptTask/archive/refs/heads/master.zip", "repository": { "type": "git", - "url": "https://github.com/ryanblenis/MeshCentral-ScriptTask.git" + "url": "https://github.com/fud18/MeshCentral-ScriptTask.git" }, - "versionHistoryUrl": "https://api.github.com/repos/ryanblenis/MeshCentral-ScriptTask/tags", + "versionHistoryUrl": "https://api.github.com/repos/fud18/MeshCentral-ScriptTask/tags", "meshCentralCompat": ">=1.1.35" -} \ No newline at end of file +} diff --git a/scripttask.js b/scripttask.js index b6f9eec..6bffbd1 100644 --- a/scripttask.js +++ b/scripttask.js @@ -69,6 +69,12 @@ module.exports.scripttask = function (parent) { obj.db.get(job.scriptId) .then(async (script) => { script = script[0]; + + if (!script || typeof script.content !== 'string') { + console.log('PLUGIN: ScriptTask: Skipping job with missing script content. scriptId=' + job.scriptId + ', node=' + job.node); + return; + } + var foundVars = script.content.match(/#(.*?)#/g); var replaceVars = {}; if (foundVars != null && foundVars.length > 0) { diff --git a/views/scriptedit.handlebars b/views/scriptedit.handlebars index 8111f4f..16ef23c 100644 --- a/views/scriptedit.handlebars +++ b/views/scriptedit.handlebars @@ -37,8 +37,8 @@
Script Name:
- - + +
@@ -57,8 +57,17 @@ function doOnLoad() { function goSave() { scriptData.content = Q('scriptContent').value; scriptData.name = Q('scriptName').value; - window.opener.callback(scriptData); - //goClose(); + + try { + if (window.opener && typeof window.opener.callback === 'function') { + window.opener.callback(scriptData); + } else { + alert('Unable to save script: parent callback was not found.'); + return; + } + } finally { + window.close(); + } } function goClose() { diff --git a/views/user.handlebars b/views/user.handlebars index f69a731..9ea02b6 100644 --- a/views/user.handlebars +++ b/views/user.handlebars @@ -1,1022 +1,1099 @@ - - - - - - -
- - Upload: -
-
- New - Rename - Edit - Delete - New Folder - Download - Run -
-
-
-
-
-
-
Advanced Run
-
-
-
- - -
-
-
- - -
Meshes
-
-
- - -
Tags
-
-
-
Node Schedules
-
- - -
ScriptAuthorEveryStartingEndingLast RunNext RunAction
-
-
Script Schedules
-
- - -
NodeAuthorEveryStartingEndingLast RunNext RunAction
-
-
Node History
-
- - -
TimeRun ByScriptStatusReturn Value
-
-
Script History
-
- - -
TimeRun ByNodeStatusReturn Value
-
-
Variables
-
- - -
Variable NameValueScopeScope TargetAction
-
- [+] -
-
- -
-
-
- - - + + + + + + +
+ + Upload: +
+
+ + + + + + + +
+
+
+
+
+
+
Advanced Run
+
+
+
+ + +
+
+
+ + +
Meshes
+
+
+ + +
Tags
+
+
+
Node Schedules
+
+ + +
ScriptAuthorEveryStartingEndingLast RunNext RunAction
+
+
Script Schedules
+
+ + +
NodeAuthorEveryStartingEndingLast RunNext RunAction
+
+
Node History
+
+ + +
TimeRun ByScriptStatusReturn Value
+
+
Script History
+
+ + +
TimeRun ByNodeStatusReturn Value
+
+
Variables
+
+ + +
Variable NameValueScopeScope TargetAction
+
+ [+] +
+
+ +
+
+
+ + +