Skip to content

Commit b41fa55

Browse files
authored
Merge pull request #23 from youyou-sudo/chore/add-redis-password
feat(redis): add password support and update .env.example
2 parents 5e1a534 + 5ed15a1 commit b41fa55

File tree

10 files changed

+18
-7
lines changed

10 files changed

+18
-7
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ NEXT_PUBLIC_KUN_PATCH_APP_ADDRESS_PROD_PORT = ""
99

1010
REDIS_HOST = '127.0.0.1'
1111
REDIS_PORT = '6379'
12+
REDIS_PASSWORD = ''
1213

1314
JWT_ISS = 'kungalgame'
1415
JWT_AUD = 'kungalgamer'

app/patch/[id]/resource/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export default async function Kun({
7272
<Image
7373
className="pointer-events-none select-none"
7474
src="/a/moyumoe1.avif"
75+
alt=""
7576
/>
7677
</Link>
7778
)}

components/home/Container.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ export const HomeContainer = ({
3333
target="_blank"
3434
className="h-full w-full"
3535
href={kunMoyuMoe.ad[0].url}
36+
rel="noreferrer"
3637
>
3738
<Image
3839
className="pointer-events-none select-none"
3940
src="/a/moyumoe1.avif"
41+
alt=""
4042
/>
4143
</a>
4244
</div>

components/kun/top-bar/KunMobileMenu.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ export const KunMobileMenu = () => {
5050
className="flex items-center gap-2"
5151
target="_blank"
5252
href="https://s.iloveren.link/s/moyumoe1"
53+
rel="noreferrer"
5354
>
5455
<img
5556
src="/a/moyumoe1-button.avif"
5657
className="h-11 dark:opacity-80"
58+
alt=""
5759
/>
5860
<span className="gap-2 flex items-center text-lg text-secondary px-4 py-2 rounded-2xl bg-secondary/15">
5961
尝试一下 AI 女友

components/kun/top-bar/TopBar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,11 @@ export const KunTopBar = () => {
133133

134134
{(!currentUser.uid || currentUser.role < 2) && (
135135
<Tooltip disableAnimation content="为什么现在的 AI 比人还要 H">
136-
<a target="_blank" href={kunMoyuMoe.ad[0].url}>
136+
<a target="_blank" href={kunMoyuMoe.ad[0].url} rel="noreferrer">
137137
<img
138138
className="h-10 dark:opacity-80"
139139
src="/a/moyumoe1-button.avif"
140+
alt=""
140141
/>
141142
</a>
142143
</Tooltip>

components/patch/introduction/section/Overview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export const OverviewSection = ({ detail }: { detail: PatchDetail }) => {
2424

2525
const hasIntro = Boolean(
2626
detail.introduction['zh-cn'] ||
27-
detail.introduction['ja-jp'] ||
28-
detail.introduction['en-us']
27+
detail.introduction['ja-jp'] ||
28+
detail.introduction['en-us']
2929
)
3030

3131
return (

components/resource/detail/ResourceDetail.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ export const KunResourceDetail = ({ detail, payload }: Props) => {
3434
target="_blank"
3535
className="h-full w-full"
3636
href={kunMoyuMoe.ad[0].url}
37+
rel="noreferrer"
3738
>
3839
<Image
3940
className="pointer-events-none select-none"
4041
src="/a/moyumoe1.avif"
42+
alt=""
4143
/>
4244
</a>
4345
</div>
@@ -104,10 +106,11 @@ export const KunResourceDetail = ({ detail, payload }: Props) => {
104106

105107
{(!payload || payload.role < 2) && (
106108
<div className="shadow-xl rounded-2xl block sm:hidden">
107-
<a target="_blank" href={kunMoyuMoe.ad[0].url}>
109+
<a target="_blank" href={kunMoyuMoe.ad[0].url} rel="noreferrer">
108110
<Image
109111
className="pointer-events-none select-none"
110112
src="/a/moyumoe1.avif"
113+
alt=""
111114
/>
112115
</a>
113116
</div>

lib/mdx/element/KunLink.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import Link from 'next/link'
22
import React, { FC } from 'react'
33

4-
interface CustomLinkProps
5-
extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
4+
interface CustomLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
65
href: string
76
}
87

lib/redis.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ const KUN_PATCH_REDIS_PREFIX = 'kun:patch'
44

55
export const redis = new Redis({
66
port: parseInt(process.env.REDIS_PORT!),
7-
host: process.env.REDIS_HOST
7+
host: process.env.REDIS_HOST,
8+
password: process.env.REDIS_PASSWORD?.trim() || undefined
89
})
910

1011
export const setKv = async (key: string, value: string, time?: number) => {

validations/dotenv-check.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const envSchema = z.object({
2424
NEXT_PUBLIC_KUN_PATCH_APP_ADDRESS_PROD_PORT: z.string(),
2525
REDIS_HOST: z.string(),
2626
REDIS_PORT: z.string(),
27+
REDIS_PASSWORD: z.string().optional(),
2728
JWT_ISS: z.string(),
2829
JWT_AUD: z.string(),
2930
JWT_SECRET: z.string(),

0 commit comments

Comments
 (0)