From 75e2e57a92dd1da17be2a7f6f3eb64524725d78c Mon Sep 17 00:00:00 2001 From: thatInfrastructureGuy Date: Thu, 5 Nov 2020 18:39:42 -0800 Subject: [PATCH 1/2] Bug fix: Deleting from empty map. Signed-off-by: thatInfrastructureGuy --- handlers/cache.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/handlers/cache.go b/handlers/cache.go index 77742d33..80a0b30e 100644 --- a/handlers/cache.go +++ b/handlers/cache.go @@ -1,10 +1,11 @@ package handlers import ( - "github.com/statping/statping/utils" "net/url" "sync" "time" + + "github.com/statping/statping/utils" ) var CacheStorage Cacher @@ -90,8 +91,8 @@ func (s Storage) List() map[string]Item { //Get a cached content by key func (s Storage) Get(key string) []byte { item := s.items[key] - if s.items[key].Expired() { - CacheStorage.Delete(key) + if item.Expired() { + s.Delete(key) return nil } return item.Content From a1776b5b44bd0e72e3b1e119b908fc76b67a3468 Mon Sep 17 00:00:00 2001 From: Ben Klein Date: Tue, 1 Dec 2020 17:09:06 -0500 Subject: [PATCH 2/2] GitHub scopes request only what's needed For #908 --- frontend/src/forms/Login.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/forms/Login.vue b/frontend/src/forms/Login.vue index 928b953b..cdbf10a9 100644 --- a/frontend/src/forms/Login.vue +++ b/frontend/src/forms/Login.vue @@ -110,7 +110,7 @@ return "" }, GHlogin() { - window.location = `https://github.com/login/oauth/authorize?client_id=${this.oauth.gh_client_id}&redirect_uri=${this.encode(this.core.domain+"/oauth/github")}&scope=user,repo` + window.location = `https://github.com/login/oauth/authorize?client_id=${this.oauth.gh_client_id}&redirect_uri=${this.encode(this.core.domain+"/oauth/github")}&scope=read:user,read:org` }, Slacklogin() { window.location = `https://slack.com/oauth/authorize?client_id=${this.oauth.slack_client_id}&redirect_uri=${this.encode(this.core.domain+"/oauth/slack")}&scope=identity.basic`