fix: remote host

This commit is contained in:
cha0s 2024-06-28 18:30:07 -05:00
parent 2830764f9f
commit 853f9f1fb4

View File

@ -1,5 +1,13 @@
import {useLoaderData} from '@remix-run/react';
import styles from './index.module.css';
export function loader({request}) {
return {
host: new URL(request.url).host,
};
}
export const meta = () => {
return [
{
@ -13,12 +21,13 @@ export const meta = () => {
};
export default function Index() {
const {host} = useLoaderData();
return (
<div>
<h1 className={styles.title}>Silphius</h1>
<ul className={styles.actions}>
<li><a href="/play/local">Single-player</a></li>
<li><a href="/play/remote/localhost:3000">Multi-player</a></li>
<li><a href={`/play/remote/${host}`}>Multi-player</a></li>
</ul>
</div>
);