From 77b482957237d8a6337e47360bdb8824add56efb Mon Sep 17 00:00:00 2001 From: Vijay A Date: Thu, 27 May 2021 21:40:16 +0530 Subject: Re-fetched zulip recipe from https://github.com/adambirds/recipe-zulip --- all.json | 2 +- recipes/zulip/README.md | 2 +- recipes/zulip/icon.png | Bin 31889 -> 70728 bytes recipes/zulip/icon.svg | 2 +- recipes/zulip/index.js | 41 +++++++++++++++++------------------------ recipes/zulip/package.json | 28 ++++++++++++++-------------- recipes/zulip/webview.js | 2 +- 7 files changed, 35 insertions(+), 42 deletions(-) diff --git a/all.json b/all.json index 055ab3f..443f118 100644 --- a/all.json +++ b/all.json @@ -1731,7 +1731,7 @@ "featured": false, "id": "zulip", "name": "Zulip", - "version": "1.0.2", + "version": "1.0.3", "icons": { "png": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/zulip/icon.png", "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/zulip/icon.svg" diff --git a/recipes/zulip/README.md b/recipes/zulip/README.md index 5406ac5..029ddbf 100644 --- a/recipes/zulip/README.md +++ b/recipes/zulip/README.md @@ -5,4 +5,4 @@ This is the Franz 5 Recipe for Zulip * [Visit the website](https://zulipchat.com/why-zulip/) ### How to create your own Franz recipes: -* [Read the documentation](https://github.com/meetfranz/plugins) \ No newline at end of file +* [Read the documentation](https://github.com/meetfranz/plugins) diff --git a/recipes/zulip/icon.png b/recipes/zulip/icon.png index 8b3758f..aa06b01 100644 Binary files a/recipes/zulip/icon.png and b/recipes/zulip/icon.png differ diff --git a/recipes/zulip/icon.svg b/recipes/zulip/icon.svg index 72466de..a64fcec 100644 --- a/recipes/zulip/icon.svg +++ b/recipes/zulip/icon.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/recipes/zulip/index.js b/recipes/zulip/index.js index 136398c..199d0f4 100644 --- a/recipes/zulip/index.js +++ b/recipes/zulip/index.js @@ -1,28 +1,21 @@ -'use strict'; - -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"); }); }; } - module.exports = Franz => class Zulip extends Franz { - validateUrl(url) { - return _asyncToGenerator(function* () { - const baseUrl = new window.URL(url); - const apiVersion = 'api/v1'; - try { - const resp = yield window.fetch(`${baseUrl.origin}/${apiVersion}/server_settings`, { - method: 'GET', - headers: { - 'Content-Type': 'application/json' - } - }); - const data = yield resp.json(); + async validateUrl(url) { + const baseUrl = new window.URL(url); + const apiVersion = 'api/v1' + try { + const resp = await window.fetch(`${baseUrl.origin}/${apiVersion}/server_settings`, { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + }); + const data = await resp.json(); - return Object.hasOwnProperty.call(data, 'realm_uri'); - } catch (err) { - console.error(err); - } - - return false; - })(); + return Object.hasOwnProperty.call(data, 'realm_uri'); + } catch (err) { + console.error(err); } + + return false; + } }; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInp1bGlwL2luZGV4LmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJGcmFueiIsIlp1bGlwIiwidmFsaWRhdGVVcmwiLCJ1cmwiLCJiYXNlVXJsIiwid2luZG93IiwiVVJMIiwiYXBpVmVyc2lvbiIsInJlc3AiLCJmZXRjaCIsIm9yaWdpbiIsIm1ldGhvZCIsImhlYWRlcnMiLCJkYXRhIiwianNvbiIsIk9iamVjdCIsImhhc093blByb3BlcnR5IiwiY2FsbCIsImVyciIsImNvbnNvbGUiLCJlcnJvciJdLCJtYXBwaW5ncyI6Ijs7OztBQUFBQSxPQUFPQyxPQUFQLEdBQWlCQyxTQUFTLE1BQU1DLEtBQU4sU0FBb0JELEtBQXBCLENBQTBCO0FBQzFDRSxlQUFOLENBQWtCQyxHQUFsQix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gICAgICAgbWV0aG9kOiAnR0VUJyxcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XG4gICAgICAgICAgICAgICAgICAgICdDb250ZW50LVR5cGUnOiAnYXBwbGljYXRpb24vanNvbicsXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgY29uc3QgZGF0YSA9IGF3YWl0IHJlc3AuanNvbigpO1xuXG4gICAgICAgICAgICByZXR1cm4gT2JqZWN0Lmhhc093blByb3BlcnR5LmNhbGwoZGF0YSwgJ3JlYWxtX3VyaScpO1xuICAgICAgICB9IGNhdGNoIChlcnIpIHtcbiAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoZXJyKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9XG59OyJdfQ== \ No newline at end of file diff --git a/recipes/zulip/package.json b/recipes/zulip/package.json index 2d0fe88..3a1f541 100644 --- a/recipes/zulip/package.json +++ b/recipes/zulip/package.json @@ -1,15 +1,15 @@ { - "id": "zulip", - "name": "Zulip", - "version": "1.0.2", - "description": "Zulip", - "main": "index.js", - "author": "Adam Birds and akashnimare", - "license": "MIT", - "config": { - "hasNotificationSound": true, - "hasDirectMessages": true, - "hasIndirectMessages": true, - "hasCustomUrl": true - } -} \ No newline at end of file + "id": "zulip", + "name": "Zulip", + "version": "1.0.3", + "description": "Zulip", + "main": "index.js", + "author": "Adam Birds and akashnimare", + "license": "MIT", + "config": { + "hasNotificationSound": true, + "hasDirectMessages": true, + "hasIndirectMessages": true, + "hasCustomUrl": true + } +} diff --git a/recipes/zulip/webview.js b/recipes/zulip/webview.js index fdf9551..a595b2c 100644 --- a/recipes/zulip/webview.js +++ b/recipes/zulip/webview.js @@ -1,6 +1,6 @@ "use strict"; -module.exports = Franz => { +module.exports = (Franz) => { const getMessages = function getMessages() { const allMessages = Math.round(document.querySelectorAll("#global_filters .top_left_all_messages .count .value")[0].innerText); Franz.setBadge(allMessages); -- cgit v1.2.3-54-g00ecf