This commit is contained in:
yezian 2024-12-04 15:57:43 +08:00
commit fc73c5bcbb
15 changed files with 5229 additions and 0 deletions

3
.eslintrc.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}

40
.gitignore vendored Normal file
View File

@ -0,0 +1,40 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# env files (can opt-in for committing if needed)
.env*
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts

36
README.md Normal file
View File

@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `app/page.js`. The page auto-updates as you edit the file.
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.

BIN
app/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

3
app/globals.css Normal file
View File

@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

18
app/layout.js Normal file
View File

@ -0,0 +1,18 @@
import "./globals.css";
export const metadata = {
title: "铁粉空间",
description: "与Ta永不失联",
};
export default function RootLayout({ children }) {
return (
<html
lang="zh-CN"
className="bg-[#07050A]"
data-prefers-color-scheme="dark"
>
<body>{children}</body>
</html>
);
}

21
app/page.js Normal file
View File

@ -0,0 +1,21 @@
export default function Home() {
return (
<div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
<footer className="w-full px-4 py-4 z-10">
<div className="flex flex-row flex-wrap justify-center items-center">
<a
target="_blank"
href="http://beian.miit.gov.cn"
className="text-xs text-white"
>
蜀ICP备2024076396号-1
</a>
<span className="text-xs text-white">&nbsp;&nbsp;&nbsp;&nbsp;</span>
<a className="text-xs text-white">
Copyright © 2023-2024 成都多塔文化传媒有限公司
</a>
</div>
</footer>
</div>
);
}

View File

@ -0,0 +1,51 @@
"use client";
import React, { useEffect } from "react";
import { useRouter } from "next/navigation";
export default function RedirectToUseableWeb({ params }) {
const router = useRouter();
function generateRandomString(length = 10) {
const characters =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
let result = "";
for (let i = 0; i < length; i++) {
result += characters.charAt(
Math.floor(Math.random() * characters.length)
);
}
return result;
}
useEffect(() => {
const getAndRedirectToUseableWebUrl = async () => {
try {
const _response = await fetch(`/api/share/zone_url`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({}),
});
const _data = await _response.json();
if (_data.ret === -1) {
console.log("something went wrong");
return;
}
if (!_data?.data?.share_url) return;
const url = `https://${_data.data.share_url}`;
//
const randomStr = generateRandomString();
const finalUrl = `${url}/zone/${params.user_id}/${randomStr}`;
router.replace(finalUrl);
} catch (error) {
console.error(error);
}
};
getAndRedirectToUseableWebUrl();
}, []);
return <div></div>;
}

View File

@ -0,0 +1,51 @@
"use client";
import React, { useEffect } from "react";
import { useRouter } from "next/navigation";
export default function RedirectToUseableWeb({ params }) {
const router = useRouter();
function generateRandomString(length = 10) {
const characters =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
let result = "";
for (let i = 0; i < length; i++) {
result += characters.charAt(
Math.floor(Math.random() * characters.length)
);
}
return result;
}
useEffect(() => {
const getAndRedirectToUseableWebUrl = async () => {
try {
const _response = await fetch(`/api/share/zone_url`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({}),
});
const _data = await _response.json();
if (_data.ret === -1) {
console.log("something went wrong");
return;
}
if (!_data?.data?.share_url) return;
const url = `https://${_data.data.share_url}`;
//
const randomStr = generateRandomString();
const finalUrl = `${url}/zone/${params.user_id}/${randomStr}`;
router.replace(finalUrl);
} catch (error) {
console.error(error);
}
};
getAndRedirectToUseableWebUrl();
}, []);
return <div></div>;
}

7
jsconfig.json Normal file
View File

@ -0,0 +1,7 @@
{
"compilerOptions": {
"paths": {
"@/*": ["./*"]
}
}
}

13
next.config.js Normal file
View File

@ -0,0 +1,13 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
async rewrites() {
return [
{
source: "/api/:path*",
destination: "https://api.tiefen.fun/api/:path*",
},
];
},
};
module.exports = nextConfig;

4939
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

22
package.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "tiefen_space_redirect_web",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbo",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"react": "18.2.0",
"react-dom": "18.2.0",
"next": "14.0.2"
},
"devDependencies": {
"postcss": "^8",
"tailwindcss": "^3.4.1",
"eslint": "^8",
"eslint-config-next": "15.0.3"
}
}

8
postcss.config.mjs Normal file
View File

@ -0,0 +1,8 @@
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
tailwindcss: {},
},
};
export default config;

17
tailwind.config.js Normal file
View File

@ -0,0 +1,17 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
colors: {
background: "var(--background)",
foreground: "var(--foreground)",
},
},
},
plugins: [],
};