2021-08-15 15:42:05 +08:00
|
|
|
|
Tea.context(function () {
|
|
|
|
|
|
this.blackListsVisible = false
|
|
|
|
|
|
this.allPublicBlackIPLists = this.publicBlackIPLists.$copy()
|
|
|
|
|
|
|
2021-12-02 17:11:44 +08:00
|
|
|
|
|
|
|
|
|
|
this.defaultItemExpiredAt = Math.floor(new Date().getTime() / 1000) + 86400
|
2021-08-15 15:42:05 +08:00
|
|
|
|
this.showBlackLists = function () {
|
2021-12-02 17:11:44 +08:00
|
|
|
|
this.defaultItemExpiredAt = Math.floor(new Date().getTime() / 1000) + 86400
|
|
|
|
|
|
|
2021-08-15 15:42:05 +08:00
|
|
|
|
let that = this
|
|
|
|
|
|
this.publicBlackIPLists = this.allPublicBlackIPLists.filter(function (allList) {
|
|
|
|
|
|
let found = true
|
|
|
|
|
|
that.ipLists.forEach(function (list) {
|
|
|
|
|
|
if (allList.id == list.id) {
|
|
|
|
|
|
found = false
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
return found
|
|
|
|
|
|
})
|
|
|
|
|
|
this.blackListsVisible = !this.blackListsVisible
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-12-02 17:11:44 +08:00
|
|
|
|
this.selectedListId = 0
|
2021-08-15 15:42:05 +08:00
|
|
|
|
this.addBlackIP = function (list) {
|
2021-12-02 17:11:44 +08:00
|
|
|
|
this.selectedListId = list.id
|
|
|
|
|
|
let expiredAt = this.$refs.itemExpiredTimestamp.resultTimestamp()
|
2021-08-15 15:44:24 +08:00
|
|
|
|
let that = this
|
2021-12-02 17:11:44 +08:00
|
|
|
|
teaweb.confirm("确定要将此IP添加到黑名单'" + list.name + "'吗?", function () {
|
2021-08-15 15:44:24 +08:00
|
|
|
|
that.$post(".addIP")
|
|
|
|
|
|
.params({
|
|
|
|
|
|
listId: list.id,
|
2021-12-02 17:11:44 +08:00
|
|
|
|
ip: that.ip,
|
|
|
|
|
|
expiredAt: expiredAt
|
|
|
|
|
|
})
|
|
|
|
|
|
.success(function () {
|
|
|
|
|
|
teaweb.reload()
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.deleteFromList = function (listId, itemId) {
|
|
|
|
|
|
teaweb.confirm("确定要从此名单中删除此IP吗?", function () {
|
|
|
|
|
|
this.$post(".deleteFromList")
|
|
|
|
|
|
.params({
|
|
|
|
|
|
listId: listId,
|
|
|
|
|
|
itemId: itemId
|
2021-08-15 15:44:24 +08:00
|
|
|
|
})
|
|
|
|
|
|
.success(function () {
|
2021-12-02 17:11:44 +08:00
|
|
|
|
teaweb.reload()
|
2021-08-15 15:44:24 +08:00
|
|
|
|
})
|
|
|
|
|
|
})
|
2021-08-15 15:42:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|