Merge pull request #200 from deepbluev7/main
Allow deeplinking into Nheko via matrix: scheme
This commit is contained in:
commit
1f611122d1
1 changed files with 27 additions and 1 deletions
|
@ -28,7 +28,33 @@ export class Nheko {
|
||||||
get platforms() { return [Platform.Windows, Platform.macOS, Platform.Linux]; }
|
get platforms() { return [Platform.Windows, Platform.macOS, Platform.Linux]; }
|
||||||
get description() { return 'A native desktop app for Matrix that feels more like a mainstream chat app.'; }
|
get description() { return 'A native desktop app for Matrix that feels more like a mainstream chat app.'; }
|
||||||
getMaturity(platform) { return Maturity.Beta; }
|
getMaturity(platform) { return Maturity.Beta; }
|
||||||
getDeepLink(platform, link) {}
|
getDeepLink(platform, link) {
|
||||||
|
if (platform === Platform.Linux || platform === Platform.Windows) {
|
||||||
|
let identifier = encodeURIComponent(link.identifier.substring(1));
|
||||||
|
let isRoomid = link.identifier.substring(0, 1) === '!';
|
||||||
|
let fragmentPath;
|
||||||
|
switch (link.kind) {
|
||||||
|
case LinkKind.User:
|
||||||
|
fragmentPath = `u/${identifier}?action=chat`;
|
||||||
|
break;
|
||||||
|
case LinkKind.Room:
|
||||||
|
case LinkKind.Event:
|
||||||
|
if (isRoomid)
|
||||||
|
fragmentPath = `roomid/${identifier}`;
|
||||||
|
else
|
||||||
|
fragmentPath = `r/${identifier}`;
|
||||||
|
|
||||||
|
if (link.kind === LinkKind.Event)
|
||||||
|
fragmentPath += `/e/${encodeURIComponent(link.eventId.substring(1))}`;
|
||||||
|
fragmentPath += '?action=join';
|
||||||
|
fragmentPath += link.servers.map(server => `&via=${encodeURIComponent(server)}`).join('');
|
||||||
|
break;
|
||||||
|
case LinkKind.Group:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return `matrix:${fragmentPath}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
canInterceptMatrixToLinks(platform) { return false; }
|
canInterceptMatrixToLinks(platform) { return false; }
|
||||||
|
|
||||||
getLinkInstructions(platform, link) {
|
getLinkInstructions(platform, link) {
|
||||||
|
|
Loading…
Reference in a new issue