mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-12 02:04:20 +01:00
This commit is contained in:
parent
3cc264b738
commit
007b5da460
3 changed files with 29 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"useChrome": "为了更好的体检,建议使用 Chrome 进行浏览",
|
||||
"clearAllAV": "确认清理所有未引用的数据库?",
|
||||
"unreferencedAV": "未引用的数据库",
|
||||
"includeSubDocs": "包含子文档",
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ import {
|
|||
setTitle,
|
||||
transactionError
|
||||
} from "./dialog/processSystem";
|
||||
import {initMessage} from "./dialog/message";
|
||||
import {initMessage, showMessage} from "./dialog/message";
|
||||
import {getAllTabs} from "./layout/getAll";
|
||||
import {getLocalStorage} from "./protyle/util/compatibility";
|
||||
import {getLocalStorage, isChromeBrowser} from "./protyle/util/compatibility";
|
||||
import {getSearch} from "./util/functions";
|
||||
import {checkPublishServiceClosed} from "./util/processMessage";
|
||||
import {hideAllElements} from "./protyle/ui/hideElements";
|
||||
|
|
@ -212,6 +212,11 @@ export class App {
|
|||
account.onSetaccount();
|
||||
setTitle(window.siyuan.languages.siyuanNote);
|
||||
initMessage();
|
||||
/// #if BROWSER && !MOBILE
|
||||
if (!isChromeBrowser()) {
|
||||
showMessage(window.siyuan.languages.useChrome, 0, "error");
|
||||
}
|
||||
/// #endif
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -359,6 +359,27 @@ export const isInEdge = () => {
|
|||
return ua.indexOf("EdgA/") > -1 || ua.indexOf("Edge/") > -1;
|
||||
};
|
||||
|
||||
export function isChromeBrowser(): boolean {
|
||||
const nav = window.navigator as Navigator & {
|
||||
userAgentData: {
|
||||
brands: {
|
||||
brand: string;
|
||||
version: string;
|
||||
}[]
|
||||
}
|
||||
};
|
||||
if (nav.userAgentData && Array.isArray(nav.userAgentData.brands)) {
|
||||
return nav.userAgentData.brands.some((b: any) => /Chrome|Chromium/i.test(b.brand));
|
||||
}
|
||||
// 回退到 userAgent
|
||||
const ua = nav.userAgent || "";
|
||||
const isChromium = /\bChrome\/\d+/i.test(ua) || /\bChromium\/\d+/i.test(ua);
|
||||
const isEdge = /\bEdg(e|A|iOS)?\/\d+/i.test(ua); // Edge Chromium
|
||||
const isOpera = /\b(OPR|Opera)\/\d+/i.test(ua);
|
||||
|
||||
return isChromium && !isEdge && !isOpera;
|
||||
}
|
||||
|
||||
export const updateHotkeyAfterTip = (hotkey: string, split = " ") => {
|
||||
if (hotkey) {
|
||||
return split + updateHotkeyTip(hotkey);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue