Skip to content

Commit b50031a

Browse files
committed
try to fix issue about downloading fanbox images
1 parent 584cb86 commit b50031a

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/background/main.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,21 @@ Main.prototype = {
121121
}
122122
});
123123

124+
let accessControlAllowOrigin = '';
125+
126+
if (details.frameId === 0 && /^https:\/\/[^.]+\.fanbox\.cc/.test(details.initiator)) {
127+
accessControlAllowOrigin = details.initiator;
128+
details.responseHeaders.push({
129+
name: 'Access-Control-Allow-Credentials',
130+
value: 'true'
131+
});
132+
} else {
133+
accessControlAllowOrigin = '*';
134+
}
135+
124136
details.responseHeaders.push({
125-
name: 'access-control-allow-origin',
126-
value: '*'
137+
name: 'Access-Control-Allow-Origin',
138+
value: accessControlAllowOrigin
127139
});
128140

129141
return { responseHeaders: details.responseHeaders };

0 commit comments

Comments
 (0)