@bbki.ng/site 1.1.3 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.html CHANGED
@@ -11,6 +11,13 @@
11
11
  crossorigin
12
12
  type="application/json"
13
13
  />
14
+ <link
15
+ rel="preload"
16
+ href="https://api.bbki.ng/posts"
17
+ as="fetch"
18
+ crossorigin
19
+ type="application/json"
20
+ />
14
21
  <link rel="icon" type="image/svg" href="/favicon.svg" />
15
22
  <link
16
23
  rel="alternate icon"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbki.ng/site",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "code behind bbki.ng",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -16,7 +16,7 @@
16
16
  "url": "git+https://github.com/bbbottle/bbki.ng.git"
17
17
  },
18
18
  "dependencies": {
19
- "@bbki.ng/components": "workspace:2.1.34",
19
+ "@bbki.ng/components": "workspace:2.1.36",
20
20
  "@supabase/supabase-js": "^1.30.6",
21
21
  "classnames": "2.3.1",
22
22
  "react": "^18.0.0",
@@ -59,7 +59,7 @@
59
59
  "typescript": "^4.5.4",
60
60
  "vite": "5.0.0",
61
61
  "vite-plugin-mdx": "^3.5.8",
62
- "vite-plugin-pwa": "^0.11.3",
62
+ "vite-plugin-pwa": "0.19",
63
63
  "workbox-window": "^6.3.0"
64
64
  },
65
65
  "author": "bbbottle",
@@ -29,7 +29,7 @@ export { MySuspense } from "./my_suspense";
29
29
 
30
30
  export const CenterLinkList = (props: any) => {
31
31
  return (
32
- <div className="flex justify-center pr-32">
32
+ <div className="flex justify-center">
33
33
  <LinkList {...props} />
34
34
  </div>
35
35
  );
@@ -12,23 +12,31 @@ export const ReloadPrompt = () => {
12
12
  onRegisterError(error: any) {
13
13
  console.log("SW registration error", error);
14
14
  },
15
+ onOfflineReady() {
16
+ console.log("App is offline-ready");
17
+ toast("", {
18
+ description: "已支持离线访问。",
19
+ position: "bottom-center",
20
+ actionButtonStyle: {
21
+ backgroundColor: "#fff",
22
+ color: "rgb(37,99,235)",
23
+ },
24
+ });
25
+ },
15
26
  });
16
27
 
17
- const close = () => {
18
- // setOfflineReady(false);
19
- setNeedRefresh(false);
20
- };
21
-
22
28
  // @ts-ignore
23
29
  const appVer = GLOBAL_BBKING_VERSION;
24
30
 
25
31
  useEffect(() => {
26
32
  if (!needRefresh) {
33
+ console.log("版本 v" + appVer + ",无需更新。");
27
34
  return;
28
35
  }
29
36
 
30
37
  toast("", {
31
- description: "检测到更新,当前 v" + appVer + "。是否更新?",
38
+ description: "检测到更新,当前版本 v" + appVer + "。是否更新?",
39
+ dismissible: false,
32
40
  position: "bottom-center",
33
41
  actionButtonStyle: {
34
42
  backgroundColor: "#fff",
@@ -45,7 +53,7 @@ export const ReloadPrompt = () => {
45
53
  },
46
54
  },
47
55
  });
48
- }, []);
56
+ }, [needRefresh]);
49
57
 
50
58
  return null;
51
59
  };
package/src/main.tsx CHANGED
@@ -13,9 +13,9 @@ const root = createRoot(container);
13
13
  root.render(
14
14
  <React.StrictMode>
15
15
  <Router>
16
- <ReloadPrompt />
17
16
  <App />
18
17
  <Toaster />
18
+ <ReloadPrompt />
19
19
  </Router>
20
20
  </React.StrictMode>
21
21
  );
package/vite.config.js CHANGED
@@ -52,14 +52,19 @@ export default defineConfig({
52
52
  react(),
53
53
  mdx(options),
54
54
  VitePWA({
55
+ injectRegister: "auto",
55
56
  includeAssets: [
56
57
  "favicon.svg",
57
58
  "robots.txt",
58
59
  "apple-touch-icon.png",
59
60
  "Logo.svg",
60
61
  ],
62
+ devOptions: {
63
+ enabled: true,
64
+ /* other options */
65
+ },
61
66
  workbox: {
62
- cleanupOutdatedCaches: false,
67
+ cleanupOutdatedCaches: true,
63
68
  runtimeCaching: [
64
69
  {
65
70
  urlPattern: