Skip to content

Commit

Permalink
Remove the legacy UI
Browse files Browse the repository at this point in the history
  • Loading branch information
IngmarStein committed Feb 26, 2025
1 parent 9b7b9b1 commit de72911
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 143 deletions.
36 changes: 0 additions & 36 deletions server/browser/browser.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ type Browser struct {
watch bool
fo *fanout.Fanout
r *http.ServeMux
tmpl *template.Template
loader *loader.Loader
serveGif bool // True if serving GIF, false if serving WebP
}
Expand All @@ -40,9 +39,6 @@ var previewMask []byte
//go:embed favicon.png
var favicon []byte

//go:embed preview.html
var previewHTML string

// previewData is used to populate the HTML template.
type previewData struct {
Title string `json:"title"`
Expand All @@ -58,11 +54,6 @@ type handlerRequest struct {

// NewBrowser sets up a browser structure. Call Run() to kick off the main loops.
func NewBrowser(addr string, servePath string, title string, watch bool, updateChan chan loader.Update, l *loader.Loader, serveGif bool) (*Browser, error) {
tmpl, err := template.New("preview").Parse(previewHTML)
if err != nil {
return nil, err
}

if !strings.HasPrefix(servePath, "/") {
servePath = "/" + servePath
}
Expand All @@ -75,7 +66,6 @@ func NewBrowser(addr string, servePath string, title string, watch bool, updateC
addr: addr,
path: servePath,
fo: fanout.NewFanout(),
tmpl: tmpl,
title: title,
loader: l,
watch: watch,
Expand All @@ -93,10 +83,6 @@ func NewBrowser(addr string, servePath string, title string, watch bool, updateC
// at /static.
r.Handle(fmt.Sprintf("GET %sstatic/", servePath), http.StripPrefix(servePath, http.FileServer(http.FS(dist.Static))))

// In case we broke something or someone prefers the legacy editor, it is
// still available for now. This will be removed in the future once we
// have confirmed the new editor is stable.
r.HandleFunc(servePath+"legacy", b.oldRootHandler)
r.HandleFunc(servePath+"ws", b.websocketHandler)
r.HandleFunc(fmt.Sprintf("GET %sfavicon.png", servePath), b.faviconHandler)
r.HandleFunc(fmt.Sprintf("GET %spreview-mask.png", servePath), b.previewMaskHandler)
Expand Down Expand Up @@ -311,25 +297,3 @@ func (b *Browser) rootHandler(w http.ResponseWriter, r *http.Request) {
http.Error(w, fmt.Sprintf("error executing template: %v", err), http.StatusInternalServerError)
}
}

func (b *Browser) oldRootHandler(w http.ResponseWriter, r *http.Request) {
config := make(map[string]string)
for k, vals := range r.URL.Query() {
config[k] = vals[0]
}

img, err := b.loader.LoadApplet(config)

data := previewData{
Title: b.title,
Watch: b.watch,
Image: img,
}

if err != nil {
data.Err = err.Error()
}

w.Header().Set("Content-Type", "text/html")
b.tmpl.Execute(w, data)
}
107 changes: 0 additions & 107 deletions server/browser/preview.html

This file was deleted.

0 comments on commit de72911

Please sign in to comment.