feat: webui login limit
This commit is contained in:
1 parent
ec6131d84a
commit
4daadb9b48
6 files changed
+18
-1
No files matched your search
File renamed without changes.
@@ -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;
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user