diff options
-rw-r--r-- | docs/configuration.md | 10 | ||||
-rw-r--r-- | pnpm-lock.yaml | 6 | ||||
-rw-r--r-- | recipes/hipchat/icon.svg | 1 | ||||
-rw-r--r-- | recipes/hipchat/index.js | 57 | ||||
-rw-r--r-- | recipes/hipchat/package.json | 14 | ||||
-rw-r--r-- | recipes/hipchat/webview.js | 21 |
6 files changed, 9 insertions, 100 deletions
diff --git a/docs/configuration.md b/docs/configuration.md index 8dff91b..081b7ad 100644 --- a/docs/configuration.md +++ b/docs/configuration.md | |||
@@ -38,7 +38,7 @@ This is the Ferdium-specific integration config. | |||
38 | * `string` **serviceURL**<br/> | 38 | * `string` **serviceURL**<br/> |
39 | Defines the URL that should be loaded into the Ferdium webview. | 39 | Defines the URL that should be loaded into the Ferdium webview. |
40 | <br /><br /> | 40 | <br /><br /> |
41 | If you want to load a simple URL like `https://www.messenger.com`, you can simply define it via the `serviceURL` parameter. If your service URL is team based, e.g. Slack or HipChat you can use `https://{teamId}.slack.com`. | 41 | If you want to load a simple URL like `https://www.messenger.com`, you can simply define it via the `serviceURL` parameter. If your service URL is team based, e.g. Slack you can use `https://{teamId}.slack.com`. |
42 | <br /><br /> | 42 | <br /><br /> |
43 | If your service works with custom URLs, just leave this empty. | 43 | If your service works with custom URLs, just leave this empty. |
44 | <br /><br /> | 44 | <br /><br /> |
@@ -61,19 +61,19 @@ If your service works with custom URLs, just leave this empty. | |||
61 | * `boolean` **hasTeamId** _default: false_<br /> | 61 | * `boolean` **hasTeamId** _default: false_<br /> |
62 | Is this a team based service? If true, the interface to add the service will require a team identifier. e.g. `[teamId]`.slack.com | 62 | Is this a team based service? If true, the interface to add the service will require a team identifier. e.g. `[teamId]`.slack.com |
63 | * `string` **urlInputPrefix**<br /> | 63 | * `string` **urlInputPrefix**<br /> |
64 | This option is only used in combination with `hasTeamId: true` in order to display the value of `urlInputPrefix` before the input for TeamId to make it obvious to the user what input is required from them. Eg. _<TeamID>.hipchat.com_ | 64 | This option is only used in combination with `hasTeamId: true` in order to display the value of `urlInputPrefix` before the input for TeamId to make it obvious to the user what input is required from them. Eg. _<TeamID>.slack.com_ |
65 | * `string` **urlInputSuffix**<br /> | 65 | * `string` **urlInputSuffix**<br /> |
66 | This option is only used in combination with `hasTeamId: true` in order to display the value of `urlInputSuffix` after the input for TeamId to make it obvious to the user what input is required from them. Eg. _<TeamID>.hipchat.com_ | 66 | This option is only used in combination with `hasTeamId: true` in order to display the value of `urlInputSuffix` after the input for TeamId to make it obvious to the user what input is required from them. Eg. _<TeamID>.slack.com_ |
67 | * `boolean` **hasHostedOption** _default: false_<br /> | 67 | * `boolean` **hasHostedOption** _default: false_<br /> |
68 | If a service can be hosted and has a teamId or customUrl | 68 | If a service can be hosted and has a teamId or customUrl |
69 | * `boolean` **hasCustomUrl** _default: false_<br /> | 69 | * `boolean` **hasCustomUrl** _default: false_<br /> |
70 | On-premise services like HipChat, Mattermost, ... require a custom URL. This option enables the user to enter a custom URL when adding the service. | 70 | On-premise services like Mattermost, ... require a custom URL. This option enables the user to enter a custom URL when adding the service. |
71 | * `boolean` **hasNotificationSound** _default: false_<br /> | 71 | * `boolean` **hasNotificationSound** _default: false_<br /> |
72 | Some services provide their own notification sound. In order to avoid multiple sounds when the user receives a message set this to `true`. If the service has no built in notification sound set this to `false`. | 72 | Some services provide their own notification sound. In order to avoid multiple sounds when the user receives a message set this to `true`. If the service has no built in notification sound set this to `false`. |
73 | * `boolean` **hasDirectMessages** _default: true_<br /> | 73 | * `boolean` **hasDirectMessages** _default: true_<br /> |
74 | Some services have direct 1x1 messages e.g. a mention or message to every user in a channel (@channel). If this flag is set to `true`, the user can enable/disable if there should be a badge for direct messages. | 74 | Some services have direct 1x1 messages e.g. a mention or message to every user in a channel (@channel). If this flag is set to `true`, the user can enable/disable if there should be a badge for direct messages. |
75 | * `boolean` **hasIndirectMessages** _default: false_<br /> | 75 | * `boolean` **hasIndirectMessages** _default: false_<br /> |
76 | Services like Slack or HipChat have direct messages e.g. a mention or message to every user in a channel (@channel) and indirect messages e.g. general discussion in a channel. If this flag is set to `true`, the user can enable/disable if there should be a badge for indirect messages. | 76 | Services like Slack have direct messages e.g. a mention or message to every user in a channel (@channel) and indirect messages e.g. general discussion in a channel. If this flag is set to `true`, the user can enable/disable if there should be a badge for indirect messages. |
77 | * `string` **message**<br /> | 77 | * `string` **message**<br /> |
78 | Info message that will be displayed in the add/edit service preferences screen. | 78 | Info message that will be displayed in the add/edit service preferences screen. |
79 | * `boolean` **disablewebsecurity** _default: false_<br /> | 79 | * `boolean` **disablewebsecurity** _default: false_<br /> |
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f097e23..461e43c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml | |||
@@ -283,8 +283,6 @@ importers: | |||
283 | 283 | ||
284 | recipes/hey: {} | 284 | recipes/hey: {} |
285 | 285 | ||
286 | recipes/hipchat: {} | ||
287 | |||
288 | recipes/home-assistant: {} | 286 | recipes/home-assistant: {} |
289 | 287 | ||
290 | recipes/hostnet: {} | 288 | recipes/hostnet: {} |
@@ -465,6 +463,8 @@ importers: | |||
465 | 463 | ||
466 | recipes/podio: {} | 464 | recipes/podio: {} |
467 | 465 | ||
466 | recipes/poe: {} | ||
467 | |||
468 | recipes/pomodoro-tracker: {} | 468 | recipes/pomodoro-tracker: {} |
469 | 469 | ||
470 | recipes/posteo: {} | 470 | recipes/posteo: {} |
@@ -617,6 +617,8 @@ importers: | |||
617 | 617 | ||
618 | recipes/whimsical: {} | 618 | recipes/whimsical: {} |
619 | 619 | ||
620 | recipes/wikipedia: {} | ||
621 | |||
620 | recipes/wire: {} | 622 | recipes/wire: {} |
621 | 623 | ||
622 | recipes/withspectrum: {} | 624 | recipes/withspectrum: {} |
diff --git a/recipes/hipchat/icon.svg b/recipes/hipchat/icon.svg deleted file mode 100644 index 4ccc019..0000000 --- a/recipes/hipchat/icon.svg +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | <svg height="80" width="80" xmlns="http://www.w3.org/2000/svg"><mask id="a" fill="#fff"><path d="M0 1.58h79.272v74.112H0" fill-rule="evenodd"/></mask><g fill="#2d497d" fill-rule="evenodd"><path d="M61.283 44.442c0-.83-.675-1.577-1.577-1.577-.366 0-.741.123-1.047.4-3.993 3.59-10.79 6.766-19.008 6.788h-.032c-8.203-.022-14.804-3.324-19.008-6.787-.265-.218-.757-.37-1.075-.37-.978 0-1.546.833-1.549 1.748 0 .703.495 1.296.902 1.905 2.356 3.538 9.663 9.55 20.66 9.55h.174c10.995 0 18.305-6.012 20.658-9.55.407-.609.902-1.4.902-2.107"/><path d="M72.217 71.027c-2.8-1.596-5.456-4.293-6.673-7.992-.24-.726-.029-1.31.53-1.741 8.102-6.267 13.199-15.366 13.199-25.5C79.273 16.9 61.526 1.58 39.638 1.58 17.748 1.579.001 16.9.001 35.795c0 18.907 17.746 34.229 39.637 34.229 2.86 0 5.649-.262 8.336-.76a2.26 2.26 0 0 1 1.637.302c5.424 3.33 13.501 6.125 20.585 6.125 2.283 0 3.16-1.448 3.16-2.766 0-.851-.46-1.51-1.139-1.898m-10.606-3.328c.123.167.19.31.19.46 0 .23-.218.389-.493.389-1.987 0-8.105-3.3-11.322-6.018-.445-.372-1.06-.508-1.937-.318a39.403 39.403 0 0 1-8.414.902c-18.22 0-32.99-12.203-32.99-27.262 0-15.05 14.77-27.25 32.99-27.25s32.992 12.2 32.992 27.25c0 8.985-5.26 16.952-13.375 21.919-.543.331-1.117.956-1.117 1.738 0 1.602 1.502 5.576 3.476 8.19" mask="url(#a)" transform="translate(0 1)"/></g></svg> \ No newline at end of file | ||
diff --git a/recipes/hipchat/index.js b/recipes/hipchat/index.js deleted file mode 100644 index e786bcb..0000000 --- a/recipes/hipchat/index.js +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | function _asyncToGenerator(fn) { | ||
2 | return function () { | ||
3 | const gen = Reflect.apply(fn, this, arguments); | ||
4 | return new Promise((resolve, reject) => { | ||
5 | function step(key, arg) { | ||
6 | try { | ||
7 | var info = gen[key](arg); | ||
8 | var value = info.value; | ||
9 | } catch (error) { | ||
10 | reject(error); | ||
11 | return; | ||
12 | } | ||
13 | if (info.done) { | ||
14 | resolve(value); | ||
15 | } else { | ||
16 | // eslint-disable-next-line consistent-return | ||
17 | return Promise.resolve(value).then( | ||
18 | value => { | ||
19 | step('next', value); | ||
20 | }, | ||
21 | error => { | ||
22 | step('throw', error); | ||
23 | }, | ||
24 | ); | ||
25 | } | ||
26 | } | ||
27 | return step('next'); | ||
28 | }); | ||
29 | }; | ||
30 | } | ||
31 | |||
32 | module.exports = Ferdium => | ||
33 | class HipChat extends Ferdium { | ||
34 | validateUrl(url) { | ||
35 | return _asyncToGenerator(function* () { | ||
36 | try { | ||
37 | const resp = yield window.fetch(`${url}/api/features`, { | ||
38 | method: 'GET', | ||
39 | headers: { | ||
40 | 'Content-Type': 'application/json', | ||
41 | }, | ||
42 | }); | ||
43 | const data = yield resp.json(); | ||
44 | |||
45 | return Object.hasOwnProperty.call(data, 'features'); | ||
46 | } catch (error) { | ||
47 | console.error(error); | ||
48 | } | ||
49 | |||
50 | return false; | ||
51 | })(); | ||
52 | } | ||
53 | |||
54 | buildUrl(url) { | ||
55 | return `${url}/chat`; | ||
56 | } | ||
57 | }; | ||
diff --git a/recipes/hipchat/package.json b/recipes/hipchat/package.json deleted file mode 100644 index 0f9f3f0..0000000 --- a/recipes/hipchat/package.json +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | { | ||
2 | "id": "hipchat", | ||
3 | "name": "HipChat", | ||
4 | "version": "1.3.0", | ||
5 | "license": "MIT", | ||
6 | "config": { | ||
7 | "serviceURL": "https://{teamId}.hipchat.com/chat", | ||
8 | "hasNotificationSound": true, | ||
9 | "hasIndirectMessages": true, | ||
10 | "hasTeamId": true, | ||
11 | "hasCustomUrl": true, | ||
12 | "urlInputSuffix": ".hipchat.com" | ||
13 | } | ||
14 | } | ||
diff --git a/recipes/hipchat/webview.js b/recipes/hipchat/webview.js deleted file mode 100644 index 6871fbb..0000000 --- a/recipes/hipchat/webview.js +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | function _interopRequireDefault(obj) { | ||
2 | return obj && obj.__esModule ? obj : { default: obj }; | ||
3 | } | ||
4 | |||
5 | const _path = _interopRequireDefault(require('path')); | ||
6 | |||
7 | module.exports = Ferdium => { | ||
8 | const getMessages = () => { | ||
9 | const directMessages = document.querySelectorAll('.hc-mention').length; | ||
10 | const allMessages = | ||
11 | document.querySelectorAll('.aui-badge:not(.hc-mention)').length - | ||
12 | directMessages; | ||
13 | |||
14 | // set Ferdium badge | ||
15 | Ferdium.setBadge(directMessages, allMessages); | ||
16 | }; | ||
17 | |||
18 | Ferdium.loop(getMessages); | ||
19 | |||
20 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
21 | }; | ||