Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
hung319 authored Feb 1, 2025
1 parent 30b9624 commit 378cafd
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,7 @@ <h1>Tải ảnh NSFW</h1>
}
};

const convertToStaticallyUrl = (imageUrl) => {
const url = new URL(imageUrl);
const domain = url.hostname;
const path = url.pathname;
return `https://cdn.statically.io/img/${domain}/f=auto${path}`;
};

const fetchImage = async (retryCount = 3) => {
const fetchImage = async (retryCount = 3) => {
const selectedApi = document.getElementById('apiSelector').value;
const apiUrl = API_URLS[selectedApi];
try {
Expand All @@ -292,10 +285,7 @@ <h1>Tải ảnh NSFW</h1>

if (!imageUrl) throw new Error("URL ảnh không xác định!");

// Chuyển đổi URL ảnh sang sử dụng Statically.io
const staticallyImageUrl = convertToStaticallyUrl(imageUrl);

const imageResponse = await fetchWithRetry(staticallyImageUrl);
const imageResponse = await fetchWithRetry(imageUrl);
const imageBlob = await imageResponse.blob();
const fileName = imageUrl.split('/').pop();
return { imageBlob, fileName };
Expand Down

0 comments on commit 378cafd

Please sign in to comment.