Switch from Oak to Hono

This commit is contained in:
Zef Hemel
2024-01-13 18:07:02 +01:00
parent bf1eb03129
commit 291280b709
9 changed files with 372 additions and 458 deletions
+1 -2
View File
@@ -14,11 +14,10 @@ export function shellSyscalls(
throw new Error("Not supported in fully local mode");
}
const resp = client.httpSpacePrimitives.authenticatedFetch(
`${client.httpSpacePrimitives.url}/.rpc`,
`${client.httpSpacePrimitives.url}/.rpc/shell`,
{
method: "POST",
body: JSON.stringify({
operation: "shell",
cmd,
args,
}),
+3 -9
View File
@@ -1,6 +1,5 @@
import { HttpSpacePrimitives } from "../../common/spaces/http_space_primitives.ts";
import { SyscallContext, SysCallMapping } from "../../plugos/system.ts";
import { SyscallResponse } from "../../server/rpc.ts";
import { Client } from "../client.ts";
export function proxySyscalls(client: Client, names: string[]): SysCallMapping {
@@ -20,18 +19,13 @@ export async function proxySyscall(
args: any[],
): Promise<any> {
const resp = await httpSpacePrimitives.authenticatedFetch(
`${httpSpacePrimitives.url}/.rpc`,
`${httpSpacePrimitives.url}/.rpc/${ctx.plug.name}/${name}`,
{
method: "POST",
body: JSON.stringify({
ctx: ctx.plug.name,
operation: "syscall",
name,
args,
}),
body: JSON.stringify(args),
},
);
const result: SyscallResponse = await resp.json();
const result = await resp.json();
if (result.error) {
console.error("Remote syscall error", result.error);
throw new Error(result.error);