Skip to content
This repository was archived by the owner on Oct 25, 2023. It is now read-only.

Commit e189ba4

Browse files
committed
Superseeded versions redirect
1 parent 007c96a commit e189ba4

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

app/js/init.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,43 @@
1818
}
1919
$(document.body).addClass(classes.join(' '))
2020

21-
ConfigStorage.get('layout_selected', 'i18n_locale', function (params) {
21+
ConfigStorage.get('layout_selected', 'i18n_locale', 'kz_version', function (params) {
2222
var layout = params[0]
2323
var locale = params[1]
24+
var kzVersion = params[2]
2425
var defaultLocale = 'en-us'
2526
var bootReady = {
2627
dom: false,
2728
i18n_ng: false,
2829
i18n_messages: false,
29-
i18n_fallback: false
30+
i18n_fallback: false,
31+
migration_check: false
32+
}
33+
if ('K' !== kzVersion && 'Z' !== kzVersion) {
34+
kzVersion = false
35+
}
36+
if ('web.telegram.org' !== location.hostname ||
37+
Config.Modes.test ||
38+
Config.Modes.ios_standalone ||
39+
location.search.indexOf('legacy=1') != -1) {
40+
bootReady.migration_check = true
41+
} else {
42+
if (kzVersion) {
43+
location.href = 'https://web.telegram.org/' + kzVersion.toLowerCase() + '/'
44+
return
45+
}
46+
$.getJSON('https://telegram.org/webogram_migrate').success(function(result) {
47+
kzVersion = result.kz_version
48+
if ('K' === kzVersion || 'Z' === kzVersion) {
49+
ConfigStorage.set({
50+
kz_version: kzVersion
51+
})
52+
location.href = 'https://web.telegram.org/' + kzVersion.toLowerCase() + '/'
53+
return
54+
} else {
55+
bootReady.migration_check = true
56+
}
57+
})
3058
}
3159
var checkReady = function checkReady () {
3260
var i

0 commit comments

Comments
 (0)