parent
5fedcd6c57
commit
d11db2f3af
19
main.go
19
main.go
|
@ -5,11 +5,11 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"html/template"
|
"html/template"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"mime"
|
||||||
"net/http"
|
"net/http"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
"mime"
|
|
||||||
|
|
||||||
"github.com/b3log/wide/conf"
|
"github.com/b3log/wide/conf"
|
||||||
"github.com/b3log/wide/editor"
|
"github.com/b3log/wide/editor"
|
||||||
|
@ -274,14 +274,10 @@ func aboutHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
// 主程序入口.
|
// 主程序入口.
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
//解决Windows环境下问题
|
|
||||||
mime.AddExtensionType(".css", "text/css")
|
|
||||||
mime.AddExtensionType(".js", "application/x-javascript")
|
|
||||||
mime.AddExtensionType(".json", "application/json")
|
|
||||||
|
|
||||||
runtime.GOMAXPROCS(conf.Wide.MaxProcs)
|
runtime.GOMAXPROCS(conf.Wide.MaxProcs)
|
||||||
|
|
||||||
|
initMime()
|
||||||
|
|
||||||
defer glog.Flush()
|
defer glog.Flush()
|
||||||
|
|
||||||
// IDE
|
// IDE
|
||||||
|
@ -387,3 +383,12 @@ func panicRecover(handler func(w http.ResponseWriter, r *http.Request)) func(w h
|
||||||
handler(w, r)
|
handler(w, r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 初始化 mime.
|
||||||
|
//
|
||||||
|
// 有的操作系统(例如 Windows XP)上运行时根据文件后缀获取不到对应的 mime 类型,会导致响应的 HTTP content-type 不正确。
|
||||||
|
func initMime() {
|
||||||
|
mime.AddExtensionType(".css", "text/css")
|
||||||
|
mime.AddExtensionType(".js", "application/x-javascript")
|
||||||
|
mime.AddExtensionType(".json", "application/json")
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
go install
|
go install
|
||||||
|
|
||||||
wide
|
wide
|
||||||
|
|
||||||
pause
|
pause
|
Loading…
Reference in New Issue