diff --git a/admin_games.go b/admin_games.go index 0c5dda4..3e47889 100644 --- a/admin_games.go +++ b/admin_games.go @@ -1,8 +1,10 @@ package main import ( + "fmt" "io/ioutil" "net/http" + "strings" "encoding/base64" @@ -52,11 +54,21 @@ func handleAdminGames(w http.ResponseWriter, req *http.Request, page *pageData) } func saveScreenshots(teamId string, req *http.Request) error { - file, _, err := req.FormFile("newssfile") + var err error + file, hdr, err := req.FormFile("newssfile") if err != nil { return err } - data, err := ioutil.ReadAll(file) + fmt.Println("File Received: " + hdr.Filename) + extIdx := strings.LastIndex(hdr.Filename, ".") + fltp := "png" + if len(hdr.Filename) > extIdx { + fltp = hdr.Filename[extIdx+1:] + } + data, _ := ioutil.ReadAll(file) str := base64.StdEncoding.EncodeToString(data) - return dbSaveTeamGameScreenshot(teamId, &Screenshot{Image: str}) + return dbSaveTeamGameScreenshot(teamId, &Screenshot{ + Image: str, + Filetype: fltp, + }) } diff --git a/assets.go b/assets.go index fa8ea1e..d1c8660 100644 --- a/assets.go +++ b/assets.go @@ -202,8 +202,8 @@ Y8Pj6dAeZ3gBzLZbhMnSW8r0f78+9y+zlDVuQ3ZNXD8zD+/mGzZjDfK53gEAAP//D/6XxHkAAAA= "/assets/css/gjvote.css": { local: "assets/css/gjvote.css", - size: 4044, - modtime: 1499645867, + size: 4090, + modtime: 1499955435, compressed: ` H4sIAAAAAAAA/6xX7WrcOhP+n6sQLIUWXhk7zTZZB8oLaXIDvQLZ0tpDZMlI8u4mh9z7QR/2WracHg4H 8iOWZkbPzDzzsa3pOPrrBqEOBG4ZNK0pUZHnXx5vPm5uKknf3G0tuVQl2t3f3z9uCRMnadjFYMpqqYgB @@ -222,9 +222,9 @@ CTMNrbiBeD6kRD6SD3RAaZjbi2EYdz5PXFxEj/nDdThSD3GydsTqf+5HSuLfIIoglRS0TS/dylGY9uPn 4XAInVBSwt1I5cTvTifQUAEH81aiFihlYrsDhwVs1oDD/xtjf/xOl8g7BkHZxYnl6d6mmop8zf+Hwl+2 /5Zw4yeFU7waRWEOnTfUWzJajr/JrWlEFhNrnJ6rrXejYCmcdqyroGmYYPR3rRgTv9tQl+NK1UsYI7MF MQyk48C5dkaWA+ZLIhl/Xh7itCZzNW9aUyTHBBZ5Xjhw/+8YBYK+2uU/oLjLWffNwbwuievdYe3EHPcR -Lsytyh83k53V2pRYI1bi07RdKIAAA4Q/RtgCEGdktfykXEgAXsTWEskPu3Dgjc9+6Sx6w2TdCRI7jLMj -J7oNwrMBeXuXlsyuvfwP3Tzq56EkVtb0UNdM6217t7cHcjx8ai/65bjt8ZVQgexEUPS1I5fAre97u5B/ -C5vTyfdHa1pJji2qHnFSMZ6NZ+4rPLpeDv7Jkz/u7IP+cMbxh/8ext8BAAD//w7sG7XMDwAA +Lsytyh83k53V2pRYI1bi07RdKIAAA4Q/RtgCEGdktfykXEgAXsTWEskPu3Dgjc9+6Sx6w2TdCbrcc6Lb +IDobj7d3n6KYZzvt4WQ7u/b+P3T/qP+HElrY0kNdM623rd3eHsjx8Km16Hfmdnyu9AulQQRFXztyCUz8 +vrfr+7ewZ518N7WmleTYouoRJxXj2XjmvsKj61Xinzz5484+6A9nFfHw38P4OwAA///cV+Jj+g8AAA== `, }, @@ -310,35 +310,36 @@ GwM5xLYdRhVY/PPdX2X8mMmnqO5/AdOTL+cjjP0hAAAAAElFTkSuQmCCAQAA//+FC1PpvxAAAA== "/assets/js/admin.js": { local: "assets/js/admin.js", - size: 34, - modtime: 1494731526, + size: 0, + modtime: 1499949720, compressed: ` -H4sIAAAAAAAA/0rOzyvOz0nVy8lP11DydA5RcE/MTfVKzFVwTMnNzFPStOYCBAAA//8imS6KIgAAAA== +H4sIAAAAAAAA/wEAAP//AAAAAAAAAAA= `, }, "/assets/js/gjvote.js": { local: "assets/js/gjvote.js", - size: 3469, - modtime: 1499644439, + size: 3561, + modtime: 1499955342, compressed: ` -H4sIAAAAAAAA/6xWT2/jthO9+1MMvAdJSCLIP+CHAlG1i3a7RQsk2wKbW9EDLY4kwhTpipS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rCs9aFyAnx9Q7IWHjfq8tiVGU3SdSGIsK +q2g4Po9Kc7xYW3UKvnNdEJ948nQ6QI4VRwcYDthL11PrPruh1lZ1AZ66q8mjuw6+E0ashRS2cbr4J4m+ +k3fd1rBKS3mjo/QU0ng16VcbwbHtV/+uUR1fUDc4vLWbddVGXuM4bhwTP3/ftpL+InYvb2mQ34m3ERKj +vXeSi8pYn5D+Zh4Z28GsS1fQJzAroP1VUrO5QmNogdHWFKfAZNdlRB7B1/WfyGxSVtpq25SYWH1tK6GK +hFEpIweGGP6XZUButcfCx6qizR2Bfo0OksGt/7zrO5vTJXfUz0y+3C3fYdoE+6+T3rw1hTcc9kImg/2v +DTGdK5l0Z2VouXNIaN5tMW2p6ZIyYZvs3Bk2VHGJE0nn1R5ADGX/RkFEHs1Xu/89kFMuVLH/PWDQ3ogt +6tpGOeX4tZ5k/hTO0zQNVEgA+88X7FycXm7OPpRwGNscIIPlMobHHn6+2s9DlMF7SEP7GnrlMHgEaPxN +TxmcQZqk5/2tGNxnd+M5cfbShHP8dwAAAP//EdP42ekNAAA= `, }, @@ -11973,42 +11974,42 @@ AzZ13XlyoWq0W413wp1qSZRt1WjlGq3oSzub9lZ2CyYO03iFZSGo1fye5Rcp6t8AAAD//+fF4HvJAgAA "/templates/admin-editteam.html": { local: "templates/admin-editteam.html", - size: 7789, - modtime: 1498145831, + size: 7805, + modtime: 1499955087, compressed: ` -H4sIAAAAAAAA/7xYX3PbuBF/96fY4WSG8tQS0+YuDzKlXnK+dvxw107tPN3cA0SsSDQgwAFAOa5G370D -gKTAP5Ls3OXyEFPAcv/ht7s/cL+HN3XNKCxXsHjEsuLE4B0xZPHp0/0dHA5XKWU7yDjRehVlKAyqaH0F -EC5z3Bq3CJBupSrb9apWOHcL3dOccJYLpBGQzDApVlFCaMlEYpCUOuncORwSTXYYQYmmkHQV/ftfD4+N +H4sIAAAAAAAA/7xYX3PbuBF/96fY4WSG8tQS0+YuDzKlXnK+6/jhrp3aebq5B4hYkWh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j+sWCcWvf07PqYLber3N3RCXhxTrRx +P4MMNbKkqlBQL+vDb2TGXaAtcZvIYFp22LBVbR1aBlnq9rraPfL9QVOJb85VzrHiYLLkXD1PwMf/e2KC +yqcFlxlxeFjBS0a1L8Ek+ouFg53EGs1Ca0ZvA+WHoHdMxNb2panYJqMa9abOgm8Abfkfc7xwI2XRDKhV +tOEy+xydkCrQmllFf3v7tvrihA69Spn6QBZUiGcvl/A/RcLii7ga8bDuiF83X444PHrbS91x+VzqTkZX +Wu/n1kp83c9q/Nf331dfYp/VNGmH9/8CAAD//xVMliN9HgAA `, }, @@ -12074,16 +12075,10 @@ LVzkkM5QrSQnvObEI3VzRIrCexi06R1XCF2XMSl2kKgd2SzC+7678Ve/y9AqPGIZqnb7l2i/5uTITbWG "/templates/admin-menu.html": { local: "templates/admin-menu.html", - size: 1124, - modtime: 1498691362, + size: 0, + modtime: 1499949610, compressed: ` -H4sIAAAAAAAA/9yUwW6jMBCG7/sUI2+OS3xfQaTs9tBI6alP4OChGcWMK2OQKsvvXmEggSZVox57ip35 -5+f/hhG5pg5IF6JGbgWURjVNIUKgCtaPpHGra+In5DbGI2mNHAKyjlFsfgGk5rHltXWYJZO+ApArODqs -CvF74dxfskPrveVRCJDTVK0UVCo7KNeITS5pdJJqPMwel3xKy14Ro7tYteYqUGao8WcFQAjgFL8grE5/ -YNXB3wLWPSHEeNbkhq59yGM985kxhgCrbr23pfJkGWIUt1LwSWwWrEPbrhxaEvH4314d0ECMZ/ZhEIYW -GMj6EjqXrZmqIUD/Av8bQva7Ztv645xuKLP1F8kzug7dYgQTnFT9DsgyKRsZwtSkY5QOa9vhfbiVyk74 -NnI+YEo1WC0wP4L1d9PgjPSuZErrb8S6Hepq1p+tGQz7bb239Rcr9y+JftTi5VJTlz4Mw2H8eQ8AAP// -T8Bo3mQEAAA= +H4sIAAAAAAAA/wEAAP//AAAAAAAAAAA= `, }, @@ -12145,13 +12140,17 @@ XvV/PgEAAP///4iBjuQAAAA= "/templates/header.html": { local: "templates/header.html", - size: 244, - modtime: 1498849944, + size: 1364, + modtime: 1499955303, compressed: ` -H4sIAAAAAAAA/0yMPW7EIBBGe04xoo+R3GZMYylSilTJBQiMFySWXQF2g+buKyzb2vL7eQ+LzeFZtdhM -BhsDpfrtYALZ2jAfkVl+ClTnE00JjsBGU8okl2iKB0upUobWhq+e574xSy3g6n6oFHMjZoFqN2iBLmyn -xz5SpVQPBMICw+/6/xdqJGAWAO9nT8ZR/rhTWncAAP2oW7sQZlR+7BMqF7ZDSsl11ysAAP//dznCgvQA -AAA= +H4sIAAAAAAAA/9xUwW6cMBC971eM3BwLSDm2BilNVTVSckp/wIuHMFpjItsgVZb/vTJ4WdNN1ajH3hjm ++fm94THctoZeXXOYhYFWEWr3IKEG5n15n8oQ2OcDr85ILmmGVglra9YpYXtoUTs04H35Ldb3sRcCaw6w +vXtCa8ULhnDglaQ5sZCs2YB6Ymc+76mD8jtJvJMD6SfUUwg9SYnae9QyseYSXieDxUISOwBcQG+wq9mH +HXMsiuPk3KgTEIDT5kNAJ4qjMJY1vKLEVIn0kF238LSjdoI0mgvVpK4EFYqs2xBxFmCEfkG4OX2Emxk+ +1VBGhxDChuGKrnnI4ZDxZB69h5u5fBxb4WjUEAJ7S4U+sWbndT320K5HFsfp3aM4ooIQNu/rIBTtbKCW +F9G8mtS56z3ED5iSY+8m1+fu1rYe3QXyjGZGsxvB2VwlYgaqNZW22iWyMjiMM77PbieKE/5MPr/iomql +2tn83VislcXM6buUCSn/Qdbboq5m/aeYwZrv0blx+Evkviyg/yp4aadsD/mOSZfHXxa1S0tpSenzdPxB +TqUPnIN7FBLNbqv0t43325Gos7/NbszV/QoAAP//h0mw81QFAAA= `, }, @@ -12183,63 +12182,63 @@ AAD//1puW/YhAwAA "/templates/public-voting.html": { local: "templates/public-voting.html", - size: 11836, - modtime: 1499649549, + size: 11859, + modtime: 1499956689, compressed: ` -H4sIAAAAAAAA/+xaQY/bOpK+96+oaIORjW7bLzOLPXTbDSSdm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Ny+KDqOQC+kN7pC4e5EKYTacaT52ceRNp1U35L8bwAAAP//nWUSj1MuAAA= `, }, diff --git a/assets/css/gjvote.css b/assets/css/gjvote.css index 313b574..bfbe484 100644 --- a/assets/css/gjvote.css +++ b/assets/css/gjvote.css @@ -263,16 +263,19 @@ div.fullscreen { margin-left: 150px; } - aside.flash { + div.flash { font-size: 24px; + position: fixed; + top: 0px; + width: 100%; } - aside.flash.error { + div.flash.error { background-color: #DD0000; color: #FFFFFF; } - aside.flash.success { + div.flash.success { background-color: #229af9; color: #FFFFFF; } diff --git a/assets/js/admin.js b/assets/js/admin.js index 622fcd2..e69de29 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -1 +0,0 @@ -console.log("ICT GameJam Admin"); diff --git a/assets/js/gjvote.js b/assets/js/gjvote.js index 8a527d0..812627a 100644 --- a/assets/js/gjvote.js +++ b/assets/js/gjvote.js @@ -73,7 +73,10 @@ function hideModal() { } function setFlashMessage(msg, cls) { - var flash = document.querySelector('aside.flash'); + if( Object.prototype.toString.call( cls ) !== '[object Array]' ) { + cls = [ cls ]; + } + var flash = document.querySelector('div.flash'); flash.innerText = msg; for(var i = 0; i < cls.length; i++) { flash.classList.add(cls[i]); @@ -84,14 +87,14 @@ function setFlashMessage(msg, cls) { } function handleFlashMessage() { - var flash = document.querySelector('aside.flash'); + var flash = document.querySelector('div.flash'); if(flash.classList.contains('fading')) { setTimeout(fadeOutFlashMessage, 1000); } } function fadeOutFlashMessage() { - var flash = document.querySelector('aside'); + var flash = document.querySelector('div.flash'); var opac = flash.style.opacity; if(opac == "") { opac = 1; } if(opac > 0) { diff --git a/main.go b/main.go index 12ddae7..c5ed9c4 100644 --- a/main.go +++ b/main.go @@ -104,6 +104,8 @@ func main() { pub := r.PathPrefix("/").Subrouter() pub.HandleFunc("/", handleMain) pub.HandleFunc("/vote", handlePublicSaveVote) + pub.HandleFunc("/image/{teamid}/{imageid}", handleImageRequest) + pub.HandleFunc("/thumbnail/{teamid}/{imageid}", handleThumbnailRequest) // API Subrouter //api := r.PathPrefix("/api").Subtrouter() @@ -297,7 +299,6 @@ func InitPageData(w http.ResponseWriter, req *http.Request) *pageData { func (p *pageData) show(tmplName string, w http.ResponseWriter) error { for _, tmpl := range []string{ "htmlheader.html", - "admin-menu.html", "header.html", tmplName, "footer.html", diff --git a/model_games.go b/model_games.go index 4aea97e..c33833d 100644 --- a/model_games.go +++ b/model_games.go @@ -14,9 +14,11 @@ type Game struct { } type Screenshot struct { + UUID string Description string Image string - UUID string + Thumbnail string + Filetype string } func dbUpdateTeamGame(teamId, name, desc string) error { @@ -109,6 +111,15 @@ func dbGetTeamGameScreenshot(teamId, ssId string) *Screenshot { if ret.Image, err = db.GetValue(ssPath, "image"); err != nil { return nil } + if ret.Thumbnail, err = db.GetValue(ssPath, "thumbnail"); err != nil { + return nil + } + if ret.Thumbnail == "" { + ret.Thumbnail = ret.Image + } + if ret.Filetype, err = db.GetValue(ssPath, "filetype"); err != nil { + return nil + } return ret } @@ -132,6 +143,12 @@ func dbSaveTeamGameScreenshot(teamId string, ss *Screenshot) error { if err := db.SetValue(ssPath, "image", ss.Image); err != nil { return err } + if err := db.SetValue(ssPath, "thumbnail", ss.Thumbnail); err != nil { + return err + } + if err := db.SetValue(ssPath, "filetype", ss.Filetype); err != nil { + return err + } return nil } diff --git a/public_endpoints.go b/public_endpoints.go index 1adcccc..0f039cd 100644 --- a/public_endpoints.go +++ b/public_endpoints.go @@ -1,10 +1,13 @@ package main import ( + "encoding/base64" "math/rand" "net/http" "strings" "time" + + "github.com/gorilla/mux" ) func initPublicPage(w http.ResponseWriter, req *http.Request) *pageData { @@ -73,3 +76,35 @@ func handlePublicSaveVote(w http.ResponseWriter, req *http.Request) { page.session.setFlashMessage("Vote Saved!", "success large fading") redirect("/", w, req) } + +func handleThumbnailRequest(w http.ResponseWriter, req *http.Request) { + vars := mux.Vars(req) + ss := dbGetTeamGameScreenshot(vars["teamid"], vars["imageid"]) + if ss == nil { + http.Error(w, "Couldn't find image", 404) + return + } + w.Header().Set("Content-Type", "image/"+ss.Filetype) + dat, err := base64.StdEncoding.DecodeString(ss.Thumbnail) + if err != nil { + http.Error(w, "Couldn't find image", 404) + return + } + w.Write(dat) +} + +func handleImageRequest(w http.ResponseWriter, req *http.Request) { + vars := mux.Vars(req) + ss := dbGetTeamGameScreenshot(vars["teamid"], vars["imageid"]) + if ss == nil { + http.Error(w, "Couldn't find image", 404) + return + } + w.Header().Set("Content-Type", "image/"+ss.Filetype) + dat, err := base64.StdEncoding.DecodeString(ss.Image) + if err != nil { + http.Error(w, "Couldn't find image", 404) + return + } + w.Write(dat) +} diff --git a/templates/admin-editteam.html b/templates/admin-editteam.html index 885b538..8932ec4 100644 --- a/templates/admin-editteam.html +++ b/templates/admin-editteam.html @@ -40,7 +40,7 @@ Upload Screenshot {{ else }} {{ range $i, $v := .TemplateData.Game.Screenshots }} - + {{ end }} {{ end }} diff --git a/templates/admin-menu.html b/templates/admin-menu.html index 0c3a25f..e69de29 100644 --- a/templates/admin-menu.html +++ b/templates/admin-menu.html @@ -1,30 +0,0 @@ -
diff --git a/templates/header.html b/templates/header.html index 95cc19a..82c71af 100644 --- a/templates/header.html +++ b/templates/header.html @@ -1,9 +1,39 @@ -