diff --git a/src/clients/Element.io.ts b/src/clients/Element.io.ts index 6d4f6c13024a9b8fa2c74fc65b0a1a645a7c8e52..8a346ae8995ec965f8a7a069df4aa4160acac6f6 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 0000000000000000000000000000000000000000..a0caaacf6e3530575428d2894cf5c8b4c4f0a101 --- /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 <span>Click the '+' button in the top right</span>; + default: + return <span>Weechat doesn't support this kind of link</span>; + } + }, + 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 0000000000000000000000000000000000000000..a0954d1ca3ace2e66270d3400eef6e42eb405e48 --- /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 ( + <span> + Type{' '} + <code> + /join <b>{link.identifier}</b> + </code> + </span> + ); + case LinkKind.UserId: + return ( + <span> + Type{' '} + <code> + /invite <b>{link.identifier}</b> + </code> + </span> + ); + default: + return <span>Nheko doesn't support this kind of link</span>; + } + }, + 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 ff6b52899813b4b0654bac429f15c22574d6a08e..cd15769017bc2b90840ee07f1d87845759b57fa4 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 ba39676ddeaff27fcc6bc50ab631723c00abab9c..c3686bb3e41b0f1c0d5d2209bb2bbbd3e9ee953a 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 cdaed2785dd5ce19106ca277e3ff99bf940fa9e7..5a93f15848582ff6e2287900f47ab747c1142599 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 fbef28fc625643adb012c0b96af566d3c5f7400f..4d23d37387e97c59fc3af24ba914cac383ee3d3f 100644 --- a/src/components/ClientList.tsx +++ b/src/components/ClientList.tsx @@ -63,6 +63,10 @@ const ClientList: React.FC<IProps> = ({ 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 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 0000000000000000000000000000000000000000..ce3ec4069ee57e903f4759a0e2c4e42afb43943b --- /dev/null +++ b/src/imgs/nheko.svg @@ -0,0 +1,155 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="1024" + height="1024" + viewBox="0 0 270.93333 270.93333" + version="1.1" + id="svg8" + inkscape:version="0.92.4 5da689c313, 2019-01-14" + sodipodi:docname="nheko.svg" + inkscape:export-filename="/home/nicolas/Dokumente/devel/open-source/nheko/resources/nheko-rebuild-round-corners.svg.png" + inkscape:export-xdpi="130.048" + inkscape:export-ydpi="130.048"> + <defs + id="defs2" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.35355339" + inkscape:cx="852.07808" + inkscape:cy="-60.410565" + inkscape:document-units="mm" + inkscape:current-layer="layer2" + showgrid="true" + inkscape:window-width="1920" + inkscape:window-height="1019" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="1" + showguides="true" + inkscape:snap-grids="true" + gridtolerance="10" + inkscape:snap-bbox="false" + inkscape:bbox-paths="true" + inkscape:snap-global="true" + inkscape:bbox-nodes="true" + inkscape:lockguides="false" + units="px"> + <sodipodi:guide + position="0,0" + orientation="0,793.70079" + id="guide4797" + inkscape:locked="false" /> + <sodipodi:guide + position="0,297" + orientation="1122.5197,0" + id="guide4803" + inkscape:locked="false" /> + <inkscape:grid + type="axonomgrid" + id="grid4805" + units="px" + empspacing="2" + snapvisiblegridlinesonly="true" + spacingy="1.0583333" /> + <sodipodi:guide + position="0,0" + orientation="0,755.90551" + id="guide4807" + inkscape:locked="false" /> + <sodipodi:guide + position="200,0" + orientation="-755.90551,0" + id="guide4809" + inkscape:locked="false" /> + <sodipodi:guide + position="200,200" + orientation="0,-755.90551" + id="guide4811" + inkscape:locked="false" /> + <inkscape:grid + type="xygrid" + id="grid871" + empspacing="2" + color="#d43fff" + opacity="0.1254902" + empcolor="#cf3fff" + empopacity="0.25098039" + units="px" + spacingx="1.0583333" + spacingy="1.0583333" + enabled="false" /> + </sodipodi:namedview> + <metadata + id="metadata5"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:groupmode="layer" + id="layer2" + inkscape:label="Logo" + style="display:inline" + transform="translate(0,-26.066668)"> + <circle + id="path3792" + cx="135.46666" + cy="161.53333" + style="display:inline;fill:#333333;fill-opacity:1;stroke:none;stroke-width:0.3584221" + inkscape:transform-center-x="-57.929751" + inkscape:transform-center-y="532.03976" + inkscape:export-xdpi="96.000008" + inkscape:export-ydpi="96.000008" + r="135.46666" /> + <path + style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.32663074px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 48.965212,110.73276 H 239.52342 c 4.88824,0 4.88824,0 0,8.46688 L 180.59519,221.2662 c -4.6188,8.00001 -4.6188,8.00001 -9.50702,8.00001 h -19.55294 c -4.88824,0 -4.88824,0 -0.26944,-8.00001 l 44.2635,-76.66608 h -29.41224 l -43.91123,76.19952 c -4.88823,8.46657 -4.88823,8.46657 -9.77646,8.46657 H 29.329398 l 49.299816,-84.66609 h -49.29982 z" + id="path4834" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccccccccccccc" + inkscape:export-xdpi="96.000008" + inkscape:export-ydpi="96.000008" /> + <path + style="fill:#c0def5;fill-opacity:1;stroke:none;stroke-width:0.3584221px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 97.764652,110.73276 H 127.09406 L 58.658797,229.26621 H 29.329398 Z" + id="path4836" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccc" + inkscape:export-xdpi="96.000008" + inkscape:export-ydpi="96.000008" /> + <path + style="fill:#87aade;fill-opacity:1;stroke:none;stroke-width:0.3584221px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 58.658797,229.26621 127.09406,110.73276 h 29.3294 L 87.988193,229.26621 Z" + id="path4838" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccc" + inkscape:export-xdpi="96.000008" + inkscape:export-ydpi="96.000008" /> + </g> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + style="display:inline" + transform="translate(0,-26.066668)" /> +</svg>