diff options
Diffstat (limited to 'uncompressed/rocketchat/index.js')
-rw-r--r-- | uncompressed/rocketchat/index.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/uncompressed/rocketchat/index.js b/uncompressed/rocketchat/index.js new file mode 100644 index 0000000..349ed36 --- /dev/null +++ b/uncompressed/rocketchat/index.js | |||
@@ -0,0 +1,26 @@ | |||
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 | |||
5 | module.exports = Franz => class RocketChat extends Franz { | ||
6 | validateUrl(url) { | ||
7 | return _asyncToGenerator(function* () { | ||
8 | try { | ||
9 | const resp = yield window.fetch(`${url}/api/info`, { | ||
10 | method: 'GET', | ||
11 | headers: { | ||
12 | 'Content-Type': 'application/json' | ||
13 | } | ||
14 | }); | ||
15 | const data = yield resp.json(); | ||
16 | |||
17 | return Object.hasOwnProperty.call(data, 'version'); | ||
18 | } catch (err) { | ||
19 | console.error(err); | ||
20 | } | ||
21 | |||
22 | return false; | ||
23 | })(); | ||
24 | } | ||
25 | }; | ||
26 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJvY2tldGNoYXQvaW5kZXguanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIkZyYW56IiwiUm9ja2V0Q2hhdCIsInZhbGlkYXRlVXJsIiwidXJsIiwicmVzcCIsIndpbmRvdyIsImZldGNoIiwibWV0aG9kIiwiaGVhZGVycyIsImRhdGEiLCJqc29uIiwiT2JqZWN0IiwiaGFzT3duUHJvcGVydHkiLCJjYWxsIiwiZXJyIiwiY29uc29sZSIsImVycm9yIl0sIm1hcHBpbmdzIjoiOzs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