mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 15:40:12 +01:00
🎨 Sign in to use S3/WebDAV data sync https://github.com/siyuan-note/siyuan/issues/8779
This commit is contained in:
parent
11764557ac
commit
c4558c26dd
3 changed files with 45 additions and 24 deletions
|
|
@ -39,6 +39,7 @@ type User struct {
|
||||||
UserSiYuanSubscriptionPlan float64 `json:"userSiYuanSubscriptionPlan"` // -1:未订阅,0:标准订阅,1:教育订阅,2:试用
|
UserSiYuanSubscriptionPlan float64 `json:"userSiYuanSubscriptionPlan"` // -1:未订阅,0:标准订阅,1:教育订阅,2:试用
|
||||||
UserSiYuanSubscriptionStatus float64 `json:"userSiYuanSubscriptionStatus"` // -1:未订阅,0:订阅可用,1:订阅封禁,2:订阅过期
|
UserSiYuanSubscriptionStatus float64 `json:"userSiYuanSubscriptionStatus"` // -1:未订阅,0:订阅可用,1:订阅封禁,2:订阅过期
|
||||||
UserSiYuanSubscriptionType float64 `json:"userSiYuanSubscriptionType"` // 0 年付;1 终生;2 月付
|
UserSiYuanSubscriptionType float64 `json:"userSiYuanSubscriptionType"` // 0 年付;1 终生;2 月付
|
||||||
|
UserSiYuanThirdPartySyncPayStatus float64 `json:"UserSiYuanThirdPartySyncPayStatus"` // 0 未付费;1 已付费
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserTitle struct {
|
type UserTitle struct {
|
||||||
|
|
|
||||||
|
|
@ -714,6 +714,15 @@ func IsSubscriber() bool {
|
||||||
return nil != Conf.User && (-1 == Conf.User.UserSiYuanProExpireTime || 0 < Conf.User.UserSiYuanProExpireTime) && 0 == Conf.User.UserSiYuanSubscriptionStatus
|
return nil != Conf.User && (-1 == Conf.User.UserSiYuanProExpireTime || 0 < Conf.User.UserSiYuanProExpireTime) && 0 == Conf.User.UserSiYuanSubscriptionStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsThirdPartySyncPaid() bool {
|
||||||
|
if IsSubscriber() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return nil != Conf.User // Sign in to use S3/WebDAV data sync https://github.com/siyuan-note/siyuan/issues/8779
|
||||||
|
// TODO https://github.com/siyuan-note/siyuan/issues/8780
|
||||||
|
// return nil != Conf.User && 1 == Conf.User.UserSiYuanThirdPartySyncPayStatus
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MaskedUserData = ""
|
MaskedUserData = ""
|
||||||
MaskedAccessAuthCode = "*******"
|
MaskedAccessAuthCode = "*******"
|
||||||
|
|
|
||||||
|
|
@ -229,9 +229,20 @@ func checkSync(boot, exit, byHand bool) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if !IsSubscriber() && conf.ProviderSiYuan == Conf.Sync.Provider {
|
switch Conf.Sync.Provider {
|
||||||
|
case conf.ProviderSiYuan:
|
||||||
|
if !IsSubscriber() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
case conf.ProviderWebDAV:
|
||||||
|
if !IsThirdPartySyncPaid() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
case conf.ProviderS3:
|
||||||
|
if !IsThirdPartySyncPaid() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if util.IsMutexLocked(&syncLock) {
|
if util.IsMutexLocked(&syncLock) {
|
||||||
logging.LogWarnf("sync is in progress")
|
logging.LogWarnf("sync is in progress")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue