From 674b42c7afc9f08ea2f4abd82972b4760f1ffc34 Mon Sep 17 00:00:00 2001 From: Howard Date: Tue, 9 Dec 2025 10:10:34 +0800 Subject: [PATCH 01/11] Update navbar --- apps/web/src/app/dashboard/sidebar.tsx | 30 +--- apps/web/src/app/user/[userid]/page.tsx | 2 +- .../web/src/components/conditional-layout.tsx | 10 +- apps/web/src/components/footer.tsx | 18 -- apps/web/src/components/mode-toggle.tsx | 84 ++++++--- apps/web/src/components/navigation.tsx | 167 +++++++----------- apps/web/src/components/theme-provider.tsx | 6 +- packages/auth/src/index.ts | 2 + 8 files changed, 127 insertions(+), 192 deletions(-) delete mode 100644 apps/web/src/components/footer.tsx diff --git a/apps/web/src/app/dashboard/sidebar.tsx b/apps/web/src/app/dashboard/sidebar.tsx index f13de2f..cabdb81 100644 --- a/apps/web/src/app/dashboard/sidebar.tsx +++ b/apps/web/src/app/dashboard/sidebar.tsx @@ -14,6 +14,7 @@ import { } from "lucide-react"; import { Button } from "@/components/ui/button"; import Image from "next/image"; +import { ModeToggleDropdown } from "@/components/mode-toggle"; import { DropdownMenu, DropdownMenuContent, @@ -139,7 +140,7 @@ export default function DashboardSidebar({ - + @@ -211,30 +212,3 @@ export default function DashboardSidebar({ ); } - -function ModeToggle() { - const { setTheme } = useTheme(); - - return ( - - - - - - setTheme("light")}> - Light - - setTheme("dark")}> - Dark - - setTheme("system")}> - System - - - - ); -} diff --git a/apps/web/src/app/user/[userid]/page.tsx b/apps/web/src/app/user/[userid]/page.tsx index 9bffed5..6397365 100644 --- a/apps/web/src/app/user/[userid]/page.tsx +++ b/apps/web/src/app/user/[userid]/page.tsx @@ -46,7 +46,7 @@ export default async function Page(props: { alt={`The profile picture for ${content[0].name}`} width="100" height="100" - className="rounded-full border border-black dark:border-white select-none" + className="rounded-full border border-black dark:border-white select-none w-[100px] h-[100px]" draggable="false" />
diff --git a/apps/web/src/components/conditional-layout.tsx b/apps/web/src/components/conditional-layout.tsx index 4d8321a..0179ad6 100644 --- a/apps/web/src/components/conditional-layout.tsx +++ b/apps/web/src/components/conditional-layout.tsx @@ -1,7 +1,6 @@ "use client"; import { usePathname } from "next/navigation"; import Navigation from "@/components/navigation"; -import Footer from "@/components/footer"; export default function ConditionalLayout({ children, @@ -19,11 +18,10 @@ export default function ConditionalLayout({ // Regular layout with nav and footer return (
-
- -
-
{children}
-
+ +
+ {children} +
); } diff --git a/apps/web/src/components/footer.tsx b/apps/web/src/components/footer.tsx deleted file mode 100644 index 7387274..0000000 --- a/apps/web/src/components/footer.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import Link from "next/link"; -export default function Footer() { - return ( -
-
- - This project is{" "} - - open source - - . - -
- ); -} diff --git a/apps/web/src/components/mode-toggle.tsx b/apps/web/src/components/mode-toggle.tsx index 1a3c387..2acd8ef 100644 --- a/apps/web/src/components/mode-toggle.tsx +++ b/apps/web/src/components/mode-toggle.tsx @@ -1,39 +1,65 @@ "use client"; import * as React from "react"; -import { Moon, Sun } from "lucide-react"; -import { useTheme } from "next-themes"; +import { LaptopMinimalIcon, Moon, Sun } from "lucide-react"; +import { ThemeProvider, useTheme } from "next-themes"; import { Button } from "@/components/ui/button"; import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; export function ModeToggle() { - const { setTheme } = useTheme(); + const { setTheme, theme } = useTheme(); - return ( - - - - - - setTheme("light")}> - Light - - setTheme("dark")}> - Dark - - setTheme("system")}> - System - - - - ); + return ( + + ); +} + +export function ModeToggleDropdown() { + const { setTheme } = useTheme(); + + return ( + + + + + + setTheme("light")}> + Light + + setTheme("dark")}> + Dark + + setTheme("system")}> + System + + + + ); } diff --git a/apps/web/src/components/navigation.tsx b/apps/web/src/components/navigation.tsx index 53c00e5..28a682f 100644 --- a/apps/web/src/components/navigation.tsx +++ b/apps/web/src/components/navigation.tsx @@ -15,51 +15,37 @@ import { Skeleton } from "./ui/skeleton"; import { Spinner } from "./ui/spinner"; import { useRouter } from "next/navigation"; import * as React from "react"; -import { Moon, SearchIcon, Sun } from "lucide-react"; +import { ModeToggle } from "./mode-toggle"; +import { + HouseIcon, + LayoutDashboardIcon, + LogInIcon, + LogOutIcon, + Moon, + SearchIcon, + Sun, + UserIcon, +} from "lucide-react"; import { useTheme } from "next-themes"; export default function Navigation() { - const links = [] as const; - const [scrolled, setScrolled] = useState(false); - - useEffect(() => { - const handleScroll = () => { - setScrolled(window.scrollY > 10); - }; - window.addEventListener("scroll", handleScroll); - return () => window.removeEventListener("scroll", handleScroll); - }, []); - return ( -
-
-
- - logs +
+
+
+ + - -
-
-
+ © {new Date().getFullYear()}
); @@ -71,7 +57,7 @@ function UserMenu() { if (isPending) { return ( - ); @@ -79,81 +65,48 @@ function UserMenu() { if (!session) { return ( - ); } return ( - - - - - - - - - - - - - - - - - ); -} - -function ModeToggle() { - const { setTheme } = useTheme(); - - return ( - - - - - - setTheme("light")}> - Light - - setTheme("dark")}> - Dark - - setTheme("system")}> - System - - - + <> + + + + ); } diff --git a/apps/web/src/components/theme-provider.tsx b/apps/web/src/components/theme-provider.tsx index f6b22ae..189a2b1 100644 --- a/apps/web/src/components/theme-provider.tsx +++ b/apps/web/src/components/theme-provider.tsx @@ -4,8 +4,8 @@ import * as React from "react"; import { ThemeProvider as NextThemesProvider } from "next-themes"; export function ThemeProvider({ - children, - ...props + children, + ...props }: React.ComponentProps) { - return {children}; + return {children}; } diff --git a/packages/auth/src/index.ts b/packages/auth/src/index.ts index 146b7ff..2d16d7d 100644 --- a/packages/auth/src/index.ts +++ b/packages/auth/src/index.ts @@ -21,6 +21,8 @@ export const auth = betterAuth({ secure: true, httpOnly: true, }, + disableCSRFCheck: process.env.NODE_ENV === "development" ? true : false, + trustedProxyHeaders: true, }, databaseHooks: { user: { From 06721e28a22fbad5983a11e6a3a8a8c7f7225303 Mon Sep 17 00:00:00 2001 From: Howard Date: Tue, 9 Dec 2025 14:41:21 +0800 Subject: [PATCH 02/11] yeee --- apps/web/src/components/layout.tsx | 68 ------------------------------ 1 file changed, 68 deletions(-) delete mode 100644 apps/web/src/components/layout.tsx diff --git a/apps/web/src/components/layout.tsx b/apps/web/src/components/layout.tsx deleted file mode 100644 index 40f242f..0000000 --- a/apps/web/src/components/layout.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import type { Metadata } from "next"; -import { Geist, Geist_Mono } from "next/font/google"; -import "../index.css"; -import Providers from "@/components/providers"; -import Navigation from "@/components/navigation"; -import { db, main_schema, dorm } from "../../../../packages/db/src"; -import Footer from "@/components/footer"; - -const geistSans = Geist({ - variable: "--font-geist-sans", - subsets: ["latin"], -}); - -const geistMono = Geist_Mono({ - variable: "--font-geist-mono", - subsets: ["latin"], -}); - -export async function generateMetadata(): Promise { - try { - const titleResult = await db - .select() - .from(main_schema.kvData) - .where(dorm.eq(main_schema.kvData.key, "title")); - - const descResult = await db - .select() - .from(main_schema.kvData) - .where(dorm.eq(main_schema.kvData.key, "description")); - - const title = `${titleResult[0]?.value ?? ""}`; - const description = `${descResult[0]?.value ?? ""}`; - - return { - title, - description, - }; - } catch (e: any) { - console.error(e); - return { - title: `Home`, - }; - } -} - -export default function RootLayout({ - children, -}: Readonly<{ - children: React.ReactNode; -}>) { - return ( - - - -
-
- -
-
{children}
-
-
-
- - - ); -} From d146547df1a9eb97f82c341ba4c10d673c3b3666 Mon Sep 17 00:00:00 2001 From: Howard Date: Tue, 9 Dec 2025 15:34:45 +0800 Subject: [PATCH 03/11] ok --- .github/scripts/README.md | 39 +++++++ .github/scripts/increment-version.js | 105 +++++++++++++++++ .../auto-update-version.yml.disabled | 64 +++++++++++ ...ge.yml => build_docker_image.yml.disabled} | 2 + .github/workflows/version-and-build.yml | 106 ++++++++++++++++++ apps/web/projectData.ts | 2 +- apps/web/src/components/navigation.tsx | 4 +- 7 files changed, 319 insertions(+), 3 deletions(-) create mode 100644 .github/scripts/README.md create mode 100644 .github/scripts/increment-version.js create mode 100644 .github/workflows/auto-update-version.yml.disabled rename .github/workflows/{build_docker_image.yml => build_docker_image.yml.disabled} (90%) create mode 100644 .github/workflows/version-and-build.yml diff --git a/.github/scripts/README.md b/.github/scripts/README.md new file mode 100644 index 0000000..1676062 --- /dev/null +++ b/.github/scripts/README.md @@ -0,0 +1,39 @@ +# CI Scripts + +This directory contains scripts used by GitHub Actions workflows to automate various tasks. + +## increment-version.js + +Automatically increments the version number in `apps/web/projectData.ts`. + +### Usage + +```bash +node .github/scripts/increment-version.js +``` + +### Version Increment Logic + +The script handles different version formats intelligently: + +1. **Suffixed versions** (e.g., `"0.1.10-canary-1"` → `"0.1.10-canary-2"`) + - Increments the number after the final dash + +2. **Semantic versions** (e.g., `"0.1.10"` → `"0.1.11"`) + - Increments the patch version (third number) + +3. **Fallback pattern** - Increments the last number found in the version string + +### Outputs + +When run in GitHub Actions, the script sets these outputs: +- `current`: The previous version number +- `new`: The new incremented version number + +### Integration + +This script is used by the "Auto Update Version and Build" workflow (`version-and-build.yml`) to automatically increment the version on every push to the main branch, then build and tag a Docker image with the new version. + +### Prevention of Infinite Loops + +The workflow is designed to skip execution when the commit message contains "🤖 Auto-increment version" to prevent infinite loops of version updates. \ No newline at end of file diff --git a/.github/scripts/increment-version.js b/.github/scripts/increment-version.js new file mode 100644 index 0000000..9f96726 --- /dev/null +++ b/.github/scripts/increment-version.js @@ -0,0 +1,105 @@ +#!/usr/bin/env node + +import fs from "fs"; +import path from "path"; +import { fileURLToPath } from "url"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const PROJECT_DATA_PATH = path.join(__dirname, "../../apps/web/projectData.ts"); + +function incrementVersion(version) { + // Handle different version formats: + // "0.1.10-canery-1" -> "0.1.10-canery-2" + // "0.1.10" -> "0.1.11" + // "1.2.3-alpha-5" -> "1.2.3-alpha-6" + + // Pattern 1: ends with -number (e.g., "0.1.10-canery-1") + const dashNumberPattern = /^(.+-)(\d+)$/; + const dashMatch = version.match(dashNumberPattern); + + if (dashMatch) { + const prefix = dashMatch[1]; + const number = parseInt(dashMatch[2], 10); + return `${prefix}${number + 1}`; + } + + // Pattern 2: semantic version (e.g., "0.1.10" or "1.2.3") + const semverPattern = /^(\d+)\.(\d+)\.(\d+)(.*)$/; + const semverMatch = version.match(semverPattern); + + if (semverMatch) { + const major = parseInt(semverMatch[1], 10); + const minor = parseInt(semverMatch[2], 10); + const patch = parseInt(semverMatch[3], 10); + const suffix = semverMatch[4] || ""; + return `${major}.${minor}.${patch + 1}${suffix}`; + } + + // Fallback: find the last number in the string and increment it + const lastNumberPattern = /^(.*?)(\d+)([^\d]*)$/; + const lastNumberMatch = version.match(lastNumberPattern); + + if (lastNumberMatch) { + const prefix = lastNumberMatch[1]; + const number = parseInt(lastNumberMatch[2], 10); + const suffix = lastNumberMatch[3]; + return `${prefix}${number + 1}${suffix}`; + } + + // If no number found, append .1 + return `${version}.1`; +} + +function updateProjectData() { + try { + // Read the current file + const content = fs.readFileSync(PROJECT_DATA_PATH, "utf8"); + + // Extract current version using regex + const versionPattern = /version:\s*["']([^"']+)["']/; + const match = content.match(versionPattern); + + if (!match) { + throw new Error("Could not find version property in projectData.ts"); + } + + const currentVersion = match[1]; + const newVersion = incrementVersion(currentVersion); + + // Replace the version in the content + const newContent = content.replace( + versionPattern, + `version: "${newVersion}"`, + ); + + // Write back to file + fs.writeFileSync(PROJECT_DATA_PATH, newContent, "utf8"); + + console.log(`Version updated from ${currentVersion} to ${newVersion}`); + + // Output for GitHub Actions (using modern format) + if (process.env.GITHUB_OUTPUT) { + fs.appendFileSync( + process.env.GITHUB_OUTPUT, + `current=${currentVersion}\n`, + ); + fs.appendFileSync(process.env.GITHUB_OUTPUT, `new=${newVersion}\n`); + } else { + // Fallback for local testing + console.log(`current=${currentVersion}`); + console.log(`new=${newVersion}`); + } + } catch (error) { + console.error("Error updating version:", error.message); + process.exit(1); + } +} + +// Run if this script is executed directly +if (import.meta.url === `file://${process.argv[1]}`) { + updateProjectData(); +} + +export { incrementVersion, updateProjectData }; diff --git a/.github/workflows/auto-update-version.yml.disabled b/.github/workflows/auto-update-version.yml.disabled new file mode 100644 index 0000000..0dadbc8 --- /dev/null +++ b/.github/workflows/auto-update-version.yml.disabled @@ -0,0 +1,64 @@ +name: Auto Update Version + +on: + push: + branches: + - master + - main + workflow_dispatch: + +jobs: + update-version: + runs-on: ubuntu-latest + permissions: + contents: write + # Skip if the commit message contains the auto-increment marker to prevent infinite loops + if: "!contains(github.event.head_commit.message, '🤖 Auto-increment version')" + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Update version using Node.js script + id: version_update + run: | + # Make script executable + chmod +x .github/scripts/increment-version.js + + # Run the version increment script + node .github/scripts/increment-version.js + + # Display updated file + echo "Updated projectData.ts:" + cat apps/web/projectData.ts + + - name: Check for changes + id: git_status + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "changes=true" >> $GITHUB_OUTPUT + else + echo "changes=false" >> $GITHUB_OUTPUT + fi + + - name: Commit and push changes + if: steps.git_status.outputs.changes == 'true' + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add apps/web/projectData.ts + git commit -m "🤖 Auto-increment version to ${{ steps.version_update.outputs.new }} [skip ci]" + git push + + - name: Output version info + run: | + echo "Previous version: ${{ steps.version_update.outputs.current }}" + echo "New version: ${{ steps.version_update.outputs.new }}" diff --git a/.github/workflows/build_docker_image.yml b/.github/workflows/build_docker_image.yml.disabled similarity index 90% rename from .github/workflows/build_docker_image.yml rename to .github/workflows/build_docker_image.yml.disabled index 086faa5..51c00a6 100644 --- a/.github/workflows/build_docker_image.yml +++ b/.github/workflows/build_docker_image.yml.disabled @@ -17,6 +17,8 @@ jobs: permissions: contents: read packages: write + # Only run if not triggered by the auto-increment commit + if: "!contains(github.event.head_commit.message, '🤖 Auto-increment version')" steps: - name: Checkout repository diff --git a/.github/workflows/version-and-build.yml b/.github/workflows/version-and-build.yml new file mode 100644 index 0000000..e09064e --- /dev/null +++ b/.github/workflows/version-and-build.yml @@ -0,0 +1,106 @@ +name: Auto Update Version and Build + +on: + push: + branches: + - master + - main + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + update-version-and-build: + runs-on: ubuntu-latest + permissions: + contents: write + packages: write + # Skip if the commit message contains the auto-increment marker to prevent infinite loops + if: "!contains(github.event.head_commit.message, '🤖 Auto-increment version')" + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Update version using Node.js script + id: version_update + run: | + # Make script executable + chmod +x .github/scripts/increment-version.js + + # Run the version increment script + node .github/scripts/increment-version.js + + # Display updated file + echo "Updated projectData.ts:" + cat apps/web/projectData.ts + + - name: Check for changes + id: git_status + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "changes=true" >> $GITHUB_OUTPUT + else + echo "changes=false" >> $GITHUB_OUTPUT + fi + + - name: Commit version changes + if: steps.git_status.outputs.changes == 'true' + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add apps/web/projectData.ts + git commit -m "🤖 Auto-increment version to ${{ steps.version_update.outputs.new }}" + git push + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=latest + type=raw,value=${{ steps.version_update.outputs.new }} + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=sha,prefix= + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Output summary + run: | + echo "## Version Update Summary" >> $GITHUB_STEP_SUMMARY + echo "- Previous version: ${{ steps.version_update.outputs.current }}" >> $GITHUB_STEP_SUMMARY + echo "- New version: ${{ steps.version_update.outputs.new }}" >> $GITHUB_STEP_SUMMARY + echo "- Docker image built with tags:" >> $GITHUB_STEP_SUMMARY + echo " - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" >> $GITHUB_STEP_SUMMARY + echo " - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version_update.outputs.new }}" >> $GITHUB_STEP_SUMMARY diff --git a/apps/web/projectData.ts b/apps/web/projectData.ts index cd207cd..b015ed5 100644 --- a/apps/web/projectData.ts +++ b/apps/web/projectData.ts @@ -1,5 +1,5 @@ const data = { - version: "0.1.9", + version: "0.1.10-canery-1", }; export default data; diff --git a/apps/web/src/components/navigation.tsx b/apps/web/src/components/navigation.tsx index 28a682f..db15d96 100644 --- a/apps/web/src/components/navigation.tsx +++ b/apps/web/src/components/navigation.tsx @@ -29,8 +29,8 @@ import { import { useTheme } from "next-themes"; export default function Navigation() { return ( -
-
+
+
- +
diff --git a/apps/web/src/components/mode-toggle.tsx b/apps/web/src/components/mode-toggle.tsx index 2acd8ef..3e46bfd 100644 --- a/apps/web/src/components/mode-toggle.tsx +++ b/apps/web/src/components/mode-toggle.tsx @@ -18,6 +18,7 @@ export function ModeToggle() { ); } - -export function ModeToggleDropdown() { - const { setTheme } = useTheme(); - - return ( - - - - - - setTheme("light")}> - Light - - setTheme("dark")}> - Dark - - setTheme("system")}> - System - - - - ); -} diff --git a/apps/web/src/components/navigation.tsx b/apps/web/src/components/navigation.tsx index db15d96..31b7dc5 100644 --- a/apps/web/src/components/navigation.tsx +++ b/apps/web/src/components/navigation.tsx @@ -33,12 +33,22 @@ export default function Navigation() {
- - @@ -57,7 +67,12 @@ function UserMenu() { if (isPending) { return ( - ); @@ -65,7 +80,13 @@ function UserMenu() { if (!session) { return ( - +
+
+ Preview Image +
+
+
+ + ); +} diff --git a/apps/web/src/components/publicPostsAndVideos.tsx b/apps/web/src/components/publicPostsAndVideos.tsx index adf378e..974dae4 100644 --- a/apps/web/src/components/publicPostsAndVideos.tsx +++ b/apps/web/src/components/publicPostsAndVideos.tsx @@ -7,6 +7,7 @@ import { main_schema } from "../../../../packages/db/src/index"; import Link from "next/link"; import Image from "next/image"; import { Badge } from "./ui/badge"; +import ImageView from "./imageView"; import { CircleUserIcon, ExternalLink, @@ -34,6 +35,10 @@ export function PublicPostsAndVideos({ noDisplay?: ("profile" | "link" | "profileLink")[]; }) { const [currentOffset, setCurrentOffset] = useState(0); + const [imageViewSys, setImageViewSys] = useState({ + previewOn: false, + previewImageUrl: "", + }); const [reloadPost, setReloadPost] = useState(false); const [logData, setLogData] = useState([]); const [logUserInfo, setLogUserInfo] = useState< @@ -160,6 +165,14 @@ export function PublicPostsAndVideos({ return (
+ {imageViewSys.previewOn && ( + + setImageViewSys({ previewOn: false, previewImageUrl: "" }) + } + /> + )} {mode === "search" ? ( <>
@@ -197,7 +210,15 @@ export function PublicPostsAndVideos({ {i.textData}
{i.type === "photos" ? ( -
+
-
+ ) : ( i.type === "video" && (
@@ -295,7 +316,16 @@ export function PublicPostsAndVideos({ {i.textData}
{i.type === "photos" ? ( -
+
-
+ ) : ( i.type === "video" && (
From b3e6bea17b7e28e8abbdeda845a953c433650de7 Mon Sep 17 00:00:00 2001 From: Howard Date: Fri, 12 Dec 2025 23:43:14 +0800 Subject: [PATCH 09/11] Update SQL & Add system_info route. --- .../web/src/app/api/data/system_info/route.ts | 35 + .../migrations/0014_reflective_roughhouse.sql | 4 + .../db/src/migrations/meta/0014_snapshot.json | 733 ++++++++++++++++++ packages/db/src/migrations/meta/_journal.json | 7 + 4 files changed, 779 insertions(+) create mode 100644 apps/web/src/app/api/data/system_info/route.ts create mode 100644 packages/db/src/migrations/0014_reflective_roughhouse.sql create mode 100644 packages/db/src/migrations/meta/0014_snapshot.json diff --git a/apps/web/src/app/api/data/system_info/route.ts b/apps/web/src/app/api/data/system_info/route.ts new file mode 100644 index 0000000..8e6132e --- /dev/null +++ b/apps/web/src/app/api/data/system_info/route.ts @@ -0,0 +1,35 @@ +import type { NextRequest } from "next/server"; +import projectData from "../../../../../projectData"; +import { + db, + dorm, + main_schema, +} from "../../../../../../../packages/db/src/index"; + +export const GET = async (request: NextRequest) => { + const getHomePageStatus = await db + .select() + .from(main_schema.kvData) + .where(dorm.eq(main_schema.kvData.key, "homePageStatus")); + const getSearchPageStatus = await db + .select() + .from(main_schema.kvData) + .where(dorm.eq(main_schema.kvData.key, "searchStatus")); + const getCopyrightOwner = await db + .select() + .from(main_schema.kvData) + .where(dorm.eq(main_schema.kvData.key, "copyrightOwner")); + const exposeVersion = await db + .select() + .from(main_schema.kvData) + .where(dorm.eq(main_schema.kvData.key, "exposeVersion")); + return Response.json({ + copyright_owner: getCopyrightOwner[0].value, + feature_status: { + homePage: getHomePageStatus[0].value !== "false", + search: getSearchPageStatus[0].value !== "false", + }, + optionalExposeVersion: exposeVersion[0].value !== "false", + version: exposeVersion[0].value !== "false" ? projectData.version : null, + }); +}; diff --git a/packages/db/src/migrations/0014_reflective_roughhouse.sql b/packages/db/src/migrations/0014_reflective_roughhouse.sql new file mode 100644 index 0000000..860be5c --- /dev/null +++ b/packages/db/src/migrations/0014_reflective_roughhouse.sql @@ -0,0 +1,4 @@ +INSERT INTO kv_data (key, value) VALUES +('copyrightOwner', 'Default Owner'), +('exposeVersion', 'false'), +ON CONFLICT DO NOTHING; diff --git a/packages/db/src/migrations/meta/0014_snapshot.json b/packages/db/src/migrations/meta/0014_snapshot.json new file mode 100644 index 0000000..a1a81e5 --- /dev/null +++ b/packages/db/src/migrations/meta/0014_snapshot.json @@ -0,0 +1,733 @@ +{ + "id": "74388b03-2115-4afd-aa95-12191611747b", + "prevId": "2e425149-7760-4ca5-9703-57c44adde47d", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.account": { + "name": "account", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "account_user_id_user_id_fk": { + "name": "account_user_id_user_id_fk", + "tableFrom": "account", + "columnsFrom": [ + "user_id" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "impersonated_by": { + "name": "impersonated_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "columnsFrom": [ + "user_id" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "session_token_unique": { + "name": "session_token_unique", + "columns": [ + "token" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email_verified": { + "name": "email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "banned": { + "name": "banned", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "ban_reason": { + "name": "ban_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ban_expires": { + "name": "ban_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_email_unique": { + "name": "user_email_unique", + "columns": [ + "email" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verification": { + "name": "verification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.collections": { + "name": "collections", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "name": "collections_id_seq", + "increment": "1", + "minValue": "1", + "maxValue": "2147483647", + "startWith": "1", + "cache": "1", + "cycle": false, + "schema": "public", + "type": "byDefault" + } + }, + "collection_id": { + "name": "collection_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "items": { + "name": "items", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "by_user": { + "name": "by_user", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "collections_by_user_user_id_fk": { + "name": "collections_by_user_user_id_fk", + "tableFrom": "collections", + "columnsFrom": [ + "by_user" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "collections_collection_id_unique": { + "name": "collections_collection_id_unique", + "columns": [ + "collection_id" + ], + "nullsNotDistinct": false + }, + "collections_slug_unique": { + "name": "collections_slug_unique", + "columns": [ + "slug" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.kv_data": { + "name": "kv_data", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "name": "kv_data_id_seq", + "increment": "1", + "minValue": "1", + "maxValue": "2147483647", + "startWith": "1", + "cache": "1", + "cycle": false, + "schema": "public", + "type": "byDefault" + } + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "kv_data_key_unique": { + "name": "kv_data_key_unique", + "columns": [ + "key" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.url_shorter": { + "name": "url_shorter", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "name": "url_shorter_id_seq", + "increment": "1", + "minValue": "1", + "maxValue": "2147483647", + "startWith": "1", + "cache": "1", + "cycle": false, + "schema": "public", + "type": "byDefault" + } + }, + "url_slug": { + "name": "url_slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_url": { + "name": "target_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "by_user": { + "name": "by_user", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "url_shorter_by_user_user_id_fk": { + "name": "url_shorter_by_user_user_id_fk", + "tableFrom": "url_shorter", + "columnsFrom": [ + "by_user" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "url_shorter_url_slug_unique": { + "name": "url_shorter_url_slug_unique", + "columns": [ + "url_slug" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_posts": { + "name": "user_posts", + "schema": "", + "columns": { + "post_id": { + "name": "post_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "by_user": { + "name": "by_user", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "text_data": { + "name": "text_data", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "image_url": { + "name": "image_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "video_url": { + "name": "video_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'draft'" + }, + "tags": { + "name": "tags", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "title_search_index": { + "name": "title_search_index", + "columns": [ + { + "expression": "to_tsvector('english', \"text_data\")", + "isExpression": true, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "gin", + "concurrently": false + } + }, + "foreignKeys": { + "user_posts_by_user_user_id_fk": { + "name": "user_posts_by_user_user_id_fk", + "tableFrom": "user_posts", + "columnsFrom": [ + "by_user" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "type_check": { + "name": "type_check", + "value": "\"user_posts\".\"type\" IN ('photos', 'text', 'video')" + }, + "checkcorrectstatus": { + "name": "checkcorrectstatus", + "value": "\"user_posts\".\"status\" IN ('draft', 'private', 'public', 'unlisted')" + }, + "image_url_check": { + "name": "image_url_check", + "value": "\"user_posts\".\"type\" != 'photos' OR \"user_posts\".\"image_url\" IS NOT NULL" + }, + "video_url_check": { + "name": "video_url_check", + "value": "\"user_posts\".\"type\" != 'video' OR \"user_posts\".\"video_url\" IS NOT NULL" + } + }, + "isRLSEnabled": false + } + }, + "enums": {}, + "schemas": {}, + "views": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/packages/db/src/migrations/meta/_journal.json b/packages/db/src/migrations/meta/_journal.json index e63835c..1df7ba2 100644 --- a/packages/db/src/migrations/meta/_journal.json +++ b/packages/db/src/migrations/meta/_journal.json @@ -99,6 +99,13 @@ "when": 1764485135340, "tag": "0013_clear_rockslide", "breakpoints": true + }, + { + "idx": 14, + "version": "7", + "when": 1765554089478, + "tag": "0014_reflective_roughhouse", + "breakpoints": true } ] } \ No newline at end of file From 41e89ffdc7df976d8c1855d7c92fa741680c2011 Mon Sep 17 00:00:00 2001 From: Howard Date: Sun, 14 Dec 2025 15:06:54 +0800 Subject: [PATCH 10/11] Update registartion not disabled bug --- apps/web/package.json | 2 +- bun.lock | 22 +--------------------- packages/auth/src/index.ts | 17 +++++++++-------- 3 files changed, 11 insertions(+), 30 deletions(-) diff --git a/apps/web/package.json b/apps/web/package.json index e3f95b8..05d4174 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -32,7 +32,7 @@ "geist": "^1.5.1", "lucide-react": "^0.546.0", "marked-react": "^3.0.2", - "next": "^16.0.7", + "next": "^16.0.10", "next-themes": "^0.4.6", "prism-react-renderer": "^2.4.1", "radix-ui": "^1.4.3", diff --git a/bun.lock b/bun.lock index 3a305b1..e89a3ee 100644 --- a/bun.lock +++ b/bun.lock @@ -44,7 +44,7 @@ "geist": "^1.5.1", "lucide-react": "^0.546.0", "marked-react": "^3.0.2", - "next": "^16.0.7", + "next": "^16.0.10", "next-themes": "^0.4.6", "prism-react-renderer": "^2.4.1", "radix-ui": "^1.4.3", @@ -1078,8 +1078,6 @@ "web/@types/node": ["@types/node@20.19.25", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-ZsJzA5thDQMSQO788d7IocwwQbI8B5OPzmqNvpf3NY/+MHDAS759Wo0gd2WQeXYt5AAAQjzcrTVC6SKCuYgoCQ=="], - "web/next": ["next@16.0.7", "", { "dependencies": { "@next/env": "16.0.7", "@swc/helpers": "0.5.15", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", "styled-jsx": "5.1.6" }, "optionalDependencies": { "@next/swc-darwin-arm64": "16.0.7", "@next/swc-darwin-x64": "16.0.7", "@next/swc-linux-arm64-gnu": "16.0.7", "@next/swc-linux-arm64-musl": "16.0.7", "@next/swc-linux-x64-gnu": "16.0.7", "@next/swc-linux-x64-musl": "16.0.7", "@next/swc-win32-arm64-msvc": "16.0.7", "@next/swc-win32-x64-msvc": "16.0.7", "sharp": "^0.34.4" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.51.1", "babel-plugin-react-compiler": "*", "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "optionalPeers": ["@opentelemetry/api", "@playwright/test", "babel-plugin-react-compiler", "sass"], "bin": { "next": "dist/bin/next" } }, "sha512-3mBRJyPxT4LOxAJI6IsXeFtKfiJUbjCLgvXO02fV8Wy/lIhPvP94Fe7dGhUgHXcQy4sSuYwQNcOLhIfOm0rL0A=="], - "@aws-crypto/crc32/@aws-sdk/types/@smithy/types": ["@smithy/types@4.8.1", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-N0Zn0OT1zc+NA+UVfkYqQzviRh5ucWwO7mBV3TmHHprMnfcJNfhlPicDkBHi0ewbh+y3evR6cNAW0Raxvb01NA=="], "@aws-crypto/crc32c/@aws-sdk/types/@smithy/types": ["@smithy/types@4.8.1", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-N0Zn0OT1zc+NA+UVfkYqQzviRh5ucWwO7mBV3TmHHprMnfcJNfhlPicDkBHi0ewbh+y3evR6cNAW0Raxvb01NA=="], @@ -1142,24 +1140,6 @@ "@esbuild-kit/core-utils/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.18.20", "", { "os": "win32", "cpu": "x64" }, "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ=="], - "web/next/@next/env": ["@next/env@16.0.7", "", {}, "sha512-gpaNgUh5nftFKRkRQGnVi5dpcYSKGcZZkQffZ172OrG/XkrnS7UBTQ648YY+8ME92cC4IojpI2LqTC8sTDhAaw=="], - - "web/next/@next/swc-darwin-arm64": ["@next/swc-darwin-arm64@16.0.7", "", { "os": "darwin", "cpu": "arm64" }, "sha512-LlDtCYOEj/rfSnEn/Idi+j1QKHxY9BJFmxx7108A6D8K0SB+bNgfYQATPk/4LqOl4C0Wo3LACg2ie6s7xqMpJg=="], - - "web/next/@next/swc-darwin-x64": ["@next/swc-darwin-x64@16.0.7", "", { "os": "darwin", "cpu": "x64" }, "sha512-rtZ7BhnVvO1ICf3QzfW9H3aPz7GhBrnSIMZyr4Qy6boXF0b5E3QLs+cvJmg3PsTCG2M1PBoC+DANUi4wCOKXpA=="], - - "web/next/@next/swc-linux-arm64-gnu": ["@next/swc-linux-arm64-gnu@16.0.7", "", { "os": "linux", "cpu": "arm64" }, "sha512-mloD5WcPIeIeeZqAIP5c2kdaTa6StwP4/2EGy1mUw8HiexSHGK/jcM7lFuS3u3i2zn+xH9+wXJs6njO7VrAqww=="], - - "web/next/@next/swc-linux-arm64-musl": ["@next/swc-linux-arm64-musl@16.0.7", "", { "os": "linux", "cpu": "arm64" }, "sha512-+ksWNrZrthisXuo9gd1XnjHRowCbMtl/YgMpbRvFeDEqEBd523YHPWpBuDjomod88U8Xliw5DHhekBC3EOOd9g=="], - - "web/next/@next/swc-linux-x64-gnu": ["@next/swc-linux-x64-gnu@16.0.7", "", { "os": "linux", "cpu": "x64" }, "sha512-4WtJU5cRDxpEE44Ana2Xro1284hnyVpBb62lIpU5k85D8xXxatT+rXxBgPkc7C1XwkZMWpK5rXLXTh9PFipWsA=="], - - "web/next/@next/swc-linux-x64-musl": ["@next/swc-linux-x64-musl@16.0.7", "", { "os": "linux", "cpu": "x64" }, "sha512-HYlhqIP6kBPXalW2dbMTSuB4+8fe+j9juyxwfMwCe9kQPPeiyFn7NMjNfoFOfJ2eXkeQsoUGXg+O2SE3m4Qg2w=="], - - "web/next/@next/swc-win32-arm64-msvc": ["@next/swc-win32-arm64-msvc@16.0.7", "", { "os": "win32", "cpu": "arm64" }, "sha512-EviG+43iOoBRZg9deGauXExjRphhuYmIOJ12b9sAPy0eQ6iwcPxfED2asb/s2/yiLYOdm37kPaiZu8uXSYPs0Q=="], - - "web/next/@next/swc-win32-x64-msvc": ["@next/swc-win32-x64-msvc@16.0.7", "", { "os": "win32", "cpu": "x64" }, "sha512-gniPjy55zp5Eg0896qSrf3yB1dw4F/3s8VK1ephdsZZ129j2n6e1WqCbE2YgcKhW9hPB9TVZENugquWJD5x0ug=="], - "@aws-crypto/sha1-browser/@smithy/util-utf8/@smithy/util-buffer-from/@smithy/is-array-buffer": ["@smithy/is-array-buffer@2.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA=="], "@aws-crypto/sha256-browser/@smithy/util-utf8/@smithy/util-buffer-from/@smithy/is-array-buffer": ["@smithy/is-array-buffer@2.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA=="], diff --git a/packages/auth/src/index.ts b/packages/auth/src/index.ts index 1f55c78..88f8667 100644 --- a/packages/auth/src/index.ts +++ b/packages/auth/src/index.ts @@ -28,15 +28,16 @@ export const auth = betterAuth({ user: { create: { before: async (user, ctx) => { + const checkIfSystemDisabledRegister = await db + .select() + .from(main_schema.kvData) + .where(dorm.eq(main_schema.kvData.key, "registrationStatus")) + .limit(1); + console.log(checkIfSystemDisabledRegister[0]); + if (checkIfSystemDisabledRegister[0]?.value === false) { + throw new Error("Registration is disabled"); + } try { - const checkIfSystemDisabledRegister = await db - .select() - .from(main_schema.kvData) - .where(dorm.eq(main_schema.kvData.key, "registrationStatus")) - .limit(1); - if (checkIfSystemDisabledRegister[0]?.value === false) { - throw new Error("Registration is disabled"); - } // Query database directly using your existing Drizzle connection const existingUsers = await db .select() From 1f9d95e0c959b8bbbf5fbdb4bb5d6ef6b79a5509 Mon Sep 17 00:00:00 2001 From: Howard Date: Sun, 14 Dec 2025 15:10:58 +0800 Subject: [PATCH 11/11] Update Version --- apps/web/projectData.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/projectData.ts b/apps/web/projectData.ts index 52b83a7..93b0c8b 100644 --- a/apps/web/projectData.ts +++ b/apps/web/projectData.ts @@ -1,5 +1,5 @@ const data = { - version: "0.1.10", + version: "0.1.12", }; export default data;