Merge pull request #41 from oiov/s3/cloudflare-r2

Add umami env for analytics
This commit is contained in:
oiov
2025-07-01 19:20:25 +08:00
committed by GitHub
8 changed files with 39 additions and 3 deletions
+3
View File
@@ -30,6 +30,9 @@ RESEND_FROM_EMAIL="wrdo <support@wr.do>"
# Google Analytics
NEXT_PUBLIC_GOOGLE_ID=
# Umami Script
NEXT_PUBLIC_UMAMI_SCRIPT=
NEXT_PUBLIC_UMAMI_WEBSITE_ID=
# ScreenShot API
SCREENSHOTONE_BASE_URL=https://shot.wr.do
+3 -1
View File
@@ -10,9 +10,10 @@ import { ViewTransitions } from "next-view-transitions";
import { cn, constructMetadata } from "@/lib/utils";
import { Toaster } from "@/components/ui/sonner";
import ModalProvider from "@/components/modals/providers";
import UmamiAnalytics from "@/components/shared/UmamiAnalytics";
import { TailwindIndicator } from "@/components/tailwind-indicator";
import GoogleAnalytics from "./GoogleAnalytics";
import GoogleAnalytics from "../components/shared/GoogleAnalytics";
interface RootLayoutProps {
children: React.ReactNode;
@@ -49,6 +50,7 @@ export default async function RootLayout({ children }: RootLayoutProps) {
</SessionProvider>
</NextIntlClientProvider>
<GoogleAnalytics />
<UmamiAnalytics />
</body>
</html>
</ViewTransitions>
@@ -1,7 +1,8 @@
"use client";
import Script from "next/script";
import * as gtag from "../gtag.js";
import * as gtag from "../../gtag.js";
const GoogleAnalytics = () => {
return (
+26
View File
@@ -0,0 +1,26 @@
"use client";
import Script from "next/script";
const UmamiAnalytics = () => {
const umamiScriptUrl = process.env.NEXT_PUBLIC_UMAMI_SCRIPT;
const websiteId = process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID;
return (
<>
{process.env.NEXT_PUBLIC_UMAMI_SCRIPT &&
process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID ? (
<Script
src={umamiScriptUrl}
data-website-id={websiteId}
strategy="afterInteractive"
async
/>
) : (
<></>
)}
</>
);
};
export default UmamiAnalytics;
@@ -63,6 +63,8 @@ pnpm install
| SCREENSHOTONE\_BASE\_URL | `https://api.example.com` | 待补充 |
| GITHUB\_TOKEN | `ghp_sscsfarwetqet` | [https://github.com/settings/tokens](https://github.com/settings/tokens) |
| NEXT_PUBLIC_GOOGLE_ID | `G-EWREW323` | Google Analytics ID |
| NEXT_PUBLIC_UMAMI_SCRIPT | `https://umami.example.com/script.js` | Umami 站点脚本 |
| NEXT_PUBLIC_UMAMI_WEBSITE_ID | `123465` | Umami 站点 ID |
| NEXT_PUBLIC_SUPPORT_EMAIL | `support@your-domain.com` | '联系站长'邮箱 |
| SKIP_DB_CHECK | `false` | 跳过数据库连接检测, 建议设置为 `false` |
| SKIP_DB_MIGRATION | `false` | 跳过数据库表更新, 建议设置为 `false` |
+2
View File
@@ -64,6 +64,8 @@ Copy/paste the `.env.example` in the `.env` file:
| SCREENSHOTONE_BASE_URL | `https://api.example.com` | The base URL of the screenshotone API. |
| GITHUB_TOKEN | `ghp_sscsfarwetqet` | https://github.com/settings/tokens |
| NEXT_PUBLIC_GOOGLE_ID | `G-EWREW323` | The ID of the Google Analytics. |
| NEXT_PUBLIC_UMAMI_SCRIPT | `https://umami.example.com/script.js` | The URL of the Umami script. |
| NEXT_PUBLIC_UMAMI_WEBSITE_ID | `123465` | The ID of the Umami website. |
| NEXT_PUBLIC_SUPPORT_EMAIL | `support@your-domain.com` | The email address for support. |
| SKIP_DB_CHECK | `false` | Skip database check. |
| SKIP_DB_MIGRATION | `false` | Skip database migration. |
+1 -1
View File
File diff suppressed because one or more lines are too long