mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
feat: webui login limit
This commit is contained in:
parent
fa4a403f38
commit
9471e63857
17
src/webui/src/helper/Data.ts
Normal file
17
src/webui/src/helper/Data.ts
Normal file
@ -0,0 +1,17 @@
|
||||
let LoginRuntime = {
|
||||
LoginCurrentTime: Date.now(),
|
||||
LoginCurrentRate: 0
|
||||
}
|
||||
export const Data = {
|
||||
checkLoginRate: async function (RateLimit: number): Promise<boolean> {
|
||||
if (Date.now() - LoginRuntime.LoginCurrentTime > 1000 * 60) {
|
||||
LoginRuntime.LoginCurrentRate = 0;//超出时间重置限速
|
||||
return true;
|
||||
}
|
||||
if (LoginRuntime.LoginCurrentRate <= RateLimit) {
|
||||
LoginRuntime.LoginCurrentRate++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<title>WebUi - Index</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user