This repository has been archived on 2025-11-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
api/app/random-image/route.ts
2025-03-25 21:47:40 +08:00

22 lines
671 B
TypeScript

import { type NextRequest, NextResponse } from "next/server"
export async function GET(request: NextRequest) {
// List of image URLs
const imageUrls = [
"https://zh.yuazhi.cn/apipng/18CD3BE92227887D576B2D4B7A9C9960.jpg",
"https://zh.yuazhi.cn/apipng/1.jpg",
"https://zh.yuazhi.cn/apipng/2.jpg",
"https://zh.yuazhi.cn/apipng/3.jpg",
"https://zh.yuazhi.cn/apipng/4.jpg",
"https://zh.yuazhi.cn/apipng/5.jpg",
]
// Select a random image URL
const randomIndex = Math.floor(Math.random() * imageUrls.length)
const randomImageUrl = imageUrls[randomIndex]
// Redirect to the random image
return NextResponse.redirect(randomImageUrl)
}