diff --git a/README.md b/README.md index b5b2950..d2e1f3d 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,4 @@ -# sv +pnpm i +pnpm run build -Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli). - -## Creating a project - -If you're seeing this, you've probably already done this step. Congrats! - -```bash -# create a new project in the current directory -npx sv create - -# create a new project in my-app -npx sv create my-app -``` - -## Developing - -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: - -```bash -npm run dev - -# or start the server and open the app in a new browser tab -npm run dev -- --open -``` - -## Building - -To create a production version of your app: - -```bash -npm run build -``` - -You can preview the production build with `npm run preview`. - -> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment. +place result from `build/` in a web server and in the directory place a settings.json as well diff --git a/package.json b/package.json index 2ad83e0..d20f5ff 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ }, "devDependencies": { "@sveltejs/adapter-node": "^5.2.0", + "@sveltejs/adapter-static": "^3.0.8", "@sveltejs/kit": "^2.9.0", "@sveltejs/vite-plugin-svelte": "^5.0.0", "@vitejs/plugin-basic-ssl": "^1.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 09ea658..65f9cbf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,6 +15,9 @@ importers: '@sveltejs/adapter-node': specifier: ^5.2.0 version: 5.2.10(@sveltejs/kit@2.9.1(@sveltejs/vite-plugin-svelte@5.0.1(svelte@5.10.0)(vite@6.0.3))(svelte@5.10.0)(vite@6.0.3)) + '@sveltejs/adapter-static': + specifier: ^3.0.8 + version: 3.0.8(@sveltejs/kit@2.9.1(@sveltejs/vite-plugin-svelte@5.0.1(svelte@5.10.0)(vite@6.0.3))(svelte@5.10.0)(vite@6.0.3)) '@sveltejs/kit': specifier: ^2.9.0 version: 2.9.1(@sveltejs/vite-plugin-svelte@5.0.1(svelte@5.10.0)(vite@6.0.3))(svelte@5.10.0)(vite@6.0.3) @@ -344,6 +347,11 @@ packages: peerDependencies: '@sveltejs/kit': ^2.4.0 + '@sveltejs/adapter-static@3.0.8': + resolution: {integrity: sha512-YaDrquRpZwfcXbnlDsSrBQNCChVOT9MGuSg+dMAyfsAa1SmiAhrA5jUYUiIMC59G92kIbY/AaQOWcBdq+lh+zg==} + peerDependencies: + '@sveltejs/kit': ^2.0.0 + '@sveltejs/kit@2.9.1': resolution: {integrity: sha512-D+yH3DTvvkjXdl3Xv7akKmolrArDZRtsFv3nlxJPjlIKsZEpkkInnomKJuAql2TrNGJ2dJMGBO1YYgVn2ILmag==} engines: {node: '>=18.13'} @@ -834,6 +842,10 @@ snapshots: '@sveltejs/kit': 2.9.1(@sveltejs/vite-plugin-svelte@5.0.1(svelte@5.10.0)(vite@6.0.3))(svelte@5.10.0)(vite@6.0.3) rollup: 4.28.1 + '@sveltejs/adapter-static@3.0.8(@sveltejs/kit@2.9.1(@sveltejs/vite-plugin-svelte@5.0.1(svelte@5.10.0)(vite@6.0.3))(svelte@5.10.0)(vite@6.0.3))': + dependencies: + '@sveltejs/kit': 2.9.1(@sveltejs/vite-plugin-svelte@5.0.1(svelte@5.10.0)(vite@6.0.3))(svelte@5.10.0)(vite@6.0.3) + '@sveltejs/kit@2.9.1(@sveltejs/vite-plugin-svelte@5.0.1(svelte@5.10.0)(vite@6.0.3))(svelte@5.10.0)(vite@6.0.3)': dependencies: '@sveltejs/vite-plugin-svelte': 5.0.1(svelte@5.10.0)(vite@6.0.3) diff --git a/src/lib/client.ts b/src/lib/client.ts index c258463..f0a242c 100644 --- a/src/lib/client.ts +++ b/src/lib/client.ts @@ -8,10 +8,12 @@ import { type WriteEvent, writeEvent, WriteKind } from "./protocol/clientEvent"; import { BinaryWriter } from "./binary/writer"; import { cached, type CachedWritable, type Cached, cachedWritable } from "./stores"; import { BinaryReader } from "./binary/reader"; +import { base } from "$app/paths"; export class Client { static async connect(name: Readable, audioManager: AudioManager, outputAudio: HTMLDivElement) { - const transport = new WebTransport(`https://${location.hostname}:4433`, { allowPooling: false }); + const settings = await (await fetch("settings.json")).json(); + const transport = new WebTransport(`https://${settings.host}:${settings.port}`, { allowPooling: false }); await transport.ready; console.log("ready!"); const stream = await transport.createBidirectionalStream(); diff --git a/svelte.config.js b/svelte.config.js index e0a641e..5666c6d 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,4 +1,5 @@ -import adapter from '@sveltejs/adapter-node'; +// import adapter from '@sveltejs/adapter-node'; +import adapter from '@sveltejs/adapter-static'; import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; /** @type {import('@sveltejs/kit').Config} */ @@ -11,7 +12,16 @@ const config = { // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list. // If your environment is not supported, or you settled on a specific environment, switch out the adapter. // See https://svelte.dev/docs/kit/adapters for more information about adapters. - adapter: adapter() + // adapter: adapter() + adapter: adapter({ + // default options are shown. On some platforms + // these options are set automatically — see below + pages: 'build', + assets: 'build', + fallback: undefined, + precompress: false, + strict: true + }) } };