2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Option to control auto-login on Telegram sites

This commit is contained in:
RadRussianRus
2021-07-04 22:44:33 +03:00
parent 997e20d502
commit 9a872a355e
8 changed files with 17 additions and 1 deletions

View File

@@ -2897,6 +2897,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ktg_net_speed_boost_medium" = "Medium";
"ktg_net_speed_boost_big" = "Big";
"ktg_settings_telegram_sites_autologin" = "Auto-login on Telegram sites";
"ktg_settings_system" = "System";
"ktg_settings_qt_scale" = "Qt scaling engine";
"ktg_settings_gtk_integration" = "GTK integration";

View File

@@ -221,5 +221,6 @@
"ktg_filters_hide_button": "Hide button",
"ktg_filters_hide_all_chats_toast": "\"All Chats\" folder is hidden.\nYou can enable it back in Kotatogram Settings.",
"ktg_filters_hide_edit_toast": "Edit button is hidden.\nYou can enable it back in Kotatogram Settings.",
"ktg_settings_telegram_sites_autologin": "Auto-login on Telegram sites",
"dummy_last_string": ""
}

View File

@@ -221,5 +221,6 @@
"ktg_filters_hide_button": "Скрыть кнопку",
"ktg_filters_hide_all_chats_toast": "Папка «Все чаты» скрыта.\nВы можете включить её обратно в настройках Kotatogram.",
"ktg_filters_hide_edit_toast": "Кнопка изменения скрыта.\nВы можете включить её обратно в настройках Kotatogram.",
"ktg_settings_telegram_sites_autologin": "Авто-вход на сайты Telegram",
"dummy_last_string": ""
}

View File

@@ -49,7 +49,8 @@ const auto kBadPrefix = u"http://"_q;
const auto domains = config.get<std::vector<QString>>(
"autologin_domains",
{});
if (token.isEmpty()
if (!cTelegramSitesAutologin()
|| token.isEmpty()
|| domain.isEmpty()
|| !ranges::contains(domains, domain)) {
return url;

View File

@@ -389,6 +389,7 @@ QByteArray GenerateSettingsJson(bool areDefault = false) {
settings.insert(qsl("monospace_large_bubbles"), MonospaceLargeBubbles());
settings.insert(qsl("forward_retain_selection"), cForwardRetainSelection());
settings.insert(qsl("forward_on_click"), cForwardChatOnClick());
settings.insert(qsl("telegram_sites_autologin"), cTelegramSitesAutologin());
settingsFonts.insert(qsl("size"), cFontSize());
settingsFonts.insert(qsl("use_system_font"), cUseSystemFont());
@@ -963,6 +964,10 @@ bool Manager::readCustomFile() {
ReadBoolOption(settings, "forward_on_click", [&](auto v) {
cSetForwardChatOnClick(v);
});
ReadBoolOption(settings, "telegram_sites_autologin", [&](auto v) {
cSetTelegramSitesAutologin(v);
});
return true;
}

View File

@@ -265,3 +265,5 @@ bool gForwardGrouped = false;
bool gAutoScrollUnfocused = false;
LocalFolderVector gLocalFolders;
bool gTelegramSitesAutologin = true;

View File

@@ -177,3 +177,5 @@ struct LocalFolder {
using LocalFolderVector = std::vector<LocalFolder>;
DeclareRefSetting(LocalFolderVector, LocalFolders);
DeclareSetting(bool, TelegramSitesAutologin);

View File

@@ -417,6 +417,8 @@ void SetupKotatoNetwork(not_null<Ui::VerticalLayout*> container) {
}, true));
});
SettingsMenuCSwitch(ktg_settings_telegram_sites_autologin, TelegramSitesAutologin);
AddSkip(container);
}