mirror of
https://git.joinfirefish.org/firefish/firefish.git
synced 2024-05-18 06:11:11 +02:00
Revert "Merge branch 'feat/proxy_media_fallback' into 'develop'"
This reverts commita7d6e8eb1a
, reversing changes made to1871dacd8d
.
This commit is contained in:
parent
ba972e1c03
commit
8b01433f2b
|
@ -15,23 +15,6 @@ import { isMimeImage } from "@/misc/is-mime-image.js";
|
|||
import { inspect } from "node:util";
|
||||
|
||||
export async function proxyMedia(ctx: Koa.Context) {
|
||||
try {
|
||||
proxyMediaInternal(ctx);
|
||||
} catch (e) {
|
||||
if (ctx.query.fallback) {
|
||||
ctx.redirect("/static-assets/badges/error.webp");
|
||||
return;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
if (ctx.status !== 200 && ctx.query.fallback) {
|
||||
ctx.redirect("/static-assets/badges/error.webp");
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
async function proxyMediaInternal(ctx: Koa.Context) {
|
||||
let url = "url" in ctx.query ? ctx.query.url : `https://${ctx.params.url}`;
|
||||
|
||||
if (typeof url !== "string") {
|
||||
|
@ -41,10 +24,9 @@ async function proxyMediaInternal(ctx: Koa.Context) {
|
|||
|
||||
url = url.replace("//", "/");
|
||||
|
||||
let hostname;
|
||||
const { hostname } = new URL(url);
|
||||
let resolvedIps;
|
||||
try {
|
||||
hostname = new URL(url);
|
||||
resolvedIps = await promises.resolve(hostname);
|
||||
} catch (error) {
|
||||
ctx.status = 400;
|
||||
|
|
|
@ -17,11 +17,7 @@
|
|||
}"
|
||||
>
|
||||
<div v-if="thumbnail" class="thumbnail">
|
||||
<img
|
||||
:src="thumbnail"
|
||||
onerror="this.src='/static-assets/badges/error.webp'"
|
||||
loading="lazy"
|
||||
/>
|
||||
<img :src="thumbnail" loading="lazy" />
|
||||
<button
|
||||
v-if="tweetId"
|
||||
v-tooltip="
|
||||
|
@ -59,12 +55,7 @@
|
|||
<p :title="description">
|
||||
<span>
|
||||
<span :title="sitename || undefined">
|
||||
<img
|
||||
v-if="icon"
|
||||
class="icon"
|
||||
:src="icon"
|
||||
onerror="this.src='/static-assets/badges/error.webp'"
|
||||
/>
|
||||
<img v-if="icon" class="icon" :src="icon" />
|
||||
{{ sitename }}
|
||||
</span>
|
||||
{{ description }}
|
||||
|
|
Loading…
Reference in a new issue