code refactoring

fixed bad escape in i18n.yaml
This commit is contained in:
2024-08-19 10:25:25 +02:00
parent b7511eb064
commit a64798644a
4 changed files with 11 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "yt-dlp-webui", "name": "yt-dlp-webui",
"version": "3.1.0", "version": "3.1.2",
"description": "Frontend compontent of yt-dlp-webui", "description": "Frontend compontent of yt-dlp-webui",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -627,7 +627,7 @@ languages:
playlistCheckbox: Ladda ner spellista (detta kommer ta did, efter start så kan du stänga detta fönster) playlistCheckbox: Ladda ner spellista (detta kommer ta did, efter start så kan du stänga detta fönster)
restartAppMessage: En sidomladdning behövs innan förändringen får effekt restartAppMessage: En sidomladdning behövs innan förändringen får effekt
servedFromReverseProxyCheckbox: Servern befinner sig bakom en omvänd proxy servedFromReverseProxyCheckbox: Servern befinner sig bakom en omvänd proxy
urlBase: URL-bas, måste anges när en omvänd proxy används. Standardinställning: lämna blank urlBase: "URL-bas, måste anges när en omvänd proxy används. Standardinställning: lämna blank"
newDownloadButton: Ny nedladdning newDownloadButton: Ny nedladdning
homeButtonLabel: Hem homeButtonLabel: Hem
archiveButtonLabel: Arkiv archiveButtonLabel: Arkiv

View File

@@ -35,7 +35,7 @@ const Footer: React.FC = () => {
display: 'flex', gap: 1, justifyContent: 'space-between' display: 'flex', gap: 1, justifyContent: 'space-between'
}}> }}>
<div style={{ display: 'flex', gap: 4, alignItems: 'center' }}> <div style={{ display: 'flex', gap: 4, alignItems: 'center' }}>
<Chip label="RPC v3.1.0" variant="outlined" size="small" /> <Chip label="RPC v3.1.2" variant="outlined" size="small" />
<VersionIndicator /> <VersionIndicator />
</div> </div>
<div style={{ display: 'flex', gap: 4, 'alignItems': 'center' }}> <div style={{ display: 'flex', gap: 4, 'alignItems': 'center' }}>

View File

@@ -18,6 +18,8 @@ type OAuth2SuccessResponse struct {
IDTokenClaims *json.RawMessage IDTokenClaims *json.RawMessage
} }
// var cookieMaxAge = int(time.Hour * 24 * 30) XXX: overflows on 32 bit architectures.
func Login(w http.ResponseWriter, r *http.Request) { func Login(w http.ResponseWriter, r *http.Request) {
state := uuid.NewString() state := uuid.NewString()
@@ -32,7 +34,8 @@ func Login(w http.ResponseWriter, r *http.Request) {
HttpOnly: true, HttpOnly: true,
Path: "/", Path: "/",
Secure: r.TLS != nil, Secure: r.TLS != nil,
MaxAge: int(time.Hour * 24 * 30), // MaxAge: cookieMaxAge,
Expires: time.Now().Add(time.Hour * 24 * 30), // XXX: change to MaxAge
}) })
http.SetCookie(w, &http.Cookie{ http.SetCookie(w, &http.Cookie{
@@ -41,7 +44,8 @@ func Login(w http.ResponseWriter, r *http.Request) {
HttpOnly: true, HttpOnly: true,
Path: "/", Path: "/",
Secure: r.TLS != nil, Secure: r.TLS != nil,
MaxAge: int(time.Hour * 24 * 30), // MaxAge: cookieMaxAge,
Expires: time.Now().Add(time.Hour * 24 * 30), // XXX: change to MaxAge
}) })
http.Redirect(w, r, oauth2Config.AuthCodeURL(state, oidc.Nonce(nonce)), http.StatusFound) http.Redirect(w, r, oauth2Config.AuthCodeURL(state, oidc.Nonce(nonce)), http.StatusFound)
@@ -108,7 +112,7 @@ func SingIn(w http.ResponseWriter, r *http.Request) {
HttpOnly: true, HttpOnly: true,
Path: "/", Path: "/",
Secure: r.TLS != nil, Secure: r.TLS != nil,
MaxAge: int(time.Hour * 24 * 30), // MaxAge: int(time.Hour * 24 * 30), XXX: overflows on 32 bit architectures.
}) })
}) })
if err != nil { if err != nil {
@@ -116,11 +120,6 @@ func SingIn(w http.ResponseWriter, r *http.Request) {
return return
} }
// if err := json.NewEncoder(w).Encode(res); err != nil {
// http.Error(w, err.Error(), http.StatusInternalServerError)
// return
// }
w.Write([]byte("Login succesfully, you may now close this window and refresh yt-dlp-webui.")) w.Write([]byte("Login succesfully, you may now close this window and refresh yt-dlp-webui."))
} }
@@ -141,7 +140,7 @@ func Refresh(w http.ResponseWriter, r *http.Request) {
HttpOnly: true, HttpOnly: true,
Path: "/", Path: "/",
Secure: r.TLS != nil, Secure: r.TLS != nil,
MaxAge: int(time.Hour * 24 * 30), // MaxAge: int(time.Hour * 24 * 30), XXX: overflows on 32 bit architectures.
}) })
token.AccessToken = "*redacted*" token.AccessToken = "*redacted*"