FlintyLemming 00630209f1 init
2024-12-09 17:29:54 +08:00

144 lines
5.9 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use client'
import { useState } from 'react'
import Image from 'next/image'
import { Button } from "@/components/ui/button"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator"
import { Check, Copy } from 'lucide-react'
export default function KMSActivationGuide() {
const [copiedStates, setCopiedStates] = useState({
quickAction1: false,
quickAction2: false,
setKMS: false,
activate: false,
replaceKey: false,
})
const copyToClipboard = (text: string, key: keyof typeof copiedStates) => {
navigator.clipboard.writeText(text)
setCopiedStates(prev => ({ ...prev, [key]: true }))
setTimeout(() => setCopiedStates(prev => ({ ...prev, [key]: false })), 2000)
}
return (
<div className="min-h-screen bg-background flex flex-col items-center justify-center p-4">
<div className="max-w-2xl w-full space-y-8">
<h1 className="text-4xl font-bold text-center mb-8">KMS </h1>
<Card className="bg-card">
<CardHeader>
<CardTitle></CardTitle>
<CardDescription> PowerShell () </CardDescription>
</CardHeader>
<CardContent className="space-y-4">
<div className="flex items-center space-x-2">
<code className="bg-muted p-2 rounded flex-grow">slmgr /skms kms.flinty.moe</code>
<Button variant="outline" size="icon" onClick={() => copyToClipboard('slmgr /skms kms.flinty.moe', 'quickAction1')}>
{copiedStates.quickAction1 ? <Check className="h-4 w-4" /> : <Copy className="h-4 w-4" />}
</Button>
</div>
<div className="flex items-center space-x-2">
<code className="bg-muted p-2 rounded flex-grow">slmgr /ato</code>
<Button variant="outline" size="icon" onClick={() => copyToClipboard('slmgr /ato', 'quickAction2')}>
{copiedStates.quickAction2 ? <Check className="h-4 w-4" /> : <Copy className="h-4 w-4" />}
</Button>
</div>
</CardContent>
</Card>
<Card className="bg-card">
<CardHeader>
<CardTitle> 1: 打开 PowerShell</CardTitle>
</CardHeader>
<CardContent>
<p> &quot;PowerShell ()&quot; &quot;&quot;</p>
<div className="mt-4">
<Image
src="/images/open-powershell.png"
alt="打开 PowerShell"
width={500}
height={300}
className="rounded-lg"
/>
</div>
</CardContent>
</Card>
<Card className="bg-card">
<CardHeader>
<CardTitle> 2: 设置 KMS </CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<p> PowerShell </p>
<div className="flex items-center space-x-2">
<code className="bg-muted p-2 rounded flex-grow">slmgr /skms kms.flinty.moe</code>
<Button variant="outline" size="icon" onClick={() => copyToClipboard('slmgr /skms kms.flinty.moe', 'setKMS')}>
{copiedStates.setKMS ? <Check className="h-4 w-4" /> : <Copy className="h-4 w-4" />}
</Button>
</div>
<div className="mt-4">
<Image
src="/images/set-kms-address.png"
alt="设置 KMS 地址"
width={500}
height={300}
className="rounded-lg"
/>
</div>
</CardContent>
</Card>
<Card className="bg-card">
<CardHeader>
<CardTitle> 3: 激活 Windows</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<p> Windows</p>
<div className="flex items-center space-x-2">
<code className="bg-muted p-2 rounded flex-grow">slmgr /ato</code>
<Button variant="outline" size="icon" onClick={() => copyToClipboard('slmgr /ato', 'activate')}>
{copiedStates.activate ? <Check className="h-4 w-4" /> : <Copy className="h-4 w-4" />}
</Button>
</div>
<p> VL keyWindows </p>
<div className="mt-4">
<Image
src="/images/activate-windows.png"
alt="激活 Windows"
width={500}
height={300}
className="rounded-lg"
/>
</div>
</CardContent>
</Card>
<Card className="bg-card">
<CardHeader>
<CardTitle></CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<p><a href="https://learn.microsoft.com/zh-cn/windows-server/get-started/kms-client-activation-keys" className="text-blue-500 hover:underline"></a> GVLK使 key</p>
<div className="flex items-center space-x-2">
<code className="bg-muted p-2 rounded flex-grow">slmgr /ipk &lt;product key&gt;</code>
<Button variant="outline" size="icon" onClick={() => copyToClipboard('slmgr /ipk <product key>', 'replaceKey')}>
{copiedStates.replaceKey ? <Check className="h-4 w-4" /> : <Copy className="h-4 w-4" />}
</Button>
</div>
<p> key 2 3</p>
</CardContent>
</Card>
<Separator />
<footer className="text-center text-sm text-muted-foreground">
<p>使 Windows </p>
</footer>
</div>
</div>
)
}