Hotlink protection warning on file viewer

This commit is contained in:
2021-12-26 13:21:02 +01:00
parent 132d50372f
commit 14c8ea594d
5 changed files with 96 additions and 8 deletions

View File

@@ -10,6 +10,7 @@ import Text from "./Text.svelte";
import File from "./File.svelte";
import Abuse from "./Abuse.svelte";
import { file_type } from "../FileUtilities.svelte";
import RateLimit from "./RateLimit.svelte";
let viewer
let viewer_type = "loading"
@@ -20,6 +21,8 @@ export const set_file = async file => {
return
} else if (file.abuse_type !== "") {
viewer_type = "abuse"
} else if (file.availability === "file_rate_limited_captcha_required") {
viewer_type = "rate_limit"
} else {
viewer_type = file_type(file)
}
@@ -45,6 +48,8 @@ const prev = () => { dispatch("prev") }
</div>
{:else if viewer_type === "abuse"}
<Abuse bind:this={viewer}></Abuse>
{:else if viewer_type === "rate_limit"}
<RateLimit bind:this={viewer} on:download={download}></RateLimit>
{:else if viewer_type === "image"}
<Image bind:this={viewer}></Image>
{:else if viewer_type === "video"}