@@ -194,26 +194,6 @@ <h1 class="mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">
194
194
195
195
} ) ;
196
196
197
- // 拦截 fetch 请求,替换头像
198
- const originalFetch = window . fetch ;
199
- window . fetch = async function ( resource , options ) {
200
- const response = await originalFetch ( resource , options ) ;
201
-
202
- // 检查请求的 URL
203
- if ( resource . includes ( 'https://files.e5n.cc/accounts/avatars/' ) ) {
204
- // 创建一个新的响应,返回 /eallion.webp
205
- const newResponse = new Response ( null , {
206
- status : 302 ,
207
- headers : {
208
- 'Location' : '/eallion.webp'
209
- }
210
- } ) ;
211
- return newResponse ;
212
- }
213
-
214
- return response ;
215
- } ;
216
-
217
197
</ script >
218
198
219
199
< script >
@@ -248,10 +228,14 @@ <h1 class="mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">
248
228
const images = document . querySelectorAll ( 'img' ) ;
249
229
images . forEach ( img => {
250
230
const src = img . getAttribute ( 'src' ) ;
251
- if ( src && src . includes ( 'https://files.e5n.cc/accounts/avatars/' ) ) {
252
- img . setAttribute ( 'src' , '/eallion.webp' ) ;
253
- img . setAttribute ( 'data-original-src' , src ) ; // 添加调试信息
254
- }
231
+ if ( src && src . includes ( 'https://files.e5n.cc/accounts/' ) ) {
232
+ img . setAttribute ( 'src' , '/eallion.webp' ) ;
233
+ img . setAttribute ( 'data-original-src' , src ) ;
234
+ } else if ( src && src . includes ( 'https://files.e5n.cc/media_attachments/' ) ) {
235
+ const newSrc = src . replace ( 'https://files.e5n.cc/media_attachments/' , 'https://mastodon-s3-files.eallion.com/media_attachments/' ) ;
236
+ img . setAttribute ( 'src' , newSrc ) ;
237
+ img . setAttribute ( 'data-original-src' , src ) ;
238
+ }
255
239
} ) ;
256
240
} ) ;
257
241
0 commit comments