diff --git a/frontend/src/components/setting/SetSystem.vue b/frontend/src/components/setting/SetSystem.vue
index 51b54db..fd60947 100644
--- a/frontend/src/components/setting/SetSystem.vue
+++ b/frontend/src/components/setting/SetSystem.vue
@@ -38,7 +38,7 @@
@@ -195,8 +195,8 @@ function submitOsInfo() {
RestartApp();
}
if (saveData.storeType === "webdav") {
- const urlRegex = /^(https?:\/\/)[^\/]+$/;
- if (!urlRegex.test(saveData.webdavClient.url)) {
+ const urlRegex = /^(https?:\/\/)/;
+ if (!urlRegex.test(saveData.webdavClient.url.trim())) {
Dialog.showMessageBox({
message: "服务器地址格式错误",
type: "error",
diff --git a/frontend/src/system/event/SystemEvent.ts b/frontend/src/system/event/SystemEvent.ts
index ed3e352..6211e51 100644
--- a/frontend/src/system/event/SystemEvent.ts
+++ b/frontend/src/system/event/SystemEvent.ts
@@ -2,7 +2,7 @@ import { mountEvent, emitEvent } from './EventHook';
import { RootState } from '../root';
import { useSystem } from '../index';
-import { join } from '../core/Path';
+//import { join } from '../core/Path';
function initSizeEvent() {
const rootState = useSystem()._rootState;
@@ -54,35 +54,35 @@ function initNetworkEvent() {
rootState.info.connection = connection;
});
}
-function setAlertTask(time: number, callback: any) {
- const date = new Date(); //现在时刻
- const dateIntegralPoint = new Date(time);
+// function setAlertTask(time: number, callback: any) {
+// const date = new Date(); //现在时刻
+// const dateIntegralPoint = new Date(time);
- setTimeout(() => {
- callback();
- }, dateIntegralPoint.getTime() - date.getTime()); //用户登录后的下一个整点执行。
-}
+// setTimeout(() => {
+// callback();
+// }, dateIntegralPoint.getTime() - date.getTime()); //用户登录后的下一个整点执行。
+// }
async function initAlertEvent() {
- const sys = useSystem();
+ // const sys = useSystem();
- const chosenDay = new Date();
- const fileName = `${chosenDay.getFullYear()}-${chosenDay.getMonth() + 1}-${chosenDay.getDate()}.json`;
- const alredyNotes = await sys.fs.readFile(
- join(sys._rootState.options.userLocation || '', '/Schedule', fileName)
- );
- if (alredyNotes) {
- const alertList = JSON.parse(alredyNotes);
- alertList.forEach((item: any) => {
- if (item.time < Date.now()) return;
- setAlertTask(item.time, () => {
- sys.createNotify({
- title: '日程提醒',
- content: `今日${new Date(item.time).getHours()}时${new Date(item.time).getMinutes()}分 的提醒: ${
- item.text
- }`,
- });
- });
- });
- }
+ // const chosenDay = new Date();
+ // const fileName = `${chosenDay.getFullYear()}-${chosenDay.getMonth() + 1}-${chosenDay.getDate()}.json`;
+ // const alredyNotes = await sys.fs.readFile(
+ // join(sys._rootState.options.userLocation || '', '/Schedule', fileName)
+ // );
+ // if (alredyNotes) {
+ // const alertList = JSON.parse(alredyNotes);
+ // alertList.forEach((item: any) => {
+ // if (item.time < Date.now()) return;
+ // setAlertTask(item.time, () => {
+ // sys.createNotify({
+ // title: '日程提醒',
+ // content: `今日${new Date(item.time).getHours()}时${new Date(item.time).getMinutes()}分 的提醒: ${
+ // item.text
+ // }`,
+ // });
+ // });
+ // });
+ // }
}
export { initSizeEvent, initBatteryEvent, initNetworkEvent, initAlertEvent };
diff --git a/frontend/src/system/index.ts b/frontend/src/system/index.ts
index b92d108..5222de9 100644
--- a/frontend/src/system/index.ts
+++ b/frontend/src/system/index.ts
@@ -117,11 +117,13 @@ export class System {
}
const upgradeStore = useUpgradeStore();
upgradeStore.checkUpdate()
- // setTimeout(() => {
- // if (this._rootState.magnet?.length < 1) {
- // this.recover()
- // }
- // }, 3000);
+ setTimeout(() => {
+ if (this._rootState.magnet?.length < 1) {
+ //this.recover()
+ clearSystemConfig();
+ RestartApp();
+ }
+ }, 3000);
}, 6000);
}
@@ -248,11 +250,7 @@ export class System {
private async initFileSystem() {
const storeType = getSystemKey("storeType")
- if (storeType == 'local' || storeType == 'net'){
- //this.fs = this._options.fs;
- this.fs = useOsFile();
- await this.initOutSystem()
- } else {
+ if(storeType == 'browser'){
this.fs = await new OsFileSystem().initFileSystem(this._options);
(this.fs as OsFileSystem).on('error', (err: string) => {
this.emitError(err);
@@ -260,6 +258,10 @@ export class System {
this.fs.registerWatcher(new RegExp(`^${this._options.userLocation}`), () => {
this.initAppList();
});
+ }else{
+ //this.fs = this._options.fs;
+ this.fs = useOsFile();
+ await this.initOutSystem()
}
}
async initOutSystem() {
diff --git a/godo/sys/setting.go b/godo/sys/setting.go
index cdf7cd2..fa4c39b 100644
--- a/godo/sys/setting.go
+++ b/godo/sys/setting.go
@@ -38,7 +38,7 @@ func ConfigHandler(w http.ResponseWriter, r *http.Request) {
libs.SetConfig(req)
err := webdav.InitWebdav()
if err != nil {
- libs.ErrorMsg(w, "The webdav client init is error!")
+ libs.ErrorMsg(w, "The webdav client init is error:"+err.Error())
return
}
}
diff --git a/godo/webdav/httpclient.go b/godo/webdav/httpclient.go
index f52909a..8b87fe0 100644
--- a/godo/webdav/httpclient.go
+++ b/godo/webdav/httpclient.go
@@ -17,22 +17,23 @@ func InitWebdav() error {
return fmt.Errorf("failed to find configuration for webdavClient")
}
- infoMap, ok := clientInfo.(map[string]string)
+ // 检查 clientInfo 是否为 map 类型
+ infoMap, ok := clientInfo.(map[string]interface{})
if !ok {
- return fmt.Errorf("configuration for webdavClient is not a map[string]string")
+ return fmt.Errorf("configuration for webdavClient is not a map")
}
- url, ok := infoMap["url"]
+ url, ok := infoMap["url"].(string)
if !ok {
return fmt.Errorf("missing 'url' in webdavClient configuration")
}
- username, ok := infoMap["username"]
+ username, ok := infoMap["username"].(string)
if !ok {
return fmt.Errorf("missing 'username' in webdavClient configuration")
}
- password, ok := infoMap["password"]
+ password, ok := infoMap["password"].(string)
if !ok {
return fmt.Errorf("missing 'password' in webdavClient configuration")
}