disable ignis specific plugins if synced to regular obsidian instance
This commit is contained in:
parent
91ab6c77c9
commit
3fed6241bd
4 changed files with 37 additions and 2 deletions
5
build.js
5
build.js
|
|
@ -2,6 +2,8 @@ const esbuild = require("esbuild");
|
||||||
const sveltePlugin = require("esbuild-svelte");
|
const sveltePlugin = require("esbuild-svelte");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
|
const { version: ignisVersion } = require("./package.json");
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
// Build shim-loader.js
|
// Build shim-loader.js
|
||||||
esbuild.build({
|
esbuild.build({
|
||||||
|
|
@ -14,6 +16,9 @@ Promise.all([
|
||||||
alias: {
|
alias: {
|
||||||
path: "path-browserify",
|
path: "path-browserify",
|
||||||
},
|
},
|
||||||
|
define: {
|
||||||
|
__IGNIS_VERSION__: JSON.stringify(ignisVersion),
|
||||||
|
},
|
||||||
logLevel: "info",
|
logLevel: "info",
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,13 @@
|
||||||
const { Plugin, TFile, TFolder } = require("obsidian");
|
const { Plugin, TFile, TFolder } = require("obsidian");
|
||||||
const { showFilePicker, addFileMenuItems, addFolderMenuItems } = require("./file-actions");
|
const {
|
||||||
const { patchSettingsModal, unpatchSettingsModal } = require("./settings/inject");
|
showFilePicker,
|
||||||
|
addFileMenuItems,
|
||||||
|
addFolderMenuItems,
|
||||||
|
} = require("./file-actions");
|
||||||
|
const {
|
||||||
|
patchSettingsModal,
|
||||||
|
unpatchSettingsModal,
|
||||||
|
} = require("./settings/inject");
|
||||||
const pluginRegistry = require("./plugin-registry");
|
const pluginRegistry = require("./plugin-registry");
|
||||||
const { initStatusBar } = require("./status-bar");
|
const { initStatusBar } = require("./status-bar");
|
||||||
const { WorkspacePickerModal } = require("./workspace-picker");
|
const { WorkspacePickerModal } = require("./workspace-picker");
|
||||||
|
|
@ -10,6 +17,11 @@ window.__obsidianAPI = require("obsidian");
|
||||||
|
|
||||||
class IgnisBridgePlugin extends Plugin {
|
class IgnisBridgePlugin extends Plugin {
|
||||||
async onload() {
|
async onload() {
|
||||||
|
if (!window.__ignis) {
|
||||||
|
console.log("[ignis-bridge] Not running in Ignis - plugin is a no-op.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
console.log("[ignis-bridge] Plugin loaded");
|
console.log("[ignis-bridge] Plugin loaded");
|
||||||
|
|
||||||
await pluginRegistry.refresh();
|
await pluginRegistry.refresh();
|
||||||
|
|
@ -41,6 +53,10 @@ class IgnisBridgePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
onunload() {
|
onunload() {
|
||||||
|
if (!window.__ignis) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this._statusBarInterval) {
|
if (this._statusBarInterval) {
|
||||||
clearInterval(this._statusBarInterval);
|
clearInterval(this._statusBarInterval);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,13 @@ const api = require("./api");
|
||||||
|
|
||||||
class IgnisHeadlessSyncPlugin extends Plugin {
|
class IgnisHeadlessSyncPlugin extends Plugin {
|
||||||
async onload() {
|
async onload() {
|
||||||
|
if (!window.__ignis) {
|
||||||
|
console.log(
|
||||||
|
"[ignis-headless-sync] Not running in Ignis - plugin is a no-op.",
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.wsListener = new WsListener();
|
this.wsListener = new WsListener();
|
||||||
this.wsListener.start();
|
this.wsListener.start();
|
||||||
|
|
||||||
|
|
@ -53,6 +60,10 @@ class IgnisHeadlessSyncPlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
onunload() {
|
onunload() {
|
||||||
|
if (!window.__ignis) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
window.__ignisHeadlessSyncActive = false;
|
window.__ignisHeadlessSyncActive = false;
|
||||||
|
|
||||||
if (this._coreSyncGuard) {
|
if (this._coreSyncGuard) {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@ import { installCssOverrides } from "./css-overrides.js";
|
||||||
import { initialize } from "./init.js";
|
import { initialize } from "./init.js";
|
||||||
import { fsShim } from "./fs/index.js";
|
import { fsShim } from "./fs/index.js";
|
||||||
|
|
||||||
|
// __IGNIS_VERSION__ is replaced at build time from package.json.
|
||||||
|
window.__ignis = { version: __IGNIS_VERSION__ };
|
||||||
|
|
||||||
installGlobals(); // process, Buffer, window overrides (before require so Buffer is available)
|
installGlobals(); // process, Buffer, window overrides (before require so Buffer is available)
|
||||||
installRequire(); // shim registry, window.require
|
installRequire(); // shim registry, window.require
|
||||||
installCssOverrides(); // browser-specific CSS fixes
|
installCssOverrides(); // browser-specific CSS fixes
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue