From 91cbb73ac87618bd13c333f7c612fa7bc817697e Mon Sep 17 00:00:00 2001 From: Jorik Schellekens Date: Wed, 16 Sep 2020 14:28:29 +0100 Subject: [PATCH] add clients --- src/clients/Element.io.ts | 2 + src/clients/Fractal.tsx | 69 +++++++++++++++ src/clients/Nheko.tsx | 85 +++++++++++++++++++ src/clients/Weechat.tsx | 11 +++ src/clients/index.ts | 6 +- src/clients/types.ts | 3 + src/components/ClientList.tsx | 4 + src/imgs/fractal.png | Bin 0 -> 8796 bytes src/imgs/nheko.svg | 155 ++++++++++++++++++++++++++++++++++ 9 files changed, 334 insertions(+), 1 deletion(-) create mode 100644 src/clients/Fractal.tsx create mode 100644 src/clients/Nheko.tsx create mode 100644 src/imgs/fractal.png create mode 100644 src/imgs/nheko.svg 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 0000000000000000000000000000000000000000..e60c89c98878256859f41e0667183cccf6de2d68 GIT binary patch literal 8796 zcmd^Fg3>&}Q^f&iJ*%ZTq##VN7b{i?5P+BY#riZQA=i5ssNS^OL*g=$E5SN(nfnSu^ z6`_};o~46QwT6vp0kNASAnYvpeDM$0!Maj?6-VjX##3)1tM)Rv;I6T^`cZmqc0^jlasL(U6@^HoHI&{WQS2Y=_BLQKNK&yuTI zxL~8Wnfli(^9Z+vlK58f@58vrWOW%Y8sQ8UVqSFX0()xpi@v`jP%{0)F_r!pkj~63 zCF@aB-B%)~&nC4TCeJSa*40q^3bUk4`}+A5GOZjmt(QDg!{mx}icRGCY-tUDJ)x(k zj-RgoY=nDVd!%5Ob_YyM|EKxGDVL{kLE$rLoJHrvYQhPv<3N!~h;iKEyXf3%caJ|& zb?uTHfwoRxgbRZ8wckrl5M=MOoQ!3$iYQ*NzYW0)E+iZ~?=z<2Ke^n`OxqO(9+?Zp zsfAEgWrIBrmjsqWb@(s*tsy1Ey{kX$Nju22R&^ANIsE+DrNFT@&je&YP~@*ZH0qt( z`=fYwS2X0cxPJ>(X_M>>6)mL8!0eM`vue~(+K%VelkH2|v20VQbj}GRr9+GSennT8oH>aEc4ISW6XTA%rw z2reC3h~>z5gkt)lsF&mG+e7yjYZfHt?wWLXx~ zvWzVk``~8aO7RXD>?_>Upp20I?p!uoEe|y@f9JG+e7ek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T#V z3^;>%bd27aLcA7k!cr=%l+-19w2tDut{PjEn@zxjm; z&^=cjA9}-;BbTH4W%Sgd-%DDE%v-#fG_dK=&H8ERTUENCQW3#VGG% z{h6&^yX*mubn*d?LD6NLRIy%1MfQeyAqS;8Pgf2-um1vkoeEy+&XTzM+(Y`$&u3E; zVjMqyaS2UgP?gNYA@ZIqy#6v64iM)1>Y$+d6#+udk{O1$&Az{M!Ud^Xe%E&abKGc; z#g+pGBDlcvyZ@B~;h1quei|ZxoQaxtpmTG_3hHsx3mh>ReLM?rs`{wK3G7M*vzwO&w&QpMcq# zN3FsnJj94SP?LMK4Bjab;+I?xq+tT+qKe`+Nh>~V#mCVrA(7Vn+dUQw;uH1S%IqJ- zXNgZxlRRF$-Z&*XTGW`*(g4Os7NP@{&IN4KD1cbt1H5MMnGoC2FEgpNT6yd&GN0iC z$-@Y~YZ;*Uo8hGI@XG#aZ!q8?g+1V5J|n<$!~uR#SnsTk&&%YH04Ec4OfHD}U<@_- z^~`|5{>g7Wx2Lb6ac}znJx+Bj3osL6qHBRPPf8zcnovh(+_}n&>OblZZ3*w7`jXlR zZY>{GQ&w{#k6GqmgS5ay+}Joo+wplQ#pHVr49|oA)hE=P9KVZ6EgS4n7ah5w>Gr{m z_wlCY)dyr9UzXpIRNQ0D*8>+hl2W5j0(~I1Hs7>;5ZU?$oCHBrQc#z#k+q2YKPw#> A`v3p{ literal 0 HcmV?d00001 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 + + + + + + + + + + + + +