diff --git a/src/controller/main.ts b/src/controller/main.ts index 758fb0d..785ce0a 100644 --- a/src/controller/main.ts +++ b/src/controller/main.ts @@ -69,7 +69,7 @@ async function init(setStartStr: Function) { await addAlistInRclone() //await reupStorage()//addAlistInRclone中结尾有reupStorage所以注释 await reupMount() - + //自动挂载 await autoMount() diff --git a/src/utils/alist/request.ts b/src/utils/alist/request.ts index 3aca5c0..e6cb303 100644 --- a/src/utils/alist/request.ts +++ b/src/utils/alist/request.ts @@ -3,9 +3,12 @@ import runCmd from "../tauri/cmd"; import { addParams } from "./process"; async function alist_api_ping(){ - console.log (await fetch(alistInfo.endpoint.url+'/ping',{method: 'GET'} ).then((res) => { return res.ok;})) - - return await fetch(alistInfo.endpoint.url+'/ping',{method: 'GET'} ).then((res) => { return res.ok;}) + try { + return await fetch(alistInfo.endpoint.url+'/ping',{method: 'GET'} ).then((res) => res.ok) + }catch (e) { + console.log(e) + return false + } } diff --git a/src/utils/rclone/process.ts b/src/utils/rclone/process.ts index 81e6578..ef0dcf7 100644 --- a/src/utils/rclone/process.ts +++ b/src/utils/rclone/process.ts @@ -51,7 +51,7 @@ async function startRclone() { while (true) { await setTimeout(() => { }, 1000); - if (await rclone_api_noop()&&rcloneInfo.process.log.includes('Serving remote control on')) { + if (await rclone_api_noop()/* &&rcloneInfo.process.log.includes('Serving remote control on') */) { break; } } diff --git a/src/utils/rclone/request.ts b/src/utils/rclone/request.ts index 254c4e8..15d0b8f 100644 --- a/src/utils/rclone/request.ts +++ b/src/utils/rclone/request.ts @@ -7,7 +7,12 @@ let rcloneApiHeaders = { }; async function rclone_api_noop(): Promise { - return fetch(rcloneInfo.endpoint.url + '/rc/noop', { method: 'POST' }).then(data => data.ok); + try { + return await fetch(rcloneInfo.endpoint.url + '/rc/noop', { method: 'POST' }).then(data => data.ok) + } catch (e) { + console.log(e) + return false; + } } function rclone_api_post(path: string, bodyData: object = {}, ignoreError?: boolean) {