MCPcopy Index your code
hub / github.com/1Panel-dev/KubePi / setUpStaticFile

Method setUpStaticFile

internal/server/server.go:139–167  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

137}
138
139func (e *KubePiServer) setUpStaticFile() {
140 spaOption := iris.DirOptions{SPA: true, IndexName: "index.html"}
141 party := e.rootRoute.Party("/")
142 party.Use(iris.Compression)
143
144 dashboardSubFS, err := fs.Sub(EmbedWebDashboard, "web/dashboard")
145 if err != nil {
146 panic(err)
147 }
148 dashboardFS := http.FS(dashboardSubFS)
149 party.RegisterView(view.HTML(dashboardFS, ".html"))
150 party.HandleDir("/dashboard/", dashboardFS, spaOption)
151
152 terminalSubFS, err := fs.Sub(EmbedWebTerminal, "web/terminal")
153 if err != nil {
154 panic(err)
155 }
156 terminalFS := http.FS(terminalSubFS)
157 party.RegisterView(view.HTML(terminalFS, ".html"))
158 party.HandleDir("/terminal/", terminalFS, spaOption)
159
160 kubePiSubFS, err := fs.Sub(EmbedWebKubePi, "web/kubepi")
161 if err != nil {
162 panic(err)
163 }
164 kubePiFS := http.FS(kubePiSubFS)
165 party.RegisterView(view.HTML(kubePiFS, ".html"))
166 party.HandleDir("/", kubePiFS, spaOption)
167}
168
169func (e *KubePiServer) setUpSession() {
170 SessionMgr = sessions.New(sessions.Config{Cookie: SessionCookieName, AllowReclaim: true, Expires: time.Duration(e.config.Spec.Session.Expires) * time.Hour})

Callers 1

bootstrapMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected