From 9ea6105384cf3e1272ff62350fc3d5fa55d416ad Mon Sep 17 00:00:00 2001 From: sebinside Date: Fri, 5 Oct 2018 21:22:14 +0200 Subject: [PATCH] Updated framework to work without the need of separate json file. Added sample code. Finished release candidate 1. --- CSXS/manifest.xml | 2 +- client/index.html | 10 +- client/index.js | 100 ++++++++------ client/package-lock.json | 278 +++++++++++++++++++-------------------- host/commands.json | 17 --- host/index.jsx | 23 ++-- sample.ahk | 13 ++ 7 files changed, 233 insertions(+), 210 deletions(-) delete mode 100644 host/commands.json create mode 100644 sample.ahk diff --git a/CSXS/manifest.xml b/CSXS/manifest.xml index e77b8ce..486ab90 100644 --- a/CSXS/manifest.xml +++ b/CSXS/manifest.xml @@ -29,7 +29,7 @@ Panel - Premiere AHK Framework + AHK2CEP - Premiere 50 diff --git a/client/index.html b/client/index.html index 8c0e731..eb274f6 100644 --- a/client/index.html +++ b/client/index.html @@ -2,10 +2,18 @@ - Premiere AHK Framework + AHK2CEP - Premiere + + + + + +
Loading...
diff --git a/client/index.js b/client/index.js index 08c98f3..938ab53 100644 --- a/client/index.js +++ b/client/index.js @@ -3,56 +3,65 @@ const csInterface = new CSInterface(); const loc = window.location.pathname; const dir = decodeURI(loc.substring(1, loc.lastIndexOf('/'))); const express = require(dir + "/node_modules/express/index.js"); -const endpoints = require(dir + "/../host/commands.json"); function init() { // Setup server const app = express(); - const port = process.env.PORT || 8081; + const port = SERVER_PORT; const router = express.Router(); // Setup endpoints - Object.keys(endpoints).forEach(function(key) { - const value = endpoints[key]; - router.get('/' + key, function(req, res) { - - if (value.functionName === "killApp") { - res.json({ message: 'ok.' }); - csInterface.closeExtension(); - } - - // Count request query parameters - let propertyCount = 0; - for (const propName in req.query) { - if (req.query.hasOwnProperty(propName)) { - propertyCount++; + for (const functionDeclaration in host) { + const key = functionDeclaration; + const signature = host[key].toString().split("{")[0]; + + if (signature === host[key].toString()) { + console.log("Unable to read function definition of '" + key + "'."); + } else { + + const parameters = extractParameters(signature); + + router.get('/' + key, function (req, res) { + + // Special code for faster debugging + if (key === "kill") { + res.json({message: 'ok.'}); + csInterface.closeExtension(); } - } - - // Extract request query parameters - let params = []; - for (const id in value.parameters) { - const propName = value.parameters[id]; - if (req.query.hasOwnProperty(propName)) { - params.push(req.query[propName]); - } else { - console.log("Param not found: '" + propName + "'"); + + // Count request query parameters + let propertyCount = 0; + for (const propName in req.query) { + if (req.query.hasOwnProperty(propName)) { + propertyCount++; + } } - } - // Check query parameter count - if(value.parameters.length === params.length && params.length === propertyCount) { - res.json({ message: 'ok.' }); + // Extract request query parameters + let params = []; + for (const id in parameters) { + const propName = parameters[id]; + if (req.query.hasOwnProperty(propName)) { + params.push(req.query[propName]); + } else { + console.log("Param not found: '" + propName + "'"); + } + } - // Execute function with given parameters - executeCommand(value.functionName, params); - } else { - res.json({ message: 'error. wrong parameters.' }); - } + // Check query parameter count + if (parameters.length === params.length && params.length === propertyCount) { + res.json({message: 'ok.'}); - }); - }); + // Execute function with given parameters + executeCommand(key, params); + } else { + res.json({message: 'error. wrong parameters.'}); + } + + }); + } + } // Start server app.use('/', router); @@ -62,22 +71,33 @@ function init() { document.getElementById("statusContainer").className = "green"; } +const STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; +const ARGUMENT_NAMES = /([^\s,]+)/g; + +function extractParameters(signature) { + const fnStr = signature.toString().replace(STRIP_COMMENTS, ''); + let result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES); + if (result === null) + result = []; + return Array.prototype.slice.call(result); +} + function executeCommand(command, params) { console.log("Execute: " + command); document.getElementById("lastCommandContainer").innerHTML = command; command += "("; - for(let i = 0; i < params.length; i++) { + for (let i = 0; i < params.length; i++) { command += '"' + params[i] + '"'; - if(i < (params.length - 1)) { + if (i < (params.length - 1)) { command += ", "; } } command += ")"; console.log(command); - csInterface.evalScript(command); + csInterface.evalScript("host." + command); } function openHostWindow() { diff --git a/client/package-lock.json b/client/package-lock.json index 09eb743..7ba53b3 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -9,7 +9,7 @@ "resolved": "https://registry.npmjs.org/abs/-/abs-1.3.12.tgz", "integrity": "sha512-3gGc4URRHTUhdTOzRpnTKSoK+Bo9CcYTMKw7QYEFGzasu9on72GKjXMjZZNYKlAGqbPZfPqCRFRB3zGrX6260A==", "requires": { - "ul": "^5.0.0" + "ul": "5.2.13" } }, "accepts": { @@ -17,7 +17,7 @@ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", "requires": { - "mime-types": "~2.1.18", + "mime-types": "2.1.20", "negotiator": "0.6.1" } }, @@ -32,15 +32,15 @@ "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", "requires": { "bytes": "3.0.0", - "content-type": "~1.0.4", + "content-type": "1.0.4", "debug": "2.6.9", - "depd": "~1.1.1", - "http-errors": "~1.6.2", + "depd": "1.1.2", + "http-errors": "1.6.3", "iconv-lite": "0.4.19", - "on-finished": "~2.3.0", + "on-finished": "2.3.0", "qs": "6.5.1", "raw-body": "2.3.2", - "type-is": "~1.6.15" + "type-is": "1.6.16" } }, "builtin-modules": { @@ -88,7 +88,7 @@ "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", "integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=", "requires": { - "capture-stack-trace": "^1.0.0" + "capture-stack-trace": "1.0.1" } }, "debug": { @@ -109,7 +109,7 @@ "resolved": "https://registry.npmjs.org/deffy/-/deffy-2.2.2.tgz", "integrity": "sha1-CI9AkTy0cHhlP6b2l8IG4DRx1SM=", "requires": { - "typpy": "^2.0.0" + "typpy": "2.3.10" } }, "depd": { @@ -127,7 +127,7 @@ "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", "requires": { - "readable-stream": "^2.0.2" + "readable-stream": "2.3.6" } }, "ee-first": { @@ -145,7 +145,7 @@ "resolved": "https://registry.npmjs.org/err/-/err-1.1.1.tgz", "integrity": "sha1-65KOLhGjFmSPeCgz0PlyWLpDwvg=", "requires": { - "typpy": "^2.2.0" + "typpy": "2.3.10" } }, "error-ex": { @@ -153,7 +153,7 @@ "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", "requires": { - "is-arrayish": "^0.2.1" + "is-arrayish": "0.2.1" } }, "escape-html": { @@ -171,8 +171,8 @@ "resolved": "https://registry.npmjs.org/exec-limiter/-/exec-limiter-3.2.11.tgz", "integrity": "sha512-In82PmbeZ7spR2eJh2mlxVOU2q+TqevTvArNIyjHWasvSZuHSUqz3DqgWOOrTQir1/Q1yYE7SOdiqAsLrEP8Ng==", "requires": { - "limit-it": "^3.0.0", - "typpy": "^2.1.0" + "limit-it": "3.2.8", + "typpy": "2.3.10" } }, "express": { @@ -180,50 +180,50 @@ "resolved": "http://registry.npmjs.org/express/-/express-4.16.3.tgz", "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", "requires": { - "accepts": "~1.3.5", + "accepts": "1.3.5", "array-flatten": "1.1.1", "body-parser": "1.18.2", "content-disposition": "0.5.2", - "content-type": "~1.0.4", + "content-type": "1.0.4", "cookie": "0.3.1", "cookie-signature": "1.0.6", "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", + "depd": "1.1.2", + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "etag": "1.8.1", "finalhandler": "1.1.1", "fresh": "0.5.2", "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", + "methods": "1.1.2", + "on-finished": "2.3.0", + "parseurl": "1.3.2", "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.3", + "proxy-addr": "2.0.4", "qs": "6.5.1", - "range-parser": "~1.2.0", + "range-parser": "1.2.0", "safe-buffer": "5.1.1", "send": "0.16.2", "serve-static": "1.13.2", "setprototypeof": "1.1.0", - "statuses": "~1.4.0", - "type-is": "~1.6.16", + "statuses": "1.4.0", + "type-is": "1.6.16", "utils-merge": "1.0.1", - "vary": "~1.1.2" + "vary": "1.1.2" } }, "finalhandler": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", "requires": { "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "statuses": "~1.4.0", - "unpipe": "~1.0.0" + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "on-finished": "2.3.0", + "parseurl": "1.3.2", + "statuses": "1.4.0", + "unpipe": "1.0.0" } }, "forwarded": { @@ -241,7 +241,7 @@ "resolved": "https://registry.npmjs.org/function.name/-/function.name-1.0.11.tgz", "integrity": "sha512-dR60geqE4iI/siyBiWGcUjrQNtMqvToGXR/RkVkSSm4iH8FiHkIx2ljUFFiOZMbgBl/N9o9+VzikNp2hVV6y2Q==", "requires": { - "noop6": "^1.0.1" + "noop6": "1.0.7" } }, "git-package-json": { @@ -249,14 +249,14 @@ "resolved": "https://registry.npmjs.org/git-package-json/-/git-package-json-1.4.8.tgz", "integrity": "sha512-m8RMUABVtiMwOhRaCmB2fQnkBfVsKbg9lJqB/lDfXCLl2+qFQNhIWPsqtfP9uZLHS69V7DdhoIFA5zW5PQgr9g==", "requires": { - "deffy": "^2.2.1", - "err": "^1.1.1", - "gry": "^5.0.0", - "normalize-package-data": "^2.3.5", - "oargv": "^3.4.1", - "one-by-one": "^3.1.0", - "r-json": "^1.2.1", - "r-package-json": "^1.0.0", + "deffy": "2.2.2", + "err": "1.1.1", + "gry": "5.0.7", + "normalize-package-data": "2.4.0", + "oargv": "3.4.8", + "one-by-one": "3.2.6", + "r-json": "1.2.8", + "r-package-json": "1.0.7", "tmp": "0.0.28" } }, @@ -265,7 +265,7 @@ "resolved": "https://registry.npmjs.org/git-source/-/git-source-1.1.8.tgz", "integrity": "sha512-l/rT/+l5MTPrO7suPzSMD9IiQsbp7oE9z91imvKnSsxconIMWWyrtVOcQI7MA53lRdmBaFju5d8lW3th76X6hg==", "requires": { - "git-url-parse": "^5.0.1" + "git-url-parse": "5.0.1" } }, "git-up": { @@ -273,8 +273,8 @@ "resolved": "https://registry.npmjs.org/git-up/-/git-up-1.2.1.tgz", "integrity": "sha1-JkSAoAax2EJhrB/gmjpRacV+oZ0=", "requires": { - "is-ssh": "^1.0.0", - "parse-url": "^1.0.0" + "is-ssh": "1.3.0", + "parse-url": "1.3.11" } }, "git-url-parse": { @@ -282,7 +282,7 @@ "resolved": "https://registry.npmjs.org/git-url-parse/-/git-url-parse-5.0.1.tgz", "integrity": "sha1-/j15xnRq4FBIz6UIyB553du6OEM=", "requires": { - "git-up": "^1.0.0" + "git-up": "1.2.1" } }, "got": { @@ -290,21 +290,21 @@ "resolved": "http://registry.npmjs.org/got/-/got-5.7.1.tgz", "integrity": "sha1-X4FjWmHkplifGAVp6k44FoClHzU=", "requires": { - "create-error-class": "^3.0.1", - "duplexer2": "^0.1.4", - "is-redirect": "^1.0.0", - "is-retry-allowed": "^1.0.0", - "is-stream": "^1.0.0", - "lowercase-keys": "^1.0.0", - "node-status-codes": "^1.0.0", - "object-assign": "^4.0.1", - "parse-json": "^2.1.0", - "pinkie-promise": "^2.0.0", - "read-all-stream": "^3.0.0", - "readable-stream": "^2.0.5", - "timed-out": "^3.0.0", - "unzip-response": "^1.0.2", - "url-parse-lax": "^1.0.0" + "create-error-class": "3.0.2", + "duplexer2": "0.1.4", + "is-redirect": "1.0.0", + "is-retry-allowed": "1.1.0", + "is-stream": "1.1.0", + "lowercase-keys": "1.0.1", + "node-status-codes": "1.0.0", + "object-assign": "4.1.1", + "parse-json": "2.2.0", + "pinkie-promise": "2.0.1", + "read-all-stream": "3.1.0", + "readable-stream": "2.3.6", + "timed-out": "3.1.3", + "unzip-response": "1.0.2", + "url-parse-lax": "1.0.0" } }, "gry": { @@ -312,10 +312,10 @@ "resolved": "https://registry.npmjs.org/gry/-/gry-5.0.7.tgz", "integrity": "sha1-3JjiUO13eOgsSpLCCNc1CzD56c8=", "requires": { - "abs": "^1.2.1", - "exec-limiter": "^3.0.0", - "one-by-one": "^3.0.0", - "ul": "^5.0.0" + "abs": "1.3.12", + "exec-limiter": "3.2.11", + "one-by-one": "3.2.6", + "ul": "5.2.13" } }, "hosted-git-info": { @@ -328,10 +328,10 @@ "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", "requires": { - "depd": "~1.1.2", + "depd": "1.1.2", "inherits": "2.0.3", "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" + "statuses": "1.4.0" } }, "iconv-lite": { @@ -364,7 +364,7 @@ "resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "requires": { - "builtin-modules": "^1.0.0" + "builtin-modules": "1.1.1" } }, "is-redirect": { @@ -382,7 +382,7 @@ "resolved": "https://registry.npmjs.org/is-ssh/-/is-ssh-1.3.0.tgz", "integrity": "sha1-6+oRaaJhTaOSpjdANmw84EnY3/Y=", "requires": { - "protocols": "^1.1.0" + "protocols": "1.4.6" } }, "is-stream": { @@ -405,7 +405,7 @@ "resolved": "https://registry.npmjs.org/limit-it/-/limit-it-3.2.8.tgz", "integrity": "sha1-uXsBRhzPVNt3fP3318Dty/sBCUo=", "requires": { - "typpy": "^2.0.0" + "typpy": "2.3.10" } }, "lowercase-keys": { @@ -443,7 +443,7 @@ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", "requires": { - "mime-db": "~1.36.0" + "mime-db": "1.36.0" } }, "minimist": { @@ -476,10 +476,10 @@ "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", "requires": { - "hosted-git-info": "^2.1.4", - "is-builtin-module": "^1.0.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" + "hosted-git-info": "2.7.1", + "is-builtin-module": "1.0.0", + "semver": "5.5.1", + "validate-npm-package-license": "3.0.4" } }, "oargv": { @@ -487,8 +487,8 @@ "resolved": "https://registry.npmjs.org/oargv/-/oargv-3.4.8.tgz", "integrity": "sha1-e248D8y9TEHkTLQy0PQLc+Ecg1g=", "requires": { - "iterate-object": "^1.1.0", - "ul": "^5.0.0" + "iterate-object": "1.3.2", + "ul": "5.2.13" } }, "obj-def": { @@ -496,7 +496,7 @@ "resolved": "https://registry.npmjs.org/obj-def/-/obj-def-1.0.6.tgz", "integrity": "sha1-d1ThcohJwvk00f3SvnL+Yn7LWxQ=", "requires": { - "deffy": "^2.2.2" + "deffy": "2.2.2" } }, "object-assign": { @@ -517,8 +517,8 @@ "resolved": "https://registry.npmjs.org/one-by-one/-/one-by-one-3.2.6.tgz", "integrity": "sha1-M+Pelthw+alL3LY/ontRcAvhESs=", "requires": { - "obj-def": "^1.0.0", - "sliced": "^1.0.1" + "obj-def": "1.0.6", + "sliced": "1.0.1" } }, "os-tmpdir": { @@ -531,10 +531,10 @@ "resolved": "http://registry.npmjs.org/package-json/-/package-json-2.4.0.tgz", "integrity": "sha1-DRW9Z9HLvduyyiIv8u24a8sxqLs=", "requires": { - "got": "^5.0.0", - "registry-auth-token": "^3.0.1", - "registry-url": "^3.0.3", - "semver": "^5.1.0" + "got": "5.7.1", + "registry-auth-token": "3.3.2", + "registry-url": "3.1.0", + "semver": "5.5.1" } }, "package-json-path": { @@ -542,7 +542,7 @@ "resolved": "https://registry.npmjs.org/package-json-path/-/package-json-path-1.0.7.tgz", "integrity": "sha1-wleQnEcBqbNfzjAwZNTOmISJ3S0=", "requires": { - "abs": "^1.2.1" + "abs": "1.3.12" } }, "package.json": { @@ -550,9 +550,9 @@ "resolved": "https://registry.npmjs.org/package.json/-/package.json-2.0.1.tgz", "integrity": "sha1-+IYFnSpJ7QduZIg2ldc7K0bSHW0=", "requires": { - "git-package-json": "^1.4.0", - "git-source": "^1.1.0", - "package-json": "^2.3.1" + "git-package-json": "1.4.8", + "git-source": "1.1.8", + "package-json": "2.4.0" } }, "parse-json": { @@ -560,7 +560,7 @@ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "requires": { - "error-ex": "^1.2.0" + "error-ex": "1.3.2" } }, "parse-url": { @@ -568,8 +568,8 @@ "resolved": "https://registry.npmjs.org/parse-url/-/parse-url-1.3.11.tgz", "integrity": "sha1-V8FUKKuKiSsfQ4aWRccR0OFEtVQ=", "requires": { - "is-ssh": "^1.3.0", - "protocols": "^1.4.0" + "is-ssh": "1.3.0", + "protocols": "1.4.6" } }, "parseurl": { @@ -592,7 +592,7 @@ "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "requires": { - "pinkie": "^2.0.0" + "pinkie": "2.0.4" } }, "prepend-http": { @@ -615,7 +615,7 @@ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", "requires": { - "forwarded": "~0.1.2", + "forwarded": "0.1.2", "ipaddr.js": "1.8.0" } }, @@ -634,8 +634,8 @@ "resolved": "https://registry.npmjs.org/r-package-json/-/r-package-json-1.0.7.tgz", "integrity": "sha512-OCIwYDX4ZUpYr+CJb78ZlN+R52Lwul2+e4eqewExCsx6L+2Um/3A+TqdFPKm9HMON/sqiK9GlLAjuFIX3v2fYQ==", "requires": { - "package-json-path": "^1.0.0", - "r-json": "^1.2.1" + "package-json-path": "1.0.7", + "r-json": "1.2.8" } }, "range-parser": { @@ -667,7 +667,7 @@ "depd": "1.1.1", "inherits": "2.0.3", "setprototypeof": "1.0.3", - "statuses": ">= 1.3.1 < 2" + "statuses": "1.4.0" } }, "setprototypeof": { @@ -682,10 +682,10 @@ "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" + "deep-extend": "0.6.0", + "ini": "1.3.5", + "minimist": "1.2.0", + "strip-json-comments": "2.0.1" } }, "read-all-stream": { @@ -693,8 +693,8 @@ "resolved": "https://registry.npmjs.org/read-all-stream/-/read-all-stream-3.1.0.tgz", "integrity": "sha1-NcPhd/IHjveJ7kv6+kNzB06u9Po=", "requires": { - "pinkie-promise": "^2.0.0", - "readable-stream": "^2.0.0" + "pinkie-promise": "2.0.1", + "readable-stream": "2.3.6" } }, "readable-stream": { @@ -702,13 +702,13 @@ "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.1", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" } }, "registry-auth-token": { @@ -716,8 +716,8 @@ "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.3.2.tgz", "integrity": "sha512-JL39c60XlzCVgNrO+qq68FoNb56w/m7JYvGR2jT5iR1xBrUA3Mfx5Twk5rqTThPmQKMWydGmq8oFtDlxfrmxnQ==", "requires": { - "rc": "^1.1.6", - "safe-buffer": "^5.0.1" + "rc": "1.2.8", + "safe-buffer": "5.1.1" } }, "registry-url": { @@ -725,7 +725,7 @@ "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz", "integrity": "sha1-PU74cPc93h138M+aOBQyRE4XSUI=", "requires": { - "rc": "^1.0.1" + "rc": "1.2.8" } }, "safe-buffer": { @@ -744,18 +744,18 @@ "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", "requires": { "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", + "depd": "1.1.2", + "destroy": "1.0.4", + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "etag": "1.8.1", "fresh": "0.5.2", - "http-errors": "~1.6.2", + "http-errors": "1.6.3", "mime": "1.4.1", "ms": "2.0.0", - "on-finished": "~2.3.0", - "range-parser": "~1.2.0", - "statuses": "~1.4.0" + "on-finished": "2.3.0", + "range-parser": "1.2.0", + "statuses": "1.4.0" } }, "serve-static": { @@ -763,9 +763,9 @@ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.2", + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "parseurl": "1.3.2", "send": "0.16.2" } }, @@ -784,8 +784,8 @@ "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.1.tgz", "integrity": "sha512-hxSPZbRZvSDuOvADntOElzJpenIR7wXJkuoUcUtS0erbgt2fgeaoPIYretfKpslMhfFDY4k0MZ2F5CUzhBsSvQ==", "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" + "spdx-expression-parse": "3.0.0", + "spdx-license-ids": "3.0.1" } }, "spdx-exceptions": { @@ -798,8 +798,8 @@ "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" + "spdx-exceptions": "2.2.0", + "spdx-license-ids": "3.0.1" } }, "spdx-license-ids": { @@ -817,7 +817,7 @@ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "requires": { - "safe-buffer": "~5.1.0" + "safe-buffer": "5.1.1" } }, "strip-json-comments": { @@ -835,7 +835,7 @@ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.28.tgz", "integrity": "sha1-Fyc1t/YU6nrzlmT6hM8N5OUV0SA=", "requires": { - "os-tmpdir": "~1.0.1" + "os-tmpdir": "1.0.2" } }, "type-is": { @@ -844,7 +844,7 @@ "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", "requires": { "media-typer": "0.3.0", - "mime-types": "~2.1.18" + "mime-types": "2.1.20" } }, "typpy": { @@ -852,7 +852,7 @@ "resolved": "https://registry.npmjs.org/typpy/-/typpy-2.3.10.tgz", "integrity": "sha512-DKiSmYeXF4q+K0H999sVROLjwsngad5AloblLo72No+xVT9W09ytUIOCC/3puHsf+Dsf8M2hoPds0H1HwJgQqg==", "requires": { - "function.name": "^1.0.3" + "function.name": "1.0.11" } }, "ul": { @@ -860,8 +860,8 @@ "resolved": "https://registry.npmjs.org/ul/-/ul-5.2.13.tgz", "integrity": "sha1-n/BQTqNcofdMC/WeZIDe8Am617U=", "requires": { - "deffy": "^2.2.2", - "typpy": "^2.3.4" + "deffy": "2.2.2", + "typpy": "2.3.10" } }, "unpipe": { @@ -879,7 +879,7 @@ "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", "requires": { - "prepend-http": "^1.0.1" + "prepend-http": "1.0.4" } }, "util-deprecate": { @@ -897,8 +897,8 @@ "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" + "spdx-correct": "3.0.1", + "spdx-expression-parse": "3.0.0" } }, "vary": { diff --git a/host/commands.json b/host/commands.json deleted file mode 100644 index ad00f33..0000000 --- a/host/commands.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "ahk" : { - "functionName": "sendNameAlert", - "parameters" : [] - }, - "alert" : { - "functionName": "sendAlert", - "parameters": [ - "content", - "nextcontent" - ] - }, - "kill" : { - "functionName": "killApp", - "parameters": [] - } -} \ No newline at end of file diff --git a/host/index.jsx b/host/index.jsx index 4763c7d..8f51796 100644 --- a/host/index.jsx +++ b/host/index.jsx @@ -1,12 +1,11 @@ -function sendNameAlert(){ - alert(app.project.name); -} - -function sendAlert(content, content2) { - alert("Content: " + content + ", " + content2); -} - -function killApp() { - //alert("Killed"); - //This will not even be called -} \ No newline at end of file +var host = { + projectNameAlert: function () { + alert(app.project.name); + }, + alert: function (content) { + alert("Alert: " + content); + }, + kill: function() { + // This method is only there for debugging purposes. + } +}; \ No newline at end of file diff --git a/sample.ahk b/sample.ahk new file mode 100644 index 0000000..a7c9544 --- /dev/null +++ b/sample.ahk @@ -0,0 +1,13 @@ +#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. +SendMode Input ; Recommended for new scripts due to its superior speed and reliability. +SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. + + +; Interesting code starts here, lol +F10:: +Run curl ""http://localhost:8081/alert?content=helloworld"",,hide +return + +F11:: +Run curl ""http://localhost:8081/projectNameAlert"",,hide +return \ No newline at end of file