webGenerated.go 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Package webGenerated -- Generated by folder2go
  2. package webGenerated
  3. import (
  4. "mime"
  5. "net/http"
  6. "path/filepath"
  7. "strings"
  8. )
  9. //Data exported data taken from folder web
  10. var Data = map[string][]byte {
  11. "index.html": []byte("\x3C\x68\x74\x6D\x6C\x3E\x0A\x09\x3C\x68\x65\x61\x64\x3E\x0A\x09\x09\x3C\x73\x63\x72\x69\x70\x74\x20\x73\x72\x63\x3D\x27\x77\x73\x72\x70\x63\x2F\x63\x6C\x69\x2E\x6A\x73\x27\x3E\x3C\x2F\x73\x63\x72\x69\x70\x74\x3E\x09\x0A\x09\x09\x3C\x73\x63\x72\x69\x70\x74\x20\x73\x72\x63\x3D\x27\x6A\x73\x2F\x6D\x61\x69\x6E\x2E\x6A\x73\x27\x3E\x3C\x2F\x73\x63\x72\x69\x70\x74\x3E\x09\x0A\x09\x3C\x2F\x68\x65\x61\x64\x3E\x0A\x09\x3C\x62\x6F\x64\x79\x3E\x0A\x09\x09\x3C\x62\x75\x74\x74\x6F\x6E\x20\x69\x64\x3D\x22\x62\x74\x6E\x31\x22\x3E\x54\x68\x65\x20\x62\x75\x74\x74\x6F\x6E\x3C\x2F\x62\x75\x74\x74\x6F\x6E\x3E\x09\x0A\x09\x3C\x2F\x62\x6F\x64\x79\x3E\x0A\x3C\x2F\x68\x74\x6D\x6C\x3E\x0A"),
  12. "js/main.js": []byte("\x0A\x2F\x2F\x20\x53\x69\x6D\x70\x6C\x65\x20\x66\x75\x6E\x63\x20\x74\x6F\x20\x61\x74\x74\x61\x63\x68\x20\x74\x6F\x20\x65\x6C\x65\x6D\x65\x6E\x74\x0A\x2F\x2A\x0A\x20\x2A\x20\x4C\x69\x76\x65\x55\x49\x28\x27\x23\x6D\x61\x69\x6E\x27\x2C\x27\x77\x73\x3A\x2F\x2F\x68\x6F\x73\x74\x2F\x77\x73\x27\x29\x3B\x0A\x20\x2A\x2F\x0A\x0A\x2F\x2F\x20\x68\x74\x74\x70\x3A\x2F\x2F\x73\x74\x61\x63\x6B\x6F\x76\x65\x72\x66\x6C\x6F\x77\x2E\x63\x6F\x6D\x2F\x71\x75\x65\x73\x74\x69\x6F\x6E\x73\x2F\x31\x30\x35\x30\x33\x34\x2F\x63\x72\x65\x61\x74\x65\x2D\x67\x75\x69\x64\x2D\x75\x75\x69\x64\x2D\x69\x6E\x2D\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x0A\x0A\x77\x69\x6E\x64\x6F\x77\x2E\x6F\x6E\x6C\x6F\x61\x64\x20\x3D\x20\x66\x75\x6E\x63\x74\x69\x6F\x6E\x20\x28\x29\x20\x7B\x0A\x20\x20\x76\x61\x72\x20\x77\x73\x72\x70\x63\x20\x3D\x20\x6E\x65\x77\x20\x57\x73\x52\x70\x63\x28\x29\x0A\x20\x20\x77\x73\x72\x70\x63\x2E\x63\x6F\x6E\x6E\x65\x63\x74\x28\x27\x77\x73\x3A\x2F\x2F\x27\x20\x2B\x20\x77\x69\x6E\x64\x6F\x77\x2E\x6C\x6F\x63\x61\x74\x69\x6F\x6E\x2E\x68\x6F\x73\x74\x20\x2B\x20\x27\x2F\x77\x73\x72\x70\x63\x2F\x77\x73\x27\x29\x0A\x0A\x20\x20\x63\x6F\x6E\x73\x6F\x6C\x65\x2E\x6C\x6F\x67\x28\x27\x54\x72\x79\x69\x6E\x67\x20\x74\x6F\x20\x63\x6F\x6E\x6E\x65\x63\x74\x27\x29\x0A\x0A\x20\x20\x76\x61\x72\x20\x6F\x62\x6A\x20\x3D\x20\x7B\x0A\x20\x20\x20\x20\x48\x65\x6C\x6C\x6F\x3A\x20\x66\x75\x6E\x63\x74\x69\x6F\x6E\x20\x28\x72\x65\x73\x70\x6F\x6E\x73\x65\x2C\x20\x70\x61\x72\x61\x6D\x29\x20\x7B\x0A\x20\x20\x20\x20\x20\x20\x63\x6F\x6E\x73\x6F\x6C\x65\x2E\x6C\x6F\x67\x28\x27\x48\x65\x6C\x6C\x6F\x20\x77\x6F\x72\x6C\x64\x27\x29\x0A\x20\x20\x20\x20\x20\x20\x72\x65\x73\x70\x6F\x6E\x73\x65\x28\x7B\x6F\x6B\x3A\x20\x27\x4F\x4B\x27\x7D\x29\x0A\x20\x20\x20\x20\x7D\x0A\x20\x20\x7D\x0A\x0A\x20\x20\x77\x73\x72\x70\x63\x2E\x65\x78\x70\x6F\x72\x74\x28\x6F\x62\x6A\x29\x0A\x0A\x20\x20\x76\x61\x72\x20\x62\x74\x6E\x20\x3D\x20\x64\x6F\x63\x75\x6D\x65\x6E\x74\x2E\x71\x75\x65\x72\x79\x53\x65\x6C\x65\x63\x74\x6F\x72\x28\x27\x23\x62\x74\x6E\x31\x27\x29\x0A\x0A\x20\x20\x62\x74\x6E\x2E\x61\x64\x64\x45\x76\x65\x6E\x74\x4C\x69\x73\x74\x65\x6E\x65\x72\x28\x27\x63\x6C\x69\x63\x6B\x27\x2C\x20\x66\x75\x6E\x63\x74\x69\x6F\x6E\x20\x28\x29\x20\x7B\x0A\x20\x20\x20\x20\x63\x6F\x6E\x73\x6F\x6C\x65\x2E\x6C\x6F\x67\x28\x27\x42\x75\x74\x74\x6F\x6E\x20\x63\x6C\x69\x63\x6B\x65\x64\x27\x29\x0A\x20\x20\x20\x20\x77\x73\x72\x70\x63\x2E\x63\x61\x6C\x6C\x28\x27\x62\x74\x6E\x31\x2E\x63\x6C\x69\x63\x6B\x27\x2C\x20\x7B\x27\x68\x65\x6C\x6C\x6F\x27\x3A\x20\x27\x6F\x6B\x27\x7D\x29\x2E\x74\x68\x65\x6E\x28\x28\x72\x65\x73\x29\x20\x3D\x3E\x20\x7B\x0A\x20\x20\x20\x20\x20\x20\x63\x6F\x6E\x73\x6F\x6C\x65\x2E\x6C\x6F\x67\x28\x27\x61\x6E\x73\x77\x65\x72\x65\x64\x3A\x27\x2C\x20\x72\x65\x73\x29\x0A\x20\x20\x20\x20\x7D\x29\x0A\x20\x20\x7D\x29\x0A\x7D\x0A"),
  13. }
  14. func AssetHandleFunc(w http.ResponseWriter, r *http.Request) {
  15. urlPath := ""
  16. // func that handles mux
  17. server := r.Context().Value(http.ServerContextKey).(*http.Server)
  18. mux, ok := server.Handler.(*http.ServeMux)
  19. if ok {
  20. _, handlerPath := mux.Handler(r)
  21. urlPath = strings.TrimPrefix(r.URL.String(), handlerPath)
  22. }
  23. if urlPath == "" { // Auto index
  24. urlPath = "index.html"
  25. }
  26. data, ok := Data[urlPath]
  27. if !ok {
  28. w.WriteHeader(404)
  29. }
  30. w.Header().Set("Content-type", mime.TypeByExtension(filepath.Ext(urlPath)))
  31. w.Write(data)
  32. }