Support t.me client prefixes
Fix reading status on message editing
This commit is contained in:
parent
6843a409ae
commit
0fa8bc84bc
|
@ -4,6 +4,7 @@
|
|||
* https://github.com/morethanwords/tweb/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
import {T_ME_PREFIXES} from '../lib/mtproto/mtproto_config';
|
||||
import cancelEvent from './dom/cancelEvent';
|
||||
import parseUriParams from './string/parseUriParams';
|
||||
|
||||
|
@ -26,7 +27,7 @@ export default function addAnchorListener<Params extends {pathnameParams?: any,
|
|||
|
||||
const u = new URL(href);
|
||||
const match = u.host.match(/(.+?)\.t(?:elegram)?\.me/);
|
||||
if(match) {
|
||||
if(match && !T_ME_PREFIXES.has(match[1])) {
|
||||
u.pathname = match[1] + (u.pathname === '/' ? '' : u.pathname);
|
||||
href = u.toString();
|
||||
}
|
||||
|
|
|
@ -2810,7 +2810,6 @@ export class AppMessagesManager extends AppManager {
|
|||
}
|
||||
}
|
||||
|
||||
this.setMessageUnreadByDialog(message);
|
||||
// this.log(dT(), 'msg unread', mid, apiMessage.pFlags.out, dialog && dialog[apiMessage.pFlags.out ? 'read_outbox_max_id' : 'read_inbox_max_id'])
|
||||
|
||||
const replyTo = message.reply_to;
|
||||
|
@ -2848,6 +2847,8 @@ export class AppMessagesManager extends AppManager {
|
|||
message.fromId = message.pFlags.post || !message.from_id ? peerId : this.appPeersManager.getPeerId(message.from_id);
|
||||
}
|
||||
|
||||
this.setMessageUnreadByDialog(message);
|
||||
|
||||
if(fwdHeader) {
|
||||
// if(peerId === myID) {
|
||||
if(fwdHeader.saved_from_msg_id) fwdHeader.saved_from_msg_id = generateMessageId(fwdHeader.saved_from_msg_id);
|
||||
|
|
|
@ -23,6 +23,7 @@ export const THUMB_TYPE_FULL = '';
|
|||
export const TOPIC_COLORS = [0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, 0xFB6F5F];
|
||||
export const ATTACH_MENU_BOT_ICON_NAME = 'default_static';
|
||||
export const GENERAL_TOPIC_ID = 4295032831;
|
||||
export const T_ME_PREFIXES = new Set(['web', 'k', 'z']);
|
||||
|
||||
export const FOLDER_ID_ALL: REAL_FOLDER_ID = 0;
|
||||
export const FOLDER_ID_ARCHIVE: REAL_FOLDER_ID = 1;
|
||||
|
|
|
@ -8,6 +8,7 @@ import type addAnchorListener from '../../helpers/addAnchorListener';
|
|||
import {PHONE_NUMBER_REG_EXP} from '.';
|
||||
import {MOUNT_CLASS_TO} from '../../config/debug';
|
||||
import matchUrlProtocol from './matchUrlProtocol';
|
||||
import {T_ME_PREFIXES} from '../mtproto/mtproto_config';
|
||||
|
||||
export default function wrapUrl(url: string, unsafe?: number | boolean) {
|
||||
if(!matchUrlProtocol(url)) {
|
||||
|
@ -19,10 +20,15 @@ export default function wrapUrl(url: string, unsafe?: number | boolean) {
|
|||
let onclick: typeof out['onclick'];
|
||||
/* if(unsafe === 2) {
|
||||
url = 'tg://unsafe_url?url=' + encodeURIComponent(url);
|
||||
} else */if((tgMeMatch = url.match(/^(?:https?:\/\/)?(?:(.+?)\.)?t(?:elegram)?\.me(?:\/(.+))?/))) {
|
||||
} else */if((tgMeMatch = url.match(/^(?:https?:\/\/)?(?:(.+?)\.)?(?:(?:web|k|z)\.)?t(?:elegram)?\.me(?:\/(.+))?/))) {
|
||||
const u = new URL(url);
|
||||
if(tgMeMatch[1]) {
|
||||
u.pathname = tgMeMatch[1] + (u.pathname === '/' ? '' : u.pathname);
|
||||
let prefix = tgMeMatch[1];
|
||||
if(prefix && T_ME_PREFIXES.has(tgMeMatch[1])) {
|
||||
prefix = undefined;
|
||||
}
|
||||
|
||||
if(prefix) {
|
||||
u.pathname = prefix + (u.pathname === '/' ? '' : u.pathname);
|
||||
}
|
||||
|
||||
const fullPath = u.pathname.slice(1);
|
||||
|
@ -38,7 +44,7 @@ export default function wrapUrl(url: string, unsafe?: number | boolean) {
|
|||
case 'addemoji':
|
||||
case 'voicechat':
|
||||
case 'invoice':
|
||||
if(path.length !== 1 && !tgMeMatch[1]) {
|
||||
if(path.length !== 1 && !prefix) {
|
||||
onclick = path[0];
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue