🔥 移除旧版云端同步和备份功能入口 https://github.com/siyuan-note/siyuan/issues/5405

This commit is contained in:
Liang Ding 2022-07-13 17:14:54 +08:00
parent bc046e7339
commit 8581f83e61
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
12 changed files with 54 additions and 312 deletions

View file

@ -18,9 +18,7 @@ package model
import (
"bytes"
"crypto/sha256"
"errors"
"fmt"
"os"
"path/filepath"
"runtime"
@ -63,8 +61,6 @@ type AppConf struct {
ReadOnly bool `json:"readonly"` // 是否是只读
LocalIPs []string `json:"localIPs"` // 本地 IP 列表
AccessAuthCode string `json:"accessAuthCode"` // 访问授权码
E2EEPasswd string `json:"e2eePasswd"` // 端到端加密密码,用于备份和同步
E2EEPasswdMode int `json:"e2eePasswdMode"` // 端到端加密密码生成方式0自动1自定义
System *conf.System `json:"system"` // 系统
Keymap *conf.Keymap `json:"keymap"` // 快捷键
Backup *conf.Backup `json:"backup"` // 备份配置
@ -283,11 +279,6 @@ func InitConf() {
Conf.AccessAuthCode = util.AccessAuthCode
}
Conf.E2EEPasswdMode = 0
if !isBuiltInE2EEPasswd() {
Conf.E2EEPasswdMode = 1
}
Conf.LocalIPs = util.GetLocalIPs()
Conf.Save()
@ -555,23 +546,6 @@ func IsSubscriber() bool {
return nil != Conf.User && (-1 == Conf.User.UserSiYuanProExpireTime || 0 < Conf.User.UserSiYuanProExpireTime) && 0 == Conf.User.UserSiYuanSubscriptionStatus
}
func isBuiltInE2EEPasswd() bool {
if nil == Conf || nil == Conf.User || "" == Conf.E2EEPasswd {
return true
}
pwd := GetBuiltInE2EEPasswd()
return Conf.E2EEPasswd == util.AESEncrypt(pwd)
}
func GetBuiltInE2EEPasswd() (ret string) {
part1 := Conf.User.UserId[:7]
part2 := Conf.User.UserId[7:]
ret = part2 + part1
ret = fmt.Sprintf("%x", sha256.Sum256([]byte(ret)))[:7]
return
}
func clearWorkspaceTemp() {
os.RemoveAll(filepath.Join(util.TempDir, "bazaar"))
os.RemoveAll(filepath.Join(util.TempDir, "export"))