fix: prefix hp_wasm paths correctly

Co-authored-by: palchrb <Breyholtz@gmail.com>
This commit is contained in:
Aarnav Tale
2026-03-26 12:53:54 -04:00
parent 54f236a332
commit 98d8dfe235
2 changed files with 44 additions and 42 deletions
+2 -2
View File
@@ -32,8 +32,8 @@ RUN corepack enable
COPY patches ./patches COPY patches ./patches
COPY package.json pnpm-lock.yaml build.sh ./ COPY package.json pnpm-lock.yaml build.sh ./
COPY --from=go-base /bin/hp_ssh.wasm /run/app/hp_ssh.wasm COPY --from=go-base /bin/hp_ssh.wasm /run/public/hp_ssh.wasm
COPY --from=go-base /bin/wasm_exec.js /run/app/wasm_exec.js COPY --from=go-base /bin/wasm_exec.js /run/public/wasm_exec.js
RUN ./build.sh --app --app-install-only RUN ./build.sh --app --app-install-only
COPY . . COPY . .
+7 -5
View File
@@ -19,7 +19,7 @@ export const shouldRevalidate: ShouldRevalidateFunction = () => {
export async function loader({ request, context }: Route.LoaderArgs) { export async function loader({ request, context }: Route.LoaderArgs) {
const origin = new URL(request.url).origin; const origin = new URL(request.url).origin;
const assets = ["/wasm_exec.js", "/hp_ssh.wasm"]; const assets = [`${__PREFIX__}/wasm_exec.js`, `${__PREFIX__}/hp_ssh.wasm`];
const missing: string[] = []; const missing: string[] = [];
for (const file of assets) { for (const file of assets) {
@@ -180,7 +180,7 @@ export async function action({ request, context }: Route.ActionArgs) {
export const links: Route.LinksFunction = () => [ export const links: Route.LinksFunction = () => [
{ {
rel: "preload", rel: "preload",
href: "/hp_ssh.wasm", href: `${__PREFIX__}/hp_ssh.wasm`,
as: "fetch", as: "fetch",
type: "application/wasm", type: "application/wasm",
crossOrigin: "anonymous", crossOrigin: "anonymous",
@@ -190,7 +190,7 @@ export const links: Route.LinksFunction = () => [
export const handle: ExternalScriptsHandle = { export const handle: ExternalScriptsHandle = {
scripts: [ scripts: [
{ {
src: "/wasm_exec.js", src: `${__PREFIX__}/wasm_exec.js`,
crossOrigin: "anonymous", crossOrigin: "anonymous",
preload: true, preload: true,
}, },
@@ -211,7 +211,8 @@ export default function Page({ loaderData: { ipnDetails, sshDetails } }: Route.C
pause(); pause();
const go = new Go(); // Go is defined by wasm_exec.js const go = new Go(); // Go is defined by wasm_exec.js
WebAssembly.instantiateStreaming(fetch("/hp_ssh.wasm"), go.importObject).then((value) => { WebAssembly.instantiateStreaming(fetch(`${__PREFIX__}/hp_ssh.wasm`), go.importObject).then(
(value) => {
go.run(value.instance); go.run(value.instance);
const handle = TsWasmNet(ipnDetails, { const handle = TsWasmNet(ipnDetails, {
NotifyState: (state) => { NotifyState: (state) => {
@@ -248,7 +249,8 @@ export default function Page({ loaderData: { ipnDetails, sshDetails } }: Route.C
}); });
handle.Start(); handle.Start();
}); },
);
}, []); }, []);
if (!sshDetails.username) { if (!sshDetails.username) {