mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: security: add mail_domain blacklist
This commit is contained in:
1 parent
b902b54409
commit
869c3131ca
4 files changed
+13
-7
No files matched your search
@@ -6,10 +6,10 @@ const coll = db.collection('blacklist');
|
||||
|
||||
class BlackListModel {
|
||||
@ArgMethod
|
||||
static async add(ip: string) {
|
||||
static async add(id: string) {
|
||||
const expireAt = new Date(new Date().getTime() + 365 * 24 * 60 * 60 * 1000);
|
||||
const res = await coll.findOneAndUpdate(
|
||||
{ _id: ip },
|
||||
{ _id: id },
|
||||
{ $set: { expireAt } },
|
||||
{ upsert: true, returnOriginal: false },
|
||||
);
|
||||
@@ -17,8 +17,8 @@ class BlackListModel {
|
||||
}
|
||||
|
||||
@ArgMethod
|
||||
static async get(ip: string) {
|
||||
return await coll.findOne({ _id: ip });
|
||||
static async get(id: string) {
|
||||
return await coll.findOne({ _id: id });
|
||||
}
|
||||
|
||||
@ArgMethod
|
||||
|
||||
Reference in new issue
Block a user