Commit 1532eb42 by Torkel Ödegaard

Fixed png rendering

parent ed879df1
Subproject commit 984ece646f831678c5a8f32e4a69f54fdad914c4 Subproject commit 64f98d2409152a2bfa34b6f032d21e6bb18b97f8
...@@ -12,7 +12,7 @@ import ( ...@@ -12,7 +12,7 @@ import (
func RenderToPng(c *middleware.Context) { func RenderToPng(c *middleware.Context) {
accountId := c.UsingAccountId accountId := c.UsingAccountId
queryReader := util.NewUrlQueryReader(c.Req.URL) queryReader := util.NewUrlQueryReader(c.Req.URL)
queryParams := "?render&accountId=" + strconv.FormatInt(accountId, 10) + "&" + c.Req.URL.RawQuery queryParams := "?render=1&accountId=" + strconv.FormatInt(accountId, 10) + "&" + c.Req.URL.RawQuery
renderOpts := &renderer.RenderOpts{ renderOpts := &renderer.RenderOpts{
Url: c.Params("*") + queryParams, Url: c.Params("*") + queryParams,
......
package middleware package middleware
import ( import (
"strconv"
"strings" "strings"
"github.com/Unknwon/macaron" "github.com/Unknwon/macaron"
...@@ -22,12 +21,11 @@ func getRequestAccountId(c *Context) int64 { ...@@ -22,12 +21,11 @@ func getRequestAccountId(c *Context) int64 {
return accountId.(int64) return accountId.(int64)
} }
// localhost render query // TODO: figure out a way to secure this
urlQuery := c.Req.URL.Query() if c.Query("render") == "1" {
if len(urlQuery["render"]) > 0 { accountId := c.QueryInt64("accountId")
accId, _ := strconv.ParseInt(urlQuery["accountId"][0], 10, 64) c.Session.Set("accountId", accountId)
c.Session.Set("accountId", accId) return accountId
accountId = accId
} }
return 0 return 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment