mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-10-15 05:42:31 +00:00
- Fixed the issue where the detail level was not being applied in the log pane.
- Pop-ups are now shown. - Add coverage for test. - Pop-ups are now shown in the web app as well.
This commit is contained in:
@@ -2,3 +2,4 @@ node_modules
|
|||||||
dist
|
dist
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.log
|
*.log
|
||||||
|
.nyc_output
|
||||||
+19
-6
@@ -13,11 +13,11 @@ import type { InjectableSettingService } from "@lib/services/implements/injectab
|
|||||||
import { useOfflineScanner } from "@lib/serviceFeatures/offlineScanner";
|
import { useOfflineScanner } from "@lib/serviceFeatures/offlineScanner";
|
||||||
import { useRedFlagFeatures } from "@/serviceFeatures/redFlag";
|
import { useRedFlagFeatures } from "@/serviceFeatures/redFlag";
|
||||||
import { useCheckRemoteSize } from "@lib/serviceFeatures/checkRemoteSize";
|
import { useCheckRemoteSize } from "@lib/serviceFeatures/checkRemoteSize";
|
||||||
import { useSetupQRCodeFeature } from "@lib/serviceFeatures/setupObsidian/qrCode";
|
|
||||||
import { useSetupURIFeature } from "@lib/serviceFeatures/setupObsidian/setupUri";
|
import { useSetupURIFeature } from "@lib/serviceFeatures/setupObsidian/setupUri";
|
||||||
import { SetupManager } from "@/modules/features/SetupManager";
|
import { SetupManager } from "@/modules/features/SetupManager";
|
||||||
// import { ModuleObsidianSettingsAsMarkdown } from "@/modules/features/ModuleObsidianSettingAsMarkdown";
|
import { useSetupManagerHandlersFeature } from "@/serviceFeatures/setupObsidian/setupManagerHandlers";
|
||||||
// import { ModuleObsidianMenu } from "@/modules/essentialObsidian/ModuleObsidianMenu";
|
import { useP2PReplicatorCommands } from "@/lib/src/replication/trystero/useP2PReplicatorCommands";
|
||||||
|
import { useP2PReplicatorFeature } from "@/lib/src/replication/trystero/useP2PReplicatorFeature";
|
||||||
|
|
||||||
const SETTINGS_DIR = ".livesync";
|
const SETTINGS_DIR = ".livesync";
|
||||||
const SETTINGS_FILE = "settings.json";
|
const SETTINGS_FILE = "settings.json";
|
||||||
@@ -96,6 +96,16 @@ class LiveSyncWebApp {
|
|||||||
return DEFAULT_SETTINGS as ObsidianLiveSyncSettings;
|
return DEFAULT_SETTINGS as ObsidianLiveSyncSettings;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// App lifecycle handlers
|
||||||
|
this.serviceHub.appLifecycle.scheduleRestart.setHandler(async () => {
|
||||||
|
console.log("[AppLifecycle] Restart requested");
|
||||||
|
await this.shutdown();
|
||||||
|
await this.initialize();
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.reload();
|
||||||
|
}, 1000);
|
||||||
|
});
|
||||||
|
|
||||||
// Create LiveSync core
|
// Create LiveSync core
|
||||||
this.core = new LiveSyncBaseCore(
|
this.core = new LiveSyncBaseCore(
|
||||||
this.serviceHub,
|
this.serviceHub,
|
||||||
@@ -114,15 +124,18 @@ class LiveSyncWebApp {
|
|||||||
// new ModuleDev(this, core),
|
// new ModuleDev(this, core),
|
||||||
// new ModuleReplicateTest(this, core),
|
// new ModuleReplicateTest(this, core),
|
||||||
// new ModuleIntegratedTest(this, core),
|
// new ModuleIntegratedTest(this, core),
|
||||||
// new SetupManager(core),
|
// new ModuleReplicatorP2P(core), // Register P2P replicator for CLI (useP2PReplicator is not used here)
|
||||||
new SetupManager(core), // this should be moved to core?
|
new SetupManager(core),
|
||||||
],
|
],
|
||||||
() => [], // No add-ons
|
() => [], // No add-ons
|
||||||
(core) => {
|
(core) => {
|
||||||
useOfflineScanner(core);
|
useOfflineScanner(core);
|
||||||
useRedFlagFeatures(core);
|
useRedFlagFeatures(core);
|
||||||
useCheckRemoteSize(core);
|
useCheckRemoteSize(core);
|
||||||
useSetupQRCodeFeature(core);
|
const replicator = useP2PReplicatorFeature(core);
|
||||||
|
useP2PReplicatorCommands(core, replicator);
|
||||||
|
const setupManager = core.getModule(SetupManager);
|
||||||
|
useSetupManagerHandlersFeature(core, setupManager);
|
||||||
useSetupURIFeature(core);
|
useSetupURIFeature(core);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,16 +1,45 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
||||||
|
import istanbul from "vite-plugin-istanbul";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { readFileSync } from "node:fs";
|
import { readFileSync } from "node:fs";
|
||||||
const packageJson = JSON.parse(readFileSync("../../../package.json", "utf-8"));
|
const packageJson = JSON.parse(readFileSync("../../../package.json", "utf-8"));
|
||||||
const manifestJson = JSON.parse(readFileSync("../../../manifest.json", "utf-8"));
|
const manifestJson = JSON.parse(readFileSync("../../../manifest.json", "utf-8"));
|
||||||
|
const enableCoverage = process.env.PW_COVERAGE === "1";
|
||||||
|
const repoRoot = path.resolve(__dirname, "../../..");
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [svelte()],
|
plugins: [
|
||||||
|
svelte(),
|
||||||
|
...(enableCoverage
|
||||||
|
? [
|
||||||
|
istanbul({
|
||||||
|
cwd: repoRoot,
|
||||||
|
include: ["src/**/*.ts", "src/**/*.svelte"],
|
||||||
|
exclude: [
|
||||||
|
"node_modules",
|
||||||
|
"dist",
|
||||||
|
"test",
|
||||||
|
"coverage",
|
||||||
|
"src/apps/webapp/test/**",
|
||||||
|
"playwright.config.ts",
|
||||||
|
"vite.config.ts",
|
||||||
|
"**/*.spec.ts",
|
||||||
|
"**/*.test.ts",
|
||||||
|
],
|
||||||
|
extension: [".js", ".ts", ".svelte"],
|
||||||
|
requireEnv: false,
|
||||||
|
cypress: false,
|
||||||
|
checkProd: false,
|
||||||
|
}),
|
||||||
|
]
|
||||||
|
: []),
|
||||||
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
"@": path.resolve(__dirname, "../../"),
|
"@": path.resolve(__dirname, "../../"),
|
||||||
"@lib": path.resolve(__dirname, "../../lib/src"),
|
"@lib": path.resolve(__dirname, "../../lib/src"),
|
||||||
|
obsidian: path.resolve(__dirname, "../../../test/harness/obsidian-mock.ts"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
base: "./",
|
base: "./",
|
||||||
@@ -18,9 +47,12 @@ export default defineConfig({
|
|||||||
outDir: "dist",
|
outDir: "dist",
|
||||||
emptyOutDir: true,
|
emptyOutDir: true,
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
|
// test.html is used by the Playwright dev-server; include it here
|
||||||
|
// so the production build doesn't emit warnings about unused inputs.
|
||||||
input: {
|
input: {
|
||||||
index: path.resolve(__dirname, "index.html"),
|
index: path.resolve(__dirname, "index.html"),
|
||||||
webapp: path.resolve(__dirname, "webapp.html"),
|
webapp: path.resolve(__dirname, "webapp.html"),
|
||||||
|
test: path.resolve(__dirname, "test.html"),
|
||||||
},
|
},
|
||||||
external: ["crypto"],
|
external: ["crypto"],
|
||||||
},
|
},
|
||||||
@@ -28,6 +60,8 @@ export default defineConfig({
|
|||||||
define: {
|
define: {
|
||||||
MANIFEST_VERSION: JSON.stringify(process.env.MANIFEST_VERSION || manifestJson.version || "0.0.0"),
|
MANIFEST_VERSION: JSON.stringify(process.env.MANIFEST_VERSION || manifestJson.version || "0.0.0"),
|
||||||
PACKAGE_VERSION: JSON.stringify(process.env.PACKAGE_VERSION || packageJson.version || "0.0.0"),
|
PACKAGE_VERSION: JSON.stringify(process.env.PACKAGE_VERSION || packageJson.version || "0.0.0"),
|
||||||
|
global: "globalThis",
|
||||||
|
hostPlatform: JSON.stringify(process.platform || "linux"),
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
port: 3000,
|
port: 3000,
|
||||||
|
|||||||
@@ -4,6 +4,18 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--background-primary: #ffffff;
|
||||||
|
--background-primary-alt: #667eea;
|
||||||
|
--background-secondary: #f0f0f0;
|
||||||
|
--background-secondary-alt: #e0e0e0;
|
||||||
|
--background-modifier-border: #d0d0d0;
|
||||||
|
--text-normal: #333333;
|
||||||
|
--text-warning: #d9534f;
|
||||||
|
--text-accent: #5bc0de;
|
||||||
|
--text-on-accent: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
||||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
@@ -134,6 +146,7 @@ button {
|
|||||||
|
|
||||||
button:hover {
|
button:hover {
|
||||||
background: #1e4ad6;
|
background: #1e4ad6;
|
||||||
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
button:disabled {
|
button:disabled {
|
||||||
@@ -367,3 +380,23 @@ body.livesync-log-visible {
|
|||||||
bottom: 12px;
|
bottom: 12px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
popup {
|
||||||
|
position: fixed;
|
||||||
|
min-width: 80vw;
|
||||||
|
max-width: 90vw;
|
||||||
|
min-height: 40vh;
|
||||||
|
max-height: 80vh;
|
||||||
|
background: rgba(255, 255, 255, 0.8);
|
||||||
|
padding: 1em;
|
||||||
|
border-radius: 6px;
|
||||||
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
|
||||||
|
z-index: 10000;
|
||||||
|
overflow-y: auto;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
backdrop-filter: blur(15px);
|
||||||
|
border-radius: 10px;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Self-hosted LiveSync</h1>
|
<h1>Self-hosted LiveSync on Web</h1>
|
||||||
<p class="subtitle">Browser-based Self-hosted LiveSync using FileSystem API</p>
|
<p class="subtitle">Browser-based Self-hosted LiveSync using FileSystem API</p>
|
||||||
|
|
||||||
<div id="status" class="info">Initialising...</div>
|
<div id="status" class="info">Initialising...</div>
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>Select a vault folder and grant permission</li>
|
<li>Select a vault folder and grant permission</li>
|
||||||
<li>Create <code>.livesync/settings.json</code> in your vault folder</li>
|
<li>Create <code>.livesync/settings.json</code> in your vault folder</li>
|
||||||
<li>Add your CouchDB connection details</li>
|
<li>Or use Setup-URI to apply settings</li>
|
||||||
<li>Your files will be synced automatically</li>
|
<li>Your files will be synced after "replicate now"</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user