mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-11-07 15:19:44 +00:00
wip
This commit is contained in:
parent
1da6a39900
commit
3463de85ee
@ -25,6 +25,8 @@ func InitRouter() *gin.Engine {
|
|||||||
r.Use(middleware.WriteLog())
|
r.Use(middleware.WriteLog())
|
||||||
r.Use(gzip.Gzip(gzip.DefaultCompression))
|
r.Use(gzip.Gzip(gzip.DefaultCompression))
|
||||||
gin.SetMode(config.ServerInfo.RunMode)
|
gin.SetMode(config.ServerInfo.RunMode)
|
||||||
|
|
||||||
|
// @tiger - 为了方便未来的模块化迭代,前端输出需要独立端口,不要和 API 端口公用。
|
||||||
r.StaticFS("/ui", http.FS(web.Static))
|
r.StaticFS("/ui", http.FS(web.Static))
|
||||||
r.GET("/", WebUIHome)
|
r.GET("/", WebUIHome)
|
||||||
// r.StaticFS("/assets", http.Dir("./static/assets"))
|
// r.StaticFS("/assets", http.Dir("./static/assets"))
|
||||||
|
|||||||
@ -31,8 +31,17 @@ import (
|
|||||||
func PostUserRegister(c *gin.Context) {
|
func PostUserRegister(c *gin.Context) {
|
||||||
json := make(map[string]string)
|
json := make(map[string]string)
|
||||||
c.BindJSON(&json)
|
c.BindJSON(&json)
|
||||||
|
|
||||||
|
// @tiger - user_name 改成 username
|
||||||
username := json["user_name"]
|
username := json["user_name"]
|
||||||
pwd := json["password"]
|
pwd := json["password"]
|
||||||
|
|
||||||
|
// @tiger - 尽量统一用 JSON 本体来传参。用 query string 来传参的话,
|
||||||
|
// 1 - 有可能会被路由记录,形成不必要的泄露
|
||||||
|
// 2 - 开发者不需要处理两种入参方式
|
||||||
|
//
|
||||||
|
// query string 更加适合运维层面的需求,比如跟踪码,回调地址等
|
||||||
|
|
||||||
key := c.Param("key")
|
key := c.Param("key")
|
||||||
if _, ok := service.UserRegisterHash[key]; !ok {
|
if _, ok := service.UserRegisterHash[key]; !ok {
|
||||||
c.JSON(http.StatusOK,
|
c.JSON(http.StatusOK,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user