Compare commits
6 Commits
2d44c6c208
...
8f8da41e1a
Author | SHA1 | Date |
---|---|---|
laozhoubuluo | 8f8da41e1a | |
naskya | 4005307cbe | |
naskya | 2535fed09a | |
CI | 7e3b46f504 | |
CI | 32c00d3014 | |
老周部落 | 5e8578f500 |
|
@ -85,9 +85,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.84"
|
||||
version = "1.0.86"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18b8795de6d09abb2b178fa5a9e3bb10da935750f33449a132b328b9391b2c6a"
|
||||
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
|
||||
|
||||
[[package]]
|
||||
name = "arbitrary"
|
||||
|
@ -500,9 +500,9 @@ checksum = "a2698f953def977c68f935bb0dfa959375ad4638570e969e2f1e9f433cbf1af6"
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.97"
|
||||
version = "1.0.98"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4"
|
||||
checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
"libc",
|
||||
|
@ -1223,9 +1223,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.14"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c"
|
||||
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
|
@ -1642,9 +1642,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.153"
|
||||
version = "0.2.155"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
|
||||
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
|
||||
|
||||
[[package]]
|
||||
name = "libfuzzer-sys"
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
"feed": "4.2.2",
|
||||
"file-type": "19.0.0",
|
||||
"firefish-js": "workspace:*",
|
||||
"fluent-ffmpeg": "2.1.2",
|
||||
"fluent-ffmpeg": "2.1.3",
|
||||
"form-data": "4.0.0",
|
||||
"got": "14.3.0",
|
||||
"gunzip-maybe": "1.4.2",
|
||||
|
|
|
@ -15,6 +15,23 @@ 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") {
|
||||
|
@ -24,9 +41,10 @@ export async function proxyMedia(ctx: Koa.Context) {
|
|||
|
||||
url = url.replace("//", "/");
|
||||
|
||||
const { hostname } = new URL(url);
|
||||
let hostname;
|
||||
let resolvedIps;
|
||||
try {
|
||||
hostname = new URL(url);
|
||||
resolvedIps = await promises.resolve(hostname);
|
||||
} catch (error) {
|
||||
ctx.status = 400;
|
||||
|
|
|
@ -17,7 +17,11 @@
|
|||
}"
|
||||
>
|
||||
<div v-if="thumbnail" class="thumbnail">
|
||||
<img :src="thumbnail" loading="lazy" />
|
||||
<img
|
||||
:src="thumbnail"
|
||||
loading="lazy"
|
||||
@error="imageErrorEvent($event)"
|
||||
/>
|
||||
<button
|
||||
v-if="tweetId"
|
||||
v-tooltip="
|
||||
|
@ -55,7 +59,12 @@
|
|||
<p :title="description">
|
||||
<span>
|
||||
<span :title="sitename || undefined">
|
||||
<img v-if="icon" class="icon" :src="icon" />
|
||||
<img
|
||||
v-if="icon"
|
||||
class="icon"
|
||||
:src="icon"
|
||||
@error="imageErrorEvent($event)"
|
||||
/>
|
||||
{{ sitename }}
|
||||
</span>
|
||||
{{ description }}
|
||||
|
@ -181,6 +190,10 @@ function adjustTweetHeight(message: any) {
|
|||
if (height) tweetHeight.value = height;
|
||||
}
|
||||
|
||||
function imageErrorEvent($event) {
|
||||
$event.target.src = "/static-assets/badges/error.webp";
|
||||
}
|
||||
|
||||
window.addEventListener("message", adjustTweetHeight);
|
||||
|
||||
onUnmounted(() => {
|
||||
|
|
|
@ -142,8 +142,8 @@ importers:
|
|||
specifier: workspace:*
|
||||
version: link:../firefish-js
|
||||
fluent-ffmpeg:
|
||||
specifier: 2.1.2
|
||||
version: 2.1.2
|
||||
specifier: 2.1.3
|
||||
version: 2.1.3
|
||||
form-data:
|
||||
specifier: 4.0.0
|
||||
version: 4.0.0
|
||||
|
@ -1282,8 +1282,8 @@ packages:
|
|||
'@discordapp/twemoji@15.0.3':
|
||||
resolution: {integrity: sha512-5t0LLrNaSqViG0cSaomWwfR0+3fWqok+xLq40M8hJHxNX7s8gIoyNZYybQJo+s5/rGMjgdldpt8Ox8MapGvBUA==}
|
||||
|
||||
'@emnapi/runtime@1.1.1':
|
||||
resolution: {integrity: sha512-3bfqkzuR1KLx57nZfjr2NLnFOobvyS0aTszaEGCGqmYMVDRaGvgIZbjGSV/MHSSmLgQ/b9JFHQ5xm5WRZYd+XQ==}
|
||||
'@emnapi/runtime@1.2.0':
|
||||
resolution: {integrity: sha512-bV21/9LQmcQeCPEg3BDFtvwL6cwiTMksYNWQQ4KOxCZikEGalWtenoZ0wCiukJINlGCIi2KXx01g4FoH/LxpzQ==}
|
||||
|
||||
'@es-joy/jsdoccomment@0.43.0':
|
||||
resolution: {integrity: sha512-Q1CnsQrytI3TlCB1IVWXWeqUIPGVEKGaE7IbVdt13Nq/3i0JESAkQQERrfiQkmlpijl+++qyqPgaS31Bvc1jRQ==}
|
||||
|
@ -3005,6 +3005,9 @@ packages:
|
|||
async-lock@1.4.0:
|
||||
resolution: {integrity: sha512-coglx5yIWuetakm3/1dsX9hxCNox22h7+V80RQOu2XUUMidtArxKoZoOtHUPuR84SycKTXzgGzAUR5hJxujyJQ==}
|
||||
|
||||
async@0.2.10:
|
||||
resolution: {integrity: sha512-eAkdoKxU6/LkKDBzLpT+t6Ff5EtfSF4wx1WfJiPEEV7WNLnDaRXk0oVysiEPm262roaachGexwUv94WhSgN5TQ==}
|
||||
|
||||
async@3.2.5:
|
||||
resolution: {integrity: sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==}
|
||||
|
||||
|
@ -4499,8 +4502,8 @@ packages:
|
|||
fast-levenshtein@2.0.6:
|
||||
resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==}
|
||||
|
||||
fast-xml-parser@4.3.6:
|
||||
resolution: {integrity: sha512-M2SovcRxD4+vC493Uc2GZVcZaj66CCJhWurC4viynVSTvrpErCShNcDz1lAho6n9REQKvL/ll4A4/fw6Y9z8nw==}
|
||||
fast-xml-parser@4.4.0:
|
||||
resolution: {integrity: sha512-kLY3jFlwIYwBNDojclKsNAC12sfD6NwW74QB2CoNGPvtVxjliYehVunB3HYyNi+n4Tt1dAcgwYvmKF/Z18flqg==}
|
||||
hasBin: true
|
||||
|
||||
fastq@1.17.1:
|
||||
|
@ -4597,9 +4600,9 @@ packages:
|
|||
flatted@3.3.1:
|
||||
resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==}
|
||||
|
||||
fluent-ffmpeg@2.1.2:
|
||||
resolution: {integrity: sha512-IZTB4kq5GK0DPp7sGQ0q/BWurGHffRtQQwVkiqDgeO6wYJLLV5ZhgNOQ65loZxxuPMKZKZcICCUnaGtlxBiR0Q==}
|
||||
engines: {node: '>=0.8.0'}
|
||||
fluent-ffmpeg@2.1.3:
|
||||
resolution: {integrity: sha512-Be3narBNt2s6bsaqP6Jzq91heDgOEaDCJAXcE3qcma/EJBSy5FB4cvO31XBInuAuKBx8Kptf8dkhjK0IOru39Q==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
focus-trap-vue@4.0.3:
|
||||
resolution: {integrity: sha512-cIX5rybkCAlNZ4IHYJ3nCFIsipDDljJHHjtTO2IgYWkVYg7X9ipUVdab3HzYp88kmHgMwjcB71LYnXRRsF6ZqQ==}
|
||||
|
@ -8486,7 +8489,7 @@ snapshots:
|
|||
jsonfile: 5.0.0
|
||||
universalify: 0.1.2
|
||||
|
||||
'@emnapi/runtime@1.1.1':
|
||||
'@emnapi/runtime@1.2.0':
|
||||
dependencies:
|
||||
tslib: 2.6.2
|
||||
optional: true
|
||||
|
@ -8843,7 +8846,7 @@ snapshots:
|
|||
|
||||
'@img/sharp-wasm32@0.33.4':
|
||||
dependencies:
|
||||
'@emnapi/runtime': 1.1.1
|
||||
'@emnapi/runtime': 1.2.0
|
||||
optional: true
|
||||
|
||||
'@img/sharp-win32-ia32@0.33.4':
|
||||
|
@ -10448,6 +10451,8 @@ snapshots:
|
|||
|
||||
async-lock@1.4.0: {}
|
||||
|
||||
async@0.2.10: {}
|
||||
|
||||
async@3.2.5: {}
|
||||
|
||||
asynckit@0.4.0: {}
|
||||
|
@ -12211,7 +12216,7 @@ snapshots:
|
|||
|
||||
fast-levenshtein@2.0.6: {}
|
||||
|
||||
fast-xml-parser@4.3.6:
|
||||
fast-xml-parser@4.4.0:
|
||||
dependencies:
|
||||
strnum: 1.0.5
|
||||
|
||||
|
@ -12319,9 +12324,9 @@ snapshots:
|
|||
|
||||
flatted@3.3.1: {}
|
||||
|
||||
fluent-ffmpeg@2.1.2:
|
||||
fluent-ffmpeg@2.1.3:
|
||||
dependencies:
|
||||
async: 3.2.5
|
||||
async: 0.2.10
|
||||
which: 1.3.1
|
||||
|
||||
focus-trap-vue@4.0.3(focus-trap@7.5.4)(vue@3.4.27(typescript@5.4.5)):
|
||||
|
@ -12487,7 +12492,7 @@ snapshots:
|
|||
fs.realpath: 1.0.0
|
||||
inflight: 1.0.6
|
||||
inherits: 2.0.4
|
||||
minimatch: 5.1.6
|
||||
minimatch: 5.0.1
|
||||
once: 1.4.0
|
||||
|
||||
globals@11.12.0: {}
|
||||
|
@ -12924,7 +12929,7 @@ snapshots:
|
|||
|
||||
is-svg@5.0.1:
|
||||
dependencies:
|
||||
fast-xml-parser: 4.3.6
|
||||
fast-xml-parser: 4.4.0
|
||||
|
||||
is-symbol@1.0.4:
|
||||
dependencies:
|
||||
|
@ -13741,7 +13746,7 @@ snapshots:
|
|||
content-disposition: 0.5.4
|
||||
content-type: 1.0.5
|
||||
cookies: 0.8.0
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.3
|
||||
delegates: 1.0.0
|
||||
depd: 2.0.0
|
||||
destroy: 1.2.0
|
||||
|
|
Loading…
Reference in New Issue