fix: Fixed cross platform errors and emulatorjs not opening on linux
This commit is contained in:
parent
f33c928633
commit
df20979afa
6 changed files with 39 additions and 18 deletions
|
|
@ -9,6 +9,8 @@ export default new Elysia({ prefix: "/api/romm" })
|
||||||
.use([games, platforms, auth])
|
.use([games, platforms, auth])
|
||||||
.all("/*", async ({ request, params, set }) =>
|
.all("/*", async ({ request, params, set }) =>
|
||||||
{
|
{
|
||||||
|
set.headers["cross-origin-resource-policy"] = 'cross-origin';
|
||||||
|
|
||||||
if (!config.has('rommAddress') && !config.get('rommAddress'))
|
if (!config.has('rommAddress') && !config.get('rommAddress'))
|
||||||
{
|
{
|
||||||
return new Response("Romm Address Not Found", { status: 404 });
|
return new Response("Romm Address Not Found", { status: 404 });
|
||||||
|
|
|
||||||
|
|
@ -74,21 +74,24 @@ export default new Elysia()
|
||||||
params: z.object({ id: z.coerce.number() }),
|
params: z.object({ id: z.coerce.number() }),
|
||||||
query: z.object({ blur: z.coerce.number().optional(), width: z.coerce.number().optional(), height: z.coerce.number().optional() })
|
query: z.object({ blur: z.coerce.number().optional(), width: z.coerce.number().optional(), height: z.coerce.number().optional() })
|
||||||
})
|
})
|
||||||
.get('/image/:source/*', async ({ params: { source, "*": path }, query }) =>
|
.get('/image/:source/*', async ({ params: { source, "*": path }, query, set }) =>
|
||||||
{
|
{
|
||||||
if (source === 'romm')
|
if (source === 'romm')
|
||||||
{
|
{
|
||||||
|
set.headers["cross-origin-resource-policy"] = 'cross-origin';
|
||||||
const rommAdress = config.get('rommAddress');
|
const rommAdress = config.get('rommAddress');
|
||||||
return processImage(`${rommAdress}/${path}`, query);
|
return processImage(`${rommAdress}/${path}`, query);
|
||||||
}
|
}
|
||||||
return status('Not Found');
|
return status('Not Found');
|
||||||
}, { query: z.object({ blur: z.coerce.number().optional(), width: z.coerce.number().optional(), height: z.coerce.number().optional(), noBlur: z.coerce.boolean().optional() }) })
|
}, { query: z.object({ blur: z.coerce.number().optional(), width: z.coerce.number().optional(), height: z.coerce.number().optional(), noBlur: z.coerce.boolean().optional() }) })
|
||||||
.get('/image', async ({ query }) =>
|
.get('/image', async ({ query, set }) =>
|
||||||
{
|
{
|
||||||
|
set.headers["cross-origin-resource-policy"] = 'cross-origin';
|
||||||
return processImage(query.url, query);
|
return processImage(query.url, query);
|
||||||
}, { query: z.object({ url: z.url(), blur: z.coerce.number().optional(), width: z.coerce.number().optional(), height: z.coerce.number().optional() }) })
|
}, { query: z.object({ url: z.url(), blur: z.coerce.number().optional(), width: z.coerce.number().optional(), height: z.coerce.number().optional() }) })
|
||||||
.get('/screenshot/:id', async ({ params: { id }, query, set }) =>
|
.get('/screenshot/:id', async ({ params: { id }, query, set }) =>
|
||||||
{
|
{
|
||||||
|
set.headers["cross-origin-resource-policy"] = 'cross-origin';
|
||||||
const screenshot = await db.query.screenshots.findFirst({ where: eq(schema.screenshots.id, id), columns: { content: true, type: true } });
|
const screenshot = await db.query.screenshots.findFirst({ where: eq(schema.screenshots.id, id), columns: { content: true, type: true } });
|
||||||
if (screenshot)
|
if (screenshot)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,8 @@ export default new Elysia()
|
||||||
return status("Not Implemented");
|
return status("Not Implemented");
|
||||||
}, { params: z.object({ source: z.string(), id: z.coerce.number() }) }).get('/platform/local/:id/cover', async ({ params: { id }, set }) =>
|
}, { params: z.object({ source: z.string(), id: z.coerce.number() }) }).get('/platform/local/:id/cover', async ({ params: { id }, set }) =>
|
||||||
{
|
{
|
||||||
|
set.headers["cross-origin-resource-policy"] = 'cross-origin';
|
||||||
|
|
||||||
const coverBlob = await db.query.platforms.findFirst({
|
const coverBlob = await db.query.platforms.findFirst({
|
||||||
columns: {
|
columns: {
|
||||||
cover: true, cover_type: true
|
cover: true, cover_type: true
|
||||||
|
|
|
||||||
|
|
@ -12,25 +12,25 @@ export function RunBunServer ()
|
||||||
console.log("Launching Server on port ", SERVER_PORT);
|
console.log("Launching Server on port ", SERVER_PORT);
|
||||||
return new Elysia()
|
return new Elysia()
|
||||||
.use(cors())
|
.use(cors())
|
||||||
|
.headers({
|
||||||
|
'cross-origin-embedder-policy': 'credentialless',
|
||||||
|
'cross-origin-opener-policy': 'same-origin',
|
||||||
|
'cross-origin-resource-policy': 'cross-origin'
|
||||||
|
})
|
||||||
.get("/", ({ set }) =>
|
.get("/", ({ set }) =>
|
||||||
{
|
{
|
||||||
set.headers['cross-origin-opener-policy'] = 'same-origin';
|
return Bun.file(appPath("./dist/index.html"));
|
||||||
set.headers['cross-origin-embedder-policy'] = 'require-corp';
|
|
||||||
return file("./dist/index.html");
|
|
||||||
})
|
})
|
||||||
.get('/emulatorjs', ({ set }) =>
|
.get('/emulatorjs', ({ set }) =>
|
||||||
{
|
{
|
||||||
set.headers['cross-origin-opener-policy'] = 'same-origin';
|
return Bun.file(appPath('./dist/emulatorjs/index.html'));
|
||||||
set.headers['cross-origin-embedder-policy'] = 'require-corp';
|
|
||||||
set.headers['cross-origin-resource-policy'] = 'cross-origin';
|
|
||||||
return file('./dist/emulatorjs/index.html');
|
|
||||||
})
|
})
|
||||||
.use(staticPlugin({
|
.use(staticPlugin({
|
||||||
indexHTML: false,
|
indexHTML: false,
|
||||||
assets: "dist",
|
assets: appPath("./dist"),
|
||||||
prefix: "/",
|
prefix: "/",
|
||||||
alwaysStatic: true
|
alwaysStatic: true
|
||||||
})).listen({ port: SERVER_PORT, hostname: host }, console.log);
|
})).listen({ port: SERVER_PORT, hostname: host, development: true }, console.log);
|
||||||
/*return Bun.serve({
|
/*return Bun.serve({
|
||||||
port: SERVER_PORT,
|
port: SERVER_PORT,
|
||||||
hostname: host,
|
hostname: host,
|
||||||
|
|
|
||||||
|
|
@ -118,9 +118,7 @@ function Frame (data: { ref: RefObject<HTMLIFrameElement | null>; })
|
||||||
data.ref.current = r;
|
data.ref.current = r;
|
||||||
}}
|
}}
|
||||||
allow='fullscreen; cross-origin-isolated'
|
allow='fullscreen; cross-origin-isolated'
|
||||||
className='absolute w-full h-full transition-[padding]' src={
|
className='absolute w-full h-full transition-[padding]' src={`${SERVER_URL(__HOST__)}/emulatorjs/?${params}`}></iframe>;
|
||||||
__PUBLIC__ ? `${SERVER_URL(__HOST__)}/emulatorjs/?${params}` : `${EMULATORJS_URL(__HOST__)}/?${params}`
|
|
||||||
}></iframe>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function RouteComponent ()
|
function RouteComponent ()
|
||||||
|
|
@ -147,12 +145,23 @@ function RouteComponent ()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
useShortcuts(focusKey, () => [{
|
useShortcuts(focusKey, () => [
|
||||||
button: GamePadButtonCode.Steam, action: () =>
|
{
|
||||||
|
button: GamePadButtonCode.Steam,
|
||||||
|
action: () =>
|
||||||
{
|
{
|
||||||
setOverlayOpen(!overlayOpen);
|
setOverlayOpen(!overlayOpen);
|
||||||
}
|
}
|
||||||
}], [overlayOpen, setOverlayOpen]);
|
},
|
||||||
|
{
|
||||||
|
button: GamePadButtonCode.Select,
|
||||||
|
heldTime: 1000,
|
||||||
|
action: () =>
|
||||||
|
{
|
||||||
|
setOverlayOpen(!overlayOpen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
], [overlayOpen, setOverlayOpen]);
|
||||||
|
|
||||||
const setPaused = (paused: boolean) =>
|
const setPaused = (paused: boolean) =>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ export default defineConfig(({ command }) =>
|
||||||
minify: production,
|
minify: production,
|
||||||
sourcemap: production ? false : 'inline',
|
sourcemap: production ? false : 'inline',
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
|
preserveEntrySignatures: 'strict',
|
||||||
input: {
|
input: {
|
||||||
main: 'src/mainview/index.html',
|
main: 'src/mainview/index.html',
|
||||||
login: 'src/mainview/auth/qr/index.html',
|
login: 'src/mainview/auth/qr/index.html',
|
||||||
|
|
@ -58,6 +59,10 @@ export default defineConfig(({ command }) =>
|
||||||
manualChunks: (id
|
manualChunks: (id
|
||||||
) =>
|
) =>
|
||||||
{
|
{
|
||||||
|
if (id.includes('@emulatorjs'))
|
||||||
|
{
|
||||||
|
return 'emulatorjs';
|
||||||
|
}
|
||||||
if (id
|
if (id
|
||||||
.includes
|
.includes
|
||||||
('node_modules'))
|
('node_modules'))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue