Browse Source

Allow unsafe urls (maybe this is unsafe)

master
morethanwords 4 years ago
parent
commit
69caa741e5
  1. 2
      src/lib/appManagers/appMessagesManager.ts
  2. 4
      src/lib/richtextprocessor.ts

2
src/lib/appManagers/appMessagesManager.ts

@ -2404,7 +2404,7 @@ export class AppMessagesManager { @@ -2404,7 +2404,7 @@ export class AppMessagesManager {
apiMessage.rReply = this.getRichReplyText(apiMessage);
if(apiMessage.message && apiMessage.message.length) {
if(apiMessage.message && apiMessage.message.length && !apiMessage.totalEntities) {
const myEntities = RichTextProcessor.parseEntities(apiMessage.message);
const apiEntities = apiMessage.entities || [];
apiMessage.totalEntities = RichTextProcessor.mergeEntities(myEntities, apiEntities, !apiMessage.pending);

4
src/lib/richtextprocessor.ts

@ -745,7 +745,7 @@ namespace RichTextProcessor { @@ -745,7 +745,7 @@ namespace RichTextProcessor {
export function wrapUrl(url: string, unsafe: number | boolean): string {
if(!url.match(/^https?:\/\//i)) {
url = 'http://' + url;
url = 'https://' + url;
}
var tgMeMatch;
@ -789,7 +789,7 @@ namespace RichTextProcessor { @@ -789,7 +789,7 @@ namespace RichTextProcessor {
} else if((telescoPeMatch = url.match(/^https?:\/\/telesco\.pe\/([^/?]+)\/(\d+)/))) {
url = 'tg://resolve?domain=' + telescoPeMatch[1] + '&post=' + telescoPeMatch[2];
} else if(unsafe) {
url = 'tg://unsafe_url?url=' + encodeURIComponent(url);
//url = 'tg://unsafe_url?url=' + encodeURIComponent(url);
}
return url;

Loading…
Cancel
Save