fix: cookie expiry needs to be set
This commit is contained in:
@ -20,6 +20,7 @@ package cookies
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/internal/preferences"
|
"github.com/ProtonMail/proton-bridge/internal/preferences"
|
||||||
)
|
)
|
||||||
@ -30,6 +31,12 @@ type pantry struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *pantry) persistCookies(url string, cookies []*http.Cookie) error {
|
func (p *pantry) persistCookies(url string, cookies []*http.Cookie) error {
|
||||||
|
for _, cookie := range cookies {
|
||||||
|
if cookie.MaxAge > 0 {
|
||||||
|
cookie.Expires = time.Now().Add(time.Duration(cookie.MaxAge) * time.Second)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
b, err := json.Marshal(cookies)
|
b, err := json.Marshal(cookies)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user