Skip to content

Commit

Permalink
fix: variables in prod mode issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dosco committed Dec 25, 2022
1 parent d97b1b0 commit b9e69f3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions core/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (gj *graphjin) compileQuery(qr queryReq, role string) (*queryComp, error) {
qcomp := &queryComp{qr: qr}

if !gj.prod || gj.conf.DisableAllowList {
var userVars map[string]json.RawMessage
userVars := make(map[string]json.RawMessage)

if len(qr.vars) != 0 {
if err := json.Unmarshal(qr.vars, &userVars); err != nil {
Expand All @@ -55,8 +55,8 @@ func (gj *graphjin) compileQuery(qr queryReq, role string) (*queryComp, error) {
}

// Overwrite allow list vars with user vars
// qcomp.qr.vars = qr.vars
// qcomp.qr.ns = qr.ns
qcomp.qr.vars = qr.vars
qcomp.qr.ns = qr.ns
}
return qcomp, err
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graphjin",
"version": "2.0.13",
"version": "2.0.14",
"description": "GraphJin - Build APIs in 5 minutes with GraphQL",
"type": "module",
"main": "./wasm/js/graphjin.js",
Expand Down
2 changes: 1 addition & 1 deletion serv/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func HeaderHandler(ac Auth) (HandlerFunc, error) {
}

func IsAuth(c context.Context) bool {
return c.Value(core.UserIDKey) != nil
return c != nil && c.Value(core.UserIDKey) != nil
}

func UserID(c context.Context) interface{} {
Expand Down
Binary file modified wasm/graphjin.wasm
Binary file not shown.

1 comment on commit b9e69f3

@vercel
Copy link

@vercel vercel bot commented on b9e69f3 Dec 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.