Skip to content

Commit

Permalink
增加禁用ip记录展示
Browse files Browse the repository at this point in the history
  • Loading branch information
name committed Jan 17, 2022
1 parent 3d9076d commit 60c9903
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 12 deletions.
3 changes: 2 additions & 1 deletion data/DataSource.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ func TableInit() {
new(table.Image),
new(table.Task),
new(table.Config),
new(table.WhiteIp))
new(table.WhiteIp),
new(table.Forbidden))
if err != nil {
log.Println("TableInit.err:", err)
}
Expand Down
16 changes: 16 additions & 0 deletions data/forbidden.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package data

import (
"docker-manager/data/base"
"docker-manager/data/table"
)

func AddForbidden(e table.Forbidden) (err error) {
_, err = base.DBEngine.Table("forbidden").Insert(&e)
return
}

func ForbiddenList() (records []table.Forbidden) {
base.DBEngine.Table("forbidden").SQL("select ip,sum(num) as num,max(create_date) as create_date from forbidden").Find(&records)
return
}
10 changes: 10 additions & 0 deletions data/table/forbidden.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package table

import "time"

type Forbidden struct {
Id int `xorm:"not null pk autoincr INT"`
Ip string `xorm:"comment('ip') VARCHAR(24)"`
Num int `xorm:"default 1 comment('num') INT"`
CreateDate time.Time `xorm:"created default CURRENT_TIMESTAMP TIMESTAMP"`
}
14 changes: 8 additions & 6 deletions service/ForbiddenService.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
package service

import (
"docker-manager/model"
"docker-manager/data"
"docker-manager/data/table"
"log"
)

var Log model.SyncMap

func AddForbiddenLog(reqIp string) {
log.Println("禁止访问,IP:", reqIp)
Log.IncInt(reqIp, 1)
data.AddForbidden(table.Forbidden{
Ip: reqIp,
Num: 1,
})
}

func ForbiddenLogMap() map[string]interface{} {
return Log.ToStrMap()
func ForbiddenLogRecord() []table.Forbidden {
return data.ForbiddenList()
}
2 changes: 1 addition & 1 deletion views/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon href=/favicon.ico><title>Docker Manager</title><link href=/static/css/app.e4881bbb.css rel=preload as=style><link href=/static/css/chunk-elementUI.68c70ad5.css rel=preload as=style><link href=/static/css/chunk-libs.3dfb7769.css rel=preload as=style><link href=/static/js/app.89c04615.js rel=preload as=script><link href=/static/js/chunk-elementUI.a450811c.js rel=preload as=script><link href=/static/js/chunk-libs.6a1e1032.js rel=preload as=script><link href=/static/css/chunk-elementUI.68c70ad5.css rel=stylesheet><link href=/static/css/chunk-libs.3dfb7769.css rel=stylesheet><link href=/static/css/app.e4881bbb.css rel=stylesheet></head><body><noscript><strong>We're sorry but Docker Manager doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script>(function(e){function n(n){for(var t,r,o=n[0],f=n[1],d=n[2],h=0,i=[];h<o.length;h++)r=o[h],Object.prototype.hasOwnProperty.call(u,r)&&u[r]&&i.push(u[r][0]),u[r]=0;for(t in f)Object.prototype.hasOwnProperty.call(f,t)&&(e[t]=f[t]);l&&l(n);while(i.length)i.shift()();return a.push.apply(a,d||[]),c()}function c(){for(var e,n=0;n<a.length;n++){for(var c=a[n],t=!0,r=1;r<c.length;r++){var o=c[r];0!==u[o]&&(t=!1)}t&&(a.splice(n--,1),e=f(f.s=c[0]))}return e}var t={},r={runtime:0},u={runtime:0},a=[];function o(e){return f.p+"static/js/"+({}[e]||e)+"."+{"chunk-04efd970":"6bd51b18","chunk-06ff5938":"1f67e0a8","chunk-0c0c47bd":"572b1050","chunk-093f04d7":"bd17f35a","chunk-20b64ef3":"2583382e","chunk-3465ad58":"2b381238","chunk-350622dd":"e05c3338","chunk-4794904a":"245a2b63","chunk-b415acce":"ae51c3a9","chunk-4e661b5c":"2ba5bae6","chunk-63945102":"40fcf23d","chunk-65f486c0":"c84622e9","chunk-bd5fa1ce":"688421f1","chunk-76cea4de":"7406d44c","chunk-784647d6":"4fa054bc","chunk-8c1e49a2":"c61f5a25","chunk-a7fcc1ea":"44392cd3","chunk-b73ad414":"c1fdd027","chunk-be12e77a":"f02a0979","chunk-d57827a0":"d418b422"}[e]+".js"}function f(n){if(t[n])return t[n].exports;var c=t[n]={i:n,l:!1,exports:{}};return e[n].call(c.exports,c,c.exports,f),c.l=!0,c.exports}f.e=function(e){var n=[],c={"chunk-0c0c47bd":1,"chunk-093f04d7":1,"chunk-20b64ef3":1,"chunk-3465ad58":1,"chunk-350622dd":1,"chunk-b415acce":1,"chunk-65f486c0":1,"chunk-bd5fa1ce":1,"chunk-76cea4de":1,"chunk-be12e77a":1};r[e]?n.push(r[e]):0!==r[e]&&c[e]&&n.push(r[e]=new Promise((function(n,c){for(var t="static/css/"+({}[e]||e)+"."+{"chunk-04efd970":"31d6cfe0","chunk-06ff5938":"31d6cfe0","chunk-0c0c47bd":"49c04802","chunk-093f04d7":"f856b379","chunk-20b64ef3":"d6cb73fb","chunk-3465ad58":"b3fc1146","chunk-350622dd":"1437f69a","chunk-4794904a":"31d6cfe0","chunk-b415acce":"4d6545f9","chunk-4e661b5c":"31d6cfe0","chunk-63945102":"31d6cfe0","chunk-65f486c0":"537be47b","chunk-bd5fa1ce":"6e542416","chunk-76cea4de":"3c7f5ad9","chunk-784647d6":"31d6cfe0","chunk-8c1e49a2":"31d6cfe0","chunk-a7fcc1ea":"31d6cfe0","chunk-b73ad414":"31d6cfe0","chunk-be12e77a":"1ae7f901","chunk-d57827a0":"31d6cfe0"}[e]+".css",u=f.p+t,a=document.getElementsByTagName("link"),o=0;o<a.length;o++){var d=a[o],h=d.getAttribute("data-href")||d.getAttribute("href");if("stylesheet"===d.rel&&(h===t||h===u))return n()}var i=document.getElementsByTagName("style");for(o=0;o<i.length;o++){d=i[o],h=d.getAttribute("data-href");if(h===t||h===u)return n()}var l=document.createElement("link");l.rel="stylesheet",l.type="text/css",l.onload=n,l.onerror=function(n){var t=n&&n.target&&n.target.src||u,a=new Error("Loading CSS chunk "+e+" failed.\n("+t+")");a.code="CSS_CHUNK_LOAD_FAILED",a.request=t,delete r[e],l.parentNode.removeChild(l),c(a)},l.href=u;var s=document.getElementsByTagName("head")[0];s.appendChild(l)})).then((function(){r[e]=0})));var t=u[e];if(0!==t)if(t)n.push(t[2]);else{var a=new Promise((function(n,c){t=u[e]=[n,c]}));n.push(t[2]=a);var d,h=document.createElement("script");h.charset="utf-8",h.timeout=120,f.nc&&h.setAttribute("nonce",f.nc),h.src=o(e);var i=new Error;d=function(n){h.onerror=h.onload=null,clearTimeout(l);var c=u[e];if(0!==c){if(c){var t=n&&("load"===n.type?"missing":n.type),r=n&&n.target&&n.target.src;i.message="Loading chunk "+e+" failed.\n("+t+": "+r+")",i.name="ChunkLoadError",i.type=t,i.request=r,c[1](i)}u[e]=void 0}};var l=setTimeout((function(){d({type:"timeout",target:h})}),12e4);h.onerror=h.onload=d,document.head.appendChild(h)}return Promise.all(n)},f.m=e,f.c=t,f.d=function(e,n,c){f.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:c})},f.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,n){if(1&n&&(e=f(e)),8&n)return e;if(4&n&&"object"===typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(f.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var t in e)f.d(c,t,function(n){return e[n]}.bind(null,t));return c},f.n=function(e){var n=e&&e.__esModule?function(){return e["default"]}:function(){return e};return f.d(n,"a",n),n},f.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},f.p="/",f.oe=function(e){throw console.error(e),e};var d=window["webpackJsonp"]=window["webpackJsonp"]||[],h=d.push.bind(d);d.push=n,d=d.slice();for(var i=0;i<d.length;i++)n(d[i]);var l=h;c()})([]);</script><script src=/static/js/chunk-elementUI.a450811c.js></script><script src=/static/js/chunk-libs.6a1e1032.js></script><script src=/static/js/app.89c04615.js></script></body></html>
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon href=/favicon.ico><title>Docker Manager</title><link href=/static/css/app.e4881bbb.css rel=preload as=style><link href=/static/css/chunk-elementUI.68c70ad5.css rel=preload as=style><link href=/static/css/chunk-libs.3dfb7769.css rel=preload as=style><link href=/static/js/app.6ca90b3c.js rel=preload as=script><link href=/static/js/chunk-elementUI.a450811c.js rel=preload as=script><link href=/static/js/chunk-libs.6a1e1032.js rel=preload as=script><link href=/static/css/chunk-elementUI.68c70ad5.css rel=stylesheet><link href=/static/css/chunk-libs.3dfb7769.css rel=stylesheet><link href=/static/css/app.e4881bbb.css rel=stylesheet></head><body><noscript><strong>We're sorry but Docker Manager doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script>(function(e){function n(n){for(var t,r,o=n[0],f=n[1],d=n[2],h=0,i=[];h<o.length;h++)r=o[h],Object.prototype.hasOwnProperty.call(u,r)&&u[r]&&i.push(u[r][0]),u[r]=0;for(t in f)Object.prototype.hasOwnProperty.call(f,t)&&(e[t]=f[t]);l&&l(n);while(i.length)i.shift()();return a.push.apply(a,d||[]),c()}function c(){for(var e,n=0;n<a.length;n++){for(var c=a[n],t=!0,r=1;r<c.length;r++){var o=c[r];0!==u[o]&&(t=!1)}t&&(a.splice(n--,1),e=f(f.s=c[0]))}return e}var t={},r={runtime:0},u={runtime:0},a=[];function o(e){return f.p+"static/js/"+({}[e]||e)+"."+{"chunk-04efd970":"6bd51b18","chunk-06ff5938":"8ee90bf3","chunk-0c0c47bd":"572b1050","chunk-093f04d7":"bd17f35a","chunk-20b64ef3":"2583382e","chunk-3465ad58":"2b381238","chunk-350622dd":"e05c3338","chunk-4794904a":"245a2b63","chunk-b415acce":"ae51c3a9","chunk-4e661b5c":"2ba5bae6","chunk-51b20511":"499045fc","chunk-63945102":"3d3ba49e","chunk-65f486c0":"c84622e9","chunk-bd5fa1ce":"688421f1","chunk-76cea4de":"7406d44c","chunk-784647d6":"4fa054bc","chunk-8c1e49a2":"c61f5a25","chunk-a7fcc1ea":"44392cd3","chunk-b73ad414":"c1fdd027","chunk-be12e77a":"f02a0979","chunk-d57827a0":"d418b422"}[e]+".js"}function f(n){if(t[n])return t[n].exports;var c=t[n]={i:n,l:!1,exports:{}};return e[n].call(c.exports,c,c.exports,f),c.l=!0,c.exports}f.e=function(e){var n=[],c={"chunk-0c0c47bd":1,"chunk-093f04d7":1,"chunk-20b64ef3":1,"chunk-3465ad58":1,"chunk-350622dd":1,"chunk-b415acce":1,"chunk-65f486c0":1,"chunk-bd5fa1ce":1,"chunk-76cea4de":1,"chunk-be12e77a":1};r[e]?n.push(r[e]):0!==r[e]&&c[e]&&n.push(r[e]=new Promise((function(n,c){for(var t="static/css/"+({}[e]||e)+"."+{"chunk-04efd970":"31d6cfe0","chunk-06ff5938":"31d6cfe0","chunk-0c0c47bd":"49c04802","chunk-093f04d7":"f856b379","chunk-20b64ef3":"d6cb73fb","chunk-3465ad58":"b3fc1146","chunk-350622dd":"1437f69a","chunk-4794904a":"31d6cfe0","chunk-b415acce":"4d6545f9","chunk-4e661b5c":"31d6cfe0","chunk-51b20511":"31d6cfe0","chunk-63945102":"31d6cfe0","chunk-65f486c0":"537be47b","chunk-bd5fa1ce":"6e542416","chunk-76cea4de":"3c7f5ad9","chunk-784647d6":"31d6cfe0","chunk-8c1e49a2":"31d6cfe0","chunk-a7fcc1ea":"31d6cfe0","chunk-b73ad414":"31d6cfe0","chunk-be12e77a":"1ae7f901","chunk-d57827a0":"31d6cfe0"}[e]+".css",u=f.p+t,a=document.getElementsByTagName("link"),o=0;o<a.length;o++){var d=a[o],h=d.getAttribute("data-href")||d.getAttribute("href");if("stylesheet"===d.rel&&(h===t||h===u))return n()}var i=document.getElementsByTagName("style");for(o=0;o<i.length;o++){d=i[o],h=d.getAttribute("data-href");if(h===t||h===u)return n()}var l=document.createElement("link");l.rel="stylesheet",l.type="text/css",l.onload=n,l.onerror=function(n){var t=n&&n.target&&n.target.src||u,a=new Error("Loading CSS chunk "+e+" failed.\n("+t+")");a.code="CSS_CHUNK_LOAD_FAILED",a.request=t,delete r[e],l.parentNode.removeChild(l),c(a)},l.href=u;var s=document.getElementsByTagName("head")[0];s.appendChild(l)})).then((function(){r[e]=0})));var t=u[e];if(0!==t)if(t)n.push(t[2]);else{var a=new Promise((function(n,c){t=u[e]=[n,c]}));n.push(t[2]=a);var d,h=document.createElement("script");h.charset="utf-8",h.timeout=120,f.nc&&h.setAttribute("nonce",f.nc),h.src=o(e);var i=new Error;d=function(n){h.onerror=h.onload=null,clearTimeout(l);var c=u[e];if(0!==c){if(c){var t=n&&("load"===n.type?"missing":n.type),r=n&&n.target&&n.target.src;i.message="Loading chunk "+e+" failed.\n("+t+": "+r+")",i.name="ChunkLoadError",i.type=t,i.request=r,c[1](i)}u[e]=void 0}};var l=setTimeout((function(){d({type:"timeout",target:h})}),12e4);h.onerror=h.onload=d,document.head.appendChild(h)}return Promise.all(n)},f.m=e,f.c=t,f.d=function(e,n,c){f.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:c})},f.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,n){if(1&n&&(e=f(e)),8&n)return e;if(4&n&&"object"===typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(f.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var t in e)f.d(c,t,function(n){return e[n]}.bind(null,t));return c},f.n=function(e){var n=e&&e.__esModule?function(){return e["default"]}:function(){return e};return f.d(n,"a",n),n},f.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},f.p="/",f.oe=function(e){throw console.error(e),e};var d=window["webpackJsonp"]=window["webpackJsonp"]||[],h=d.push.bind(d);d.push=n,d=d.slice();for(var i=0;i<d.length;i++)n(d[i]);var l=h;c()})([]);</script><script src=/static/js/chunk-elementUI.a450811c.js></script><script src=/static/js/chunk-libs.6a1e1032.js></script><script src=/static/js/app.6ca90b3c.js></script></body></html>

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion views/static/js/chunk-06ff5938.1f67e0a8.js

This file was deleted.

1 change: 1 addition & 0 deletions views/static/js/chunk-06ff5938.8ee90bf3.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 60c9903

Please sign in to comment.