diff --git a/app/src/plugin/API.ts b/app/src/plugin/API.ts index 584cc1efd..4e25f6122 100644 --- a/app/src/plugin/API.ts +++ b/app/src/plugin/API.ts @@ -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, diff --git a/app/src/util/functions.ts b/app/src/util/functions.ts index 708ac7842..b2c912c3d 100644 --- a/app/src/util/functions.ts +++ b/app/src/util/functions.ts @@ -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/")) {