You've already forked CasaOS
mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-07-15 23:54:17 +02:00
Add CasaConnect function
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
@ -231,10 +232,10 @@ func CheckSerialDiskMount() {
|
||||
}
|
||||
service.MyService.Disk().RemoveLSBLKCache()
|
||||
command.OnlyExec("source " + config.AppInfo.ProjectPath + "/shell/helper.sh ;AutoRemoveUnuseDir")
|
||||
|
||||
}
|
||||
func Update2_3() {
|
||||
command.OnlyExec("source " + config.AppInfo.ProjectPath + "/shell/assist.sh")
|
||||
|
||||
}
|
||||
func CheckToken2_11() {
|
||||
if len(config.ServerInfo.Token) == 0 {
|
||||
@ -253,20 +254,34 @@ func CheckToken2_11() {
|
||||
// config.AppInfo.RootPath = "/casaOS"
|
||||
// config.Cfg.SaveTo(config.SystemConfigInfo.ConfigPath)
|
||||
// }
|
||||
if len(config.FileSettingInfo.ShareDir) == 0 {
|
||||
config.Cfg.Section("file").Key("ShareDir").SetValue("/DATA")
|
||||
config.FileSettingInfo.ShareDir[0] = "/DATA"
|
||||
|
||||
config.Cfg.SaveTo(config.SystemConfigInfo.ConfigPath)
|
||||
}
|
||||
|
||||
sysType := runtime.GOOS
|
||||
if len(config.FileSettingInfo.DownloadDir) == 0 {
|
||||
config.Cfg.Section("file").Key("DownloadDir").SetValue("/DATA/share")
|
||||
config.FileSettingInfo.DownloadDir = "/DATA/share"
|
||||
downloadPath := "/DATA/Downloads"
|
||||
if sysType == "windows" {
|
||||
downloadPath = "C:\\CasaOS\\DATA\\Downloads"
|
||||
}
|
||||
if sysType == "darwin" {
|
||||
downloadPath = "~/CasaOS/DATA/Downloads"
|
||||
}
|
||||
config.Cfg.Section("file").Key("DownloadDir").SetValue(downloadPath)
|
||||
config.FileSettingInfo.DownloadDir = downloadPath
|
||||
file.IsNotExistMkDir(config.FileSettingInfo.DownloadDir)
|
||||
config.Cfg.SaveTo(config.SystemConfigInfo.ConfigPath)
|
||||
}
|
||||
|
||||
if len(config.UserInfo.Description) == 0 {
|
||||
config.Cfg.Section("user").Key("Description").SetValue("nothing")
|
||||
config.UserInfo.Description = "nothing"
|
||||
config.Cfg.SaveTo(config.SystemConfigInfo.ConfigPath)
|
||||
}
|
||||
if len(config.ServerInfo.Handshake) == 0 {
|
||||
config.Cfg.Section("server").Key("Handshake").SetValue("socket.casaos.io")
|
||||
config.ServerInfo.Handshake = "socket.casaos.io"
|
||||
config.Cfg.SaveTo(config.SystemConfigInfo.ConfigPath)
|
||||
}
|
||||
|
||||
service.MyService.System().ExecUSBAutoMountShell(config.ServerInfo.USBAutoMount)
|
||||
|
||||
// str := []string{}
|
||||
// str = append(str, "ddd")
|
||||
// str = append(str, "aaa")
|
||||
|
Reference in New Issue
Block a user