test
This commit is contained in:
+1
-10
@@ -13,7 +13,6 @@ COPY . .
|
||||
|
||||
RUN pnpm config set registry https://registry.npmmirror.com
|
||||
|
||||
# COPY package.json pnpm-lock.yaml* .npmrc* ./
|
||||
RUN pnpm i --frozen-lockfile
|
||||
|
||||
FROM base AS builder
|
||||
@@ -23,14 +22,6 @@ RUN apk add --no-cache openssl
|
||||
|
||||
RUN npm install -g pnpm
|
||||
|
||||
# ARG NEXT_PUBLIC_APP_URL="http://localhost:3001"
|
||||
# ARG RESEND_API_KEY="re_your_resend_api_key"
|
||||
# ARG DATABASE_URL="postgres://postgres:postgres@postgres:5432/wrdo"
|
||||
|
||||
# ENV NEXT_PUBLIC_APP_URL=$NEXT_PUBLIC_APP_URL
|
||||
# ENV RESEND_API_KEY=$RESEND_API_KEY
|
||||
# ENV DATABASE_URL=$DATABASE_URL
|
||||
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
@@ -55,9 +46,9 @@ COPY --from=builder /app/prisma ./prisma
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
|
||||
# ENV NODE_OPTIONS="--network-family-autoselection-attempt-timeout=500"
|
||||
EXPOSE 3000
|
||||
|
||||
# ENV HOSTNAME=0.0.0.0
|
||||
ENV PORT=3000
|
||||
|
||||
CMD ["node", "server.js"]
|
||||
+29
-1
@@ -1,9 +1,15 @@
|
||||
import { getIpInfo } from "@/lib/geo";
|
||||
import maxmind, { CityResponse } from "maxmind";
|
||||
|
||||
import { extractRealIP, getIpInfo } from "@/lib/geo";
|
||||
|
||||
export async function GET(req: Request) {
|
||||
try {
|
||||
const data = await getIpInfo(req);
|
||||
|
||||
const i_p = extractRealIP(req.headers);
|
||||
const ge_o = await getGeoFromIP(i_p);
|
||||
console.log("自助ip", i_p, ge_o);
|
||||
|
||||
return Response.json({
|
||||
ip: data.ip,
|
||||
city: data.city,
|
||||
@@ -15,8 +21,30 @@ export async function GET(req: Request) {
|
||||
lang: data.lang,
|
||||
device: data.device,
|
||||
browser: data.browser,
|
||||
i_p,
|
||||
ge_o,
|
||||
});
|
||||
} catch (error) {
|
||||
return Response.json({ statusText: "Server error" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
export async function getGeoFromIP(ip: string) {
|
||||
try {
|
||||
const lookup = await maxmind.open<CityResponse>("./GeoLite2-City.mmdb");
|
||||
|
||||
const result = lookup.get(ip);
|
||||
if (!result) return null;
|
||||
|
||||
return {
|
||||
ip,
|
||||
country: result.country?.names?.en,
|
||||
city: result.city?.names?.en,
|
||||
region: result.subdivisions?.[0]?.names?.en,
|
||||
// timezone: result.location?.time_zone
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("IP地理位置查询失败:", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-4
@@ -54,10 +54,7 @@ export default {
|
||||
from: provider.from || "no-reply@wr.do",
|
||||
to: [email],
|
||||
subject: "Verify your email address",
|
||||
html: getVerificationEmailHtml({
|
||||
url: siteConfig.url,
|
||||
appName: siteConfig.name,
|
||||
}),
|
||||
html: getVerificationEmailHtml({ url, appName: siteConfig.name }),
|
||||
});
|
||||
|
||||
if (error) {
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import { auth } from "auth";
|
||||
import { NextAuthRequest } from "next-auth/lib";
|
||||
|
||||
import { siteConfig } from "./config/site";
|
||||
import { extractRealIP, getGeolocation, getUserAgent } from "./lib/geo";
|
||||
import { getGeolocation, getUserAgent } from "./lib/geo";
|
||||
|
||||
export const config = {
|
||||
matcher: ["/((?!api|_next/static|_next/image|favicon.ico).*)"],
|
||||
|
||||
@@ -86,6 +86,7 @@
|
||||
"lodash-es": "^4.17.21",
|
||||
"lucide-react": "^0.414.0",
|
||||
"lucide-static": "^0.460.0",
|
||||
"maxmind": "^4.3.25",
|
||||
"minimist": "^1.2.8",
|
||||
"ms": "^2.1.3",
|
||||
"next": "14.2.28",
|
||||
|
||||
Generated
+24
@@ -200,6 +200,9 @@ importers:
|
||||
lucide-static:
|
||||
specifier: ^0.460.0
|
||||
version: 0.460.0
|
||||
maxmind:
|
||||
specifier: ^4.3.25
|
||||
version: 4.3.25
|
||||
minimist:
|
||||
specifier: ^1.2.8
|
||||
version: 1.2.8
|
||||
@@ -5673,6 +5676,10 @@ packages:
|
||||
resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
maxmind@4.3.25:
|
||||
resolution: {integrity: sha512-u7L6LrbXZUtpdoovTVHo/l4/EoWUT2eHfCKWDMNNTsW9BaLa7h0jCHjqVx5ZeS5aWorLGZSsZwqxcpoollBw1g==}
|
||||
engines: {node: '>=12', npm: '>=6'}
|
||||
|
||||
md-to-react-email@5.0.2:
|
||||
resolution: {integrity: sha512-x6kkpdzIzUhecda/yahltfEl53mH26QdWu4abUF9+S0Jgam8P//Ciro8cdhyMHnT5MQUJYrIbO6ORM2UxPiNNA==}
|
||||
peerDependencies:
|
||||
@@ -5910,6 +5917,10 @@ packages:
|
||||
resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==}
|
||||
engines: {node: '>=16 || 14 >=14.17'}
|
||||
|
||||
mmdb-lib@2.2.0:
|
||||
resolution: {integrity: sha512-V6DDh3v8tfZFWbeH6fsL5uBIlWL7SvRgGDaAZWFC5kjQ2xP5dl/mLpWwJQ1Ho6ZbEKVp/351QF1JXYTAmeZ/zA==}
|
||||
engines: {node: '>=10', npm: '>=6'}
|
||||
|
||||
motion-dom@12.5.0:
|
||||
resolution: {integrity: sha512-uH2PETDh7m+Hjd1UQQ56yHqwn83SAwNjimNPE/kC+Kds0t4Yh7+29rfo5wezVFpPOv57U4IuWved5d1x0kNhbQ==}
|
||||
|
||||
@@ -7267,6 +7278,10 @@ packages:
|
||||
tiny-invariant@1.3.3:
|
||||
resolution: {integrity: sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==}
|
||||
|
||||
tiny-lru@11.2.11:
|
||||
resolution: {integrity: sha512-27BIW0dIWTYYoWNnqSmoNMKe5WIbkXsc0xaCQHd3/3xT2XMuMJrzHdrO9QBFR14emBz1Bu0dOAs2sCBBrvgPQA==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
tinycolor2@1.6.0:
|
||||
resolution: {integrity: sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==}
|
||||
|
||||
@@ -13862,6 +13877,11 @@ snapshots:
|
||||
|
||||
math-intrinsics@1.1.0: {}
|
||||
|
||||
maxmind@4.3.25:
|
||||
dependencies:
|
||||
mmdb-lib: 2.2.0
|
||||
tiny-lru: 11.2.11
|
||||
|
||||
md-to-react-email@5.0.2(react@18.3.1):
|
||||
dependencies:
|
||||
marked: 7.0.4
|
||||
@@ -14390,6 +14410,8 @@ snapshots:
|
||||
|
||||
minipass@7.0.4: {}
|
||||
|
||||
mmdb-lib@2.2.0: {}
|
||||
|
||||
motion-dom@12.5.0:
|
||||
dependencies:
|
||||
motion-utils: 12.5.0
|
||||
@@ -16000,6 +16022,8 @@ snapshots:
|
||||
|
||||
tiny-invariant@1.3.3: {}
|
||||
|
||||
tiny-lru@11.2.11: {}
|
||||
|
||||
tinycolor2@1.6.0: {}
|
||||
|
||||
tinyqueue@2.0.3: {}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 58 MiB |
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user