Deleted fetch syscall (now natively supported)

This commit is contained in:
Zef Hemel
2022-04-21 15:29:13 +02:00
parent dad2b4e835
commit a2cb2727d2
5 changed files with 8 additions and 39 deletions
-2
View File
@@ -11,7 +11,6 @@ import { EndpointHook, EndpointHookT } from "../hooks/endpoint";
import { safeRun } from "../util";
import knex from "knex";
import { ensureTable, storeSyscalls } from "../syscalls/store.knex_node";
import { fetchSyscalls } from "../syscalls/fetch.node";
import { EventHook, EventHookT } from "../hooks/event";
import { eventSyscalls } from "../syscalls/event";
@@ -54,7 +53,6 @@ safeRun(async () => {
system.registerSyscalls([], eventSyscalls(eventHook));
system.addHook(new EndpointHook(app, ""));
system.registerSyscalls([], shellSyscalls("."));
system.registerSyscalls([], fetchSyscalls());
system.registerSyscalls([], storeSyscalls(db, "item"));
app.listen(args.port, () => {
console.log(`Plugbox server listening on port ${args.port}`);
-15
View File
@@ -1,15 +0,0 @@
import fetch, { RequestInfo, RequestInit } from "node-fetch";
import { SysCallMapping } from "../system";
export function fetchSyscalls(): SysCallMapping {
return {
"fetch.json": async (ctx, url: RequestInfo, init: RequestInit) => {
let resp = await fetch(url, init);
return resp.json();
},
"fetch.text": async (ctx, url: RequestInfo, init: RequestInit) => {
let resp = await fetch(url, init);
return resp.text();
},
};
}