diff --git a/package-lock.json b/package-lock.json index b21cb3d..657324a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,6 +45,78 @@ } } }, + "@sentry/apm": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@sentry/apm/-/apm-5.15.0.tgz", + "integrity": "sha512-2N33gcl+MIcRDAdV150pRb+IkSnoqLdu0mZV9Cm7dIYvCxeZ6J+k903qAwTPdoR6/MCu795aiw4zUvsRbMJy6Q==", + "requires": { + "@sentry/browser": "5.15.0", + "@sentry/hub": "5.15.0", + "@sentry/minimal": "5.15.0", + "@sentry/types": "5.15.0", + "@sentry/utils": "5.15.0", + "tslib": "^1.9.3" + }, + "dependencies": { + "@sentry/browser": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-5.15.0.tgz", + "integrity": "sha512-9sgqWGaoT5jb3vk8sgQ1bz1LzhUf3oKoDMp/c6vX0reuA6Vz+/jwOC7a/FPWtQir2PwRJfbak2QOxw8W6Mwa3g==", + "requires": { + "@sentry/core": "5.15.0", + "@sentry/types": "5.15.0", + "@sentry/utils": "5.15.0", + "tslib": "^1.9.3" + } + }, + "@sentry/core": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-5.15.0.tgz", + "integrity": "sha512-ujwHMwinPwuADoIBFjh1BiC6Li7RpEG3Mmo0MxOqKm7xKngkRUk5uH5e36roORnx+ngr/3NCe80QuvSqK7gQsw==", + "requires": { + "@sentry/hub": "5.15.0", + "@sentry/minimal": "5.15.0", + "@sentry/types": "5.15.0", + "@sentry/utils": "5.15.0", + "tslib": "^1.9.3" + } + }, + "@sentry/hub": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-5.15.0.tgz", + "integrity": "sha512-wIDcaIuaYpg+Ma01NfFQTOnZLDCKSx2D06TTBqlo93WfMFNgyEgdMbU5Fk1PFZzjj2AMtzlc9DJzAfvt1hZx3w==", + "requires": { + "@sentry/types": "5.15.0", + "@sentry/utils": "5.15.0", + "tslib": "^1.9.3" + } + }, + "@sentry/minimal": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-5.15.0.tgz", + "integrity": "sha512-VBkMfR6ahmuJrx4V51BNYd6XzGZ7GB8sfnBufMzqK6MsKe+g5oSyXeqHFd4oFC0co0YlFIw7IphF2JZLwVs0zA==", + "requires": { + "@sentry/hub": "5.15.0", + "@sentry/types": "5.15.0", + "tslib": "^1.9.3" + } + }, + "@sentry/types": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-5.15.0.tgz", + "integrity": "sha512-MC96wUAHhzRuH3xo4Qd+EXTOap8+d+SWbAdLBukScxuwhOSY/HNRh1TW17CuAu7s1oXa7xxO2ZCdyamSZinIiQ==" + }, + "@sentry/utils": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-5.15.0.tgz", + "integrity": "sha512-td+wSBdVUPO3mEPcEHZwJiVEQ0+wplJCHBvM1PHqwQd+miB2mQAaiSkzdAAHzUpTeqPBI3rzjWPn59WkCcVF5Q==", + "requires": { + "@sentry/types": "5.15.0", + "tslib": "^1.9.3" + } + } + } + }, "@sentry/browser": { "version": "5.6.2", "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-5.6.2.tgz", @@ -89,18 +161,67 @@ } }, "@sentry/node": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/@sentry/node/-/node-5.6.2.tgz", - "integrity": "sha512-A9CELco6SjF4zt8iS1pO3KdUVI2WVhtTGhSH6X04OVf2en1fimPR+Vs8YVY/04udwd7o+3mI6byT+rS9+/Qzow==", - "requires": { - "@sentry/core": "5.6.2", - "@sentry/hub": "5.6.1", - "@sentry/types": "5.6.1", - "@sentry/utils": "5.6.1", - "cookie": "0.3.1", - "https-proxy-agent": "2.2.1", - "lru_map": "0.3.3", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-5.15.0.tgz", + "integrity": "sha512-uy53L3O7Ood0RGRnFPT+EDTkK63qkbvGM5Al7Le6r9Sl6joACng+K3zmkJWzW5xrjcG6m8ExT3bm1hPjVOmOJA==", + "requires": { + "@sentry/apm": "5.15.0", + "@sentry/core": "5.15.0", + "@sentry/hub": "5.15.0", + "@sentry/types": "5.15.0", + "@sentry/utils": "5.15.0", + "cookie": "^0.3.1", + "https-proxy-agent": "^4.0.0", + "lru_map": "^0.3.3", "tslib": "^1.9.3" + }, + "dependencies": { + "@sentry/core": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-5.15.0.tgz", + "integrity": "sha512-ujwHMwinPwuADoIBFjh1BiC6Li7RpEG3Mmo0MxOqKm7xKngkRUk5uH5e36roORnx+ngr/3NCe80QuvSqK7gQsw==", + "requires": { + "@sentry/hub": "5.15.0", + "@sentry/minimal": "5.15.0", + "@sentry/types": "5.15.0", + "@sentry/utils": "5.15.0", + "tslib": "^1.9.3" + } + }, + "@sentry/hub": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-5.15.0.tgz", + "integrity": "sha512-wIDcaIuaYpg+Ma01NfFQTOnZLDCKSx2D06TTBqlo93WfMFNgyEgdMbU5Fk1PFZzjj2AMtzlc9DJzAfvt1hZx3w==", + "requires": { + "@sentry/types": "5.15.0", + "@sentry/utils": "5.15.0", + "tslib": "^1.9.3" + } + }, + "@sentry/minimal": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-5.15.0.tgz", + "integrity": "sha512-VBkMfR6ahmuJrx4V51BNYd6XzGZ7GB8sfnBufMzqK6MsKe+g5oSyXeqHFd4oFC0co0YlFIw7IphF2JZLwVs0zA==", + "requires": { + "@sentry/hub": "5.15.0", + "@sentry/types": "5.15.0", + "tslib": "^1.9.3" + } + }, + "@sentry/types": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-5.15.0.tgz", + "integrity": "sha512-MC96wUAHhzRuH3xo4Qd+EXTOap8+d+SWbAdLBukScxuwhOSY/HNRh1TW17CuAu7s1oXa7xxO2ZCdyamSZinIiQ==" + }, + "@sentry/utils": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-5.15.0.tgz", + "integrity": "sha512-td+wSBdVUPO3mEPcEHZwJiVEQ0+wplJCHBvM1PHqwQd+miB2mQAaiSkzdAAHzUpTeqPBI3rzjWPn59WkCcVF5Q==", + "requires": { + "@sentry/types": "5.15.0", + "tslib": "^1.9.3" + } + } } }, "@sentry/types": { @@ -145,12 +266,9 @@ "dev": true }, "agent-base": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", - "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", - "requires": { - "es6-promisify": "^5.0.0" - } + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", + "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==" }, "ajv": { "version": "6.10.2", @@ -1035,9 +1153,9 @@ "integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==" }, "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "requires": { "ms": "^2.1.1" } @@ -1679,19 +1797,6 @@ "is-arrayish": "^0.2.1" } }, - "es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" - }, - "es6-promisify": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", - "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", - "requires": { - "es6-promise": "^4.0.3" - } - }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -2114,12 +2219,12 @@ } }, "https-proxy-agent": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", - "integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", + "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", "requires": { - "agent-base": "^4.1.0", - "debug": "^3.1.0" + "agent-base": "5", + "debug": "4" } }, "iconv-lite": { @@ -2576,9 +2681,9 @@ } }, "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "dev": true }, "mkdirp": { @@ -2646,9 +2751,9 @@ "dev": true }, "npm": { - "version": "6.11.2", - "resolved": "https://registry.npmjs.org/npm/-/npm-6.11.2.tgz", - "integrity": "sha512-OAkXqI4bm5MUvqVvqe6rxCXmJqrln8VDlkdftpOoayHKazz8IOCJAiCuKmz0TchL224EAKeG86umuD6RYNpuEg==", + "version": "6.14.3", + "resolved": "https://registry.npmjs.org/npm/-/npm-6.14.3.tgz", + "integrity": "sha512-3tQYVEEdSGQGYoXhZvNqW8faqCidfMMaL387RdDo4Uu5kQy4IgvJ13NIsWVMQ6e3QWlbicNMSpFiyzYfMUuPDw==", "dev": true, "requires": { "JSONStream": "^1.3.5", @@ -2657,12 +2762,12 @@ "ansistyles": "~0.1.3", "aproba": "^2.0.0", "archy": "~1.0.0", - "bin-links": "^1.1.3", + "bin-links": "^1.1.7", "bluebird": "^3.5.5", "byte-size": "^5.0.1", "cacache": "^12.0.3", "call-limit": "^1.1.1", - "chownr": "^1.1.2", + "chownr": "^1.1.4", "ci-info": "^2.0.0", "cli-columns": "^3.1.2", "cli-table3": "^0.5.1", @@ -2678,11 +2783,11 @@ "find-npm-prefix": "^1.0.2", "fs-vacuum": "~1.2.10", "fs-write-stream-atomic": "~1.0.10", - "gentle-fs": "^2.2.1", - "glob": "^7.1.4", - "graceful-fs": "^4.2.2", + "gentle-fs": "^2.3.0", + "glob": "^7.1.6", + "graceful-fs": "^4.2.3", "has-unicode": "~2.0.1", - "hosted-git-info": "^2.8.2", + "hosted-git-info": "^2.8.8", "iferr": "^1.0.2", "imurmurhash": "*", "infer-owner": "^1.0.4", @@ -2693,14 +2798,14 @@ "is-cidr": "^3.0.0", "json-parse-better-errors": "^1.0.2", "lazy-property": "~1.0.0", - "libcipm": "^4.0.3", + "libcipm": "^4.0.7", "libnpm": "^3.0.1", "libnpmaccess": "^3.0.2", "libnpmhook": "^5.0.3", "libnpmorg": "^1.0.1", "libnpmsearch": "^2.0.2", "libnpmteam": "^1.0.2", - "libnpx": "^10.2.0", + "libnpx": "^10.2.2", "lock-verify": "^2.1.0", "lockfile": "^1.0.4", "lodash._baseindexof": "*", @@ -2717,41 +2822,41 @@ "lru-cache": "^5.1.1", "meant": "~1.0.1", "mississippi": "^3.0.0", - "mkdirp": "~0.5.1", + "mkdirp": "^0.5.3", "move-concurrently": "^1.0.1", - "node-gyp": "^5.0.3", + "node-gyp": "^5.1.0", "nopt": "~4.0.1", "normalize-package-data": "^2.5.0", "npm-audit-report": "^1.3.2", "npm-cache-filename": "~1.0.2", - "npm-install-checks": "~3.0.0", - "npm-lifecycle": "^3.1.3", + "npm-install-checks": "^3.0.2", + "npm-lifecycle": "^3.1.4", "npm-package-arg": "^6.1.1", - "npm-packlist": "^1.4.4", - "npm-pick-manifest": "^3.0.0", - "npm-profile": "^4.0.2", - "npm-registry-fetch": "^4.0.0", + "npm-packlist": "^1.4.8", + "npm-pick-manifest": "^3.0.2", + "npm-profile": "^4.0.4", + "npm-registry-fetch": "^4.0.3", "npm-user-validate": "~1.0.0", "npmlog": "~4.1.2", "once": "~1.4.0", "opener": "^1.5.1", "osenv": "^0.1.5", - "pacote": "^9.5.8", + "pacote": "^9.5.12", "path-is-inside": "~1.0.2", "promise-inflight": "~1.0.1", "qrcode-terminal": "^0.12.0", "query-string": "^6.8.2", "qw": "~1.0.1", "read": "~1.0.7", - "read-cmd-shim": "^1.0.3", + "read-cmd-shim": "^1.0.5", "read-installed": "~4.0.3", - "read-package-json": "^2.1.0", + "read-package-json": "^2.1.1", "read-package-tree": "^5.3.1", - "readable-stream": "^3.4.0", + "readable-stream": "^3.6.0", "readdir-scoped-modules": "^1.1.0", "request": "^2.88.0", "retry": "^0.12.0", - "rimraf": "^2.6.3", + "rimraf": "^2.7.1", "safe-buffer": "^5.1.2", "semver": "^5.7.1", "sha": "^3.0.0", @@ -2759,8 +2864,8 @@ "sorted-object": "~2.0.1", "sorted-union-stream": "~2.1.3", "ssri": "^6.0.1", - "stringify-package": "^1.0.0", - "tar": "^4.4.10", + "stringify-package": "^1.0.1", + "tar": "^4.4.13", "text-table": "~0.2.0", "tiny-relative-date": "^1.3.0", "uid-number": "0.0.6", @@ -2768,7 +2873,7 @@ "unique-filename": "^1.1.1", "unpipe": "~1.0.0", "update-notifier": "^2.5.0", - "uuid": "^3.3.2", + "uuid": "^3.3.3", "validate-npm-package-license": "^3.0.4", "validate-npm-package-name": "~3.0.0", "which": "^1.3.1", @@ -2939,14 +3044,15 @@ } }, "bin-links": { - "version": "1.1.3", + "version": "1.1.7", "bundled": true, "dev": true, "requires": { "bluebird": "^3.5.3", "cmd-shim": "^3.0.0", - "gentle-fs": "^2.0.1", + "gentle-fs": "^2.3.0", "graceful-fs": "^4.1.15", + "npm-normalize-package-bin": "^1.0.0", "write-file-atomic": "^2.3.0" } }, @@ -3051,7 +3157,7 @@ } }, "chownr": { - "version": "1.1.2", + "version": "1.1.4", "bundled": true, "dev": true }, @@ -3491,7 +3597,7 @@ } }, "env-paths": { - "version": "1.0.0", + "version": "2.2.0", "bundled": true, "dev": true }, @@ -3689,11 +3795,22 @@ } }, "fs-minipass": { - "version": "1.2.6", + "version": "1.2.7", "bundled": true, "dev": true, "requires": { - "minipass": "^2.2.1" + "minipass": "^2.6.0" + }, + "dependencies": { + "minipass": { + "version": "2.9.0", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + } } }, "fs-vacuum": { @@ -3794,12 +3911,13 @@ "dev": true }, "gentle-fs": { - "version": "2.2.1", + "version": "2.3.0", "bundled": true, "dev": true, "requires": { "aproba": "^1.1.2", "chownr": "^1.1.2", + "cmd-shim": "^3.0.3", "fs-vacuum": "^1.2.10", "graceful-fs": "^4.1.11", "iferr": "^0.1.5", @@ -3823,7 +3941,7 @@ } }, "get-caller-file": { - "version": "1.0.2", + "version": "1.0.3", "bundled": true, "dev": true }, @@ -3844,7 +3962,7 @@ } }, "glob": { - "version": "7.1.4", + "version": "7.1.6", "bundled": true, "dev": true, "requires": { @@ -3890,7 +4008,7 @@ } }, "graceful-fs": { - "version": "4.2.2", + "version": "4.2.3", "bundled": true, "dev": true }, @@ -3932,12 +4050,9 @@ "dev": true }, "hosted-git-info": { - "version": "2.8.2", + "version": "2.8.8", "bundled": true, - "dev": true, - "requires": { - "lru-cache": "^5.1.1" - } + "dev": true }, "http-cache-semantics": { "version": "3.8.1", @@ -3964,7 +4079,7 @@ } }, "https-proxy-agent": { - "version": "2.2.2", + "version": "2.2.4", "bundled": true, "dev": true, "requires": { @@ -3994,7 +4109,7 @@ "dev": true }, "ignore-walk": { - "version": "3.0.1", + "version": "3.0.3", "bundled": true, "dev": true, "requires": { @@ -4051,7 +4166,7 @@ } }, "invert-kv": { - "version": "1.0.0", + "version": "2.0.0", "bundled": true, "dev": true }, @@ -4240,15 +4355,15 @@ "dev": true }, "lcid": { - "version": "1.0.0", + "version": "2.0.0", "bundled": true, "dev": true, "requires": { - "invert-kv": "^1.0.0" + "invert-kv": "^2.0.0" } }, "libcipm": { - "version": "4.0.3", + "version": "4.0.7", "bundled": true, "dev": true, "requires": { @@ -4417,7 +4532,7 @@ } }, "libnpx": { - "version": "10.2.0", + "version": "10.2.2", "bundled": true, "dev": true, "requires": { @@ -4551,7 +4666,7 @@ } }, "make-fetch-happen": { - "version": "5.0.0", + "version": "5.0.2", "bundled": true, "dev": true, "requires": { @@ -4559,7 +4674,7 @@ "cacache": "^12.0.0", "http-cache-semantics": "^3.8.1", "http-proxy-agent": "^2.1.0", - "https-proxy-agent": "^2.2.1", + "https-proxy-agent": "^2.2.3", "lru-cache": "^5.1.1", "mississippi": "^3.0.0", "node-fetch-npm": "^2.0.2", @@ -4568,17 +4683,34 @@ "ssri": "^6.0.0" } }, + "map-age-cleaner": { + "version": "0.1.3", + "bundled": true, + "dev": true, + "requires": { + "p-defer": "^1.0.0" + } + }, "meant": { "version": "1.0.1", "bundled": true, "dev": true }, "mem": { - "version": "1.1.0", + "version": "4.3.0", "bundled": true, "dev": true, "requires": { - "mimic-fn": "^1.0.0" + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^2.0.0", + "p-is-promise": "^2.0.0" + }, + "dependencies": { + "mimic-fn": { + "version": "2.1.0", + "bundled": true, + "dev": true + } } }, "mime-db": { @@ -4594,11 +4726,6 @@ "mime-db": "~1.35.0" } }, - "mimic-fn": { - "version": "1.2.0", - "bundled": true, - "dev": true - }, "minimatch": { "version": "3.0.4", "bundled": true, @@ -4607,35 +4734,25 @@ "brace-expansion": "^1.1.7" } }, - "minimist": { - "version": "0.0.8", - "bundled": true, - "dev": true - }, - "minipass": { - "version": "2.3.3", + "minizlib": { + "version": "1.3.3", "bundled": true, "dev": true, "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" + "minipass": "^2.9.0" }, "dependencies": { - "yallist": { - "version": "3.0.2", + "minipass": { + "version": "2.9.0", "bundled": true, - "dev": true + "dev": true, + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } } } }, - "minizlib": { - "version": "1.2.1", - "bundled": true, - "dev": true, - "requires": { - "minipass": "^2.2.1" - } - }, "mississippi": { "version": "3.0.0", "bundled": true, @@ -4654,11 +4771,18 @@ } }, "mkdirp": { - "version": "0.5.1", + "version": "0.5.3", "bundled": true, "dev": true, "requires": { - "minimist": "0.0.8" + "minimist": "^1.2.5" + }, + "dependencies": { + "minimist": { + "version": "1.2.5", + "bundled": true, + "dev": true + } } }, "move-concurrently": { @@ -4691,6 +4815,11 @@ "bundled": true, "dev": true }, + "nice-try": { + "version": "1.0.5", + "bundled": true, + "dev": true + }, "node-fetch-npm": { "version": "2.0.2", "bundled": true, @@ -4702,36 +4831,21 @@ } }, "node-gyp": { - "version": "5.0.3", + "version": "5.1.0", "bundled": true, "dev": true, "requires": { - "env-paths": "^1.0.0", - "glob": "^7.0.3", - "graceful-fs": "^4.1.2", - "mkdirp": "^0.5.0", - "nopt": "2 || 3", - "npmlog": "0 || 1 || 2 || 3 || 4", - "request": "^2.87.0", - "rimraf": "2", - "semver": "~5.3.0", - "tar": "^4.4.8", - "which": "1" - }, - "dependencies": { - "nopt": { - "version": "3.0.6", - "bundled": true, - "dev": true, - "requires": { - "abbrev": "1" - } - }, - "semver": { - "version": "5.3.0", - "bundled": true, - "dev": true - } + "env-paths": "^2.2.0", + "glob": "^7.1.4", + "graceful-fs": "^4.2.2", + "mkdirp": "^0.5.1", + "nopt": "^4.0.1", + "npmlog": "^4.1.2", + "request": "^2.88.0", + "rimraf": "^2.6.3", + "semver": "^5.7.1", + "tar": "^4.4.12", + "which": "^1.3.1" } }, "nopt": { @@ -4774,9 +4888,12 @@ } }, "npm-bundled": { - "version": "1.0.6", + "version": "1.1.1", "bundled": true, - "dev": true + "dev": true, + "requires": { + "npm-normalize-package-bin": "^1.0.1" + } }, "npm-cache-filename": { "version": "1.0.2", @@ -4784,7 +4901,7 @@ "dev": true }, "npm-install-checks": { - "version": "3.0.0", + "version": "3.0.2", "bundled": true, "dev": true, "requires": { @@ -4792,7 +4909,7 @@ } }, "npm-lifecycle": { - "version": "3.1.3", + "version": "3.1.4", "bundled": true, "dev": true, "requires": { @@ -4811,6 +4928,11 @@ "bundled": true, "dev": true }, + "npm-normalize-package-bin": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, "npm-package-arg": { "version": "6.1.1", "bundled": true, @@ -4823,16 +4945,17 @@ } }, "npm-packlist": { - "version": "1.4.4", + "version": "1.4.8", "bundled": true, "dev": true, "requires": { "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1" + "npm-bundled": "^1.0.1", + "npm-normalize-package-bin": "^1.0.1" } }, "npm-pick-manifest": { - "version": "3.0.0", + "version": "3.0.2", "bundled": true, "dev": true, "requires": { @@ -4842,7 +4965,7 @@ } }, "npm-profile": { - "version": "4.0.2", + "version": "4.0.4", "bundled": true, "dev": true, "requires": { @@ -4852,7 +4975,7 @@ } }, "npm-registry-fetch": { - "version": "4.0.0", + "version": "4.0.3", "bundled": true, "dev": true, "requires": { @@ -4861,7 +4984,15 @@ "figgy-pudding": "^3.4.1", "lru-cache": "^5.1.1", "make-fetch-happen": "^5.0.0", - "npm-package-arg": "^6.1.0" + "npm-package-arg": "^6.1.0", + "safe-buffer": "^5.2.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.2.0", + "bundled": true, + "dev": true + } } }, "npm-run-path": { @@ -4936,13 +5067,41 @@ "dev": true }, "os-locale": { - "version": "2.1.0", + "version": "3.1.0", "bundled": true, "dev": true, "requires": { - "execa": "^0.7.0", - "lcid": "^1.0.0", - "mem": "^1.1.0" + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "6.0.5", + "bundled": true, + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "execa": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + } } }, "os-tmpdir": { @@ -4959,11 +5118,21 @@ "os-tmpdir": "^1.0.0" } }, + "p-defer": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, "p-finally": { "version": "1.0.0", "bundled": true, "dev": true }, + "p-is-promise": { + "version": "2.1.0", + "bundled": true, + "dev": true + }, "p-limit": { "version": "1.2.0", "bundled": true, @@ -4997,7 +5166,7 @@ } }, "pacote": { - "version": "9.5.8", + "version": "9.5.12", "bundled": true, "dev": true, "requires": { @@ -5015,6 +5184,7 @@ "mississippi": "^3.0.0", "mkdirp": "^0.5.1", "normalize-package-data": "^2.4.0", + "npm-normalize-package-bin": "^1.0.0", "npm-package-arg": "^6.1.0", "npm-packlist": "^1.1.12", "npm-pick-manifest": "^3.0.0", @@ -5033,7 +5203,7 @@ }, "dependencies": { "minipass": { - "version": "2.3.5", + "version": "2.9.0", "bundled": true, "dev": true, "requires": { @@ -5266,7 +5436,7 @@ } }, "read-cmd-shim": { - "version": "1.0.3", + "version": "1.0.5", "bundled": true, "dev": true, "requires": { @@ -5288,7 +5458,7 @@ } }, "read-package-json": { - "version": "2.1.0", + "version": "2.1.1", "bundled": true, "dev": true, "requires": { @@ -5296,7 +5466,7 @@ "graceful-fs": "^4.1.2", "json-parse-better-errors": "^1.0.1", "normalize-package-data": "^2.0.0", - "slash": "^1.0.0" + "npm-normalize-package-bin": "^1.0.0" } }, "read-package-tree": { @@ -5310,7 +5480,7 @@ } }, "readable-stream": { - "version": "3.4.0", + "version": "3.6.0", "bundled": true, "dev": true, "requires": { @@ -5395,7 +5565,7 @@ "dev": true }, "rimraf": { - "version": "2.6.3", + "version": "2.7.1", "bundled": true, "dev": true, "requires": { @@ -5471,28 +5641,23 @@ "bundled": true, "dev": true }, - "slash": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, "slide": { "version": "1.1.6", "bundled": true, "dev": true }, "smart-buffer": { - "version": "4.0.2", + "version": "4.1.0", "bundled": true, "dev": true }, "socks": { - "version": "2.3.2", + "version": "2.3.3", "bundled": true, "dev": true, "requires": { - "ip": "^1.1.5", - "smart-buffer": "4.0.2" + "ip": "1.1.5", + "smart-buffer": "^4.1.0" } }, "socks-proxy-agent": { @@ -5699,15 +5864,22 @@ } }, "string_decoder": { - "version": "1.2.0", + "version": "1.3.0", "bundled": true, "dev": true, "requires": { - "safe-buffer": "~5.1.0" + "safe-buffer": "~5.2.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.2.0", + "bundled": true, + "dev": true + } } }, "stringify-package": { - "version": "1.0.0", + "version": "1.0.1", "bundled": true, "dev": true }, @@ -5738,13 +5910,13 @@ } }, "tar": { - "version": "4.4.10", + "version": "4.4.13", "bundled": true, "dev": true, "requires": { "chownr": "^1.1.1", "fs-minipass": "^1.2.5", - "minipass": "^2.3.5", + "minipass": "^2.8.6", "minizlib": "^1.2.1", "mkdirp": "^0.5.0", "safe-buffer": "^5.1.2", @@ -5752,18 +5924,13 @@ }, "dependencies": { "minipass": { - "version": "2.3.5", + "version": "2.9.0", "bundled": true, "dev": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" } - }, - "yallist": { - "version": "3.0.3", - "bundled": true, - "dev": true } } }, @@ -5944,7 +6111,7 @@ } }, "uuid": { - "version": "3.3.2", + "version": "3.3.3", "bundled": true, "dev": true }, @@ -6089,7 +6256,7 @@ "dev": true }, "yargs": { - "version": "11.0.0", + "version": "11.1.1", "bundled": true, "dev": true, "requires": { @@ -6097,7 +6264,7 @@ "decamelize": "^1.1.1", "find-up": "^2.1.0", "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", + "os-locale": "^3.1.0", "require-directory": "^2.1.1", "require-main-filename": "^1.0.1", "set-blocking": "^2.0.0", @@ -7061,9 +7228,9 @@ } }, "tree-kill": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.1.tgz", - "integrity": "sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q==" + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==" }, "trim-repeated": { "version": "1.0.0", diff --git a/package.json b/package.json index 508b771..e520d11 100644 --- a/package.json +++ b/package.json @@ -34,14 +34,14 @@ "download": "7.1.0", "electron": "^7.0.0-beta.6", "electron-builder": "21.2.0", - "npm": "6.11.2", + "npm": "^6.14.3", "rimraf": "3.0.0", "run": "1.4.0", "typescript": "3.5.3" }, "dependencies": { "@sentry/browser": "^5.6.2", - "@sentry/node": "^5.6.2", + "@sentry/node": "^5.15.0", "concurrently": "^4.1.1", "electron-google-analytics": "^0.1.0", "electron-is-dev": "^1.1.0", diff --git a/src/const.ts b/src/const.ts new file mode 100644 index 0000000..0929552 --- /dev/null +++ b/src/const.ts @@ -0,0 +1,20 @@ +export const EXE_RELATED_CONTENT_TYPES = [ + "application/x-msdownload", + "application/bin", + "application/binary", + "application/com", + "application/dos-exe", + "application/exe", + "application/macbinary", + "application/msdos-windows", + "application/octet-stream", + "application/x-com", + "application/x-exe", + "application/x-macbinary", + "application/x-msdos-program", + "application/x-stuffit", + "application/x-tencore", + "application/x-winexe", + "application/x-zip-compressed", + "vms/exe" +]; diff --git a/src/switch.ts b/src/switch.ts index f93d746..9c8d9d1 100644 --- a/src/switch.ts +++ b/src/switch.ts @@ -1,357 +1,386 @@ -import { SwitchHotApp } from './interfaces'; -import * as Tether from 'tether'; +import { SwitchHotApp } from "./interfaces"; +import * as Tether from "tether"; +import { EXE_RELATED_CONTENT_TYPES } from "./const"; const fileIcon = require("extract-file-icon"); -const open = require('open'); -const path = require('path'); +const open = require("open"); +const path = require("path"); -const remote = require('electron').remote; +const remote = require("electron").remote; const Menu = remote.Menu; const MenuItem = remote.MenuItem; - export class Switch { - - hotApps: SwitchHotApp[] | null; - hotApp: SwitchHotApp = { empty: true, name: '', rawcode: null, path: '', icon: '' }; - lastHotAppIndex: number = null; - runningHotApps = []; - - - constructor(public config) { - // Create hot apps elements - this.awakeAppList(); - // Get them from store - this.hotApps = this.getHotApps(); - // Render them - this.renderUIUpdate(); - // set up context menu - this.setUpContextMenu(); + hotApps: SwitchHotApp[] | null; + hotApp: SwitchHotApp = { + empty: true, + name: "", + rawcode: null, + path: "", + icon: "" + }; + lastHotAppIndex: number = null; + runningHotApps = []; + + constructor(public config) { + /// Create hot apps elements + this.awakeAppList(); + /// Get them from store + this.hotApps = this.getHotApps(); + /// Render them + this.renderUIUpdate(); + /// Set up context menu + this.setUpContextMenu(); + } + + /** + * Get a list of hot apps + * @returns SwitchHotApp + */ + + getHotApps(): SwitchHotApp[] | null { + let data = this.config.get("DockHotApps"); + if (data == null) { + data = []; + for (let i = 0; i < 10; i++) data.push(this.hotApp); + this.saveHotApps(data); } - - /** - * Get a list of hot apps - * @returns SwitchHotApp - */ - getHotApps(): SwitchHotApp[] | null { - let data = this.config.get('DockHotApps'); - if (data == null) { - data = []; - for (let i = 0; i < 10; i++) data.push(this.hotApp); - this.saveHotApps(data); - } - return data; + return data; + } + + /** + * Render Changes + */ + + renderUIUpdate() { + const appsListUI: HTMLCollectionOf = document.getElementsByClassName( + "app" + ) as HTMLCollectionOf; + for (let i = 0; i < this.hotApps.length; i++) { + let elem = appsListUI[i]; + let hot = this.hotApps[i]; + if (hot.empty) continue; + elem.className = "app tooltip"; + /// Tooltip + document.getElementById("tip-" + i).innerHTML = `

${ + hot.name.split(".exe")[0] + }

`; + let icon: HTMLImageElement = document.createElement("img"); + icon.dataset.hotAppId = i.toString(); + icon.dataset.appName = hot.name; + icon.id = "ic-" + i; + icon.onclick = function() { + icon.classList.add("animated"); + icon.classList.add("bounce"); + setTimeout(() => { + icon.classList.remove("animated"); + icon.classList.remove("bounce"); + (window as any).APP.openApp(this); + }, 1000); + }.bind(i); + + icon.src = "data:image/png;base64," + hot.icon; + icon.className = "icon"; + elem.innerHTML = ""; + elem.append(icon); } - /** - * Render Changes - */ - renderUIUpdate() { - const appsListUI: HTMLCollectionOf = document.getElementsByClassName('app') as HTMLCollectionOf; - for (let i = 0; i < this.hotApps.length; i++) { - let elem = appsListUI[i]; - let hot = this.hotApps[i]; - if (hot.empty) continue; - elem.className = 'app tooltip'; - // tooltip - document.getElementById('tip-' + i).innerHTML = `

${hot.name.split('.exe')[0]}

`; - let icon: HTMLImageElement = document.createElement('img'); - icon.dataset.hotAppId = i.toString(); - icon.dataset.appName = hot.name; - icon.id = "ic-" + i; - icon.onclick = function () { - icon.classList.add('animated'); - icon.classList.add('bounce'); - setTimeout(() => { - icon.classList.remove('animated'); - icon.classList.remove('bounce'); - (window as any).APP.openApp(this); - }, 1000); - }.bind(i); - - - icon.src = 'data:image/png;base64,' + hot.icon; - icon.className = 'icon'; - elem.innerHTML = ""; - elem.append(icon); - } - - Tether.position(); + Tether.position(); + } + + /** + * Bootstrap the appbar UI elements + */ + + awakeAppList() { + const track = document.getElementById("track"); + for (let i = 0; i < 10; i++) { + const div = document.createElement("div"); + const file = document.createElement("input"); + div.id = "app-" + i; + div.className = "app empty tooltip"; + div.innerHTML += `

Add app

`; + file.type = "file"; + /// Remove default title behaviour. + file.title = ""; + /// if(process.platform == 'darwin') file.accept = ".app"; + file.id = "f-app-" + i; + file.addEventListener("change", e => { + (window as any).APP.onClickAddHotApp(e); + }); + div.appendChild(file); + track.appendChild(div); + + /// Place tooltip + new Tether({ + element: document.getElementById("tip-" + i), + target: div, + attachment: "middle center", + targetAttachment: i == 0 ? "bottom center" : "top center", + offset: i == 0 ? "-8px 0" : "8px 0", + constraints: [ + { + to: "scrollParent" + } + ] + }); + + /// Add hover eventlistner + div.onmouseenter = () => { + document.getElementById("tip-" + i).classList.add("show"); + }; + + div.onmouseleave = () => { + document.getElementById("tip-" + i).classList.remove("show"); + }; } - - /** - * Bootstrap the appbar UI elements - */ - awakeAppList() { - const track = document.getElementById('track'); - for (let i = 0; i < 10; i++) { - const div = document.createElement('div'); - const file = document.createElement('input'); - div.id = "app-" + i; - div.className = "app empty tooltip"; - div.innerHTML += `

Add app

`; - file.type = 'file'; - // remove default title behaviour. - file.title = ""; - // if(process.platform == 'darwin') file.accept = ".app"; - file.id = "f-app-" + i; - file.addEventListener('change', e => { - (window as any).APP.onClickAddHotApp(e); - }) - div.appendChild(file); - track.appendChild(div); - - //place tooltip - new Tether({ - element: document.getElementById("tip-" + i), - target: div, - attachment: 'middle center', - targetAttachment: (i == 0) ? 'bottom center' : 'top center', - offset: (i == 0) ? '-8px 0' : '8px 0', - constraints: [ - { - to: 'scrollParent', - } - ] - }); - - // add hover eventlistner - div.onmouseenter = () => { - document.getElementById("tip-" + i).classList.add('show'); - }; - - - div.onmouseleave = () => { - document.getElementById("tip-" + i).classList.remove('show'); - } - - - - - - } - - } - - /** - * Resets the hot app tile of as given index - * @param {number} i Index to reset - */ - resetAppTileUI(i: number) { - const appTile = document.getElementById('app-' + i); - appTile.innerHTML = ""; - appTile.className = "app empty tooltip"; - document.getElementById('tip-' + i).innerHTML = `

Add app

`; - const file = document.createElement('input'); - file.type = 'file'; - file.id = "f-app-" + i; - file.title = ""; - // if(process.platform == 'darwin') file.accept = ".app"; - file.addEventListener('change', e => { - (window as any).APP.onClickAddHotApp(e); + } + + /** + * Resets the hot app tile of as given index + * @param {number} i Index to reset + */ + + resetAppTileUI(i: number) { + const appTile = document.getElementById("app-" + i); + appTile.innerHTML = ""; + appTile.className = "app empty tooltip"; + document.getElementById("tip-" + i).innerHTML = `

Add app

`; + const file = document.createElement("input"); + file.type = "file"; + file.id = "f-app-" + i; + file.title = ""; + /// if(process.platform == 'darwin') file.accept = ".app"; + file.addEventListener("change", e => { + (window as any).APP.onClickAddHotApp(e); + }); + appTile.appendChild(file); + } + + /** + * Handles click event when user want to add new app + * @param {Event} elem - Event + */ + + onClickAddHotApp(elem) { + if (process.platform == "darwin") (window as any).SHOW_DOCK(); + + /// Request dock to appear. A fix for macOS - dock disappears while add app.. + try { + (window as any).SWITCH_SERVICE_CHANNEL.emit( + "switch-service-incoming", + JSON.stringify({ + type: "show-dock" }) - appTile.appendChild(file); - } - - /** - * Handles click event when user want to add new app - * @param {Event} elem - Event - */ - onClickAddHotApp(elem) { - - if(process.platform == "darwin") (window as any).SHOW_DOCK(); - - // request dock to appear. A fix for macOS - dock disappears while add app.. - try { - (window as any).SWITCH_SERVICE_CHANNEL.emit('switch-service-incoming', JSON.stringify({ - type: 'show-dock' - })); - - const file = elem.target.files[0]; - if (this.checkIfAppExists(file.path, file.name)) { - alert('App already exists in dock!'); - return; - } - - // get app icon - let opsys = process.platform; - if (opsys == 'darwin' && file.path.toLowerCase().split('/pkginfo').length == 2 ) { - const chunck = file.path.split('.app'); - const p = chunck[0].split('/'); - const appPath = chunck[0]+'.app'; - const icon = fileIcon(appPath, 64).toString('base64'); - (window as any).APP.addApp(elem.target.id.split('-')[2], {name: p[p.length -1], path: appPath}, icon); - } else if (file.type == 'application/x-msdownload' && path.extname(file.path.toLowerCase()) == '.exe' && (opsys == "win32" || 'win64')) { - const icon = fileIcon(file.path, 32).toString('base64'); - (window as any).APP.addApp(elem.target.id.split('-')[2], file, icon); - } else { - alert('Please select an app!'); - } - - } catch (e) { } - } - - /** - * Checks if an app with a given name and path already exists - * @param {string} path - * @param {string} name - */ - checkIfAppExists(path: string, name: string) { - const nameExits = this.hotApps.filter(hotapp => hotapp.name.toLowerCase() == name.toLocaleLowerCase()); - const pathExists = this.hotApps.filter(hotapp => hotapp.path.toLowerCase() == path.toLowerCase()); - return (pathExists.length == 0 || nameExits.length == 0) ? false : true; - } - - - /** - * Adds a new app and save it details - * @param {any} index - * @param {any} fileDetails - * @param {string} appIcon - */ - addApp(index: any, fileDetails: any, appIcon: string) { - let mapDarwinKeycode = parseInt(index) + 2; - if(mapDarwinKeycode == 10) mapDarwinKeycode = 0; - this.hotApps[index] = { - empty: false, - name: fileDetails.name, - path: fileDetails.path, - icon: appIcon, - rawcode: ((process.platform == 'darwin') ? mapDarwinKeycode : 49 + parseInt(index)) - }; - this.saveHotApps(this.hotApps); - this.renderUIUpdate(); + ); + + const file = elem.target.files[0]; + if (this.checkIfAppExists(file.path, file.name)) { + alert("App already exists in dock!"); + return; + } + + /// Get app icon + let opsys = process.platform; + if ( + opsys == "darwin" && + file.path.toLowerCase().split("/pkginfo").length == 2 + ) { + const chunck = file.path.split(".app"); + const p = chunck[0].split("/"); + const appPath = chunck[0] + ".app"; + const icon = fileIcon(appPath, 64).toString("base64"); + (window as any).APP.addApp( + elem.target.id.split("-")[2], + { name: p[p.length - 1], path: appPath }, + icon + ); + } else if ( + EXE_RELATED_CONTENT_TYPES.includes(file.type) && + path.extname(file.path.toLowerCase()) == ".exe" && + (opsys == "win32" || "win64") + ) { + const icon = fileIcon(file.path, 32).toString("base64"); + (window as any).APP.addApp(elem.target.id.split("-")[2], file, icon); + } else { + alert("Please select an app!"); + } + } catch (e) {} + } + + /** + * Checks if an app with a given name and path already exists + * @param {string} path + * @param {string} name + */ + + checkIfAppExists(path: string, name: string) { + const nameExits = this.hotApps.filter( + hotapp => hotapp.name.toLowerCase() == name.toLocaleLowerCase() + ); + const pathExists = this.hotApps.filter( + hotapp => hotapp.path.toLowerCase() == path.toLowerCase() + ); + return pathExists.length == 0 || nameExits.length == 0 ? false : true; + } + + /** + * Adds a new app and save it details + * @param {any} index + * @param {any} fileDetails + * @param {string} appIcon + */ + + addApp(index: any, fileDetails: any, appIcon: string) { + let mapDarwinKeycode = parseInt(index) + 2; + if (mapDarwinKeycode == 10) mapDarwinKeycode = 0; + this.hotApps[index] = { + empty: false, + name: fileDetails.name, + path: fileDetails.path, + icon: appIcon, + rawcode: + process.platform == "darwin" ? mapDarwinKeycode : 49 + parseInt(index) + }; + this.saveHotApps(this.hotApps); + this.renderUIUpdate(); + } + + /** + * Removes an hotapp of given index and update store. + * @param {number} index + */ + + removeApp(index: number) { + this.hotApps[index] = this.hotApp; + this.saveHotApps(this.hotApps); + this.resetAppTileUI(index); + } + + /** + * Saves hotapps update into the store + * @param {any} update + */ + + saveHotApps(update) { + this.config.set("DockHotApps", update); + /// Send update to background service + let hotAppsData = []; + update.forEach(hot => { + hotAppsData.push({ + name: hot.name, + path: hot.path, + rawcode: hot.rawcode + }); + }); + try { + (window as any).SWITCH_SERVICE_CHANNEL.emit( + "switch-service-incoming", + JSON.stringify({ type: "update-hot-apps", data: hotAppsData }) + ); + } catch (e) {} + } + + /** + * Get the hot app index of a given hot app name + * @param {string} name Hot app name + */ + + getHotApppIndex(name: string) { + for (let i = 0; i < this.hotApps.length; i++) { + if (this.hotApps[i].name == name) return i; } - - /** - * Removes an hotapp of given index and update store. - * @param {number} index - */ - removeApp(index: number) { - this.hotApps[index] = this.hotApp; - this.saveHotApps(this.hotApps); - this.resetAppTileUI(index); + return null; + } + + /** + * Sets the last switched hot app + * @param hotApp Last switched hot app + */ + + lastSwitchedApp(hotApp) { + const hotAppIndex = this.getHotApppIndex(hotApp.name); + if (this.lastHotAppIndex != null) { + document.getElementById("app-" + this.lastHotAppIndex).className = "app"; } - /** - * Saves hotapps update into the store - * @param {any} update - */ - saveHotApps(update) { - this.config.set('DockHotApps', update); - // send update to background service - let hotAppsData = []; - update.forEach(hot => { - hotAppsData.push({ name: hot.name, path: hot.path, rawcode: hot.rawcode }) - }); - try { - (window as any).SWITCH_SERVICE_CHANNEL.emit('switch-service-incoming', JSON.stringify({ type: 'update-hot-apps', data: hotAppsData })); - } catch (e) { - + document.getElementById("app-" + hotAppIndex).className = "app active"; + this.lastHotAppIndex = hotAppIndex; + } + + /** + * Open a hot app with a given index + * @param {number} index Index of the hot app to open + */ + + openApp(index: number) { + let hotAppData = this.hotApps[index]; + open(hotAppData.path); + } + + onRightClick() {} + + /** + * Builds new context menu which triggers functions of the + * hot app provided. + * @param {number} i Index of the hot app + * @returns {Menu} The built menu + */ + + buildContextMenuBasedOnHotAppIndex(i: number) { + const menu = new Menu(); + const menuItems = [ + { + label: "Launch app", + click: () => { + this.openApp(i); } - } - - - /** - * Get the hot app index of a given hot app name - * @param {string} name Hot app name - */ - getHotApppIndex(name: string) { - for (let i = 0; i < this.hotApps.length; i++) { - if (this.hotApps[i].name == name) return i; + }, + { + label: "Remove app", + click: () => { + this.removeApp(i); } - return null; - } - - /** - * Sets the last switched hot app - * @param hotApp Last switched hot app - */ - lastSwitchedApp(hotApp) { - const hotAppIndex = this.getHotApppIndex(hotApp.name); - // console.log('new', hotAppIndex); - if (this.lastHotAppIndex != null) { - console.log(this.lastHotAppIndex); - document.getElementById('app-' + this.lastHotAppIndex).className = 'app'; + } + ]; + + menuItems.forEach(item => { + menu.append(new MenuItem(item)); + }); + + return menu; + } + + /** + * Add event listener on context menu. + */ + + setUpContextMenu() { + window.addEventListener( + "contextmenu", + e => { + e.preventDefault(); + const elem = e.target as HTMLElement; + // if the element has a data attribute data-hotAppId. + if (elem.dataset.hotAppId) { + const hotAppID = parseInt(elem.dataset.hotAppId); + document.getElementById("tip-" + hotAppID).classList.remove("show"); + const menu = this.buildContextMenuBasedOnHotAppIndex(hotAppID); + menu.popup(remote.getCurrentWindow() as any); } - - document.getElementById('app-' + hotAppIndex).className = 'app active'; - this.lastHotAppIndex = hotAppIndex; - } - - /** - * Open a hot app with a given index - * @param {number} index Index of the hot app to open - */ - openApp(index: number) { - - // console.log('before', this.runningHotApps); - let hotAppData = this.hotApps[index]; - open(hotAppData.path); - } - - onRightClick() { - - } - - /** - * Builds new context menu which triggers functions of the - * hot app provided. - * @param {number} i Index of the hot app - * @returns {Menu} The built menu - */ - buildContextMenuBasedOnHotAppIndex(i: number) { - const menu = new Menu(); - const menuItems = [ - { - label: 'Launch app', - click: () => { - this.openApp(i); - } - }, - { - label: 'Remove app', - click: () => { - this.removeApp(i); - } - }]; - - menuItems.forEach(item => { - menu.append(new MenuItem(item)); - }); - - return menu; - } - - /** - * Add event listener on context menu. - */ - - setUpContextMenu() { - window.addEventListener('contextmenu', (e) => { - e.preventDefault(); - const elem = e.target as HTMLElement; - // if the element has a data attribute data-hotAppId. - if (elem.dataset.hotAppId) { - const hotAppID = parseInt(elem.dataset.hotAppId); - document.getElementById("tip-" + hotAppID).classList.remove('show'); - const menu = this.buildContextMenuBasedOnHotAppIndex(hotAppID); - menu.popup(remote.getCurrentWindow() as any); - } - }, false); - } - + }, + false + ); + } } - -export function osSpecificAppearance() -{ - const opsys = process.platform; - const appBar = document.getElementById('appbar'); - if(opsys == "win32") - { - appBar.style.borderRadius = '0px'; - } else if(opsys == 'darwin') - { - appBar.classList.add('mac-style'); - } -} \ No newline at end of file +export function osSpecificAppearance() { + const opsys = process.platform; + const appBar = document.getElementById("appbar"); + if (opsys == "win32") { + appBar.style.borderRadius = "0px"; + } else if (opsys == "darwin") { + appBar.classList.add("mac-style"); + } +}