Support new /joinchat/ url format

This commit is contained in:
morethanwords 2021-10-27 20:31:05 +03:00
parent 730d79523f
commit 1d388fe62a
2 changed files with 8 additions and 1 deletions

View File

@ -308,12 +308,13 @@ export class AppImManager {
}
});
// Support old t.me/joinchat/asd and new t.me/+asd
this.addAnchorListener<{pathnameParams: ['joinchat', string]}>({
name: 'joinchat',
callback: ({pathnameParams}) => {
const link: InternalLink = {
_: INTERNAL_LINK_TYPE.JOIN_CHAT,
invite: pathnameParams[1]
invite: pathnameParams[1] || decodeURIComponent(pathnameParams[0]).slice(1)
};
this.processInternalLink(link);

View File

@ -847,6 +847,12 @@ namespace RichTextProcessor {
url = 'tg://unsafe_url?url=' + encodeURIComponent(url);
} else */if((tgMeMatch = url.match(/^(?:https?:\/\/)?t(?:elegram)?\.me\/(.+)/))) {
const fullPath = tgMeMatch[1];
if(/^\W/.test(fullPath)) {
onclick = 'joinchat';
return {url, onclick};
}
const path = fullPath.split('/');
switch(path[0]) {
case 'joinchat':