IPBox把IP加入黑名单可以选择过期时间/可以从已经添加的名单中删除/已经添加的名单中显示过期时间

This commit is contained in:
GoEdgeLab
2021-12-02 17:11:44 +08:00
parent 54eda21f7d
commit 889417beda
7 changed files with 145 additions and 18 deletions

View File

@@ -2,7 +2,11 @@ Tea.context(function () {
this.blackListsVisible = false
this.allPublicBlackIPLists = this.publicBlackIPLists.$copy()
this.defaultItemExpiredAt = Math.floor(new Date().getTime() / 1000) + 86400
this.showBlackLists = function () {
this.defaultItemExpiredAt = Math.floor(new Date().getTime() / 1000) + 86400
let that = this
this.publicBlackIPLists = this.allPublicBlackIPLists.filter(function (allList) {
let found = true
@@ -16,17 +20,33 @@ Tea.context(function () {
this.blackListsVisible = !this.blackListsVisible
}
this.selectedListId = 0
this.addBlackIP = function (list) {
this.selectedListId = list.id
let expiredAt = this.$refs.itemExpiredTimestamp.resultTimestamp()
let that = this
teaweb.confirm("确定要将此IP添加到黑名单吗?", function () {
teaweb.confirm("确定要将此IP添加到黑名单'" + list.name + "'吗?", function () {
that.$post(".addIP")
.params({
listId: list.id,
ip: that.ip
ip: that.ip,
expiredAt: expiredAt
})
.success(function () {
that.ipLists.push(list)
that.blackListsVisible = false
teaweb.reload()
})
})
}
this.deleteFromList = function (listId, itemId) {
teaweb.confirm("确定要从此名单中删除此IP吗", function () {
this.$post(".deleteFromList")
.params({
listId: listId,
itemId: itemId
})
.success(function () {
teaweb.reload()
})
})
}