Fixes shell/fetch regression
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import type { SysCallMapping } from "../../plugos/system.ts";
|
||||
import type { HttpSpacePrimitives } from "../../common/spaces/http_space_primitives.ts";
|
||||
import {
|
||||
performLocalFetch,
|
||||
ProxyFetchRequest,
|
||||
ProxyFetchResponse,
|
||||
} from "../../common/proxy_fetch.ts";
|
||||
import type { Client } from "../client.ts";
|
||||
|
||||
export function sandboxFetchSyscalls(
|
||||
httpSpacePrimitives?: HttpSpacePrimitives,
|
||||
client: Client,
|
||||
): SysCallMapping {
|
||||
return {
|
||||
"sandboxFetch.fetch": async (
|
||||
@@ -16,12 +16,12 @@ export function sandboxFetchSyscalls(
|
||||
options: ProxyFetchRequest,
|
||||
): Promise<ProxyFetchResponse> => {
|
||||
// console.log("Got sandbox fetch ", url);
|
||||
if (!httpSpacePrimitives) {
|
||||
if (!client.remoteSpacePrimitives) {
|
||||
// No SB server to proxy the fetch available so let's execute the request directly
|
||||
return performLocalFetch(url, options);
|
||||
}
|
||||
const resp = httpSpacePrimitives.authenticatedFetch(
|
||||
`${httpSpacePrimitives.url}/.rpc`,
|
||||
const resp = client.remoteSpacePrimitives.authenticatedFetch(
|
||||
`${client.remoteSpacePrimitives.url}/.rpc`,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
|
||||
Reference in New Issue
Block a user