This commit is contained in:
Daniel 2023-09-25 16:38:24 +08:00
parent 7923cca130
commit 30d60d2de8
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
5 changed files with 16 additions and 11 deletions

View file

@ -20,7 +20,7 @@ import {hideElements} from "../ui/hideElements";
import {genAssetHTML} from "../../asset/renderAssets";
import {unicode2Emoji} from "../../emoji";
import {avRender} from "../render/av/render";
import {needSubscribe} from "../../util/needSubscribe";
import {isPaidUser} from "../../util/needSubscribe";
export const hintSlash = (key: string, protyle: IProtyle) => {
const allList: IHintData[] = [{
@ -48,7 +48,7 @@ export const hintSlash = (key: string, protyle: IProtyle) => {
value: Constants.ZWSP + 5,
html: '<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconSparkles"></use></svg><span class="b3-list-item__text">AI Chat</span></div>',
}]
if (!needSubscribe("")) {
if (isPaidUser()) {
allList.push({
filter: ["数据库", "属性视图", "shujuku", "shuxingshitu", "sjk", "sxst", "database", "attribute view"],
value: '<div data-type="NodeAttributeView" data-av-type="table"></div>',

View file

@ -12,7 +12,8 @@ export const needLogin = (tip = window.siyuan.languages.needLogin) => {
};
export const needSubscribe = (tip = window.siyuan.languages._kernel[29]) => {
if (window.siyuan.user && (window.siyuan.user.userSiYuanProExpireTime === -1 || window.siyuan.user.userSiYuanProExpireTime > 0)) {
if (window.siyuan.user && (window.siyuan.user.userSiYuanProExpireTime === -1 || window.siyuan.user.userSiYuanProExpireTime > 0) ||
window.siyuan.user.userSiYuanOneTimePayStatus === 1) {
return false;
}
if (tip) {
@ -27,3 +28,7 @@ export const needSubscribe = (tip = window.siyuan.languages._kernel[29]) => {
}
return true;
};
export const isPaidUser = () => {
return 0 === window.siyuan.user.userSiYuanSubscriptionStatus || 1 === window.siyuan.user.userSiYuanOneTimePayStatus;
}

View file

@ -714,12 +714,12 @@ func IsSubscriber() bool {
return nil != Conf.User && (-1 == Conf.User.UserSiYuanProExpireTime || 0 < Conf.User.UserSiYuanProExpireTime) && 0 == Conf.User.UserSiYuanSubscriptionStatus
}
func IsOneTimePaid() bool {
func IsPaidUser() 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
// TODO S3/WebDAV data sync and backup are available for a fee https://github.com/siyuan-note/siyuan/issues/8780
// return nil != Conf.User && 1 == Conf.User.UserSiYuanOneTimePayStatus
}

View file

@ -634,7 +634,7 @@ func DownloadCloudSnapshot(tag, id string) (err error) {
return
}
case conf.ProviderWebDAV, conf.ProviderS3:
if !IsOneTimePaid() {
if !IsPaidUser() {
util.PushErrMsg(Conf.Language(214), 5000)
return
}
@ -676,7 +676,7 @@ func UploadCloudSnapshot(tag, id string) (err error) {
return
}
case conf.ProviderWebDAV, conf.ProviderS3:
if !IsOneTimePaid() {
if !IsPaidUser() {
util.PushErrMsg(Conf.Language(214), 5000)
return
}
@ -722,7 +722,7 @@ func RemoveCloudRepoTag(tag string) (err error) {
return
}
case conf.ProviderWebDAV, conf.ProviderS3:
if !IsOneTimePaid() {
if !IsPaidUser() {
util.PushErrMsg(Conf.Language(214), 5000)
return
}
@ -754,7 +754,7 @@ func GetCloudRepoTagSnapshots() (ret []*dejavu.Log, err error) {
return
}
case conf.ProviderWebDAV, conf.ProviderS3:
if !IsOneTimePaid() {
if !IsPaidUser() {
util.PushErrMsg(Conf.Language(214), 5000)
return
}
@ -790,7 +790,7 @@ func GetCloudRepoSnapshots(page int) (ret []*dejavu.Log, pageCount, totalCount i
return
}
case conf.ProviderWebDAV, conf.ProviderS3:
if !IsOneTimePaid() {
if !IsPaidUser() {
util.PushErrMsg(Conf.Language(214), 5000)
return
}

View file

@ -235,7 +235,7 @@ func checkSync(boot, exit, byHand bool) bool {
return false
}
case conf.ProviderWebDAV, conf.ProviderS3:
if !IsOneTimePaid() {
if !IsPaidUser() {
return false
}
}