diff options
author | 2020-06-22 10:40:27 +0200 | |
---|---|---|
committer | 2020-06-22 10:40:27 +0200 | |
commit | 57fffb6572dd4fa8257357b42448cd2bbeb8d586 (patch) | |
tree | 73f8c766150bc4a37382cb10929fb2e4758bbfc7 /uncompressed/rocketchat | |
parent | Repackaged #206 (diff) | |
download | ferdium-recipes-57fffb6572dd4fa8257357b42448cd2bbeb8d586.tar.gz ferdium-recipes-57fffb6572dd4fa8257357b42448cd2bbeb8d586.tar.zst ferdium-recipes-57fffb6572dd4fa8257357b42448cd2bbeb8d586.zip |
Update repository
Diffstat (limited to 'uncompressed/rocketchat')
-rw-r--r-- | uncompressed/rocketchat/index.js | 39 | ||||
-rw-r--r-- | uncompressed/rocketchat/package.json | 2 | ||||
-rw-r--r-- | uncompressed/rocketchat/webview.js | 16 |
3 files changed, 27 insertions, 30 deletions
diff --git a/uncompressed/rocketchat/index.js b/uncompressed/rocketchat/index.js index 349ed36..54450ce 100644 --- a/uncompressed/rocketchat/index.js +++ b/uncompressed/rocketchat/index.js | |||
@@ -1,26 +1,21 @@ | |||
1 | 'use strict'; | 1 | "use strict"; |
2 | |||
3 | function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } | ||
4 | 2 | ||
5 | module.exports = Franz => class RocketChat extends Franz { | 3 | module.exports = Franz => class RocketChat extends Franz { |
6 | validateUrl(url) { | 4 | async validateUrl(url) { |
7 | return _asyncToGenerator(function* () { | 5 | try { |
8 | try { | 6 | const resp = await window.fetch(url, { |
9 | const resp = yield window.fetch(`${url}/api/info`, { | 7 | method: 'GET', |
10 | method: 'GET', | 8 | headers: { |
11 | headers: { | 9 | 'Content-Type': 'application/json' |
12 | 'Content-Type': 'application/json' | 10 | } |
13 | } | 11 | }); |
14 | }); | 12 | const status = resp.status.toString(); |
15 | const data = yield resp.json(); | 13 | return status.startsWith('2') || status.startsWith('3'); |
16 | 14 | } catch (err) { | |
17 | return Object.hasOwnProperty.call(data, 'version'); | 15 | console.error(err); |
18 | } catch (err) { | 16 | } |
19 | console.error(err); | ||
20 | } | ||
21 | 17 | ||
22 | return false; | 18 | return false; |
23 | })(); | ||
24 | } | 19 | } |
25 | }; | 20 | |
26 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJvY2tldGNoYXQvaW5kZXguanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIkZyYW56IiwiUm9ja2V0Q2hhdCIsInZhbGlkYXRlVXJsIiwidXJsIiwicmVzcCIsIndpbmRvdyIsImZldGNoIiwibWV0aG9kIiwiaGVhZGVycyIsImRhdGEiLCJqc29uIiwiT2JqZWN0IiwiaGFzT3duUHJvcGVydHkiLCJjYWxsIiwiZXJyIiwiY29uc29sZSIsImVycm9yIl0sIm1hcHBpbmdzIjoiOzs7O0FBQUFBLE9BQU9DLE9BQVAsR0FBaUJDLFNBQVMsTUFBTUMsVUFBTixTQUF5QkQsS0FBekIsQ0FBK0I7QUFDakRFLGFBQU4sQ0FBa0JDLEdBQWxCLEVBQXVCO0FBQUE7QUFDckIsVUFBSTtBQUNGLGNBQU1DLE9BQU8sTUFBTUMsT0FBT0MsS0FBUCxDQUFjLEdBQUVILEdBQUksV0FBcEIsRUFBZ0M7QUFDakRJLGtCQUFRLEtBRHlDO0FBRWpEQyxtQkFBUztBQUNQLDRCQUFnQjtBQURUO0FBRndDLFNBQWhDLENBQW5CO0FBTUEsY0FBTUMsT0FBTyxNQUFNTCxLQUFLTSxJQUFMLEVBQW5COztBQUVBLGVBQU9DLE9BQU9DLGNBQVAsQ0FBc0JDLElBQXRCLENBQTJCSixJQUEzQixFQUFpQyxTQUFqQyxDQUFQO0FBQ0QsT0FWRCxDQVVFLE9BQU9LLEdBQVAsRUFBWTtBQUNaQyxnQkFBUUMsS0FBUixDQUFjRixHQUFkO0FBQ0Q7O0FBRUQsYUFBTyxLQUFQO0FBZnFCO0FBZ0J0QjtBQWpCc0QsQ0FBekQiLCJmaWxlIjoicm9ja2V0Y2hhdC9pbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gRnJhbnogPT4gY2xhc3MgUm9ja2V0Q2hhdCBleHRlbmRzIEZyYW56IHtcbiAgYXN5bmMgdmFsaWRhdGVVcmwodXJsKSB7XG4gICAgdHJ5IHtcbiAgICAgIGNvbnN0IHJlc3AgPSBhd2FpdCB3aW5kb3cuZmV0Y2goYCR7dXJsfS9hcGkvaW5mb2AsIHtcbiAgICAgICAgbWV0aG9kOiAnR0VUJyxcbiAgICAgICAgaGVhZGVyczoge1xuICAgICAgICAgICdDb250ZW50LVR5cGUnOiAnYXBwbGljYXRpb24vanNvbicsXG4gICAgICAgIH0sXG4gICAgICB9KTtcbiAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCByZXNwLmpzb24oKTtcblxuICAgICAgcmV0dXJuIE9iamVjdC5oYXNPd25Qcm9wZXJ0eS5jYWxsKGRhdGEsICd2ZXJzaW9uJyk7XG4gICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICBjb25zb2xlLmVycm9yKGVycik7XG4gICAgfVxuXG4gICAgcmV0dXJuIGZhbHNlO1xuICB9XG59O1xuIl19 \ No newline at end of file | 21 | }; \ No newline at end of file |
diff --git a/uncompressed/rocketchat/package.json b/uncompressed/rocketchat/package.json index 61c77e8..7200d76 100644 --- a/uncompressed/rocketchat/package.json +++ b/uncompressed/rocketchat/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "rocketchat", | 2 | "id": "rocketchat", |
3 | "name": "Rocket.Chat", | 3 | "name": "Rocket.Chat", |
4 | "version": "1.0.6", | 4 | "version": "1.0.8", |
5 | "description": "Rocket.Chat", | 5 | "description": "Rocket.Chat", |
6 | "main": "index.js", | 6 | "main": "index.js", |
7 | "author": "Stefan Malzner <stefan@adlk.io>", | 7 | "author": "Stefan Malzner <stefan@adlk.io>", |
diff --git a/uncompressed/rocketchat/webview.js b/uncompressed/rocketchat/webview.js index 1e26ac9..5ccd0d2 100644 --- a/uncompressed/rocketchat/webview.js +++ b/uncompressed/rocketchat/webview.js | |||
@@ -1,10 +1,11 @@ | |||
1 | 'use strict'; | 1 | "use strict"; |
2 | 2 | ||
3 | const { ipcRenderer } = require('electron'); | 3 | const { |
4 | ipcRenderer | ||
5 | } = require('electron'); | ||
4 | 6 | ||
5 | const getTeamIcon = function getTeamIcon() { | 7 | const getTeamIcon = function getTeamIcon() { |
6 | console.log('getTeamIcon'); | 8 | console.log('getTeamIcon'); |
7 | |||
8 | const manifestElement = document.querySelector('link[rel="manifest"]'); | 9 | const manifestElement = document.querySelector('link[rel="manifest"]'); |
9 | 10 | ||
10 | if (manifestElement == null) { | 11 | if (manifestElement == null) { |
@@ -12,12 +13,14 @@ const getTeamIcon = function getTeamIcon() { | |||
12 | } | 13 | } |
13 | 14 | ||
14 | const manifestUrl = manifestElement.getAttribute('href'); | 15 | const manifestUrl = manifestElement.getAttribute('href'); |
16 | console.log(manifestUrl); | ||
15 | 17 | ||
16 | if (manifestUrl == null) { | 18 | if (manifestUrl == null) { |
17 | return; | 19 | return; |
18 | } | 20 | } |
19 | 21 | ||
20 | const xmlhttp = new XMLHttpRequest(); | 22 | const xmlhttp = new XMLHttpRequest(); |
23 | |||
21 | xmlhttp.onreadystatechange = function () { | 24 | xmlhttp.onreadystatechange = function () { |
22 | if (this.readyState != 4 || this.status != 200) { | 25 | if (this.readyState != 4 || this.status != 200) { |
23 | return; | 26 | return; |
@@ -26,9 +29,10 @@ const getTeamIcon = function getTeamIcon() { | |||
26 | const response = JSON.parse(this.responseText); | 29 | const response = JSON.parse(this.responseText); |
27 | 30 | ||
28 | if (response.icons.length >= 1) { | 31 | if (response.icons.length >= 1) { |
29 | ipcRenderer.sendToHost('avatar', `${window.location.protocol}//${window.location.host}/${response.icons[0].src}`); | 32 | ipcRenderer.sendToHost('avatar', `${window.location.protocol}//${window.location.host}${response.icons[0].src}`); |
30 | } | 33 | } |
31 | }; | 34 | }; |
35 | |||
32 | xmlhttp.open('GET', manifestUrl, true); | 36 | xmlhttp.open('GET', manifestUrl, true); |
33 | xmlhttp.send(); | 37 | xmlhttp.send(); |
34 | }; | 38 | }; |
@@ -41,9 +45,7 @@ module.exports = Franz => { | |||
41 | }; | 45 | }; |
42 | 46 | ||
43 | Franz.loop(getMessages); | 47 | Franz.loop(getMessages); |
44 | |||
45 | setTimeout(() => { | 48 | setTimeout(() => { |
46 | getTeamIcon(); | 49 | getTeamIcon(); |
47 | }, 4000); | 50 | }, 4000); |
48 | }; | 51 | }; \ No newline at end of file |
49 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJvY2tldGNoYXQvd2Vidmlldy5qcyJdLCJuYW1lcyI6WyJpcGNSZW5kZXJlciIsInJlcXVpcmUiLCJnZXRUZWFtSWNvbiIsImNvbnNvbGUiLCJsb2ciLCJtYW5pZmVzdEVsZW1lbnQiLCJkb2N1bWVudCIsInF1ZXJ5U2VsZWN0b3IiLCJtYW5pZmVzdFVybCIsImdldEF0dHJpYnV0ZSIsInhtbGh0dHAiLCJYTUxIdHRwUmVxdWVzdCIsIm9ucmVhZHlzdGF0ZWNoYW5nZSIsInJlYWR5U3RhdGUiLCJzdGF0dXMiLCJyZXNwb25zZSIsIkpTT04iLCJwYXJzZSIsInJlc3BvbnNlVGV4dCIsImljb25zIiwibGVuZ3RoIiwic2VuZFRvSG9zdCIsIndpbmRvdyIsImxvY2F0aW9uIiwicHJvdG9jb2wiLCJob3N0Iiwic3JjIiwib3BlbiIsInNlbmQiLCJtb2R1bGUiLCJleHBvcnRzIiwiRnJhbnoiLCJnZXRNZXNzYWdlcyIsImRpcmVjdE1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