Allow password entry for shared directories

This commit is contained in:
2026-10-05 17:39:39 +02:00
parent 6f0f58d2d9
commit f3738cbc4d
8 changed files with 91 additions and 24 deletions

View File

@@ -124,12 +124,20 @@ func (wc *WebController) metadataFromFilesystem(r *http.Request, f api.Filesyste
}
}
// The services which make link previews don't keep cookies, so a password
// in the link has to be in every URL they open
var query, thumbnail = "", "?thumbnail"
if password := r.URL.Query().Get("password"); password != "" {
password = "password=" + url.QueryEscape(password)
query, thumbnail = "?"+password, thumbnail+"&"+password
}
return generateOGData(
base.Name,
base.FileType,
addr+"/d"+filepath,
addr+"/api/filesystem"+filepath,
addr+"/api/filesystem"+filepath+"?thumbnail",
addr+"/d"+filepath+query,
addr+"/api/filesystem"+filepath+query,
addr+"/api/filesystem"+filepath+thumbnail,
colour,
)
}