OLD | NEW |
1 package main | 1 package main |
2 | 2 |
3 import ( | 3 import ( |
4 "bytes" | 4 "bytes" |
5 "crypto/md5" | 5 "crypto/md5" |
6 "database/sql" | 6 "database/sql" |
7 "encoding/base64" | 7 "encoding/base64" |
8 "encoding/binary" | 8 "encoding/binary" |
9 "encoding/json" | 9 "encoding/json" |
10 "flag" | 10 "flag" |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 png, err := ioutil.ReadFile("../../../inout/" + hash + "
_raster.png") | 941 png, err := ioutil.ReadFile("../../../inout/" + hash + "
_raster.png") |
942 if err != nil { | 942 if err != nil { |
943 reportTryError(w, r, err, "Failed to open the ra
ster-generated PNG.", hash) | 943 reportTryError(w, r, err, "Failed to open the ra
ster-generated PNG.", hash) |
944 return | 944 return |
945 } | 945 } |
946 | 946 |
947 m.RasterImg = base64.StdEncoding.EncodeToString([]byte(p
ng)) | 947 m.RasterImg = base64.StdEncoding.EncodeToString([]byte(p
ng)) |
948 } | 948 } |
949 | 949 |
950 if request.GPU { | 950 if request.GPU { |
951 » » » png, err := ioutil.ReadFile("../../../inout/" + hash + "
_GPU.png") | 951 » » » png, err := ioutil.ReadFile("../../../inout/" + hash + "
_gpu.png") |
952 if err != nil { | 952 if err != nil { |
953 reportTryError(w, r, err, "Failed to open the GP
U-generated PNG.", hash) | 953 reportTryError(w, r, err, "Failed to open the GP
U-generated PNG.", hash) |
954 return | 954 return |
955 } | 955 } |
956 | 956 |
957 m.GPUImg = base64.StdEncoding.EncodeToString([]byte(png)
) | 957 m.GPUImg = base64.StdEncoding.EncodeToString([]byte(png)
) |
958 } | 958 } |
959 | 959 |
960 resp, err := json.Marshal(m) | 960 resp, err := json.Marshal(m) |
961 if err != nil { | 961 if err != nil { |
(...skipping 16 matching lines...) Expand all Loading... |
978 http.HandleFunc("/sources/", autogzip.HandleFunc(sourcesHandler)) | 978 http.HandleFunc("/sources/", autogzip.HandleFunc(sourcesHandler)) |
979 | 979 |
980 // Resources are served directly | 980 // Resources are served directly |
981 // TODO add support for caching/etags/gzip | 981 // TODO add support for caching/etags/gzip |
982 http.Handle("/res/", autogzip.Handle(http.FileServer(http.Dir("./")))) | 982 http.Handle("/res/", autogzip.Handle(http.FileServer(http.Dir("./")))) |
983 | 983 |
984 // TODO Break out /c/ as it's own handler. | 984 // TODO Break out /c/ as it's own handler. |
985 http.HandleFunc("/", autogzip.HandleFunc(mainHandler)) | 985 http.HandleFunc("/", autogzip.HandleFunc(mainHandler)) |
986 glog.Fatal(http.ListenAndServe(*port, nil)) | 986 glog.Fatal(http.ListenAndServe(*port, nil)) |
987 } | 987 } |
OLD | NEW |