mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
Merge branch 'main' into cloudflare
This commit is contained in:
commit
ee3dd9eab8
19
.github/workflows/Deploy.yml
vendored
19
.github/workflows/Deploy.yml
vendored
@ -17,6 +17,8 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
@ -49,20 +51,7 @@ jobs:
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-and-push
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
registry-url: https://registry.npmjs.org/
|
||||
node-version: lts/*
|
||||
|
||||
- run: npx changelogithub
|
||||
- name: Changelog
|
||||
run: bun x changelogithub
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
|
@ -1,5 +1,6 @@
|
||||
// @auto-i18n-check. Please do not delete the line.
|
||||
import { MotionProvider } from "@/components/motion/motion-provider";
|
||||
import { ThemeColorManager } from "@/components/ThemeColorManager";
|
||||
import getEnv from "@/lib/env-entry";
|
||||
import { FilterProvider } from "@/lib/network-filter-context";
|
||||
import { StatusProvider } from "@/lib/status-context";
|
||||
@ -81,7 +82,10 @@ export default async function LocaleLayout({
|
||||
>
|
||||
<NextIntlClientProvider messages={messages}>
|
||||
<FilterProvider>
|
||||
<StatusProvider>{children}</StatusProvider>
|
||||
<StatusProvider>
|
||||
<ThemeColorManager />
|
||||
{children}
|
||||
</StatusProvider>
|
||||
</FilterProvider>
|
||||
</NextIntlClientProvider>
|
||||
</ThemeProvider>
|
||||
|
38
components/ThemeColorManager.tsx
Normal file
38
components/ThemeColorManager.tsx
Normal file
@ -0,0 +1,38 @@
|
||||
'use client';
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import { useTheme } from 'next-themes';
|
||||
|
||||
export function ThemeColorManager() {
|
||||
const { theme, systemTheme } = useTheme();
|
||||
|
||||
useEffect(() => {
|
||||
const updateThemeColor = () => {
|
||||
const currentTheme = theme === 'system' ? systemTheme : theme;
|
||||
const meta = document.querySelector('meta[name="theme-color"]');
|
||||
|
||||
if (!meta) {
|
||||
const newMeta = document.createElement('meta');
|
||||
newMeta.name = 'theme-color';
|
||||
document.head.appendChild(newMeta);
|
||||
}
|
||||
|
||||
const themeColor = currentTheme === 'dark'
|
||||
? 'hsl(30 15% 8%)' // 深色模式背景色
|
||||
: 'hsl(0 0% 98%)'; // 浅色模式背景色
|
||||
|
||||
document.querySelector('meta[name="theme-color"]')?.setAttribute('content', themeColor);
|
||||
};
|
||||
|
||||
// Update on mount and theme change
|
||||
updateThemeColor();
|
||||
|
||||
// Listen for system theme changes
|
||||
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
mediaQuery.addEventListener('change', updateThemeColor);
|
||||
|
||||
return () => mediaQuery.removeEventListener('change', updateThemeColor);
|
||||
}, [theme, systemTheme]);
|
||||
|
||||
return null;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nezha-dash",
|
||||
"version": "1.6.4",
|
||||
"version": "1.6.5",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -p 3040",
|
||||
@ -25,7 +25,7 @@
|
||||
"@turf/turf": "^7.1.0",
|
||||
"@types/d3-geo": "^3.1.0",
|
||||
"@types/luxon": "^3.4.2",
|
||||
"@typescript-eslint/eslint-plugin": "^8.16.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.17.0",
|
||||
"caniuse-lite": "^1.0.30001685",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
@ -47,12 +47,12 @@
|
||||
"react-dom": "19.0.0-rc-02c0e824-20241028",
|
||||
"react-intersection-observer": "^9.13.1",
|
||||
"react-wrap-balancer": "^1.1.1",
|
||||
"recharts": "^2.13.3",
|
||||
"recharts": "^2.14.0",
|
||||
"sharp": "^0.33.5",
|
||||
"swr": "^2.2.6-beta.4",
|
||||
"tailwind-merge": "^2.5.5",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
"typescript-eslint": "^8.16.0"
|
||||
"typescript-eslint": "^8.17.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@next/bundle-analyzer": "^15.0.3",
|
||||
|
@ -14,8 +14,8 @@
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#000000",
|
||||
"theme_color": "hsl(0 0% 98%)",
|
||||
"background_color": "hsl(0 0% 98%)",
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"orientation": "portrait"
|
||||
|
Loading…
Reference in New Issue
Block a user