@@ -28,15 +28,15 @@ export function sandboxFetchSyscalls(
|
||||
body: options.base64Body && base64Decode(options.base64Body),
|
||||
}
|
||||
: {};
|
||||
if (!client.remoteSpacePrimitives) {
|
||||
if (!client.httpSpacePrimitives) {
|
||||
// No SB server to proxy the fetch available so let's execute the request directly
|
||||
return performLocalFetch(url, fetchOptions);
|
||||
}
|
||||
fetchOptions.headers = fetchOptions.headers
|
||||
? { ...fetchOptions.headers, "X-Proxy-Request": "true" }
|
||||
: { "X-Proxy-Request": "true" };
|
||||
const resp = await client.remoteSpacePrimitives.authenticatedFetch(
|
||||
`${client.remoteSpacePrimitives.url}/!${url}`,
|
||||
const resp = await client.httpSpacePrimitives.authenticatedFetch(
|
||||
`${client.httpSpacePrimitives.url}/!${url}`,
|
||||
fetchOptions,
|
||||
);
|
||||
const body = await resp.arrayBuffer();
|
||||
|
||||
@@ -10,11 +10,11 @@ export function shellSyscalls(
|
||||
cmd: string,
|
||||
args: string[],
|
||||
): Promise<{ stdout: string; stderr: string; code: number }> => {
|
||||
if (!client.remoteSpacePrimitives) {
|
||||
if (!client.httpSpacePrimitives) {
|
||||
throw new Error("Not supported in fully local mode");
|
||||
}
|
||||
const resp = client.remoteSpacePrimitives.authenticatedFetch(
|
||||
`${client.remoteSpacePrimitives.url}/.rpc`,
|
||||
const resp = client.httpSpacePrimitives.authenticatedFetch(
|
||||
`${client.httpSpacePrimitives.url}/.rpc`,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
|
||||
@@ -43,7 +43,7 @@ export function systemSyscalls(
|
||||
// Proxy to another environment
|
||||
return proxySyscall(
|
||||
ctx,
|
||||
client.remoteSpacePrimitives,
|
||||
client.httpSpacePrimitives,
|
||||
"system.invokeFunction",
|
||||
[fullName, ...args],
|
||||
);
|
||||
|
||||
@@ -7,7 +7,7 @@ export function proxySyscalls(client: Client, names: string[]): SysCallMapping {
|
||||
const syscalls: SysCallMapping = {};
|
||||
for (const name of names) {
|
||||
syscalls[name] = (ctx, ...args: any[]) => {
|
||||
return proxySyscall(ctx, client.remoteSpacePrimitives, name, args);
|
||||
return proxySyscall(ctx, client.httpSpacePrimitives, name, args);
|
||||
};
|
||||
}
|
||||
return syscalls;
|
||||
|
||||
Reference in New Issue
Block a user