commit
43cc610f9b
@ -0,0 +1,13 @@
|
|||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
/build
|
||||||
|
/.svelte-kit
|
||||||
|
/package
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
|
||||||
|
# Ignore files for PNPM, NPM and YARN
|
||||||
|
pnpm-lock.yaml
|
||||||
|
package-lock.json
|
||||||
|
yarn.lock
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
|
||||||
|
plugins: ['svelte3', '@typescript-eslint'],
|
||||||
|
ignorePatterns: ['*.cjs'],
|
||||||
|
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
|
||||||
|
settings: {
|
||||||
|
'svelte3/typescript': () => require('typescript')
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
sourceType: 'module',
|
||||||
|
ecmaVersion: 2020
|
||||||
|
},
|
||||||
|
env: {
|
||||||
|
browser: true,
|
||||||
|
es2017: true,
|
||||||
|
node: true
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
/build
|
||||||
|
/.svelte-kit
|
||||||
|
/package
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
vite.config.js.timestamp-*
|
||||||
|
vite.config.ts.timestamp-*
|
||||||
|
/.pnpm-store
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
/build
|
||||||
|
/.svelte-kit
|
||||||
|
/package
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
|
||||||
|
# Ignore files for PNPM, NPM and YARN
|
||||||
|
pnpm-lock.yaml
|
||||||
|
package-lock.json
|
||||||
|
yarn.lock
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"useTabs": true,
|
||||||
|
"singleQuote": true,
|
||||||
|
"trailingComma": "all",
|
||||||
|
"semi": false,
|
||||||
|
"plugins": ["prettier-plugin-svelte"],
|
||||||
|
"pluginSearchDirs": ["."],
|
||||||
|
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
|
||||||
|
}
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
# create-svelte
|
||||||
|
|
||||||
|
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
|
||||||
|
|
||||||
|
## 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
|
||||||
|
npm create svelte@latest
|
||||||
|
|
||||||
|
# create a new project in my-app
|
||||||
|
npm create svelte@latest 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://kit.svelte.dev/docs/adapters) for your target environment.
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
# Save the output of this file and use kubectl create -f to import
|
||||||
|
# it into Kubernetes.
|
||||||
|
#
|
||||||
|
# Created with podman-4.4.2
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: '2023-03-16T17:11:45Z'
|
||||||
|
labels:
|
||||||
|
app: mariochat
|
||||||
|
name: mariochat
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- args:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- yarn global add pnpm && pnpm i && pnpm dev --host
|
||||||
|
image: docker.io/library/node:alpine
|
||||||
|
name: sveltekit
|
||||||
|
ports:
|
||||||
|
- containerPort: 4173
|
||||||
|
hostPort: 4173
|
||||||
|
- containerPort: 5173
|
||||||
|
hostPort: 5173
|
||||||
|
resources: {}
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /mariochat
|
||||||
|
name: home-nadanke-dev-mariochat-host-0
|
||||||
|
workingDir: /mariochat
|
||||||
|
- args:
|
||||||
|
- postgres
|
||||||
|
env:
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
value: mariochatpgpw
|
||||||
|
image: docker.io/library/postgres:15-alpine
|
||||||
|
name: db
|
||||||
|
ports:
|
||||||
|
- containerPort: 5432
|
||||||
|
hostPort: 5432
|
||||||
|
resources: {}
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /var/lib/postgresql/data
|
||||||
|
name: mariochatdb-pvc
|
||||||
|
hostname: mariochat
|
||||||
|
restartPolicy: Never
|
||||||
|
volumes:
|
||||||
|
- hostPath:
|
||||||
|
path: /home/nadanke/dev/mariochat
|
||||||
|
type: Directory
|
||||||
|
name: home-nadanke-dev-mariochat-host-0
|
||||||
|
- name: mariochatdb-pvc
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: mariochatdb
|
||||||
|
status: {}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
{
|
||||||
|
"name": "mariochat",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite dev",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "vite preview",
|
||||||
|
"test": "playwright test",
|
||||||
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||||
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||||
|
"test:unit": "vitest",
|
||||||
|
"lint": "prettier --plugin-search-dir . --check . && eslint .",
|
||||||
|
"format": "prettier --plugin-search-dir . --write ."
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@playwright/test": "^1.28.1",
|
||||||
|
"@sveltejs/adapter-node": "^1.2.3",
|
||||||
|
"@sveltejs/kit": "^1.5.0",
|
||||||
|
"@tailwindcss/typography": "^0.5.9",
|
||||||
|
"@types/multicast-dns": "^7.2.1",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
||||||
|
"@typescript-eslint/parser": "^5.45.0",
|
||||||
|
"autoprefixer": "^10.4.14",
|
||||||
|
"daisyui": "^2.51.4",
|
||||||
|
"eslint": "^8.28.0",
|
||||||
|
"eslint-config-prettier": "^8.5.0",
|
||||||
|
"eslint-plugin-svelte3": "^4.0.0",
|
||||||
|
"idb": "^7.1.1",
|
||||||
|
"multicast-dns": "^7.2.5",
|
||||||
|
"postcss": "^8.4.21",
|
||||||
|
"prettier": "^2.8.0",
|
||||||
|
"prettier-plugin-svelte": "^2.8.1",
|
||||||
|
"svelte": "^3.54.0",
|
||||||
|
"svelte-check": "^3.0.1",
|
||||||
|
"tailwindcss": "^3.2.7",
|
||||||
|
"tslib": "^2.4.1",
|
||||||
|
"tweetnacl": "^1.0.3",
|
||||||
|
"typescript": "^4.9.3",
|
||||||
|
"vite": "^4.0.0",
|
||||||
|
"vitest": "^0.25.3"
|
||||||
|
},
|
||||||
|
"type": "module",
|
||||||
|
"dependencies": {
|
||||||
|
"knex": "^2.4.2",
|
||||||
|
"objection": "^3.0.1",
|
||||||
|
"pg": "^8.10.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
import type { PlaywrightTestConfig } from '@playwright/test';
|
||||||
|
|
||||||
|
const config: PlaywrightTestConfig = {
|
||||||
|
webServer: {
|
||||||
|
command: 'npm run build && npm run preview',
|
||||||
|
port: 4173
|
||||||
|
},
|
||||||
|
testDir: 'tests'
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,6 @@
|
|||||||
|
module.exports = {
|
||||||
|
plugins: {
|
||||||
|
tailwindcss: {},
|
||||||
|
autoprefixer: {},
|
||||||
|
},
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
// See https://kit.svelte.dev/docs/types#app
|
||||||
|
// for information about these interfaces
|
||||||
|
declare global {
|
||||||
|
namespace App {
|
||||||
|
// interface Error {}
|
||||||
|
// interface Locals {}
|
||||||
|
// interface PageData {}
|
||||||
|
// interface Platform {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {};
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||||
|
<meta name="viewport" content="width=device-width" />
|
||||||
|
%sveltekit.head%
|
||||||
|
</head>
|
||||||
|
<body data-sveltekit-preload-data="hover">
|
||||||
|
<div style="display: contents">%sveltekit.body%</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
import * as nacl from 'tweetnacl'
|
||||||
|
|
||||||
|
const newKey = nacl.randomBytes(nacl.secretbox.keyLength)
|
||||||
|
console.log(newKey)
|
||||||
|
|
||||||
|
function encryptMessage(message: string, key: Uint8Array) {
|
||||||
|
const nonce = nacl.randomBytes(nacl.secretbox.nonceLength)
|
||||||
|
const messageUint8 = new TextEncoder().encode(message)
|
||||||
|
const box = nacl.secretbox(messageUint8, nonce, key)
|
||||||
|
return { nonce, box }
|
||||||
|
}
|
||||||
|
|
||||||
|
function decryptMessage(nonce: Uint8Array, box: Uint8Array, key: Uint8Array) {
|
||||||
|
const decryptedMessage = nacl.secretbox.open(box, nonce, key)
|
||||||
|
if (!decryptedMessage) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return new TextDecoder().decode(decryptedMessage)
|
||||||
|
}
|
||||||
|
|
||||||
|
const encrypted = encryptMessage('hallo zipfl', newKey)
|
||||||
|
|
||||||
|
const decrypted = decryptMessage(encrypted.nonce, encrypted.box, newKey)
|
||||||
|
|
||||||
|
console.log(decrypted)
|
||||||
|
|
||||||
|
const myKeyPair = nacl.box.keyPair()
|
||||||
|
console.log(myKeyPair)
|
||||||
|
|
||||||
|
const createRoom = (roomName: string) => {
|
||||||
|
const roomKey = nacl.randomBytes(nacl.secretbox.keyLength)
|
||||||
|
const room = {
|
||||||
|
name: roomName,
|
||||||
|
key: roomKey,
|
||||||
|
users: [
|
||||||
|
/* TODO self */
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
import makeMdns from 'multicast-dns'
|
||||||
|
const mdns = makeMdns()
|
||||||
|
|
||||||
|
mdns.on('response', (response) => {
|
||||||
|
console.log('got a response packet:', response)
|
||||||
|
})
|
||||||
|
|
||||||
|
mdns.on('query', function (query) {
|
||||||
|
console.log('got a query packet:', query)
|
||||||
|
})
|
||||||
|
|
||||||
|
mdns.query({
|
||||||
|
questions: [
|
||||||
|
{
|
||||||
|
name: 'brunhilde.local',
|
||||||
|
type: 'A',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
|
|
||||||
|
describe('sum test', () => {
|
||||||
|
it('adds 1 + 2 to equal 3', () => {
|
||||||
|
expect(1 + 2).toBe(3);
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
import nacl from 'tweetnacl'
|
||||||
|
import type { TechtelUser } from './TechtelUser'
|
||||||
|
|
||||||
|
export class TechtelRoom {
|
||||||
|
roomKey!: Uint8Array
|
||||||
|
name!: string
|
||||||
|
members!: TechtelUser[]
|
||||||
|
|
||||||
|
constructor(roomName: string, creator: TechtelUser) {
|
||||||
|
this.name = roomName
|
||||||
|
this.roomKey = nacl.randomBytes(nacl.secretbox.keyLength)
|
||||||
|
this.members = [creator]
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
export class TechtelUser {
|
||||||
|
name!: string
|
||||||
|
publicKey!: Uint8Array
|
||||||
|
|
||||||
|
constructor(name: string, publicKey: Uint8Array) {
|
||||||
|
this.name = name
|
||||||
|
this.publicKey = publicKey
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
import { browser } from '$app/environment'
|
||||||
|
import { openDB, type DBSchema } from 'idb'
|
||||||
|
import type { TechtelRoom } from './classes/TechtelRoom'
|
||||||
|
import type { TechtelUser } from './classes/TechtelUser'
|
||||||
|
|
||||||
|
type IDBStores = {
|
||||||
|
user: {
|
||||||
|
key: string
|
||||||
|
value: TechtelUser
|
||||||
|
}
|
||||||
|
rooms: {
|
||||||
|
key: string
|
||||||
|
value: TechtelRoom[]
|
||||||
|
}
|
||||||
|
secret: {
|
||||||
|
key: string
|
||||||
|
value: Uint8Array
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type IDB = DBSchema & IDBStores
|
||||||
|
type IDBStoreKeys = keyof IDBStores
|
||||||
|
|
||||||
|
const idb = browser
|
||||||
|
? openDB<IDB>('TechtelDB', 1, {
|
||||||
|
upgrade(db) {
|
||||||
|
db.createObjectStore('user')
|
||||||
|
db.createObjectStore('rooms')
|
||||||
|
db.createObjectStore('secret')
|
||||||
|
},
|
||||||
|
})
|
||||||
|
: null
|
||||||
|
|
||||||
|
const getDb = async () => {
|
||||||
|
const db = await idb
|
||||||
|
if (!db)
|
||||||
|
throw new Error(
|
||||||
|
'No idb found. This should only ever be called in the browser.',
|
||||||
|
)
|
||||||
|
return db
|
||||||
|
}
|
||||||
|
|
||||||
|
const idbObjectStore = async (name: IDBStoreKeys) =>
|
||||||
|
(await getDb()).transaction(name, 'readwrite').objectStore(name)
|
||||||
|
|
||||||
|
export const getSecretFromIDB = async () =>
|
||||||
|
(await idbObjectStore('secret')).get('current') as Promise<
|
||||||
|
Uint8Array | undefined
|
||||||
|
>
|
||||||
|
|
||||||
|
export const putSecretInIDB = async (data: Uint8Array) =>
|
||||||
|
(await idbObjectStore('secret')).put(data, 'current')
|
||||||
|
|
||||||
|
export const getUserFromIDB = async () =>
|
||||||
|
(await idbObjectStore('user')).get('current')
|
||||||
|
|
||||||
|
export const putUserInIDB = async (data: TechtelUser) =>
|
||||||
|
(await idbObjectStore('user')).put(data, 'current')
|
||||||
|
|
||||||
|
// export const getRoomsFromIDB = async () =>
|
||||||
|
// (await roomsObjectStore()).get('current')
|
||||||
|
|
||||||
|
// export const putRoomsInIDB = async (data: TechtelRoom[]) =>
|
||||||
|
// (await roomsObjectStore()).put(data, 'current')
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
import { browser } from '$app/environment'
|
||||||
|
import { getSecretFromIDB, putSecretInIDB } from '$lib/idb'
|
||||||
|
import { derived, readable } from 'svelte/store'
|
||||||
|
import nacl from 'tweetnacl'
|
||||||
|
|
||||||
|
export const encoder = (() => {
|
||||||
|
let secret: Uint8Array | undefined
|
||||||
|
|
||||||
|
const encoderStore = readable<null | Uint8Array>(null, (set) => {
|
||||||
|
const go = async () => {
|
||||||
|
secret = await getSecretFromIDB()
|
||||||
|
if (!secret) {
|
||||||
|
secret = nacl.randomBytes(nacl.secretbox.keyLength)
|
||||||
|
putSecretInIDB(secret)
|
||||||
|
}
|
||||||
|
set(secret)
|
||||||
|
}
|
||||||
|
if (browser) go()
|
||||||
|
})
|
||||||
|
const { subscribe } = derived(
|
||||||
|
encoderStore,
|
||||||
|
($encoderStore) => !!$encoderStore,
|
||||||
|
)
|
||||||
|
|
||||||
|
const getPublicKey = () => {
|
||||||
|
if (!secret) throw new Error('No secret found - function called too early?')
|
||||||
|
return nacl.box.keyPair.fromSecretKey(secret).publicKey
|
||||||
|
}
|
||||||
|
|
||||||
|
const encodeMessage = async () => {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
const decodeMessage = async () => {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
subscribe,
|
||||||
|
getPublicKey,
|
||||||
|
encodeMessage,
|
||||||
|
decodeMessage,
|
||||||
|
}
|
||||||
|
})()
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
import { derived } from 'svelte/store'
|
||||||
|
import { encoder } from './encoder'
|
||||||
|
|
||||||
|
export const initialLoadFinished = derived([encoder], ([$encoder]) => {
|
||||||
|
return $encoder
|
||||||
|
})
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
import { TechtelUser } from '$lib/classes/TechtelUser'
|
||||||
|
import { derived } from 'svelte/store'
|
||||||
|
import { encoder } from './encoder'
|
||||||
|
|
||||||
|
export const user = derived(encoder, () => {
|
||||||
|
return new TechtelUser('test', encoder.getPublicKey())
|
||||||
|
})
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
export type TechtelUser = {
|
||||||
|
name: string
|
||||||
|
publicKey: Uint8Array
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TechtelRoom = {
|
||||||
|
roomKey: Uint8Array
|
||||||
|
name: string
|
||||||
|
members: TechtelUser[]
|
||||||
|
}
|
||||||
|
|
||||||
|
type TechtelEventType = 'message' | 'membership' | 'invite' | 'inviteResponse'
|
||||||
|
|
||||||
|
type TechtelMessageEventData = {
|
||||||
|
message: string
|
||||||
|
}
|
||||||
|
|
||||||
|
type TechtelMembershipEventData = {
|
||||||
|
user: string
|
||||||
|
action: 'join' | 'leave'
|
||||||
|
}
|
||||||
|
|
||||||
|
type TechtelInviteData = {
|
||||||
|
roomName: string
|
||||||
|
}
|
||||||
|
|
||||||
|
type TechtelInviteResponseData = {
|
||||||
|
roomName: string
|
||||||
|
accepted: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TechtelEvent = {
|
||||||
|
emitter: TechtelUser
|
||||||
|
type: TechtelEventType
|
||||||
|
room: TechtelRoom
|
||||||
|
data:
|
||||||
|
| TechtelMessageEventData
|
||||||
|
| TechtelMembershipEventData
|
||||||
|
| TechtelInviteData
|
||||||
|
| TechtelInviteResponseData
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { initialLoadFinished } from '$lib/stores/initialLoad'
|
||||||
|
import '../app.css'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if !$initialLoadFinished}
|
||||||
|
<div class="loading">Loading...</div>
|
||||||
|
{:else}
|
||||||
|
<slot />
|
||||||
|
{/if}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import type { TechtelRoom } from '$lib/types'
|
||||||
|
import { fail, type Actions } from '@sveltejs/kit'
|
||||||
|
import nacl from 'tweetnacl'
|
||||||
|
import type { PageServerLoad } from './$types'
|
||||||
|
|
||||||
|
export const load = (async () => {
|
||||||
|
return {}
|
||||||
|
}) satisfies PageServerLoad
|
||||||
|
|
||||||
|
const rooms: TechtelRoom[] = []
|
||||||
|
|
||||||
|
export const actions = {
|
||||||
|
default: async (event) => {
|
||||||
|
const formData = await event.request.formData()
|
||||||
|
const roomName = formData.get('roomName')
|
||||||
|
if (!roomName || !(typeof roomName === 'string'))
|
||||||
|
return fail(400, { roomName })
|
||||||
|
rooms.push({
|
||||||
|
roomKey: nacl.randomBytes(nacl.secretbox.keyLength),
|
||||||
|
name: roomName,
|
||||||
|
members: [],
|
||||||
|
})
|
||||||
|
},
|
||||||
|
} satisfies Actions
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
<script>
|
||||||
|
import { enhance } from '$app/forms'
|
||||||
|
import { user } from '$lib/stores/user'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<h1>Welcome to SvelteKit</h1>
|
||||||
|
<p>
|
||||||
|
Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation
|
||||||
|
</p>
|
||||||
|
{$user.publicKey}
|
||||||
|
|
||||||
|
<form method="post" use:enhance>
|
||||||
|
<input type="text" name="roomname" placeholder="room name" class="input" />
|
||||||
|
<button type="submit" class="btn">Create Room</button>
|
||||||
|
</form>
|
||||||
|
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
import adapter from '@sveltejs/adapter-node'
|
||||||
|
import { vitePreprocess } from '@sveltejs/kit/vite'
|
||||||
|
|
||||||
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
|
const config = {
|
||||||
|
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
|
||||||
|
// for more information about preprocessors
|
||||||
|
preprocess: vitePreprocess(),
|
||||||
|
|
||||||
|
kit: {
|
||||||
|
adapter: adapter(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export default config
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
module.exports = {
|
||||||
|
content: ['./src/**/*.{html,js,svelte,ts}'],
|
||||||
|
theme: {
|
||||||
|
extend: {},
|
||||||
|
},
|
||||||
|
plugins: [require('@tailwindcss/typography'), require('daisyui')],
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
import { expect, test } from '@playwright/test';
|
||||||
|
|
||||||
|
test('index page has expected h1', async ({ page }) => {
|
||||||
|
await page.goto('/');
|
||||||
|
await expect(page.getByRole('heading', { name: 'Welcome to SvelteKit' })).toBeVisible();
|
||||||
|
});
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"extends": "./.svelte-kit/tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"checkJs": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"strict": true
|
||||||
|
}
|
||||||
|
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
|
||||||
|
//
|
||||||
|
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
|
||||||
|
// from the referenced tsconfig.json - TypeScript does not merge them in
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
import { sveltekit } from '@sveltejs/kit/vite';
|
||||||
|
import { defineConfig } from 'vitest/config';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [sveltekit()],
|
||||||
|
test: {
|
||||||
|
include: ['src/**/*.{test,spec}.{js,ts}']
|
||||||
|
}
|
||||||
|
});
|
||||||
Loading…
Reference in new issue