|
@ -15,6 +15,7 @@ type RootHandler struct { |
|
|
index *static.StaticContent |
|
|
index *static.StaticContent |
|
|
css *static.StaticContent |
|
|
css *static.StaticContent |
|
|
favi *static.StaticContent |
|
|
favi *static.StaticContent |
|
|
|
|
|
usage *static.StaticContent |
|
|
submit *template.Template |
|
|
submit *template.Template |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -36,6 +37,9 @@ func (ctx *RootHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
|
|
case "/favicon.ico": |
|
|
case "/favicon.ico": |
|
|
ctx.favi.ServeHTTP(w, r) |
|
|
ctx.favi.ServeHTTP(w, r) |
|
|
|
|
|
|
|
|
|
|
|
case "/api/usage.html": |
|
|
|
|
|
ctx.usage.ServeHTTP(w, r) |
|
|
|
|
|
|
|
|
case "/api/url": |
|
|
case "/api/url": |
|
|
ctx.ServeAPI(w, r) |
|
|
ctx.ServeAPI(w, r) |
|
|
|
|
|
|
|
@ -73,7 +77,7 @@ func (ctx *RootHandler) Init() error { |
|
|
} |
|
|
} |
|
|
ctx.css = css |
|
|
ctx.css = css |
|
|
|
|
|
|
|
|
// Initialize the static content object for the css
|
|
|
|
|
|
|
|
|
// Initialize the static content object favicon
|
|
|
favi := &static.StaticContent{Content: "favicon.ico"} |
|
|
favi := &static.StaticContent{Content: "favicon.ico"} |
|
|
err = favi.Init() |
|
|
err = favi.Init() |
|
|
if err != nil { |
|
|
if err != nil { |
|
@ -81,6 +85,14 @@ func (ctx *RootHandler) Init() error { |
|
|
} |
|
|
} |
|
|
ctx.favi = favi |
|
|
ctx.favi = favi |
|
|
|
|
|
|
|
|
|
|
|
// Initialize the api usage instructions
|
|
|
|
|
|
usage := &static.StaticContent{Content: "usage.html"} |
|
|
|
|
|
err = usage.Init() |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return err |
|
|
|
|
|
} |
|
|
|
|
|
ctx.usage = usage |
|
|
|
|
|
|
|
|
// Initialize submit page template
|
|
|
// Initialize submit page template
|
|
|
ctx.submit = template.New("submit.html") |
|
|
ctx.submit = template.New("submit.html") |
|
|
_, err = ctx.submit.Parse(string(static.Assets["submit.html"])) |
|
|
_, err = ctx.submit.Parse(string(static.Assets["submit.html"])) |
|
|