Create clients and configure them

This commit is contained in:
Jorik Schellekens 2020-09-01 10:25:55 +02:00
parent 47fe7860c3
commit dd8aa3d074
5 changed files with 291 additions and 5 deletions

View File

@ -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;

63
src/clients/Weechat.tsx Normal file
View File

@ -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 (
<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>Weechat doesn't support this kind of link</span>;
}
},
description: 'Commandline Matrix interface using Weechat',
};
export default Weechat;

View File

@ -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

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

170
src/imgs/weechat.svg Normal file
View File

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
inkscape:export-ydpi="797.66998"
inkscape:export-xdpi="797.66998"
inkscape:export-filename="/tmp/weechat512.png"
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
sodipodi:docname="weechat2.svg"
width="64"
height="64"
version="1.1"
id="svg8">
<sodipodi:namedview
inkscape:current-layer="svg8"
inkscape:window-maximized="1"
inkscape:window-y="42"
inkscape:window-x="148"
inkscape:cy="32"
inkscape:cx="11.643564"
inkscape:zoom="12.625"
showgrid="false"
id="namedview1443"
inkscape:window-height="968"
inkscape:window-width="1638"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
guidetolerance="10"
gridtolerance="10"
objecttolerance="10"
borderopacity="1"
bordercolor="#666666"
pagecolor="#ffffff" />
<defs
id="defs2">
<linearGradient
id="linearGradient891">
<stop
style="stop-color:#0e16be;stop-opacity:1;"
offset="0"
id="stop887" />
<stop
style="stop-color:#63a4e1;stop-opacity:1"
offset="1"
id="stop889" />
</linearGradient>
<linearGradient
id="linearGradient883">
<stop
style="stop-color:#008726;stop-opacity:1;"
offset="0"
id="stop879" />
<stop
style="stop-color:#7ecc6f;stop-opacity:1"
offset="1"
id="stop881" />
</linearGradient>
<linearGradient
xlink:href="#linearGradient883"
id="linearGradient885"
x1="115.09375"
y1="42.862499"
x2="26.987501"
y2="42.862499"
gradientUnits="userSpaceOnUse" />
<linearGradient
xlink:href="#linearGradient891"
id="linearGradient893"
x1="60.854168"
y1="97.102089"
x2="60.854168"
y2="62.706253"
gradientUnits="userSpaceOnUse" />
<filter
style="color-interpolation-filters:sRGB"
id="filter5519">
<feFlood
flood-opacity="0.60422568746132421"
flood-color="rgb(0,0,0)"
result="flood"
id="feFlood5509" />
<feComposite
in="flood"
in2="SourceGraphic"
operator="in"
result="composite1"
id="feComposite5511" />
<feGaussianBlur
in="composite1"
stdDeviation="0.5"
result="blur"
id="feGaussianBlur5513" />
<feOffset
dx="1.9"
dy="1.4"
result="offset"
id="feOffset5515" />
<feComposite
in="SourceGraphic"
in2="offset"
operator="over"
result="fbSourceGraphic"
id="feComposite5517" />
</filter>
<filter
style="color-interpolation-filters:sRGB"
id="filter5531">
<feFlood
flood-opacity="0.60101983098700495"
flood-color="rgb(0,0,0)"
result="flood"
id="feFlood5521" />
<feComposite
in="flood"
in2="SourceGraphic"
operator="in"
result="composite1"
id="feComposite5523" />
<feGaussianBlur
in="composite1"
stdDeviation="0.5"
result="blur"
id="feGaussianBlur5525" />
<feOffset
dx="1.9"
dy="1.4"
result="offset"
id="feOffset5527" />
<feComposite
in="SourceGraphic"
in2="offset"
operator="over"
result="fbSourceGraphic"
id="feComposite5529" />
</filter>
</defs>
<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></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer2"
style="display:inline"
transform="translate(-59.26667,-59.26667)">
<path
style="fill:url(#linearGradient885);fill-opacity:1;stroke:none;stroke-width:0.26458335px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter5519)"
d="m 121.70834,29.368751 -68.262505,1.5875 c -6.711747,0.156087 -13.464507,2.719336 -18.785501,7.005035 -5.124508,4.228038 -8.190215,10.463836 -9.7895,16.807465 l 24.341667,-1.058333 c 0.214884,-2.67862 1.733902,-5.109484 3.689147,-6.885223 1.76299,-1.5286 4.013062,-2.554657 6.365024,-2.639795 l 58.472918,-2.116649 z"
id="path195"
transform="matrix(0.47244092,0,0,0.47244092,59.26667,59.26667)" />
<path
style="fill:url(#linearGradient893);fill-opacity:1;stroke:none;stroke-width:0.26458335px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter5531)"
d="m 22.489584,61.647918 -10.31875,27.252084 c -1.362514,3.598435 -1.128016,8.11836 1.70141,10.913234 3.337143,3.296424 8.403518,3.779984 12.85067,3.374224 l 72.495838,-6.614541 16.139588,-47.625001 -20.637504,0.79375 -12.435417,35.189584 -11.112501,0.79375 12.435417,-35.454167 -22.225,1.058333 -13.229167,36.512501 -7.408314,0.264613 c -2.145162,0.07662 -3.30664,-2.908063 -2.645853,-4.76253 l 8.202083,-23.01875 z"
id="path32"
transform="matrix(0.47244092,0,0,0.47244092,59.26667,59.26667)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.5 KiB