Skip to content

Commit

Permalink
mac
Browse files Browse the repository at this point in the history
  • Loading branch information
VirtualHotBar committed May 13, 2024
1 parent c6f5dc1 commit 4d8d8c5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/controller/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async function init(setStartStr: Function) {
await addAlistInRclone()
//await reupStorage()//addAlistInRclone中结尾有reupStorage所以注释
await reupMount()

//自动挂载
await autoMount()

Expand Down
9 changes: 6 additions & 3 deletions src/utils/alist/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}


Expand Down
2 changes: 1 addition & 1 deletion src/utils/rclone/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/utils/rclone/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ let rcloneApiHeaders = {
};

async function rclone_api_noop(): Promise<boolean> {
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) {
Expand Down

0 comments on commit 4d8d8c5

Please sign in to comment.