@@ -26,24 +26,24 @@ func init() {
2626 mime .AddExtensionType (".json" , "application/json" )
2727}
2828
29- type HandlerOpts struct {
29+ type handlerOpts struct {
3030 AssetsFS fs.FS
3131 StaticFS fs.FS
3232 ManifestFile * FileHandlerOption
3333}
3434
35- type HTTPHandlers struct {
36- Client * Client
35+ type httpHandlers struct {
36+ Client * clientImpl
3737 renderLock sync.Mutex
3838}
3939
40- func NewHTTPHandlers (client * Client ) * HTTPHandlers {
41- return & HTTPHandlers {
40+ func newHTTPHandlers (client * clientImpl ) * httpHandlers {
41+ return & httpHandlers {
4242 Client : client ,
4343 }
4444}
4545
46- func (h * HTTPHandlers ) RegisterHandlers (mux * http.ServeMux , opts HandlerOpts ) {
46+ func (h * httpHandlers ) registerHandlers (mux * http.ServeMux , opts handlerOpts ) {
4747 mux .HandleFunc ("/api/render" , h .handleRender )
4848 mux .HandleFunc ("/api/updates" , h .handleSSE )
4949 mux .HandleFunc ("/api/data" , h .handleData )
@@ -62,7 +62,7 @@ func (h *HTTPHandlers) RegisterHandlers(mux *http.ServeMux, opts HandlerOpts) {
6262 }
6363}
6464
65- func (h * HTTPHandlers ) handleRender (w http.ResponseWriter , r * http.Request ) {
65+ func (h * httpHandlers ) handleRender (w http.ResponseWriter , r * http.Request ) {
6666 defer func () {
6767 panicErr := util .PanicHandler ("handleRender" , recover ())
6868 if panicErr != nil {
@@ -112,7 +112,7 @@ func (h *HTTPHandlers) handleRender(w http.ResponseWriter, r *http.Request) {
112112 }
113113}
114114
115- func (h * HTTPHandlers ) processFrontendUpdate (feUpdate * rpctypes.VDomFrontendUpdate ) (* rpctypes.VDomBackendUpdate , error ) {
115+ func (h * httpHandlers ) processFrontendUpdate (feUpdate * rpctypes.VDomFrontendUpdate ) (* rpctypes.VDomBackendUpdate , error ) {
116116 h .renderLock .Lock ()
117117 defer h .renderLock .Unlock ()
118118
@@ -136,7 +136,7 @@ func (h *HTTPHandlers) processFrontendUpdate(feUpdate *rpctypes.VDomFrontendUpda
136136 for _ , event := range feUpdate .Events {
137137 if event .GlobalEventType != "" {
138138 if h .Client .GlobalEventHandler != nil {
139- h .Client .GlobalEventHandler (h . Client , event )
139+ h .Client .GlobalEventHandler (event )
140140 }
141141 } else {
142142 h .Client .Root .Event (event .WaveId , event .EventType , event )
@@ -164,7 +164,7 @@ func (h *HTTPHandlers) processFrontendUpdate(feUpdate *rpctypes.VDomFrontendUpda
164164 return update , nil
165165}
166166
167- func (h * HTTPHandlers ) handleData (w http.ResponseWriter , r * http.Request ) {
167+ func (h * httpHandlers ) handleData (w http.ResponseWriter , r * http.Request ) {
168168 defer func () {
169169 panicErr := util .PanicHandler ("handleData" , recover ())
170170 if panicErr != nil {
@@ -186,7 +186,7 @@ func (h *HTTPHandlers) handleData(w http.ResponseWriter, r *http.Request) {
186186 }
187187}
188188
189- func (h * HTTPHandlers ) handleConfig (w http.ResponseWriter , r * http.Request ) {
189+ func (h * httpHandlers ) handleConfig (w http.ResponseWriter , r * http.Request ) {
190190 defer func () {
191191 panicErr := util .PanicHandler ("handleConfig" , recover ())
192192 if panicErr != nil {
@@ -204,7 +204,7 @@ func (h *HTTPHandlers) handleConfig(w http.ResponseWriter, r *http.Request) {
204204 }
205205}
206206
207- func (h * HTTPHandlers ) handleConfigGet (w http.ResponseWriter , _ * http.Request ) {
207+ func (h * httpHandlers ) handleConfigGet (w http.ResponseWriter , _ * http.Request ) {
208208 result := h .Client .Root .GetConfigMap ()
209209
210210 w .Header ().Set ("Content-Type" , "application/json" )
@@ -214,7 +214,7 @@ func (h *HTTPHandlers) handleConfigGet(w http.ResponseWriter, _ *http.Request) {
214214 }
215215}
216216
217- func (h * HTTPHandlers ) handleConfigPost (w http.ResponseWriter , r * http.Request ) {
217+ func (h * httpHandlers ) handleConfigPost (w http.ResponseWriter , r * http.Request ) {
218218 body , err := io .ReadAll (r .Body )
219219 if err != nil {
220220 http .Error (w , fmt .Sprintf ("failed to read request body: %v" , err ), http .StatusBadRequest )
@@ -235,7 +235,7 @@ func (h *HTTPHandlers) handleConfigPost(w http.ResponseWriter, r *http.Request)
235235 w .WriteHeader (http .StatusOK )
236236}
237237
238- func (h * HTTPHandlers ) handleDynContent (w http.ResponseWriter , r * http.Request ) {
238+ func (h * httpHandlers ) handleDynContent (w http.ResponseWriter , r * http.Request ) {
239239 defer func () {
240240 panicErr := util .PanicHandler ("handleDynContent" , recover ())
241241 if panicErr != nil {
@@ -252,7 +252,7 @@ func (h *HTTPHandlers) handleDynContent(w http.ResponseWriter, r *http.Request)
252252 h .Client .UrlHandlerMux .ServeHTTP (w , r )
253253}
254254
255- func (h * HTTPHandlers ) handleSSE (w http.ResponseWriter , r * http.Request ) {
255+ func (h * httpHandlers ) handleSSE (w http.ResponseWriter , r * http.Request ) {
256256 defer func () {
257257 panicErr := util .PanicHandler ("handleSSE" , recover ())
258258 if panicErr != nil {
@@ -342,7 +342,7 @@ func serveFileDirectly(w http.ResponseWriter, r *http.Request, embeddedFS fs.FS,
342342 return true
343343}
344344
345- func (h * HTTPHandlers ) handleStaticFiles (embeddedFS fs.FS ) http.HandlerFunc {
345+ func (h * httpHandlers ) handleStaticFiles (embeddedFS fs.FS ) http.HandlerFunc {
346346 fileServer := http .FileServer (http .FS (embeddedFS ))
347347
348348 return func (w http.ResponseWriter , r * http.Request ) {
@@ -377,7 +377,7 @@ func (h *HTTPHandlers) handleStaticFiles(embeddedFS fs.FS) http.HandlerFunc {
377377 }
378378}
379379
380- func (h * HTTPHandlers ) handleManifest (manifestFile * FileHandlerOption ) http.HandlerFunc {
380+ func (h * httpHandlers ) handleManifest (manifestFile * FileHandlerOption ) http.HandlerFunc {
381381 return func (w http.ResponseWriter , r * http.Request ) {
382382 defer func () {
383383 panicErr := util .PanicHandler ("handleManifest" , recover ())
@@ -396,11 +396,11 @@ func (h *HTTPHandlers) handleManifest(manifestFile *FileHandlerOption) http.Hand
396396 return
397397 }
398398
399- ServeFileOption (w , r , * manifestFile )
399+ serveFileOption (w , r , * manifestFile )
400400 }
401401}
402402
403- func (h * HTTPHandlers ) handleStaticPathFiles (staticFS fs.FS ) http.HandlerFunc {
403+ func (h * httpHandlers ) handleStaticPathFiles (staticFS fs.FS ) http.HandlerFunc {
404404 return func (w http.ResponseWriter , r * http.Request ) {
405405 defer func () {
406406 panicErr := util .PanicHandler ("handleStaticPathFiles" , recover ())
0 commit comments