🎨 https://github.com/siyuan-note/siyuan/issues/5066 getBackend
This commit is contained in:
parent
de7c9e5c50
commit
9e83c53872
2 changed files with 12 additions and 1 deletions
|
@ -4,7 +4,7 @@ import {showMessage} from "../dialog/message";
|
|||
import {Dialog} from "../dialog";
|
||||
import {Menu as SiyuanMenu} from "../menus/Menu";
|
||||
import {fetchGet, fetchPost, fetchSyncPost} from "../util/fetch";
|
||||
import {getFrontend} from "../util/functions";
|
||||
import {getBackend, getFrontend} from "../util/functions";
|
||||
/// #if !MOBILE
|
||||
import {openFile, openFileById} from "../editor/util";
|
||||
/// #endif
|
||||
|
@ -205,6 +205,7 @@ export const API = {
|
|||
fetchSyncPost,
|
||||
fetchGet,
|
||||
getFrontend,
|
||||
getBackend,
|
||||
openTab,
|
||||
Plugin,
|
||||
Dialog,
|
||||
|
|
|
@ -2,6 +2,16 @@ export const isMobile = () => {
|
|||
return document.getElementById("sidebar") ? true : false;
|
||||
};
|
||||
|
||||
// "windows" | "linux" | "darwin" | "docker" | "android" | "ios"
|
||||
export const getBackend = () => {
|
||||
if (["docker", "ios", "android"].includes(window.siyuan.config.system.container)) {
|
||||
return window.siyuan.config.system.container
|
||||
} else {
|
||||
return window.siyuan.config.system.os
|
||||
}
|
||||
};
|
||||
|
||||
// "desktop" | "desktop-window" | "mobile" | "browser-desktop" | "browser-mobile"
|
||||
export const getFrontend = () => {
|
||||
/// #if MOBILE
|
||||
if (window.navigator.userAgent.startsWith("SiYuan/")) {
|
||||
|
|
Loading…
Add table
Reference in a new issue