Merge branch 'main' into cloudflare

This commit is contained in:
hamster1963 2024-11-01 10:03:31 +08:00
commit 1e856bab8d
14 changed files with 20 additions and 1778 deletions

View File

@ -7,7 +7,7 @@ import TabSwitch from "@/components/TabSwitch";
import { Separator } from "@/components/ui/separator"; import { Separator } from "@/components/ui/separator";
import { use, useState } from "react"; import { use, useState } from "react";
export const runtime = 'edge'; export const runtime = "edge";
export default function Page(props: { params: Promise<{ id: string }> }) { export default function Page(props: { params: Promise<{ id: string }> }) {
const params = use(props.params); const params = use(props.params);

View File

@ -1,6 +1,8 @@
import pack from "@/package.json"; import pack from "@/package.json";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
export const experimental_ppr = true;
export default function Footer() { export default function Footer() {
const t = useTranslations("Footer"); const t = useTranslations("Footer");
const version = pack.version; const version = pack.version;

View File

@ -11,6 +11,8 @@ import Image from "next/image";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import React, { useEffect, useRef, useState } from "react"; import React, { useEffect, useRef, useState } from "react";
export const experimental_ppr = true;
function Header() { function Header() {
const t = useTranslations("Header"); const t = useTranslations("Header");
const customLogo = getEnv("NEXT_PUBLIC_CustomLogo"); const customLogo = getEnv("NEXT_PUBLIC_CustomLogo");

View File

@ -11,7 +11,6 @@ type DashboardProps = {
export default async function MainLayout({ children }: DashboardProps) { export default async function MainLayout({ children }: DashboardProps) {
const session = await auth(); const session = await auth();
return ( return (
<div className="flex min-h-screen w-full flex-col"> <div className="flex min-h-screen w-full flex-col">
<main className="flex min-h-[calc(100vh_-_theme(spacing.16))] flex-1 flex-col gap-4 bg-muted/40 p-4 md:p-10 md:pt-8"> <main className="flex min-h-[calc(100vh_-_theme(spacing.16))] flex-1 flex-col gap-4 bg-muted/40 p-4 md:p-10 md:pt-8">

View File

@ -1,8 +1,9 @@
import ServerList from "@/components/ServerList"; import ServerList from "@/components/ServerList";
import ServerOverview from "@/components/ServerOverview"; import ServerOverview from "@/components/ServerOverview";
export const runtime = 'edge'; export const runtime = "edge";
export const experimental_ppr = true;
export default function Home() { export default function Home() {
return ( return (
<div className="mx-auto grid w-full max-w-5xl gap-4 md:gap-6"> <div className="mx-auto grid w-full max-w-5xl gap-4 md:gap-6">

View File

@ -1,5 +1,7 @@
import { handlers } from "@/auth" // Referring to the auth.ts we just created import { handlers } from "@/auth";
export const runtime = 'edge'; // Referring to the auth.ts we just created
export const runtime = "edge";
export const { GET, POST } = handlers; export const { GET, POST } = handlers;

View File

@ -4,7 +4,7 @@ import { GetServerDetail } from "@/lib/serverFetch";
import { redirect } from "next/navigation"; import { redirect } from "next/navigation";
import { NextRequest, NextResponse } from "next/server"; import { NextRequest, NextResponse } from "next/server";
export const runtime = 'edge'; export const runtime = "edge";
export const dynamic = "force-dynamic"; export const dynamic = "force-dynamic";

View File

@ -8,8 +8,6 @@ export const dynamic = "force-dynamic";
export const runtime = "edge"; export const runtime = "edge";
interface ResError extends Error { interface ResError extends Error {
statusCode: number; statusCode: number;
message: string; message: string;

BIN
bun.lockb

Binary file not shown.

View File

@ -1,83 +0,0 @@
# git-cliff ~ configuration file
# https://git-cliff.org/docs/configuration
#
# Lines starting with "#" are comments.
# Configuration options are organized into tables and keys.
# See documentation for more information on available options.
[changelog]
# changelog header
header = """
# Changelog\n
"""
# template for the changelog body
# https://tera.netlify.app/docs/
body = """
{% if version %}\
## Release {{ version | trim_start_matches(pat="v") }} - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
* {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]($REPO/commit/{{ commit.id }})) by [@{{ commit.author.name }}](https://github.com/{{ commit.author.name }})\
{% for footer in commit.footers -%}
, {{ footer.token }}{{ footer.separator }}{{ footer.value }}\
{% endfor %}\
{% endfor %}
{% endfor %}\n
"""
# remove the leading and trailing whitespace from the template
trim = true
postprocessors = [
{ pattern = '\$REPO', replace = "https://github.com/hamster1963/nezha-dash" }, # replace repository URL
]
# changelog footer
footer = """
"""
[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = true
# regex for preprocessing the commit messages
commit_preprocessors = [
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/orhun/git-cliff/issues/${2}))" },
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "<!-- 0 -->⛰️ Features" },
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
{ message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore\\(pr\\)", skip = true },
{ message = "^chore\\(pull\\)", skip = true },
{ message = "^chore", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
{ message = "^update", group = "<!-- 9 -->🔼 Updates" },
{ message = "^delete", group = "<!-- 10 -->🔞 Delete" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# glob pattern for matching git tags
tag_pattern = "v[0-20]*"
# regex for skipping tags
skip_tags = ""
# regex for ignoring tags
ignore_tags = "v.*-beta.*"
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"

View File

@ -1,44 +0,0 @@
"use client";
import useSWRSubscription, {
type SWRSubscriptionOptions,
} from "swr/subscription";
type LooseObject = {
[key: string]: any;
};
export function SSEDataFetch(url: string, fallbackData?: LooseObject): any {
const { data } = useSWRSubscription<LooseObject>(
url,
(key: string | URL, { next }: SWRSubscriptionOptions<LooseObject>) => {
const source = new EventSource(key);
source.onmessage = (event) => {
const parsedData = JSON.parse(event.data);
next(null, parsedData);
};
source.onerror = () => next(new Error("EventSource error"));
return () => source.close();
},
{
fallbackData: fallbackData,
},
);
return data;
}
export function verifySSEConnection(url: string): Promise<{ name: string }> {
return new Promise<{ name: string }>((resolve, reject) => {
const eventSource = new EventSource(url);
eventSource.onopen = () => {
resolve({ name: "SSE Connected" });
eventSource.close();
};
eventSource.onerror = () => {
reject("Failed to connect");
eventSource.close();
};
});
}

View File

@ -22,6 +22,9 @@ const withPWA = withPWAInit({
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
output: "standalone", output: "standalone",
experimental: {
ppr: "incremental",
},
reactStrictMode: true, reactStrictMode: true,
logging: { logging: {
fetches: { fetches: {

View File

@ -1,6 +1,6 @@
{ {
"name": "nezha-dash", "name": "nezha-dash",
"version": "1.1.0", "version": "1.1.1",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev -p 3020", "dev": "next dev -p 3020",
@ -23,7 +23,7 @@
"@trivago/prettier-plugin-sort-imports": "^4.3.0", "@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/luxon": "^3.4.2", "@types/luxon": "^3.4.2",
"@typescript-eslint/eslint-plugin": "^8.12.2", "@typescript-eslint/eslint-plugin": "^8.12.2",
"caniuse-lite": "^1.0.30001674", "caniuse-lite": "^1.0.30001676",
"class-variance-authority": "^0.7.0", "class-variance-authority": "^0.7.0",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"country-flag-icons": "^1.5.13", "country-flag-icons": "^1.5.13",
@ -32,9 +32,9 @@
"framer-motion": "^12.0.0-alpha.1", "framer-motion": "^12.0.0-alpha.1",
"lucide-react": "^0.451.0", "lucide-react": "^0.451.0",
"luxon": "^3.5.0", "luxon": "^3.5.0",
"next": "15.0.2", "next": "^15.0.3-canary.3",
"next-auth": "^5.0.0-beta.25", "next-auth": "^5.0.0-beta.25",
"next-intl": "^3.23.5", "next-intl": "^3.24.0",
"next-runtime-env": "^3.2.2", "next-runtime-env": "^3.2.2",
"next-themes": "^0.3.0", "next-themes": "^0.3.0",
"react": "19.0.0-rc-02c0e824-20241028", "react": "19.0.0-rc-02c0e824-20241028",
@ -53,7 +53,7 @@
"eslint-plugin-turbo": "^2.2.3", "eslint-plugin-turbo": "^2.2.3",
"eslint-plugin-unused-imports": "^4.1.4", "eslint-plugin-unused-imports": "^4.1.4",
"@next/bundle-analyzer": "15.0.2", "@next/bundle-analyzer": "15.0.2",
"@types/node": "^22.8.4", "@types/node": "^22.8.6",
"@types/react": "npm:types-react@19.0.0-rc.1", "@types/react": "npm:types-react@19.0.0-rc.1",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1", "@types/react-dom": "npm:types-react-dom@19.0.0-rc.1",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",

File diff suppressed because it is too large Load Diff