mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 00:20:12 +01:00
🎨 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 {Dialog} from "../dialog";
|
||||||
import {Menu as SiyuanMenu} from "../menus/Menu";
|
import {Menu as SiyuanMenu} from "../menus/Menu";
|
||||||
import {fetchGet, fetchPost, fetchSyncPost} from "../util/fetch";
|
import {fetchGet, fetchPost, fetchSyncPost} from "../util/fetch";
|
||||||
import {getFrontend} from "../util/functions";
|
import {getBackend, getFrontend} from "../util/functions";
|
||||||
/// #if !MOBILE
|
/// #if !MOBILE
|
||||||
import {openFile, openFileById} from "../editor/util";
|
import {openFile, openFileById} from "../editor/util";
|
||||||
/// #endif
|
/// #endif
|
||||||
|
|
@ -205,6 +205,7 @@ export const API = {
|
||||||
fetchSyncPost,
|
fetchSyncPost,
|
||||||
fetchGet,
|
fetchGet,
|
||||||
getFrontend,
|
getFrontend,
|
||||||
|
getBackend,
|
||||||
openTab,
|
openTab,
|
||||||
Plugin,
|
Plugin,
|
||||||
Dialog,
|
Dialog,
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,16 @@ export const isMobile = () => {
|
||||||
return document.getElementById("sidebar") ? true : false;
|
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 = () => {
|
export const getFrontend = () => {
|
||||||
/// #if MOBILE
|
/// #if MOBILE
|
||||||
if (window.navigator.userAgent.startsWith("SiYuan/")) {
|
if (window.navigator.userAgent.startsWith("SiYuan/")) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue