mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-03 03:32:27 -06:00
[chore]: Bump github.com/gin-contrib/sessions from 1.0.2 to 1.0.3 (#4033)
Bumps [github.com/gin-contrib/sessions](https://github.com/gin-contrib/sessions) from 1.0.2 to 1.0.3. - [Release notes](https://github.com/gin-contrib/sessions/releases) - [Changelog](https://github.com/gin-contrib/sessions/blob/master/.goreleaser.yaml) - [Commits](https://github.com/gin-contrib/sessions/compare/v1.0.2...v1.0.3) --- updated-dependencies: - dependency-name: github.com/gin-contrib/sessions dependency-version: 1.0.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
356c2adddc
commit
d1abbd0290
33 changed files with 278 additions and 196 deletions
17
vendor/github.com/gorilla/sessions/store.go
generated
vendored
17
vendor/github.com/gorilla/sessions/store.go
generated
vendored
|
|
@ -14,6 +14,11 @@ import (
|
|||
"github.com/gorilla/securecookie"
|
||||
)
|
||||
|
||||
const (
|
||||
// File name prefix for session files.
|
||||
sessionFilePrefix = "session_"
|
||||
)
|
||||
|
||||
// Store is an interface for custom session stores.
|
||||
//
|
||||
// See CookieStore and FilesystemStore for examples.
|
||||
|
|
@ -49,8 +54,10 @@ func NewCookieStore(keyPairs ...[]byte) *CookieStore {
|
|||
cs := &CookieStore{
|
||||
Codecs: securecookie.CodecsFromPairs(keyPairs...),
|
||||
Options: &Options{
|
||||
Path: "/",
|
||||
MaxAge: 86400 * 30,
|
||||
Path: "/",
|
||||
MaxAge: 86400 * 30,
|
||||
SameSite: http.SameSiteNoneMode,
|
||||
Secure: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -257,7 +264,7 @@ func (s *FilesystemStore) save(session *Session) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
filename := filepath.Join(s.path, "session_"+session.ID)
|
||||
filename := filepath.Join(s.path, sessionFilePrefix+filepath.Base(session.ID))
|
||||
fileMutex.Lock()
|
||||
defer fileMutex.Unlock()
|
||||
return os.WriteFile(filename, []byte(encoded), 0600)
|
||||
|
|
@ -265,7 +272,7 @@ func (s *FilesystemStore) save(session *Session) error {
|
|||
|
||||
// load reads a file and decodes its content into session.Values.
|
||||
func (s *FilesystemStore) load(session *Session) error {
|
||||
filename := filepath.Join(s.path, "session_"+session.ID)
|
||||
filename := filepath.Join(s.path, sessionFilePrefix+filepath.Base(session.ID))
|
||||
fileMutex.RLock()
|
||||
defer fileMutex.RUnlock()
|
||||
fdata, err := os.ReadFile(filepath.Clean(filename))
|
||||
|
|
@ -281,7 +288,7 @@ func (s *FilesystemStore) load(session *Session) error {
|
|||
|
||||
// delete session file
|
||||
func (s *FilesystemStore) erase(session *Session) error {
|
||||
filename := filepath.Join(s.path, "session_"+session.ID)
|
||||
filename := filepath.Join(s.path, sessionFilePrefix+filepath.Base(session.ID))
|
||||
|
||||
fileMutex.RLock()
|
||||
defer fileMutex.RUnlock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue