Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: experimental/webtry/webtry.go

Issue 644253003: fix display of fiddles that DON'T have compile errors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « experimental/webtry/res/js/webtry.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 return 930 return
931 } 931 }
932 932
933 png, err := ioutil.ReadFile("../../../inout/" + hash + ".png") 933 png, err := ioutil.ReadFile("../../../inout/" + hash + ".png")
934 if err != nil { 934 if err != nil {
935 reportTryError(w, r, err, "Failed to open the generated PNG.", hash) 935 reportTryError(w, r, err, "Failed to open the generated PNG.", hash)
936 return 936 return
937 } 937 }
938 938
939 m := response{ 939 m := response{
940 » » » Message: message, 940 » » » Img: base64.StdEncoding.EncodeToString([]byte(png)),
941 » » » Img: base64.StdEncoding.EncodeToString([]byte(png)), 941 » » » Hash: hash,
942 » » » Hash: hash,
943 } 942 }
944 resp, err := json.Marshal(m) 943 resp, err := json.Marshal(m)
945 if err != nil { 944 if err != nil {
946 reportTryError(w, r, err, "Failed to serialize a respons e.", hash) 945 reportTryError(w, r, err, "Failed to serialize a respons e.", hash)
947 return 946 return
948 } 947 }
949 w.Header().Set("Content-Type", "application/json") 948 w.Header().Set("Content-Type", "application/json")
950 w.Write(resp) 949 w.Write(resp)
951 } 950 }
952 } 951 }
953 952
954 func main() { 953 func main() {
955 flag.Parse() 954 flag.Parse()
956 http.HandleFunc("/i/", autogzip.HandleFunc(imageHandler)) 955 http.HandleFunc("/i/", autogzip.HandleFunc(imageHandler))
957 http.HandleFunc("/w/", autogzip.HandleFunc(workspaceHandler)) 956 http.HandleFunc("/w/", autogzip.HandleFunc(workspaceHandler))
958 http.HandleFunc("/recent/", autogzip.HandleFunc(recentHandler)) 957 http.HandleFunc("/recent/", autogzip.HandleFunc(recentHandler))
959 http.HandleFunc("/iframe/", autogzip.HandleFunc(iframeHandler)) 958 http.HandleFunc("/iframe/", autogzip.HandleFunc(iframeHandler))
960 http.HandleFunc("/json/", autogzip.HandleFunc(tryInfoHandler)) 959 http.HandleFunc("/json/", autogzip.HandleFunc(tryInfoHandler))
961 http.HandleFunc("/sources/", autogzip.HandleFunc(sourcesHandler)) 960 http.HandleFunc("/sources/", autogzip.HandleFunc(sourcesHandler))
962 961
963 // Resources are served directly 962 // Resources are served directly
964 // TODO add support for caching/etags/gzip 963 // TODO add support for caching/etags/gzip
965 http.Handle("/res/", autogzip.Handle(http.FileServer(http.Dir("./")))) 964 http.Handle("/res/", autogzip.Handle(http.FileServer(http.Dir("./"))))
966 965
967 // TODO Break out /c/ as it's own handler. 966 // TODO Break out /c/ as it's own handler.
968 http.HandleFunc("/", autogzip.HandleFunc(mainHandler)) 967 http.HandleFunc("/", autogzip.HandleFunc(mainHandler))
969 glog.Fatal(http.ListenAndServe(*port, nil)) 968 glog.Fatal(http.ListenAndServe(*port, nil))
970 } 969 }
OLDNEW
« no previous file with comments | « experimental/webtry/res/js/webtry.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698