Skip to content

Commit afa559d

Browse files
authored
Merge pull request #307 from yunshaochu/master
解决使用自定义翻译URL为ngrok时,需要验证警告页面的问题
2 parents 8437404 + c3556bb commit afa559d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/components/Manga/actions/translation/selfhosted.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,11 @@ export const selfhostedTranslation = async (url: string): Promise<string> => {
8787
);
8888
}
8989

90+
const headers_ngrok = apiUrl().includes('ngrok-free')? new Headers({ "ngrok-skip-browser-warning": "69420" }) : undefined;
9091
try {
9192
const res = await fetch(`${apiUrl()}/translate/with-form/image/stream`, {
9293
method: 'POST',
94+
headers: headers_ngrok,
9395
body: createFormData(imgBlob, 'selfhosted'),
9496
});
9597

@@ -147,6 +149,7 @@ export const selfhostedTranslation = async (url: string): Promise<string> => {
147149
responseType: 'blob',
148150
fetch: false,
149151
timeout: 1000 * 60 * 10,
152+
headers: headers_ngrok,
150153
data: createFormData(imgBlob, 'selfhosted'),
151154
errorText: t('translation.tip.upload_error'),
152155
});

0 commit comments

Comments
 (0)