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

[Option][GUI] Telegram sites autologin

This commit is contained in:
RadRussianRus
2022-09-09 20:59:23 +03:00
committed by Eric Kotato
parent 6c4617f04b
commit fc8feea983
4 changed files with 8 additions and 1 deletions

View File

@@ -126,6 +126,7 @@
"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",
"ktg_in_app_update_disabled": "In-app updater is disabled.",
"dummy_last_string": ""
}

View File

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

View File

@@ -369,6 +369,9 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
{ "folders/local", {
.scope = SettingScope::Account,
.type = SettingType::QJsonArraySetting, }},
{ "telegram_sites_autologin", {
.type = SettingType::BoolSetting,
.defaultValue = true, }},
};
using OldOptionKey = QString;

View File

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