Improve caching, HTTP headers and URL handling (#3594)

* Fix relative URLs
* Improve login base URL and redirects
* Prevent duplicate customlocales requests
* Improve UI base URL handling
* Improve UI embedding
* Improve CSP header
* Add Cache-Control headers to all responses
* Improve CORS responses
* Improve authentication handler
* Add back media timestamp suffixes
* Fix default image handling
* Add default param to other image URLs
This commit is contained in:
DingDongSoLong4
2023-04-19 05:01:32 +02:00
committed by GitHub
parent 87abe8c38c
commit b4b7cf02b6
74 changed files with 808 additions and 782 deletions

View File

@@ -97,12 +97,6 @@ export const SceneCard: React.FC<ISceneCardProps> = (
[props.scene]
);
// studio image is missing if it uses the default
const missingStudioImage =
props.scene.studio?.image_path?.endsWith("?default=true");
const showStudioAsText =
missingStudioImage || (configuration?.interface.showStudioAsText ?? false);
function maybeRenderSceneSpecsOverlay() {
let sizeObj = null;
if (file?.size) {
@@ -146,21 +140,31 @@ export const SceneCard: React.FC<ISceneCardProps> = (
);
}
function renderStudioThumbnail() {
const studioImage = props.scene.studio?.image_path;
const studioName = props.scene.studio?.name;
if (configuration?.interface.showStudioAsText || !studioImage) {
return studioName;
}
const studioImageURL = new URL(studioImage);
if (studioImageURL.searchParams.get("default") === "true") {
return studioName;
}
return (
<img className="image-thumbnail" alt={studioName} src={studioImage} />
);
}
function maybeRenderSceneStudioOverlay() {
if (!props.scene.studio) return;
return (
<div className="scene-studio-overlay">
<Link to={`/studios/${props.scene.studio.id}`}>
{showStudioAsText ? (
props.scene.studio.name
) : (
<img
className="image-thumbnail"
alt={props.scene.studio.name}
src={props.scene.studio.image_path ?? ""}
/>
)}
{renderStudioThumbnail()}
</Link>
</div>
);