Browse Source

Added t.me support

master
Igor Zhukov 8 years ago
parent
commit
300721e9b5
  1. 4
      app/js/controllers.js
  2. 10
      app/js/lib/ng_utils.js
  3. 13
      app/js/services.js
  4. 2
      app/partials/desktop/channel_modal.html
  5. 2
      app/partials/desktop/error_modal.html
  6. 2
      app/partials/mobile/channel_modal.html

4
app/js/controllers.js

@ -4934,7 +4934,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -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']) @@ -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)
}
})

10
app/js/lib/ng_utils.js

@ -1660,10 +1660,6 @@ angular.module('izhukov.utils', []) @@ -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,6 +1669,9 @@ angular.module('izhukov.utils', []) @@ -1673,6 +1669,9 @@ angular.module('izhukov.utils', [])
url = wrapUrl(entityText, false)
inner = encodeEntities(replaceUrlEncodings(entityText))
}
if (options.noLinks) {
html.push(inner);
} else {
html.push(
'<a href="',
encodeEntities(url),
@ -1680,6 +1679,7 @@ angular.module('izhukov.utils', []) @@ -1680,6 +1679,7 @@ angular.module('izhukov.utils', [])
inner,
'</a>'
)
}
break
case 'messageEntityLinebreak':
@ -1929,7 +1929,7 @@ angular.module('izhukov.utils', []) @@ -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':

13
app/js/services.js

@ -4409,11 +4409,17 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -4409,11 +4409,17 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}
Storage.set({tgme_sync: {canRedirect: canRedirect, ts: ts}})
var script = $('<script>').appendTo('body')
var script1 = $('<script>').appendTo('body')
.on('load error', function () {
script.remove()
script1.remove()
})
.attr('src', '//telegram.me/_websync_?authed=' + (canRedirect ? '1' : '0'))
var script2 = $('<script>').appendTo('body')
.on('load error', function () {
script2.remove()
})
.attr('src', '//t.me/_websync_?authed=' + (canRedirect ? '1' : '0'))
})
}
@ -4513,7 +4519,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -4513,7 +4519,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
url: url
}).then(function () {
var target = '_blank'
if (url.search('https://telegram.me/') === 0) {
if (url.search('https://telegram.me/') === 0 ||
url.search('https://t.me/') === 0) {
target = '_self'
}
window.open(url, target)

2
app/partials/desktop/channel_modal.html

@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
<div class="md_modal_section_param_wrap" ng-if="chatFull.chat.username">
<div class="md_modal_section_param_value">
<a class="settings_modal_username_link" ng-click="shareLink($event)" ng-bind="'https://telegram.me/' + chatFull.chat.username" ng-href="https://telegram.me/{{chatFull.chat.username}}" target="_blank"></a>
<a class="settings_modal_username_link" ng-click="shareLink($event)" ng-bind="'https://t.me/' + chatFull.chat.username" ng-href="https://t.me/{{chatFull.chat.username}}" target="_blank"></a>
</div>
<div class="md_modal_section_param_name" my-i18n="channel_modal_share_link"></div>
</div>

2
app/partials/desktop/error_modal.html

@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
<span ng-switch-when="INVITE_HASH_EMPTY" my-i18n="error_modal_invite_link_invalid"></span>
<span ng-switch-when="CHANNEL_PRIVATE" my-i18n="error_modal_channel_not_accessible"></span>
<span ng-switch-when="PEER_FLOOD" my-i18n="error_modal_not_contact_flood">
<my-i18n-param name="more-info-link"><a href="https://telegram.me/spambot">{0}</a></my-i18n-param>
<my-i18n-param name="more-info-link"><a href="https://t.me/spambot">{0}</a></my-i18n-param>
</span>
<span ng-switch-when="2FA_RECENT_CONFIRM" my-i18n="error_modal_2fa_recent_confirm"></span>
<span ng-switch-when="2FA_CONFIRM_WAIT_TIME" my-i18n="error_modal_2fa_delayed_time_md">

2
app/partials/mobile/channel_modal.html

@ -70,7 +70,7 @@ @@ -70,7 +70,7 @@
<div class="mobile_modal_section" ng-if="chatFull.chat.username || chatFull.chat.pFlags.creator">
<h4 class="mobile_modal_section_header" my-i18n="channel_modal_share_link"></h4>
<div class="mobile_modal_section_value" ng-switch="chatFull.chat.username.length > 0">
<a ng-switch-when="true" class="settings_modal_username_link" ng-click="shareLink($event)" ng-bind="'https://telegram.me/' + chatFull.chat.username" ng-href="https://telegram.me/{{chatFull.chat.username}}" target="_blank"></a>
<a ng-switch-when="true" class="settings_modal_username_link" ng-click="shareLink($event)" ng-bind="'https://t.me/' + chatFull.chat.username" ng-href="https://t.me/{{chatFull.chat.username}}" target="_blank"></a>
<a ng-switch-default ng-click="shareLink($event)" ng-bind="chatFull.exported_invite.link" ng-href="{{chatFull.exported_invite.link}}" target="_blank"></a>
</div>
</div>

Loading…
Cancel
Save