Skip to content

Commit

Permalink
feat: disable web auto login
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed May 4, 2024
1 parent 7debc83 commit 1289ec6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
Expand Up @@ -53,6 +53,8 @@
import java.util.List;
import java.util.regex.Matcher;

import xyz.nextalone.nagram.NaConfig;

public class Browser {

private static WeakReference<CustomTabsSession> customTabsCurrentSession;
Expand Down Expand Up @@ -322,7 +324,7 @@ public static void openUrl(final Context context, Uri uri, final boolean allowCu
}
}
String host = AndroidUtilities.getHostAuthority(uri.toString().toLowerCase());
if (AccountInstance.getInstance(currentAccount).getMessagesController().autologinDomains.contains(host)) {
if (AccountInstance.getInstance(currentAccount).getMessagesController().autologinDomains.contains(host) && !NaConfig.INSTANCE.getDisableAutoWebLogin().Bool()) {
String token = "autologin_token=" + URLEncoder.encode(AccountInstance.getInstance(UserConfig.selectedAccount).getMessagesController().autologinToken, "UTF-8");
String url = uri.toString();
int idx = url.indexOf("://");
Expand Down
Expand Up @@ -213,6 +213,7 @@ public class NekoGeneralSettingsActivity extends BaseNekoXSettingsActivity {
private final AbstractConfigCell disableSystemAccountRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.disableSystemAccount));
private final AbstractConfigCell doNotShareMyPhoneNumberRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getDoNotShareMyPhoneNumber()));
private final AbstractConfigCell disableSuggestionViewRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getDisableSuggestionView()));
private final AbstractConfigCell disableAutoWebLoginRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getDisableAutoWebLogin()));
private final AbstractConfigCell divider6 = cellGroup.appendCell(new ConfigCellDivider());

private final AbstractConfigCell header7 = cellGroup.appendCell(new ConfigCellHeader(LocaleController.getString("General")));
Expand Down
Expand Up @@ -584,6 +584,12 @@ object NaConfig {
ConfigItem.configTypeBool,
false
)
val disableAutoWebLogin =
addConfig(
"DisableAutoWebLogin",
ConfigItem.configTypeBool,
false
)

private fun addConfig(
k: String,
Expand Down
1 change: 1 addition & 0 deletions TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml
Expand Up @@ -139,4 +139,5 @@
<string name="DisableChannelMuteButton">禁用频道聊天页面的静音按钮</string>
<string name="DisablePreviewVideoSoundShortcut">禁用预览视频音量快捷键</string>
<string name="DisablePreviewVideoSoundShortcutNotice">禁用音量键快捷开启预览视频的声音</string>
<string name="DisableAutoWebLogin">禁用官方网页自动登录</string>
</resources>
1 change: 1 addition & 0 deletions TMessagesProj/src/main/res/values/strings_na.xml
Expand Up @@ -139,4 +139,5 @@
<string name="DisableChannelMuteButton">Disable channel mute button</string>
<string name="DisablePreviewVideoSoundShortcut">Disable preview video sound shortcut</string>
<string name="DisablePreviewVideoSoundShortcutNotice">Disable volume keys to enable preview video sound</string>
<string name="DisableAutoWebLogin">Disable auto web login</string>
</resources>

0 comments on commit 1289ec6

Please sign in to comment.