Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5746c2c

Browse files
committed
debug: dns resolution
1 parent15a1a82 commit5746c2c

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

‎package-lock.json‎

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
"sharp":"^0.33.4",
101101
"tailwind-scrollbar":"^3.0.0",
102102
"tailwindcss":"^3.4.0",
103+
"undici":"^7.16.0",
103104
"uuid":"^10.0.0",
104105
"vitest-browser-svelte":"^0.1.0",
105106
"zod":"^3.22.3"

‎src/routes/api/fetch-url/+server.ts‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import{error}from"@sveltejs/kit";
22
import{logger}from"$lib/server/logger.js";
3+
import{fetch}from"undici";
34

45
constMAX_FILE_SIZE=10*1024*1024;// 10MB
56
constFETCH_TIMEOUT=30000;// 30 seconds
@@ -30,7 +31,7 @@ function isValidUrl(urlString: string): boolean {
3031
}
3132
}
3233

33-
exportasyncfunctionGET({ url, fetch}){
34+
exportasyncfunctionGET({ url}){
3435
consttargetUrl=url.searchParams.get("url");
3536

3637
if(!targetUrl){
@@ -48,19 +49,13 @@ export async function GET({ url, fetch }) {
4849
constcontroller=newAbortController();
4950
consttimeoutId=setTimeout(()=>controller.abort(),FETCH_TIMEOUT);
5051

51-
logger.debug({ targetUrl},"Fetching url");
5252
constresponse=awaitfetch(targetUrl,{
5353
signal:controller.signal,
5454
headers:{
5555
"User-Agent":"HuggingChat-Attachment-Fetcher/1.0",
5656
},
5757
}).finally(()=>clearTimeout(timeoutId));
5858

59-
logger.debug(
60-
{ targetUrl,responseHeaders:JSON.stringify(response.headers)},
61-
"URL fetch debug"
62-
);
63-
6459
if(!response.ok){
6560
logger.error({ targetUrl, response},`Error fetching URL. Response not ok.`);
6661
throwerror(response.status,`Failed to fetch:${response.statusText}`);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp