This commit is contained in:
Zef Hemel
2023-02-28 11:13:18 +01:00
parent 520b5e91d6
commit ece4177e11
5 changed files with 57 additions and 6 deletions
+13
View File
@@ -1,6 +1,7 @@
import { store } from "$sb/plugos-syscall/mod.ts";
import { editor, space, sync, system } from "$sb/silverbullet-syscall/mod.ts";
import type { SyncEndpoint } from "$sb/silverbullet-syscall/sync.ts";
import { readSetting } from "$sb/lib/settings_page.ts";
export async function configureCommand() {
const url = await editor.prompt(
@@ -160,6 +161,8 @@ export async function performSync() {
return;
}
await augmentSettings(config);
// Check if sync not already in progress
const ongoingSync: number | undefined = await store.get("sync.startTime");
if (ongoingSync) {
@@ -196,12 +199,22 @@ export async function performSync() {
}
}
async function augmentSettings(endpoint: SyncEndpoint) {
const syncSettings = await readSetting("sync", {});
if (syncSettings.excludePrefixes) {
endpoint.excludePrefixes = syncSettings.excludePrefixes;
}
}
export async function syncPage(page: string) {
const config: SyncEndpoint = await store.get("sync.config");
if (!config) {
// Sync not configured
return;
}
await augmentSettings(config);
// Check if sync not already in progress
const ongoingSync: number | undefined = await store.get("sync.startTime");
if (ongoingSync) {