Imported project in git, removed bindata dependency
This commit is contained in:
@ -4,18 +4,18 @@ import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"net/http"
|
||||
"qurl/static"
|
||||
"qurl/storage"
|
||||
"qurl/qurl"
|
||||
"git.binarythought.com/cdramey/qurl/static"
|
||||
"git.binarythought.com/cdramey/qurl/storage"
|
||||
"git.binarythought.com/cdramey/qurl/obj"
|
||||
)
|
||||
|
||||
type RootHandler struct {
|
||||
Storage storage.Storage
|
||||
|
||||
index *static.StaticContent
|
||||
css *static.StaticContent
|
||||
favi *static.StaticContent
|
||||
usage *static.StaticContent
|
||||
index *StaticContent
|
||||
css *StaticContent
|
||||
favi *StaticContent
|
||||
usage *StaticContent
|
||||
submit *template.Template
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ func (ctx *RootHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
ctx.ServeAPI(w, r)
|
||||
|
||||
default:
|
||||
id, err := qurl.FromString(fname[1:len(fname)])
|
||||
id, err := obj.FromString(fname[1:len(fname)])
|
||||
if err != nil {
|
||||
http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
|
||||
return
|
||||
@ -68,40 +68,24 @@ func (ctx *RootHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func (ctx *RootHandler) Init() error {
|
||||
// Initialize the static content object for the index page
|
||||
index := &static.StaticContent{Content: "index.html"}
|
||||
err := index.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ctx.index = index
|
||||
ctx.index = &StaticContent{Type: "text/html", Content: static.Index_html}
|
||||
ctx.index.Init()
|
||||
|
||||
// Initialize the static content object for the css
|
||||
css := &static.StaticContent{Content: "qurl.css"}
|
||||
err = css.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ctx.css = css
|
||||
ctx.css = &StaticContent{Type: "text/css", Content: static.Qurl_css}
|
||||
ctx.css.Init()
|
||||
|
||||
// Initialize the static content object favicon
|
||||
favi := &static.StaticContent{Content: "favicon.ico"}
|
||||
err = favi.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ctx.favi = favi
|
||||
ctx.favi = &StaticContent{Type: "image/x-icon", Content: static.Favicon_ico}
|
||||
ctx.favi.Init()
|
||||
|
||||
// Initialize the api usage instructions
|
||||
usage := &static.StaticContent{Content: "usage.html"}
|
||||
err = usage.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ctx.usage = usage
|
||||
ctx.usage = &StaticContent{Type: "text/html", Content: static.Usage_html}
|
||||
ctx.usage.Init()
|
||||
|
||||
// Initialize submit page template
|
||||
ctx.submit = template.New("submit.html")
|
||||
_, err = ctx.submit.Parse(string(static.Assets["submit.html"]))
|
||||
_, err := ctx.submit.Parse(string(static.Submit_html))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user