diff --git a/src/clients/Element.io.ts b/src/clients/Element.io.ts index 402f97f..6d4f6c1 100644 --- a/src/clients/Element.io.ts +++ b/src/clients/Element.io.ts @@ -14,9 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { LinkedClient, Maturity, ClientKind } from './types'; +import { + LinkedClient, + Maturity, + ClientKind, + ClientId, + Platform, +} from './types'; import { LinkKind } from '../parser/types'; -import logo from './element.svg'; +import logo from '../imgs/element.svg'; const Element: LinkedClient = { kind: ClientKind.LINKED_CLIENT, @@ -26,7 +32,9 @@ const Element: LinkedClient = { homepage: 'https://element.io', maturity: Maturity.STABLE, description: 'Fully-featured Matrix client for the Web', - tags: [], + platform: Platform.Desktop, + experimental: false, + clientId: ClientId.Element, toUrl: (link) => { switch (link.kind) { case LinkKind.Alias: @@ -50,4 +58,37 @@ const Element: LinkedClient = { }, }; +export const ElementDevelop: LinkedClient = { + kind: ClientKind.LINKED_CLIENT, + name: 'Element Develop', + author: 'Element', + logo: logo, + homepage: 'https://element.io', + maturity: Maturity.STABLE, + description: 'Fully-featured Matrix client for the Web', + platform: Platform.Desktop, + experimental: true, + clientId: ClientId.ElementDevelop, + toUrl: (link) => { + switch (link.kind) { + case LinkKind.Alias: + case LinkKind.RoomId: + return new URL( + `https://develop.element.io/#/room/${link.identifier}` + ); + case LinkKind.UserId: + return new URL( + `https://develop.element.io/#/user/${link.identifier}` + ); + case LinkKind.Permalink: + return new URL( + `https://develop.element.io/#/room/${link.identifier}` + ); + case LinkKind.GroupId: + return new URL( + `https://develop.element.io/#/group/${link.identifier}` + ); + } + }, +}; export default Element; diff --git a/src/clients/Weechat.tsx b/src/clients/Weechat.tsx new file mode 100644 index 0000000..e88dc24 --- /dev/null +++ b/src/clients/Weechat.tsx @@ -0,0 +1,63 @@ +/* +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/weechat.svg'; + +const Weechat: TextClient = { + kind: ClientKind.TEXT_CLIENT, + name: 'Weechat', + logo: logo, + author: 'Poljar', + homepage: 'https://github.com/poljar/weechat-matrix', + maturity: Maturity.LATE_BETA, + experimental: false, + platform: Platform.Desktop, + clientId: ClientId.WeeChat, + 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 Weechat doesn't support this kind of link; + } + }, + description: 'Commandline Matrix interface using Weechat', +}; + +export default Weechat; diff --git a/src/clients/index.ts b/src/clients/index.ts index 0fc102f..ba39676 100644 --- a/src/clients/index.ts +++ b/src/clients/index.ts @@ -16,12 +16,24 @@ limitations under the License. import { Client } from './types'; -import Element from './Element.io'; +import Element, { ElementDevelop } from './Element.io'; +import Weechat from './Weechat'; /* * All the supported clients of matrix.to */ -const clients: Client[] = [Element]; +const clients: Client[] = [Element, Weechat, ElementDevelop]; + +/* + * A map from sharer string to client. + * Configured by hand so we can change the mappings + * easily later. + */ +export const clientMap: { [key: string]: Client } = { + [Element.clientId]: Element, + [Weechat.clientId]: Weechat, + [ElementDevelop.clientId]: ElementDevelop, +}; /* * All the supported clients of matrix.to diff --git a/src/clients/element.svg b/src/imgs/element.svg similarity index 100% rename from src/clients/element.svg rename to src/imgs/element.svg diff --git a/src/imgs/weechat.svg b/src/imgs/weechat.svg new file mode 100644 index 0000000..96b92b1 --- /dev/null +++ b/src/imgs/weechat.svg @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + +