diff --git a/plugos/syscalls/store.deno.ts b/plugos/syscalls/store.deno.ts index c085277..596b71a 100644 --- a/plugos/syscalls/store.deno.ts +++ b/plugos/syscalls/store.deno.ts @@ -99,7 +99,8 @@ export function storeSyscalls( "store.deletePrefix": async (_ctx, prefix: string) => { await asyncExecute( db, - `DELETE FROM ${tableName} WHERE key LIKE "${prefix}%"`, + `DELETE FROM ${tableName} WHERE key LIKE ?`, + `${prefix}%`, ); }, "store.deleteQuery": async (_ctx, query: Query) => { @@ -152,7 +153,8 @@ export function storeSyscalls( return ( await asyncQuery( db, - `SELECT key, value FROM ${tableName} WHERE key LIKE "${prefix}%"`, + `SELECT key, value FROM ${tableName} WHERE key LIKE ?`, + `${prefix}%`, ) ).map(({ key, value }) => ({ key, diff --git a/plugs/query/materialized_queries.ts b/plugs/query/materialized_queries.ts index dd2fcff..ede5cbd 100644 --- a/plugs/query/materialized_queries.ts +++ b/plugs/query/materialized_queries.ts @@ -24,7 +24,6 @@ export async function updateMaterializedQueriesCommand() { currentPage, ) ) { - console.log("Going reload the page"); await editor.reloadPage(); } } diff --git a/server/http_server.ts b/server/http_server.ts index 2212fdd..5b9ca65 100644 --- a/server/http_server.ts +++ b/server/http_server.ts @@ -283,6 +283,7 @@ export class HttpServer { const name = ctx.params.name; const plugName = ctx.params.plug; const args = await ctx.request.body().value; + console.log("Got args", args, "for", name, "in", plugName); const plug = this.system.loadedPlugs.get(plugName); if (!plug) { ctx.response.status = 404; @@ -298,6 +299,7 @@ export class HttpServer { ctx.response.headers.set("Content-Type", "application/json"); ctx.response.body = JSON.stringify(result); } catch (e: any) { + console.log("Error", e); ctx.response.status = 500; ctx.response.body = e.message; return; diff --git a/server/syscalls/index.ts b/server/syscalls/index.ts index 7085599..1761a6f 100644 --- a/server/syscalls/index.ts +++ b/server/syscalls/index.ts @@ -88,7 +88,8 @@ export function pageIndexSyscalls(db: SQLite): SysCallMapping { return ( await asyncQuery( db, - `SELECT key, page, value FROM ${tableName} WHERE key LIKE "${prefix}%"`, + `SELECT key, page, value FROM ${tableName} WHERE key LIKE ?`, + `${prefix}%`, ) ).map(({ key, value, page }) => ({ key, @@ -116,11 +117,12 @@ export function pageIndexSyscalls(db: SQLite): SysCallMapping { "index.deletePrefixForPage": async (ctx, page: string, prefix: string) => { await asyncExecute( db, - `DELETE FROM ${tableName} WHERE key LIKE "${prefix}%" AND page = ?`, + `DELETE FROM ${tableName} WHERE key LIKE ? AND page = ?`, + `${prefix}%`, page, ); }, - "index.clearPageIndex": async (ctx) => { + "index.clearPageIndex": async () => { await asyncExecute( db, `DELETE FROM ${tableName}`,