[feat] allow all ext option

This commit is contained in:
kwaroran
2023-11-25 18:56:49 +09:00
parent 2c77ae1b58
commit 5753e37f15
3 changed files with 9 additions and 8 deletions

View File

@@ -68,6 +68,9 @@
<div class="flex items-center mt-4"> <div class="flex items-center mt-4">
<Check bind:check={$DataBase.newOAIHandle} name="New OpenAI Handling"/> <Check bind:check={$DataBase.newOAIHandle} name="New OpenAI Handling"/>
</div> </div>
<div class="flex items-center mt-4">
<Check bind:check={$DataBase.allowAllExtentionFiles} name="Allow all in file select"/>
</div>
<div class="flex items-center mt-4"> <div class="flex items-center mt-4">
<Check bind:check={$DataBase.putUserOpen} name="Put OAI Random User"> <Check bind:check={$DataBase.putUserOpen} name="Put OAI Random User">
<Help key="experimental"/><Help key="oaiRandomUser"/> <Help key="experimental"/><Help key="oaiRandomUser"/>
@@ -91,6 +94,7 @@
// this is for testing 2.0 in real environment, but it's not ready yet // this is for testing 2.0 in real environment, but it's not ready yet
const accessCode = 'tendo' const accessCode = 'tendo'
$DataBase.tpo = $DataBase.tpo
if(prompt("Access Code") === accessCode){ if(prompt("Access Code") === accessCode){
$DataBase.tpo = !$DataBase.tpo $DataBase.tpo = !$DataBase.tpo
} }

View File

@@ -507,6 +507,8 @@ export interface Database{
reverseProxyOobaArgs: OobaChatCompletionRequestParams reverseProxyOobaArgs: OobaChatCompletionRequestParams
tpo?:boolean tpo?:boolean
automark?:boolean automark?:boolean
allowAllExtentionFiles?:boolean
} }
export interface customscript{ export interface customscript{
@@ -603,7 +605,6 @@ export interface character{
extentions?:{[key:string]:any} extentions?:{[key:string]:any}
largePortrait?:boolean largePortrait?:boolean
lorePlus?:boolean lorePlus?:boolean
} }

View File

@@ -112,16 +112,12 @@ function selectFileByDom(allowedExtensions:string[], multiple:'multiple'|'single
fileInput.type = 'file'; fileInput.type = 'file';
fileInput.multiple = multiple === 'multiple'; fileInput.multiple = multiple === 'multiple';
if (allowedExtensions && allowedExtensions.length) { if(!(get(DataBase).allowAllExtentionFiles || checkIsIos())){
//check is iphone if (allowedExtensions && allowedExtensions.length) {
if(checkIsIos()){
//allow all
fileInput.accept = '*/*';
}
else{
fileInput.accept = allowedExtensions.map(ext => `.${ext}`).join(','); fileInput.accept = allowedExtensions.map(ext => `.${ext}`).join(',');
} }
} }
fileInput.addEventListener('change', (event) => { fileInput.addEventListener('change', (event) => {
if (fileInput.files.length === 0) { if (fileInput.files.length === 0) {