From 599343039796f4524d4c976c2e6c1923c4ec05f4 Mon Sep 17 00:00:00 2001 From: pengtao Date: Tue, 29 Sep 2020 10:21:25 +0800 Subject: [PATCH] fix --- .idea/vcs.xml | 6 ++++++ conf/app.conf | 19 ++++++++++++++++++- controllers/default.go | 4 ++-- download1/1.txt | 2 ++ main.go | 1 + static/js/reload.min.js | 23 ++++++++++++++++++++++- 6 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 .idea/vcs.xml create mode 100644 download1/1.txt diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/conf/app.conf b/conf/app.conf index ecd174b..a41c95d 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -1,3 +1,20 @@ appname = go_ops -httpport = 8080 runmode = dev +RecoverPanic=true +RouterCaseSensitive = true +MaxMemory = 1 << 26 + +WebConfig.AutoRender = true +WebConfig.DirectoryIndex = false +WebConfig.EnableXSRF = false + + +[dev] +EnableErrorsShow = true +httpport = 8080 +[prod] +EnableErrorsShow = false +httpport = 8088 +[test] +httpport = 8888 +EnableErrorsShow = true \ No newline at end of file diff --git a/controllers/default.go b/controllers/default.go index 9a9e6f2..caed170 100644 --- a/controllers/default.go +++ b/controllers/default.go @@ -9,7 +9,7 @@ type MainController struct { } func (c *MainController) Get() { - c.Data["Website"] = "beego.me" - c.Data["Email"] = "astaxie@gmail.com" + c.Data["Website"] = "kingsome.me" + c.Data["Email"] = "pengtao@kingsome.com" c.TplName = "index.tpl" } diff --git a/download1/1.txt b/download1/1.txt new file mode 100644 index 0000000..a5a8f69 --- /dev/null +++ b/download1/1.txt @@ -0,0 +1,2 @@ +1 a +2 b \ No newline at end of file diff --git a/main.go b/main.go index 0c3133e..f5323e5 100644 --- a/main.go +++ b/main.go @@ -6,5 +6,6 @@ import ( ) func main() { + beego.SetStaticPath("/down1", "download1") beego.Run() } diff --git a/static/js/reload.min.js b/static/js/reload.min.js index e780033..e2d5425 100644 --- a/static/js/reload.min.js +++ b/static/js/reload.min.js @@ -1 +1,22 @@ -function b(a){var c=new WebSocket(a);c.onclose=function(){setTimeout(function(){b(a)},2E3)};c.onmessage=function(){location.reload()}}try{if(window.WebSocket)try{b("ws://localhost:12450/reload")}catch(a){console.error(a)}else console.log("Your browser does not support WebSockets.")}catch(a){console.error("Exception during connecting to Reload:",a)}; +function b(a) { + var c = new WebSocket(a); + c.onclose = function () { + setTimeout(function () { + b(a) + }, 2E3) + }; + c.onmessage = function () { + location.reload() + } +} + +try { + if (window.WebSocket) try { + b("ws://localhost:12450/reload") + } catch (a) { + console.error(a) + } else console.log("Your browser does not support WebSockets.") +} catch (a) { + console.error("Exception during connecting to Reload:", a) +} +;