File tree Expand file tree Collapse file tree
HMCL/src/main/java/org/jackhuang/hmcl/ui/account Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5050
5151import java .net .URI ;
5252import java .time .ZoneId ;
53- import java .time . ZonedDateTime ;
53+ import java .util . Arrays ;
5454import java .util .Locale ;
5555
5656import static org .jackhuang .hmcl .setting .ConfigHolder .globalConfig ;
@@ -63,18 +63,27 @@ public final class AccountListPage extends DecoratorAnimatedPage implements Deco
6363 static final BooleanProperty RESTRICTED = new SimpleBooleanProperty (true );
6464
6565 private static boolean isExemptedRegion () {
66- if ("Asia/Shanghai" .equals (ZoneId .systemDefault ().getId ()))
66+ String zoneId = ZoneId .systemDefault ().getId ();
67+ if (Arrays .asList (
68+ "Asia/Shanghai" ,
69+ // Although Asia/Beijing is not a legal name, Deepin uses it
70+ "Asia/Beijing" ,
71+ "Asia/Chongqing" ,
72+ "Asia/Chungking" ,
73+ "Asia/Harbin"
74+ ).contains (zoneId ))
6775 return true ;
6876
69- if (OperatingSystem .CURRENT_OS == OperatingSystem .WINDOWS
70- && NativeUtils .USE_JNA
71- && ZonedDateTime .now ().getOffset ().getTotalSeconds () == 8 * 3600 ) { // GMT+8
77+ if (OperatingSystem .CURRENT_OS == OperatingSystem .WINDOWS && NativeUtils .USE_JNA ) {
7278 Kernel32 kernel32 = Kernel32 .INSTANCE ;
7379
7480 // https://learn.microsoft.com/windows/win32/intl/table-of-geographical-locations
75- if (kernel32 != null && kernel32 .GetUserGeoID (WinConstants .GEOCLASS_NATION ) == 45 )
81+ if (kernel32 != null && kernel32 .GetUserGeoID (WinConstants .GEOCLASS_NATION ) == 45 ) // China
7682 return true ;
77- }
83+ } else if (OperatingSystem .CURRENT_OS == OperatingSystem .LINUX && "GMT+08:00" .equals (zoneId ))
84+ // Some Linux distributions may use invalid time zone ids (e.g., Asia/Beijing)
85+ // Java may not be able to resolve this name and use GMT+08:00 instead.
86+ return true ;
7887
7988 return false ;
8089 }
You can’t perform that action at this time.
0 commit comments