feat: 初始提交 - Code Server Bridge完整实现
- OAuth认证系统(Gitea + Lua扩展) - Git自动化操作(本地/SSH远程) - 实时进度WebSocket推送 - 现代化Tab界面UI - Cobra CLI命令行(init/version/serve) - 完整构建系统(Makefile + Taskfile) - UPX压缩支持(体积减少70%)
This commit is contained in:
25
internal/http/handlers/entry.go
Normal file
25
internal/http/handlers/entry.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"cs-bridge/internal/config"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func Entry(cfg *config.CodeServer) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
workspaceID := uuid.NewString()
|
||||
workspacePath := path.Join(cfg.WorkspaceRoot, workspaceID)
|
||||
|
||||
redirectURL, _ := url.Parse(cfg.BaseURL)
|
||||
|
||||
q := redirectURL.Query()
|
||||
q.Set("folder", workspacePath)
|
||||
redirectURL.RawQuery = q.Encode()
|
||||
|
||||
http.Redirect(w, r, redirectURL.String(), http.StatusFound)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user