From 87b0e7e3527feaeb46877993bfc802489b0b28b8 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Fri, 14 Jul 2023 12:15:10 +0200 Subject: [PATCH] Fixes #470 --- plug-api/silverbullet-syscall/debug.ts | 5 +++ plug-api/silverbullet-syscall/mod.ts | 1 + plugs/core/core.plug.yaml | 5 +++ plugs/core/debug.ts | 6 ++- web/auth.html | 8 +--- web/editor.tsx | 8 +--- web/logout.html | 3 -- web/syscalls/debug.ts | 55 ++++++++++++++++++++++++++ web/syscalls/system.ts | 2 +- website/CHANGELOG.md | 2 + 10 files changed, 77 insertions(+), 18 deletions(-) create mode 100644 plug-api/silverbullet-syscall/debug.ts create mode 100644 web/syscalls/debug.ts diff --git a/plug-api/silverbullet-syscall/debug.ts b/plug-api/silverbullet-syscall/debug.ts new file mode 100644 index 0000000..7c833b1 --- /dev/null +++ b/plug-api/silverbullet-syscall/debug.ts @@ -0,0 +1,5 @@ +import { syscall } from "./syscall.ts"; + +export function resetClient() { + return syscall("debug.resetClient"); +} diff --git a/plug-api/silverbullet-syscall/mod.ts b/plug-api/silverbullet-syscall/mod.ts index 7500d2c..3d763a6 100644 --- a/plug-api/silverbullet-syscall/mod.ts +++ b/plug-api/silverbullet-syscall/mod.ts @@ -6,3 +6,4 @@ export * as system from "./system.ts"; // Legacy redirect, use "store" in $sb/plugos-syscall/mod.ts instead export * as clientStore from "./store.ts"; export * as sync from "./sync.ts"; +export * as debug from "./debug.ts"; diff --git a/plugs/core/core.plug.yaml b/plugs/core/core.plug.yaml index da576c8..0cc19f9 100644 --- a/plugs/core/core.plug.yaml +++ b/plugs/core/core.plug.yaml @@ -347,6 +347,11 @@ functions: command: name: "Debug: Parse Document" + resetClientCommand: + path: ./debug.ts:resetClientCommand + command: + name: "Debug: Reset Client" + versionCommand: path: ./help.ts:versionCommand command: diff --git a/plugs/core/debug.ts b/plugs/core/debug.ts index 3b77cb4..6ceddfd 100644 --- a/plugs/core/debug.ts +++ b/plugs/core/debug.ts @@ -1,4 +1,4 @@ -import { editor, markdown } from "$sb/silverbullet-syscall/mod.ts"; +import { debug, editor, markdown } from "$sb/silverbullet-syscall/mod.ts"; export async function parsePageCommand() { console.log( @@ -10,3 +10,7 @@ export async function parsePageCommand() { ), ); } + +export async function resetClientCommand() { + await debug.resetClient(); +} diff --git a/web/auth.html b/web/auth.html index 085d227..5ba25da 100644 --- a/web/auth.html +++ b/web/auth.html @@ -56,14 +56,8 @@

Login to SilverBullet

-
-
+
diff --git a/web/editor.tsx b/web/editor.tsx index e01039a..e2195b7 100644 --- a/web/editor.tsx +++ b/web/editor.tsx @@ -134,9 +134,8 @@ import { HttpSpacePrimitives } from "../common/spaces/http_space_primitives.ts"; import { FallbackSpacePrimitives } from "../common/spaces/fallback_space_primitives.ts"; import { syncSyscalls } from "./syscalls/sync.ts"; import { FilteredSpacePrimitives } from "../common/spaces/filtered_space_primitives.ts"; -import { run } from "../plug-api/plugos-syscall/shell.ts"; import { isValidPageName } from "$sb/lib/page.ts"; -import { markdownLanguage } from "https://esm.sh/v128/@codemirror/lang-markdown@6.1.1/X-ZS9AY29kZW1pcnJvci9sYW5nLWh0bWwsQGNvZGVtaXJyb3IvbGFuZ3VhZ2UsQGNvZGVtaXJyb3Ivc3RhdGUsQGNvZGVtaXJyb3IvdmlldyxAbGV6ZXIvY29tbW9uLEBsZXplci9oaWdobGlnaHQsQGxlemVyL21hcmtkb3du/dist/index.js"; +import { debugSyscalls } from "./syscalls/debug.ts"; const frontMatterRegex = /^---\n(([^\n]|\n)*?)---\n/; @@ -327,6 +326,7 @@ export class Editor { yamlSyscalls(), storeCalls, indexSyscalls, + debugSyscalls(), syncSyscalls(this.syncService), // LEGACY clientStoreSyscalls(storeCalls), @@ -1166,10 +1166,6 @@ export class Editor { this.editorView!.focus(); } - getUsername(): string { - return localStorage.getItem("username") || "you"; - } - async navigate( name: string, pos?: number | string, diff --git a/web/logout.html b/web/logout.html index 107c83b..767382b 100644 --- a/web/logout.html +++ b/web/logout.html @@ -62,9 +62,6 @@