diff options
| author | Madis Otenurm | 2022-11-16 19:21:29 +0200 |
|---|---|---|
| committer | GitHub | 2022-11-16 18:21:29 +0100 |
| commit | c2aa3352f0aec737bd1a8c265185ced204a87f17 (patch) | |
| tree | 90a9c84e4800c983e5ed7ee1abfdbb821f888261 /src/main/java/com/aizistral | |
| parent | dc361db8e6033ce248c68c99129ce50db8050538 (diff) | |
Add "insecure by whitelisting" state (#285)
* Add insecure_whitelisted state
* Update MixinChatScreen.java
Diffstat (limited to 'src/main/java/com/aizistral')
| -rw-r--r-- | src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java | 8 | ||||
| -rw-r--r-- | src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatScreen.java | 6 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java b/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java index a12b10c..0808f4f 100644 --- a/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java +++ b/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java @@ -37,6 +37,14 @@ public enum ServerSafetyLevel { INSECURE, /** + * Servers that don't require signatures but the user gave them anyway by whitelisting. + * The state is only displayed after the player toggles the whitelist for a server, because + * it is not possible to determine whether a server requires signatures if they are already given. + */ + + INSECURE_WHITELISTED, + + /** * For Realms specifically, as these are a whole new level of unsafe. */ diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatScreen.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatScreen.java index a77d81c..53b7149 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatScreen.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatScreen.java @@ -86,7 +86,9 @@ public abstract class MixinChatScreen extends Screen { if (ServerSafetyState.getCurrent() != ServerSafetyLevel.SECURE) { ServerSafetyState.setAllowChatSigning(true); - ServerSafetyState.updateCurrent(ServerSafetyLevel.INSECURE); + if(ServerSafetyState.getCurrent() != ServerSafetyLevel.INSECURE){ + ServerSafetyState.updateCurrent(ServerSafetyLevel.INSECURE_WHITELISTED); + } } } else { whitelist.remove(address); @@ -183,7 +185,7 @@ public abstract class MixinChatScreen extends Screen { return switch (level) { case SECURE -> 21; case UNINTRUSIVE -> 42; - case INSECURE -> 0; + case INSECURE, INSECURE_WHITELISTED -> 0; case REALMS -> 63; case UNKNOWN -> 84; case UNDEFINED -> 105; |
