diff --git a/src/clients/Element.io.ts b/src/clients/Element.io.ts index 6d4f6c1..8a346ae 100644 --- a/src/clients/Element.io.ts +++ b/src/clients/Element.io.ts @@ -56,6 +56,7 @@ const Element: LinkedClient = { ); } }, + linkSupport: () => true, }; export const ElementDevelop: LinkedClient = { @@ -90,5 +91,6 @@ export const ElementDevelop: LinkedClient = { ); } }, + linkSupport: () => true, }; export default Element; diff --git a/src/clients/Fractal.tsx b/src/clients/Fractal.tsx new file mode 100644 index 0000000..a0caaac --- /dev/null +++ b/src/clients/Fractal.tsx @@ -0,0 +1,69 @@ +/* +Copyright 2020 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import React from 'react'; + +import { TextClient, Maturity, ClientKind, ClientId, Platform } from './types'; + +import { LinkKind } from '../parser/types'; + +import logo from '../imgs/fractal.png'; + +const Fractal: TextClient = { + kind: ClientKind.TEXT_CLIENT, + name: 'Fractal', + logo: logo, + author: 'Daniel Garcia Moreno', + homepage: 'https://github.com/poljar/weechat-matrix', + maturity: Maturity.BETA, + experimental: false, + platform: Platform.Desktop, + clientId: ClientId.Fractal, + toInviteString: (link) => { + switch (link.kind) { + case LinkKind.Alias: + case LinkKind.RoomId: + case LinkKind.UserId: + return Click the '+' button in the top right; + default: + return Weechat doesn't support this kind of link; + } + }, + copyString: (link) => { + switch (link.kind) { + case LinkKind.Alias: + case LinkKind.RoomId: + case LinkKind.UserId: + return `${link.identifier}`; + default: + return ''; + } + }, + linkSupport: (link) => { + switch (link.kind) { + case LinkKind.Alias: + case LinkKind.RoomId: + case LinkKind.UserId: + return true; + default: + return false; + } + }, + + description: 'Command-line Matrix interface using Weechat', +}; + +export default Fractal; diff --git a/src/clients/Nheko.tsx b/src/clients/Nheko.tsx new file mode 100644 index 0000000..a0954d1 --- /dev/null +++ b/src/clients/Nheko.tsx @@ -0,0 +1,85 @@ +/* +Copyright 2020 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import React from 'react'; + +import { TextClient, Maturity, ClientKind, ClientId, Platform } from './types'; + +import { LinkKind } from '../parser/types'; + +import logo from '../imgs/nheko.svg'; + +const Nheko: TextClient = { + kind: ClientKind.TEXT_CLIENT, + name: 'Nheko', + logo: logo, + author: 'mujx, red_sky, deepbluev7, Konstantinos Sideris', + homepage: 'https://github.com/Nheko-Reborn/nheko', + maturity: Maturity.BETA, + experimental: false, + platform: Platform.Desktop, + clientId: ClientId.Nheko, + toInviteString: (link) => { + switch (link.kind) { + case LinkKind.Alias: + case LinkKind.RoomId: + return ( + + Type{' '} + + /join {link.identifier} + + + ); + case LinkKind.UserId: + return ( + + Type{' '} + + /invite {link.identifier} + + + ); + default: + return Nheko doesn't support this kind of link; + } + }, + copyString: (link) => { + switch (link.kind) { + case LinkKind.Alias: + case LinkKind.RoomId: + return `/join ${link.identifier}`; + case LinkKind.UserId: + return `/invite ${link.identifier}`; + default: + return ''; + } + }, + linkSupport: (link) => { + switch (link.kind) { + case LinkKind.Alias: + case LinkKind.RoomId: + case LinkKind.UserId: + return true; + default: + return false; + } + }, + description: + 'A native desktop app for Matrix that feels more like a mainstream chat app.', +}; + +export default Nheko; diff --git a/src/clients/Weechat.tsx b/src/clients/Weechat.tsx index ff6b528..cd15769 100644 --- a/src/clients/Weechat.tsx +++ b/src/clients/Weechat.tsx @@ -68,6 +68,17 @@ const Weechat: TextClient = { return ''; } }, + linkSupport: (link) => { + switch (link.kind) { + case LinkKind.Alias: + case LinkKind.RoomId: + case LinkKind.UserId: + return true; + default: + return false; + } + }, + description: 'Command-line Matrix interface using Weechat', }; diff --git a/src/clients/index.ts b/src/clients/index.ts index ba39676..c3686bb 100644 --- a/src/clients/index.ts +++ b/src/clients/index.ts @@ -18,11 +18,13 @@ import { Client } from './types'; import Element, { ElementDevelop } from './Element.io'; import Weechat from './Weechat'; +import Nheko from './Nheko'; +import Fractal from './Fractal'; /* * All the supported clients of matrix.to */ -const clients: Client[] = [Element, Weechat, ElementDevelop]; +const clients: Client[] = [Element, Weechat, Nheko, Fractal, ElementDevelop]; /* * A map from sharer string to client. @@ -33,6 +35,8 @@ export const clientMap: { [key: string]: Client } = { [Element.clientId]: Element, [Weechat.clientId]: Weechat, [ElementDevelop.clientId]: ElementDevelop, + [Nheko.clientId]: Nheko, + [Fractal.clientId]: Fractal, }; /* diff --git a/src/clients/types.ts b/src/clients/types.ts index cdaed27..5a93f15 100644 --- a/src/clients/types.ts +++ b/src/clients/types.ts @@ -49,6 +49,8 @@ export enum ClientId { Element = 'element.io', ElementDevelop = 'develop.element.io', WeeChat = 'weechat', + Nheko = 'nheko', + Fractal = 'fractal', } /* @@ -64,6 +66,7 @@ export interface ClientDescription { maturity: Maturity; clientId: ClientId; experimental: boolean; + linkSupport: (link: SafeLink) => boolean; } /* diff --git a/src/components/ClientList.tsx b/src/components/ClientList.tsx index fbef28f..4d23d37 100644 --- a/src/components/ClientList.tsx +++ b/src/components/ClientList.tsx @@ -63,6 +63,10 @@ const ClientList: React.FC = ({ link, rememberSelection }: IProps) => { showClient = false; } + if (!client.linkSupport(link)) { + showClient = false; + } + return showClient; }; diff --git a/src/imgs/fractal.png b/src/imgs/fractal.png new file mode 100644 index 0000000..e60c89c Binary files /dev/null and b/src/imgs/fractal.png differ diff --git a/src/imgs/nheko.svg b/src/imgs/nheko.svg new file mode 100644 index 0000000..ce3ec40 --- /dev/null +++ b/src/imgs/nheko.svg @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + +