1404
This commit is contained in:
1 parent
4d98e5ca1e
commit
4b8018bcc3
3 files changed
+248
-158
No files matched your search
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import { Bot, RefreshCw, Server } from "lucide-react";
|
||||
import { Bot, RefreshCw, Server, StopCircle } from "lucide-react";
|
||||
|
||||
interface BotStatus {
|
||||
bot: { enabled: boolean; polling: boolean };
|
||||
@@ -33,6 +33,13 @@ export default function BotPage() {
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
async function stopHugo() {
|
||||
try {
|
||||
await fetch("/api/hugo", { method: "DELETE" });
|
||||
await fetchStatus();
|
||||
} catch { /* ignore */ }
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
fetchStatus();
|
||||
const timer = setInterval(fetchStatus, 10000);
|
||||
@@ -87,14 +94,24 @@ export default function BotPage() {
|
||||
: "已停止"}
|
||||
</span>
|
||||
</div>
|
||||
<button
|
||||
onClick={restartHugo}
|
||||
disabled={restarting}
|
||||
className="px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium hover:bg-blue-700 disabled:opacity-50 flex items-center gap-2"
|
||||
>
|
||||
<RefreshCw size={14} className={restarting ? "animate-spin" : ""} />
|
||||
{restarting ? "重启中..." : "重启 Hugo"}
|
||||
</button>
|
||||
<div className="flex items-center gap-2">
|
||||
<button
|
||||
onClick={restartHugo}
|
||||
disabled={restarting}
|
||||
className="px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium hover:bg-blue-700 disabled:opacity-50 flex items-center gap-2"
|
||||
>
|
||||
<RefreshCw size={14} className={restarting ? "animate-spin" : ""} />
|
||||
{restarting ? "重启中..." : "重启 Hugo"}
|
||||
</button>
|
||||
<button
|
||||
onClick={stopHugo}
|
||||
disabled={!status?.hugo.running}
|
||||
className="px-4 py-2 rounded-md bg-red-600 text-white text-sm font-medium hover:bg-red-700 disabled:opacity-50 flex items-center gap-2"
|
||||
>
|
||||
<StopCircle size={14} />
|
||||
停止 Hugo
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -238,7 +238,7 @@ export default function WechatPage() {
|
||||
我知道了
|
||||
</button>
|
||||
<a
|
||||
href="https://mp.weixin.qq.com/"
|
||||
href="https://developers.weixin.qq.com/platform"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="rounded-md bg-accent px-4 py-2 text-[13px] font-medium text-white transition-colors hover:bg-accent-hover"
|
||||
@@ -273,7 +273,7 @@ export default function WechatPage() {
|
||||
</div>
|
||||
<div className="mt-6 flex justify-end gap-3">
|
||||
<a
|
||||
href="https://mp.weixin.qq.com/"
|
||||
href="https://developers.weixin.qq.com/platform"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="rounded-md border border-line px-4 py-2 text-[13px] text-muted transition-colors hover:bg-surface hover:text-text"
|
||||
|
||||
Reference in new issue
Block a user