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/index.js | |
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/index.js')
-rw-r--r-- | uncompressed/rocketchat/index.js | 39 |
1 files changed, 17 insertions, 22 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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJvY2tldGNoYXQvaW5kZXguanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIkZyYW56IiwiUm9ja2V0Q2hhdCIsInZhbGlkYXRlVXJsIiwidXJsIiwicmVzcCIsIndpbmRvdyIsImZldGNoIiwibWV0aG9kIiwiaGVhZGVycyIsImRhdGEiLCJqc29uIiwiT2JqZWN0IiwiaGFzT3duUHJvcGVydHkiLCJjYWxsIiwiZXJyIiwiY29uc29sZSIsImVycm9yIl0sIm1hcHBpbmdzIjoiOzs7O0FBQUFBLE9BQU9DLE9BQVAsR0FBaUJDLFNBQVMsTUFBTUMsVUFBTixTQUF5QkQsS0FBekIsQ0FBK0I7QUFDakRFLGFBQU4sQ0FBa0JDLEdBQWxCLEVBQXVCO0FBQUE7QUFDckIsVUFBSTtBQUNGLGNBQU1DLE9BQU8sTUFBTUMsT0FBT0MsS0FBUCxDQUFjLEdBQUVILEdBQUksV0FBcEIsRUFBZ0M7QUFDakRJLGtCQUFRLEtBRHlDO0FBRWpEQyxtQkFBUztBQUNQLDRCQUFnQjtBQURUO0FBRndDLFNBQWhDLENBQW5CO0FBTUEsY0FBTUMsT0FBTyxNQUFNTCxLQUFLTSxJQUFMLEVBQW5COztBQUVBLGVBQU9DLE9BQU9DLGNBQVAsQ0FBc0JDLElBQXRCLENBQTJCSixJQUEzQixFQUFpQyxTQUFqQyxDQUFQO0FBQ0QsT0FWRCxDQVVFLE9BQU9LLEdBQVAsRUFBWTtBQUNaQyxnQkFBUUMsS0FBUixDQUFjRixHQUFkO0FBQ0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