mirror of
https://github.com/Forceu/Gokapi.git
synced 2026-05-03 04:51:15 -05:00
Added logging #18, set Dockerfile to Go 1.16.5, minor changes
This commit is contained in:
@@ -120,9 +120,7 @@ func isValidKey(key string, modifyTime bool) bool {
|
||||
return false
|
||||
}
|
||||
settings := configuration.GetServerSettings()
|
||||
defer func() {
|
||||
configuration.Release()
|
||||
}()
|
||||
defer configuration.Release()
|
||||
savedKey, ok := settings.ApiKeys[key]
|
||||
if ok && savedKey.Id != "" {
|
||||
if modifyTime {
|
||||
|
||||
@@ -24,7 +24,7 @@ func IsValidSession(w http.ResponseWriter, r *http.Request) bool {
|
||||
sessionString := cookie.Value
|
||||
if sessionString != "" {
|
||||
settings := configuration.GetServerSettings()
|
||||
defer func() { configuration.ReleaseAndSave() }()
|
||||
defer configuration.ReleaseAndSave()
|
||||
_, ok := (settings.Sessions)[sessionString]
|
||||
if ok {
|
||||
return useSession(w, sessionString, &settings.Sessions)
|
||||
@@ -56,7 +56,7 @@ func CreateSession(w http.ResponseWriter, sessions *map[string]models.Session) {
|
||||
if sessions == nil {
|
||||
settings := configuration.GetServerSettings()
|
||||
sessions = &settings.Sessions
|
||||
defer func() { configuration.ReleaseAndSave() }()
|
||||
defer configuration.ReleaseAndSave()
|
||||
}
|
||||
sessionString := helper.GenerateRandomString(60)
|
||||
(*sessions)[sessionString] = models.Session{
|
||||
|
||||
Reference in New Issue
Block a user