kinda finished

This commit is contained in:
Jakub Kropáček 2024-12-22 00:40:45 +01:00
parent 8a37f14a48
commit 11d9b7a0b4
11 changed files with 2706 additions and 162 deletions

5
.dockerignore Normal file
View file

@ -0,0 +1,5 @@
Dockerfile
node_modules/
build/
.svelte-kit/
.idea/

16
Dockerfile Normal file
View file

@ -0,0 +1,16 @@
FROM node:23-alpine AS base
WORKDIR /app
FROM base AS dependencies
COPY package*.json /app/
RUN npm ci
FROM base AS build
COPY --from=dependencies /app/node_modules /app/node_modules
COPY . /app
RUN npm run build
FROM base AS release
COPY --from=build /app/build /app/build
CMD ["node", "/app/build/index.js"]

BIN
bun.lockb

Binary file not shown.

2501
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -14,7 +14,7 @@
},
"devDependencies": {
"@eslint/compat": "^1.2.3",
"@sveltejs/adapter-static": "^3.0.6",
"@sveltejs/adapter-node": "^5.2.11",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^4.0.0",
"eslint": "^9.7.0",
@ -28,8 +28,5 @@
"typescript": "^5.0.0",
"typescript-eslint": "^8.0.0",
"vite": "^5.4.11"
},
"dependencies": {
"svelte-adapter-bun": "^0.5.2"
}
}

30
src/routes/+layout.svelte Normal file
View file

@ -0,0 +1,30 @@
<script lang="ts">
let { children } = $props();
</script>
<main>
{@render children()}
</main>
<style>
:global(body) {
margin: 0;
font-family: 'Arial', sans-serif;
background-color: #f4f4f4;
color: #1c1919;
}
main {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
width: 100vw;
background-color: #a8571c;
color: white;
text-align: center;
overflow: hidden;
padding: 20px;
box-sizing: border-box;
}
</style>

View file

@ -1,5 +1,6 @@
<script lang="ts">
import Modal from '$lib/Modal.svelte';
import { page } from '$app/state';
const difficultyClass = 15;
const skin = 'winter';
@ -23,12 +24,14 @@
};
const handleRoll = async () => {
if (rollResult) return;
rollResult = Math.floor(Math.random() * 20) + 1;
rollVideoUrl = await getVideoUrl(skin, 'd20', rollResult);
showModal('roll');
};
const handleGuidance = async () => {
if (guidanceResult) return;
guidanceResult = Math.floor(Math.random() * 4) + 1;
guidanceVideoUrl = await getVideoUrl(skin, 'd4', guidanceResult);
showModal('guidance');
@ -49,7 +52,6 @@
};
</script>
<main>
<section>
<h1>You have received a gift</h1>
</section>
@ -110,7 +112,7 @@
<p>{rollResult + guidanceResult}</p>
{#if rollResult + guidanceResult >= difficultyClass}
<h2 class="success">Success</h2>
<a href="/present">Collect your gift!</a>
<a href="/present{page.url.search}">Collect your gift!</a>
{:else}
<h2 class="failure">Failure</h2>
<button class="reset" onclick={resetPage}> Reset</button>
@ -118,30 +120,7 @@
{/if}
</section>
</main>
<style>
:global(body) {
margin: 0;
font-family: 'Arial', sans-serif;
background-color: #f4f4f4;
color: #1c1919;
}
main {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
width: 100vw;
background-color: #a8571c;
color: white;
text-align: center;
overflow: hidden;
padding: 20px;
box-sizing: border-box;
}
h1, h2 {
font-size: 2rem;
@ -227,4 +206,5 @@ button.continue:hover {
section > button {
margin-top: 20px;
}</style>
}
</style>

View file

@ -1,8 +1,23 @@
<script lang="ts">
// Show the gift key that was in ENV during build
const steamGiftKey = import.meta.env.VITE_STEAM_GIFT_KEY;
import { page } from '$app/state';
let steamGiftKey = $state<string | null>(null);
let isLegit = $state<boolean>(true);
$effect(() => {
const bk = page.url.searchParams.get('bk');
if (!bk) {
isLegit = false;
return;
}
steamGiftKey = atob(bk);
});
</script>
{#if isLegit}
<h1>Congrats!</h1>
<h2>Here is your prize &lt;3</h2>
<h2>Enjoy your gift &lt;3</h2>
<p>{steamGiftKey}</p>
{:else}
<h1>Sorry, this gift is not for you</h1>
{/if}

View file

@ -1,4 +1,4 @@
import adapter from 'svelte-adapter-bun'
import adapter from '@sveltejs/adapter-node'
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
/** @type {import('@sveltejs/kit').Config} */