From 4b9d753254af48a77848d0d1e7fcbd7af5b34f0e Mon Sep 17 00:00:00 2001
From: Yidadaa <yidadaa@qq.com>
Date: Fri, 5 May 2023 22:49:41 +0800
Subject: [PATCH] fix: #1251 use google fonts mirror

---
 app/layout.tsx          | 5 ++---
 app/store/access.ts     | 2 ++
 app/styles/globals.scss | 5 +++--
 next.config.mjs         | 2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/app/layout.tsx b/app/layout.tsx
index 38748ef37..c56341ab4 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -35,10 +35,9 @@ export default function RootLayout({
         />
         <meta name="version" content={buildConfig.commitId} />
         <link rel="manifest" href="/site.webmanifest"></link>
-        <link rel="preconnect" href="https://fonts.googleapis.com"></link>
-        <link rel="preconnect" href="https://fonts.gstatic.com"></link>
+        <link rel="preconnect" href="https://fonts.proxy.ustclug.org"></link>
         <link
-          href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;700;900&display=swap"
+          href="https://fonts.proxy.ustclug.org/css2?family=Noto+Sans+SC:wght@300;400;700;900&display=swap"
           rel="stylesheet"
         ></link>
         <script src="/serviceWorkerRegister.js" defer></script>
diff --git a/app/store/access.ts b/app/store/access.ts
index 663e1c6b1..51290d0a7 100644
--- a/app/store/access.ts
+++ b/app/store/access.ts
@@ -41,6 +41,8 @@ export const useAccessStore = create<AccessControlStore>()(
         set(() => ({ token }));
       },
       isAuthorized() {
+        get().fetch();
+
         // has token or has code or disabled access control
         return (
           !!get().token || !!get().accessCode || !get().enabledAccessControl()
diff --git a/app/styles/globals.scss b/app/styles/globals.scss
index e7b6de3b1..f849516a0 100644
--- a/app/styles/globals.scss
+++ b/app/styles/globals.scss
@@ -88,6 +88,9 @@
 }
 html {
   height: var(--full-height);
+
+  font-family: "Noto Sans SC", "SF Pro SC", "SF Pro Text", "SF Pro Icons",
+    "PingFang SC", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
 }
 
 body {
@@ -102,8 +105,6 @@ body {
   align-items: center;
   user-select: none;
   touch-action: pan-x pan-y;
-  font-family: "Noto Sans SC", "SF Pro SC", "SF Pro Text", "SF Pro Icons",
-    "PingFang SC", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
 
   @media only screen and (max-width: 600px) {
     background-color: var(--second);
diff --git a/next.config.mjs b/next.config.mjs
index 25770318b..3f7c2fb6b 100644
--- a/next.config.mjs
+++ b/next.config.mjs
@@ -17,7 +17,7 @@ const nextConfig = {
     }
 
     return {
-      afterFiles: ret,
+      beforeFiles: ret,
     };
   },
   webpack(config) {