diff --git a/.env.production b/.env.production index 5e0aa11..48e7ef1 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,3 @@ # 生产环境使用的变量 -NEXT_PUBLIC_HOST = 'http://39.103.180.196:9012/' +NEXT_PUBLIC_HOST = 'http://api.indie.cn:9012' diff --git a/.env.test b/.env.test deleted file mode 100644 index 9a091bc..0000000 --- a/.env.test +++ /dev/null @@ -1,3 +0,0 @@ -# 测试环境使用的变量 - -NEXT_PUBLIC_HOST = 'http://39.103.180.196:9012/' diff --git a/.gitignore b/.gitignore index fd3dbb5..dae8d21 100644 --- a/.gitignore +++ b/.gitignore @@ -1,36 +1,37 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js -.yarn/install-state.gz - -# testing -/coverage - -# next.js -/.next/ -/out/ - -# production -/build - -# misc -.DS_Store -*.pem - -# debug -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# local env files -.env*.local - -# vercel -.vercel - -# typescript -*.tsbuildinfo -next-env.d.ts +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js +.yarn/install-state.gz + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# local env files +.env*.local + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts +/dist diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..11ab1d8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,43 @@ +# Install dependencies only when needed +FROM node:alpine AS deps +# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. +RUN apk add --no-cache libc6-compat +WORKDIR /app +COPY package.json package-lock.json ./ +RUN yarn install --frozen-lockfile --registry=https://registry.npm.taobao.org + +# Rebuild the source code only when needed +FROM node:alpine AS builder +WORKDIR /app +COPY . . +COPY --from=deps /app/node_modules ./node_modules +RUN yarn build && yarn install --production --ignore-scripts --prefer-offline --registry=https://registry.npm.taobao.org + +# Production image, copy all the files and run next +FROM node:alpine AS runner +WORKDIR /app + +ENV NODE_ENV production + +RUN addgroup -g 1001 -S nodejs +RUN adduser -S nextjs -u 1001 + +# You only need to copy next.config.js if you are NOT using the default configuration +# COPY --from=builder /app/next.config.js ./ +COPY --from=builder /app/public ./public +COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/package.json ./package.json + +USER nextjs + +EXPOSE 3000 + +ENV PORT 3000 + +# Next.js collects completely anonymous telemetry data about general usage. +# Learn more here: https://nextjs.org/telemetry +# Uncomment the following line in case you want to disable telemetry. +# ENV NEXT_TELEMETRY_DISABLED 1 + +CMD ["node_modules/.bin/next", "start"] diff --git a/next.config.mjs b/next.config.mjs index 619e0e0..912ea71 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,22 +1,28 @@ /** @type {import('next').NextConfig} */ const nextConfig = { + // output: 'export', + distDir: 'dist', async rewrites() { return [ { source: '/queyueapi/:path*', - destination: `${process.env.NEXT_PUBLIC_HOST}/:path*`, + destination: `http://api.indie.cn:9012/:path*`, }, ]; }, redirects: async () => { return [ - { - source: '/', - destination: '/vol/list/all', - permanent: true, - }, + // { + // source: '/', + // destination: '/download', + // permanent: false, + // }, ]; }, + eslint: { + ignoreDuringBuilds: true, + ignoreBuildErrors: true, + }, }; export default nextConfig; diff --git a/package.json b/package.json index dcd465d..be658ec 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,9 @@ "scripts": { "dev": "next dev -p 3001", "build": "next build", - "start": "next start -p 3001", - "lint": "eslint src --fix --ext .ts,.tsx,.js,.jsx,.mdx,.md,.json,.mjs --max-warnings 0" + "start": "next start -p 80", + "lint": "eslint src --fix --ext .ts,.tsx,.js,.jsx,.mdx,.md,.json,.mjs --max-warnings 0", + "pm2start": "pm2 start npm --name queryue-website -- run start" }, "dependencies": { "lodash": "^4.17.21", diff --git a/src/app/api/auth/[...nextauth]/options.ts b/src/app/api/auth/[...nextauth]/options.ts index b193489..bc7ab77 100644 --- a/src/app/api/auth/[...nextauth]/options.ts +++ b/src/app/api/auth/[...nextauth]/options.ts @@ -30,7 +30,7 @@ const options: NextAuthOptions = { if (result.code === 200) { return result.data; } else { - console.log(`error ${result.code}/${result.messgae}`); + // console.log(`error ${result.code}/${result.messgae}`); throw new Error(`error ${result.code}/${result.messgae}`); } } catch (error) { @@ -44,7 +44,7 @@ const options: NextAuthOptions = { maxAge: 7 * 24 * 60 * 60, }, pages: { - signIn: '/', // 重定向到 /login + signIn: '/download', // 重定向到 /login }, // callbacks: { // async jwt({ token, user }) { diff --git a/src/app/download/components/DownloadCard.tsx b/src/app/download/components/DownloadCard.tsx index b926090..76ae088 100644 --- a/src/app/download/components/DownloadCard.tsx +++ b/src/app/download/components/DownloadCard.tsx @@ -34,7 +34,7 @@ export default function Footer({ platform, iconUrl, qrCode }: DownloadQrcodeCard {/* 二维码 */}
{qrCode ? (
{children}
-

+

{commentList[0].content}

diff --git a/src/utils/request.ts b/src/utils/request.ts index 117a41e..a148bdf 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -1,6 +1,6 @@ // client端请求 -import { getCookie } from './cookie'; -import { getApiUrl } from './helpers'; +// import { getCookie } from './cookie'; +// import { getApiUrl } from './helpers'; import { createFormBody } from './wrapper'; interface RequestOptions extends RequestInit { @@ -11,16 +11,15 @@ interface RequestOptions extends RequestInit { // 发送数据请求 const request = async (url: string, config?: RequestOptions) => { const method = config?.method || 'GET'; - // const finalUrl = method === 'POST' ? `/queyueapi${url}` : `${process.env.NEXT_PUBLIC_HOST}/${url}`; - const finalUrl = method === 'POST' ? `${url}` : `${process.env.NEXT_PUBLIC_HOST}/${url}`; + const finalUrl = method === 'POST' ? `/queyueapi${url}` : `http://api.indie.cn:9012/${url}`; const inital: RequestOptions = { method: method, body: null, headers: { 'Content-Type': 'application/x-www-form-urlencoded', - Authorization: - 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIxNzcyNjUzODM0MjYzNDY1OTg0Iiwic3ViIjoi6ZuA5LmQLWU5MnFQSHU2cSIsImlhdCI6MTcxMTU0MDgzOCwiYXZhdGFyIjoidXNlci9hdmF0YXIvZGVmYXVsdF8yMDI0MDIyN18yMzI5NDkuanBnIiwicm9sZXMiOiJ1c2VyIiwiZXhwIjoxNzEyMTQ1NjM4fQ.LqXi6ogm1jxK78-elx9vqNDQKXqzwQEoRRLpLj-PoGo', + Authorization: '', + // 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIxNzcyNjUzODM0MjYzNDY1OTg0Iiwic3ViIjoi6ZuA5LmQLWU5MnFQSHU2cSIsImlhdCI6MTcxMTU0MDgzOCwiYXZhdGFyIjoidXNlci9hdmF0YXIvZGVmYXVsdF8yMDI0MDIyN18yMzI5NDkuanBnIiwicm9sZXMiOiJ1c2VyIiwiZXhwIjoxNzEyMTQ1NjM4fQ.LqXi6ogm1jxK78-elx9vqNDQKXqzwQEoRRLpLj-PoGo', }, credentials: 'include', cache: 'no-cache', diff --git a/tsconfig.json b/tsconfig.json index 7b28589..7ca4c1c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,6 +21,6 @@ "@/*": ["./src/*"] } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "dist/types/**/*.ts"], "exclude": ["node_modules"] } diff --git a/uno.config.ts b/uno.config.ts index 6c2fbfa..639e8c5 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -26,7 +26,7 @@ export default defineConfig({ 'switch-label-base': 'bg-gray-200 dark:bg-gray-800 switch-animation', 'switch-span-base': 'bg-white dark:bg-gray-300 switch-animation', 'text-theme': 'text-[#B44343]', - 'text-overflow': 'overflow-hidden whitespace-nowrap overflow-ellipsis truncate', + 'text-overflow': 'overflow-hidden whitespace-nowrap truncate', 'border-theme': 'border-[#B44343]', 'bg-theme': 'bg-[#B44343]', },