Browse Source

Added hidden url confirm

master
Igor Zhukov 9 years ago
parent
commit
4cb11e3476
  1. 5
      app/js/lib/ng_utils.js
  2. 1
      app/js/locales/en-us.json
  3. 14
      app/js/services.js
  4. 3
      app/partials/desktop/confirm_modal.html

5
app/js/lib/ng_utils.js

@ -1532,7 +1532,10 @@ angular.module('izhukov.utils', [])
url = 'http://' + url; url = 'http://' + url;
} }
var tgMeMatch; var tgMeMatch;
if ((tgMeMatch = url.match(/^https?:\/\/telegram\.me\/(.+)/))) { if (entity._ == 'messageEntityTextUrl') {
url = 'tg://unsafe_url?url=' + encodeURIComponent(url);
}
else if ((tgMeMatch = url.match(/^https?:\/\/telegram\.me\/(.+)/))) {
var path = tgMeMatch[1].split('/'); var path = tgMeMatch[1].split('/');
switch (path[0]) { switch (path[0]) {
case 'joinchat': case 'joinchat':

1
app/js/locales/en-us.json

@ -222,6 +222,7 @@
"confirm_modal_revoke_group_link": "Are you sure you want to revoke this link? Once you do, no one will be able to join the group using it.", "confirm_modal_revoke_group_link": "Are you sure you want to revoke this link? Once you do, no one will be able to join the group using it.",
"confirm_modal_revoke_channel_link": "Are you sure you want to revoke this link? Once you do, no one will be able to join the channel using it.", "confirm_modal_revoke_channel_link": "Are you sure you want to revoke this link? Once you do, no one will be able to join the channel using it.",
"confirm_modal_delete_channel_md": "Are you sure you want to delete this channel?\n\nAll members will be removed and all messages will be lost.", "confirm_modal_delete_channel_md": "Are you sure you want to delete this channel?\n\nAll members will be removed and all messages will be lost.",
"confirm_modal_jump_ext_url_md": "Open this link?\n\n{url}",
"confirm_modal_are_u_sure": "Are you sure?", "confirm_modal_are_u_sure": "Are you sure?",

14
app/js/services.js

@ -3684,7 +3684,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}) })
.service('LocationParamsService', function ($rootScope, $routeParams, AppPeersManager, AppUsersManager, AppMessagesManager, PeersSelectService, AppStickersManager) { .service('LocationParamsService', function ($rootScope, $routeParams, AppPeersManager, AppUsersManager, AppMessagesManager, PeersSelectService, AppStickersManager, ErrorService) {
var tgAddrRegExp = /^(web\+)?tg:(\/\/)?(.+)/; var tgAddrRegExp = /^(web\+)?tg:(\/\/)?(.+)/;
@ -3750,6 +3750,18 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
return true; return true;
} }
if (inner &&
(matches = url.match(/^unsafe_url\?url=([^&]+)/))) {
var url = decodeURIComponent(matches[1]);
ErrorService.confirm({
type: 'JUMP_EXT_URL',
url: url
}).then(function () {
window.open(url, '_blank');
});
return true;
}
if (inner && if (inner &&
(matches = url.match(/^bot_command\?command=(.+?)(?:&bot=(.+))?$/))) { (matches = url.match(/^bot_command\?command=(.+?)(?:&bot=(.+))?$/))) {

3
app/partials/desktop/confirm_modal.html

@ -55,6 +55,9 @@
<div ng-switch-when="REVOKE_GROUP_INVITE_LINK" my-i18n="confirm_modal_revoke_group_link"></div> <div ng-switch-when="REVOKE_GROUP_INVITE_LINK" my-i18n="confirm_modal_revoke_group_link"></div>
<div ng-switch-when="REVOKE_CHANNEL_INVITE_LINK" my-i18n="confirm_modal_revoke_channel_link"></div> <div ng-switch-when="REVOKE_CHANNEL_INVITE_LINK" my-i18n="confirm_modal_revoke_channel_link"></div>
<div ng-switch-when="CHANNEL_DELETE" my-i18n="confirm_modal_delete_channel_md"></div> <div ng-switch-when="CHANNEL_DELETE" my-i18n="confirm_modal_delete_channel_md"></div>
<div ng-switch-when="JUMP_EXT_URL" my-i18n="confirm_modal_jump_ext_url_md">
<my-i18n-param name="url"><strong ng-bind="url"></strong></my-i18n-param>
</div>
<span ng-switch-default ng-switch="message.length > 0"> <span ng-switch-default ng-switch="message.length > 0">

Loading…
Cancel
Save