[feat] add plain fetch
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
<script lang="ts">
|
||||
import Check from "src/lib/Others/Check.svelte";
|
||||
import { language } from "src/lang";
|
||||
import Help from "src/lib/Others/Help.svelte";
|
||||
import { DataBase } from "src/ts/storage/database";
|
||||
import { alertMd } from "src/ts/alert";
|
||||
import { getRequestLog, isTauri } from "src/ts/storage/globalApi";
|
||||
|
||||
</script>
|
||||
<h2 class="text-2xl font-bold mt-2">{language.advancedSettings}</h2>
|
||||
<span class="text-draculared text-xs mb-2">{language.advancedSettingsWarn}</span>
|
||||
@@ -44,6 +42,9 @@
|
||||
<div class="flex items-center mt-4">
|
||||
<Check bind:check={$DataBase.useExperimental} name={language.useExperimental}/>
|
||||
</div>
|
||||
<div class="flex items-center mt-4">
|
||||
<Check bind:check={$DataBase.usePlainFetch} name="Force Plain Fetch"/>
|
||||
</div>
|
||||
<button
|
||||
on:click={async () => {
|
||||
alertMd(getRequestLog())
|
||||
|
||||
@@ -528,6 +528,7 @@ export interface Database{
|
||||
classicMaxWidth: boolean,
|
||||
useChatSticker:boolean,
|
||||
useAdditionalAssetsPreview:boolean,
|
||||
usePlainFetch:boolean
|
||||
}
|
||||
|
||||
interface hordeConfig{
|
||||
|
||||
@@ -414,8 +414,7 @@ export async function globalFetch(url:string, arg:{body?:any,headers?:{[key:stri
|
||||
}
|
||||
|
||||
const urlHost = (new URL(url)).hostname
|
||||
let forcePlainFetch = knownHostes.includes(urlHost) && (!isTauri)
|
||||
|
||||
let forcePlainFetch = (knownHostes.includes(urlHost) && (!isTauri)) || db.usePlainFetch
|
||||
if(forcePlainFetch){
|
||||
try {
|
||||
let headers = arg.headers ?? {}
|
||||
|
||||
Reference in New Issue
Block a user