From 300721e9b517ec0c8490341537510d0efa63396e Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Fri, 6 Jan 2017 17:28:51 +0300 Subject: [PATCH] Added t.me support --- app/js/controllers.js | 4 ++-- app/js/lib/ng_utils.js | 24 ++++++++++++------------ app/js/services.js | 13 ++++++++++--- app/partials/desktop/channel_modal.html | 2 +- app/partials/desktop/error_modal.html | 2 +- app/partials/mobile/channel_modal.html | 2 +- 6 files changed, 27 insertions(+), 20 deletions(-) diff --git a/app/js/controllers.js b/app/js/controllers.js index c2bacb00..0b97895c 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -4934,7 +4934,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) function updateLink (force) { var chat = AppChatsManager.getChat($scope.chatID) if (chat.username) { - $scope.exportedInvite = {link: 'https://telegram.me/' + chat.username, short: true} + $scope.exportedInvite = {link: 'https://t.me/' + chat.username, short: true} selectLink() return } @@ -5197,6 +5197,6 @@ angular.module('myApp.controllers', ['myApp.i18n']) } $scope.share = function () { - LocationParamsService.shareUrl('https://telegram.me/addstickers/' + $scope.stickerset.short_name, $scope.stickerset.title) + LocationParamsService.shareUrl('https://t.me/addstickers/' + $scope.stickerset.short_name, $scope.stickerset.title) } }) diff --git a/app/js/lib/ng_utils.js b/app/js/lib/ng_utils.js index 2ee73a21..b0f810b9 100755 --- a/app/js/lib/ng_utils.js +++ b/app/js/lib/ng_utils.js @@ -1660,10 +1660,6 @@ angular.module('izhukov.utils', []) case 'messageEntityUrl': case 'messageEntityTextUrl': - if (options.noLinks) { - skipEntity = true - break - } var inner if (entity._ == 'messageEntityTextUrl') { url = entity.url @@ -1673,13 +1669,17 @@ angular.module('izhukov.utils', []) url = wrapUrl(entityText, false) inner = encodeEntities(replaceUrlEncodings(entityText)) } - html.push( - '', - inner, - '' - ) + if (options.noLinks) { + html.push(inner); + } else { + html.push( + '', + inner, + '' + ) + } break case 'messageEntityLinebreak': @@ -1929,7 +1929,7 @@ angular.module('izhukov.utils', []) if (unsafe == 2) { url = 'tg://unsafe_url?url=' + encodeURIComponent(url) } - else if ( (tgMeMatch = url.match(/^https?:\/\/telegram\.me\/(.+)/))) { + else if ( (tgMeMatch = url.match(/^https?:\/\/t(?:elegram)?\.me\/(.+)/))) { var path = tgMeMatch[1].split('/') switch (path[0]) { case 'joinchat': diff --git a/app/js/services.js b/app/js/services.js index 36e66c8f..b940194b 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -4409,11 +4409,17 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) } Storage.set({tgme_sync: {canRedirect: canRedirect, ts: ts}}) - var script = $('