mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-12 23:21:23 +08:00
This commit is contained in:
parent
f3869593f0
commit
2ca0cfadde
@ -6,7 +6,7 @@ import {Constants} from "../constants";
|
||||
import {onGet} from "../protyle/util/onGet";
|
||||
import {hasClosestByAttribute, hasClosestByClassName} from "../protyle/util/hasClosest";
|
||||
import {hideElements} from "../protyle/ui/hideElements";
|
||||
import {needLogin, needSubscribe} from "../util/needSubscribe";
|
||||
import {isPaidUser, needSubscribe} from "../util/needSubscribe";
|
||||
import {fullscreen} from "../protyle/breadcrumb/action";
|
||||
import {MenuItem} from "../menus/Menu";
|
||||
import {escapeHtml} from "../util/escape";
|
||||
@ -394,7 +394,7 @@ export const bindCardEvent = (options: {
|
||||
}, () => {
|
||||
/// #if MOBILE
|
||||
if (type !== "-3" &&
|
||||
((0 !== window.siyuan.config.sync.provider && !needLogin("")) ||
|
||||
((0 !== window.siyuan.config.sync.provider && isPaidUser()) ||
|
||||
(0 === window.siyuan.config.sync.provider && !needSubscribe(""))) &&
|
||||
window.siyuan.config.repo.key && window.siyuan.config.sync.enabled) {
|
||||
document.getElementById("toolbarSync").classList.remove("fn__none");
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {needLogin, needSubscribe} from "../util/needSubscribe";
|
||||
import {isPaidUser, needSubscribe} from "../util/needSubscribe";
|
||||
import {fetchPost} from "../util/fetch";
|
||||
import {showMessage} from "../dialog/message";
|
||||
import {bindSyncCloudListEvent, getSyncCloudList} from "../sync/syncGuide";
|
||||
@ -38,8 +38,8 @@ const renderProvider = (provider: number) => {
|
||||
${window.siyuan.languages.syncOfficialProviderIntro}
|
||||
</div>`;
|
||||
}
|
||||
if (needLogin("")) {
|
||||
return `<div class="b3-label b3-label--inner">${window.siyuan.languages.needLogin}</div>`;
|
||||
if (!isPaidUser()) {
|
||||
return `<div class="b3-label b3-label--inner">${window.siyuan.languages["_kernel"][214]}</div>`;
|
||||
}
|
||||
if (provider === 2) {
|
||||
return `<div class="b3-label b3-label--inner">
|
||||
@ -235,7 +235,7 @@ const bindProviderEvent = () => {
|
||||
loadingElement.classList.add("fn__none");
|
||||
let nextElement = reposDataElement.nextElementSibling;
|
||||
while (nextElement) {
|
||||
if (!needLogin("")) {
|
||||
if (isPaidUser()) {
|
||||
nextElement.classList.remove("fn__none");
|
||||
} else {
|
||||
nextElement.classList.add("fn__none");
|
||||
|
@ -17,7 +17,7 @@ import {genEmptyElement, genSBElement} from "../../block/util";
|
||||
import {hideElements} from "../ui/hideElements";
|
||||
import {reloadProtyle} from "../util/reload";
|
||||
import {countBlockWord} from "../../layout/status";
|
||||
import {needLogin, needSubscribe} from "../../util/needSubscribe";
|
||||
import {isPaidUser, needSubscribe} from "../../util/needSubscribe";
|
||||
import {resize} from "../util/resize";
|
||||
|
||||
const removeTopElement = (updateElement: Element, protyle: IProtyle) => {
|
||||
@ -74,7 +74,7 @@ const promiseTransaction = () => {
|
||||
promiseTransaction();
|
||||
}
|
||||
/// #if MOBILE
|
||||
if (((0 !== window.siyuan.config.sync.provider && !needLogin("")) ||
|
||||
if (((0 !== window.siyuan.config.sync.provider && isPaidUser()) ||
|
||||
(0 === window.siyuan.config.sync.provider && !needSubscribe(""))) &&
|
||||
window.siyuan.config.repo.key && window.siyuan.config.sync.enabled) {
|
||||
document.getElementById("toolbarSync").classList.remove("fn__none");
|
||||
|
@ -190,6 +190,12 @@ export const assetInputEvent = (element: Element, localSearch?: ISearchAssetOpti
|
||||
orderBy: localSearch.sort
|
||||
}, (response) => {
|
||||
element.nextElementSibling.classList.add("fn__none");
|
||||
if (response.code === 1) {
|
||||
element.querySelector("#searchAssetList").innerHTML = `<div class="search__empty">
|
||||
${window.siyuan.languages["_kernel"][214]}
|
||||
</div>`;
|
||||
return;
|
||||
}
|
||||
const nextElement = element.querySelector('[data-type="assetNext"]');
|
||||
if (page < response.data.pageCount) {
|
||||
nextElement.removeAttribute("disabled");
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {needLogin, needSubscribe} from "../util/needSubscribe";
|
||||
import {isPaidUser, needSubscribe} from "../util/needSubscribe";
|
||||
import {showMessage} from "../dialog/message";
|
||||
import {fetchPost} from "../util/fetch";
|
||||
import {Dialog} from "../dialog";
|
||||
@ -147,7 +147,8 @@ export const syncGuide = (app?: App) => {
|
||||
}
|
||||
/// #if MOBILE
|
||||
if ((0 === window.siyuan.config.sync.provider && needSubscribe()) ||
|
||||
(0 !== window.siyuan.config.sync.provider && needLogin())) {
|
||||
(0 !== window.siyuan.config.sync.provider && !isPaidUser())) {
|
||||
showMessage(window.siyuan.languages["_kernel"][214]);
|
||||
return;
|
||||
}
|
||||
/// #else
|
||||
@ -164,10 +165,8 @@ export const syncGuide = (app?: App) => {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (0 !== window.siyuan.config.sync.provider && needLogin("") && app) {
|
||||
const dialogSetting = openSetting(app);
|
||||
dialogSetting.element.querySelector('.b3-tab-bar [data-name="account"]').dispatchEvent(new CustomEvent("click"));
|
||||
dialogSetting.element.querySelector('.config__tab-container[data-name="account"]').setAttribute("data-action", "go-repos");
|
||||
if (0 !== window.siyuan.config.sync.provider && !isPaidUser() && app) {
|
||||
showMessage(window.siyuan.languages["_kernel"][214]);
|
||||
return;
|
||||
}
|
||||
/// #endif
|
||||
|
@ -1,16 +1,6 @@
|
||||
import {showMessage} from "../dialog/message";
|
||||
import {getCloudURL} from "../config/util/about";
|
||||
|
||||
export const needLogin = (tip = window.siyuan.languages.needLogin) => {
|
||||
if (window.siyuan.user) {
|
||||
return false;
|
||||
}
|
||||
if (tip) {
|
||||
showMessage(tip);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
export const needSubscribe = (tip = window.siyuan.languages._kernel[29]) => {
|
||||
if (window.siyuan.user && (window.siyuan.user.userSiYuanProExpireTime === -1 || window.siyuan.user.userSiYuanProExpireTime > 0)) {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user