maint: comment source code
This commit is contained in:
1
TODO
1
TODO
@@ -1,5 +1,4 @@
|
|||||||
maint: clean up source code
|
maint: clean up source code
|
||||||
maint: comment source code
|
|
||||||
maint: document more
|
maint: document more
|
||||||
feat: improve flags
|
feat: improve flags
|
||||||
feat: replace uuid dep with custom id generator
|
feat: replace uuid dep with custom id generator
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ func main() {
|
|||||||
|
|
||||||
srv := app.New()
|
srv := app.New()
|
||||||
|
|
||||||
|
// TODO(vxc): Make this more portable
|
||||||
errx.Log("Your token is \033[1;92m%s\033[0m", lash.Token)
|
errx.Log("Your token is \033[1;92m%s\033[0m", lash.Token)
|
||||||
|
|
||||||
errx.Log("starting server at http://0.0.0.0:%d", *port)
|
errx.Log("starting server at http://0.0.0.0:%d", *port)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ func New() http.Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
share := handlers.ShareData{
|
share := handlers.ShareData{
|
||||||
Version: lash.Version,
|
Version: lash.Version,
|
||||||
}
|
}
|
||||||
|
|
||||||
file := handlers.FileData{
|
file := handlers.FileData{
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ func (h FileData) APIHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send the file over as a stream of bytes
|
||||||
w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%s", h.FileName))
|
w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%s", h.FileName))
|
||||||
w.Header().Set("Content-Type", "application/octet-stream")
|
w.Header().Set("Content-Type", "application/octet-stream")
|
||||||
w.Header().Set("Content-Length", strconv.Itoa(len(h.Contents)))
|
w.Header().Set("Content-Length", strconv.Itoa(len(h.Contents)))
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ type ShareData struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *ShareData) Handler(w http.ResponseWriter, r *http.Request) {
|
func (h *ShareData) Handler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
// Although `Must` can fail since `Templates` is embeded these files will always exist.
|
||||||
tmpl := template.Must(template.ParseFS(lash.Templates, "templates/share.html"))
|
tmpl := template.Must(template.ParseFS(lash.Templates, "templates/share.html"))
|
||||||
|
|
||||||
if err := tmpl.ExecuteTemplate(w, "share.html", h); err != nil {
|
if err := tmpl.ExecuteTemplate(w, "share.html", h); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user