kinda finished
This commit is contained in:
		
							parent
							
								
									8a37f14a48
								
							
						
					
					
						commit
						11d9b7a0b4
					
				
					 11 changed files with 2706 additions and 162 deletions
				
			
		
							
								
								
									
										5
									
								
								.dockerignore
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								.dockerignore
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | ||||||
|  | Dockerfile | ||||||
|  | node_modules/ | ||||||
|  | build/ | ||||||
|  | .svelte-kit/ | ||||||
|  | .idea/ | ||||||
							
								
								
									
										16
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								Dockerfile
									
									
									
									
									
										Normal 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
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								bun.lockb
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										2501
									
								
								package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										2501
									
								
								package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -14,7 +14,7 @@ | ||||||
| 	}, | 	}, | ||||||
| 	"devDependencies": { | 	"devDependencies": { | ||||||
| 		"@eslint/compat": "^1.2.3", | 		"@eslint/compat": "^1.2.3", | ||||||
| 		"@sveltejs/adapter-static": "^3.0.6", | 		"@sveltejs/adapter-node": "^5.2.11", | ||||||
| 		"@sveltejs/kit": "^2.0.0", | 		"@sveltejs/kit": "^2.0.0", | ||||||
| 		"@sveltejs/vite-plugin-svelte": "^4.0.0", | 		"@sveltejs/vite-plugin-svelte": "^4.0.0", | ||||||
| 		"eslint": "^9.7.0", | 		"eslint": "^9.7.0", | ||||||
|  | @ -28,8 +28,5 @@ | ||||||
| 		"typescript": "^5.0.0", | 		"typescript": "^5.0.0", | ||||||
| 		"typescript-eslint": "^8.0.0", | 		"typescript-eslint": "^8.0.0", | ||||||
| 		"vite": "^5.4.11" | 		"vite": "^5.4.11" | ||||||
| 	}, |  | ||||||
| 	"dependencies": { |  | ||||||
| 		"svelte-adapter-bun": "^0.5.2" |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										30
									
								
								src/routes/+layout.svelte
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								src/routes/+layout.svelte
									
									
									
									
									
										Normal 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> | ||||||
|  | @ -1,5 +1,6 @@ | ||||||
| <script lang="ts"> | <script lang="ts"> | ||||||
| 	import Modal from '$lib/Modal.svelte'; | 	import Modal from '$lib/Modal.svelte'; | ||||||
|  | 	import { page } from '$app/state'; | ||||||
| 	 | 	 | ||||||
| 	const difficultyClass = 15; | 	const difficultyClass = 15; | ||||||
| 	const skin = 'winter'; | 	const skin = 'winter'; | ||||||
|  | @ -23,12 +24,14 @@ | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
| 	const handleRoll = async () => { | 	const handleRoll = async () => { | ||||||
|  | 		if (rollResult) return; | ||||||
| 		rollResult = Math.floor(Math.random() * 20) + 1; | 		rollResult = Math.floor(Math.random() * 20) + 1; | ||||||
| 		rollVideoUrl = await getVideoUrl(skin, 'd20', rollResult); | 		rollVideoUrl = await getVideoUrl(skin, 'd20', rollResult); | ||||||
| 		showModal('roll'); | 		showModal('roll'); | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
| 	const handleGuidance = async () => { | 	const handleGuidance = async () => { | ||||||
|  | 		if (guidanceResult) return; | ||||||
| 		guidanceResult = Math.floor(Math.random() * 4) + 1; | 		guidanceResult = Math.floor(Math.random() * 4) + 1; | ||||||
| 		guidanceVideoUrl = await getVideoUrl(skin, 'd4', guidanceResult); | 		guidanceVideoUrl = await getVideoUrl(skin, 'd4', guidanceResult); | ||||||
| 		showModal('guidance'); | 		showModal('guidance'); | ||||||
|  | @ -49,7 +52,6 @@ | ||||||
| 	}; | 	}; | ||||||
| </script> | </script> | ||||||
| 
 | 
 | ||||||
| <main> |  | ||||||
| <section> | <section> | ||||||
| 	<h1>You have received a gift</h1> | 	<h1>You have received a gift</h1> | ||||||
| </section> | </section> | ||||||
|  | @ -110,7 +112,7 @@ | ||||||
| 		<p>{rollResult + guidanceResult}</p> | 		<p>{rollResult + guidanceResult}</p> | ||||||
| 		{#if rollResult + guidanceResult >= difficultyClass} | 		{#if rollResult + guidanceResult >= difficultyClass} | ||||||
| 			<h2 class="success">Success</h2> | 			<h2 class="success">Success</h2> | ||||||
| 				<a href="/present">Collect your gift!</a> | 			<a href="/present{page.url.search}">Collect your gift!</a> | ||||||
| 		{:else} | 		{:else} | ||||||
| 			<h2 class="failure">Failure</h2> | 			<h2 class="failure">Failure</h2> | ||||||
| 			<button class="reset" onclick={resetPage}> Reset</button> | 			<button class="reset" onclick={resetPage}> Reset</button> | ||||||
|  | @ -118,30 +120,7 @@ | ||||||
| 	{/if} | 	{/if} | ||||||
| </section> | </section> | ||||||
| 
 | 
 | ||||||
| </main> |  | ||||||
| 
 |  | ||||||
| <style> | <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 { |     h1, h2 { | ||||||
|         font-size: 2rem; |         font-size: 2rem; | ||||||
|  | @ -227,4 +206,5 @@ button.continue:hover { | ||||||
| 
 | 
 | ||||||
|     section > button { |     section > button { | ||||||
|         margin-top: 20px; |         margin-top: 20px; | ||||||
| }</style> |     } | ||||||
|  | </style> | ||||||
|  |  | ||||||
|  | @ -1,8 +1,23 @@ | ||||||
| <script lang="ts"> | <script lang="ts"> | ||||||
| 	// Show the gift key that was in ENV during build | 	import { page } from '$app/state'; | ||||||
| 	const steamGiftKey = import.meta.env.VITE_STEAM_GIFT_KEY; | 
 | ||||||
|  | 	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> | </script> | ||||||
| 
 | 
 | ||||||
|  | {#if isLegit} | ||||||
| 	<h1>Congrats!</h1> | 	<h1>Congrats!</h1> | ||||||
| <h2>Here is your prize <3</h2> | 	<h2>Enjoy your gift <3</h2> | ||||||
| 	<p>{steamGiftKey}</p> | 	<p>{steamGiftKey}</p> | ||||||
|  | {:else} | ||||||
|  | 	<h1>Sorry, this gift is not for you</h1> | ||||||
|  | {/if} | ||||||
										
											Binary file not shown.
										
									
								
							|  | @ -1,4 +1,4 @@ | ||||||
| import adapter from 'svelte-adapter-bun' | import adapter from '@sveltejs/adapter-node' | ||||||
| import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; | import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; | ||||||
| 
 | 
 | ||||||
| /** @type {import('@sveltejs/kit').Config} */ | /** @type {import('@sveltejs/kit').Config} */ | ||||||
|  |  | ||||||
		Reference in a new issue