add sveltekit template
This commit is contained in:
		
							parent
							
								
									401e268281
								
							
						
					
					
						commit
						14f8e77e6a
					
				
					 24 changed files with 2157 additions and 1 deletions
				
			
		
							
								
								
									
										5
									
								
								.idea/.idea.Foxnouns.NET/.idea/codeStyles/codeStyleConfig.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								.idea/.idea.Foxnouns.NET/.idea/codeStyles/codeStyleConfig.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | ||||||
|  | <component name="ProjectCodeStyleConfiguration"> | ||||||
|  |   <state> | ||||||
|  |     <option name="USE_PER_PROJECT_SETTINGS" value="true" /> | ||||||
|  |   </state> | ||||||
|  | </component> | ||||||
							
								
								
									
										6
									
								
								.idea/.idea.Foxnouns.NET/.idea/inspectionProfiles/Project_Default.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								.idea/.idea.Foxnouns.NET/.idea/inspectionProfiles/Project_Default.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | ||||||
|  | <component name="InspectionProjectProfileManager"> | ||||||
|  |   <profile version="1.0"> | ||||||
|  |     <option name="myName" value="Project Default" /> | ||||||
|  |     <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" /> | ||||||
|  |   </profile> | ||||||
|  | </component> | ||||||
							
								
								
									
										6
									
								
								.idea/.idea.Foxnouns.NET/.idea/jsLinters/eslint.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								.idea/.idea.Foxnouns.NET/.idea/jsLinters/eslint.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | ||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <project version="4"> | ||||||
|  |   <component name="EslintConfiguration"> | ||||||
|  |     <files-pattern value="**/*.{js,ts,jsx,tsx,html,vue,svelte}" /> | ||||||
|  |   </component> | ||||||
|  | </project> | ||||||
							
								
								
									
										9
									
								
								.idea/.idea.Foxnouns.NET/.idea/prettier.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								.idea/.idea.Foxnouns.NET/.idea/prettier.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | ||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <project version="4"> | ||||||
|  |   <component name="PrettierConfiguration"> | ||||||
|  |     <option name="myConfigurationMode" value="MANUAL" /> | ||||||
|  |     <option name="myRunOnSave" value="true" /> | ||||||
|  |     <option name="myRunOnReformat" value="true" /> | ||||||
|  |     <option name="myFilesPattern" value="**/*.{js,ts,jsx,tsx,vue,astro,svelte,html}" /> | ||||||
|  |   </component> | ||||||
|  | </project> | ||||||
|  | @ -28,5 +28,5 @@ public class DebugController(DatabaseContext db, AuthService authSvc, IClock clo | ||||||
| 
 | 
 | ||||||
|     public record CreateUserRequest(string Username, string Password, string Email); |     public record CreateUserRequest(string Username, string Password, string Email); | ||||||
| 
 | 
 | ||||||
|     public record AuthResponse(Snowflake Id, string Username, string Token); |     private record AuthResponse(Snowflake Id, string Username, string Token); | ||||||
| } | } | ||||||
							
								
								
									
										21
									
								
								Foxnouns.Backend/Controllers/MetaController.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								Foxnouns.Backend/Controllers/MetaController.cs
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,21 @@ | ||||||
|  | using Foxnouns.Backend.Database; | ||||||
|  | using Microsoft.EntityFrameworkCore; | ||||||
|  | using Microsoft.AspNetCore.Mvc; | ||||||
|  | 
 | ||||||
|  | namespace Foxnouns.Backend.Controllers; | ||||||
|  | 
 | ||||||
|  | [Route("/api/v2/meta")] | ||||||
|  | public class MetaController(DatabaseContext db) : ApiControllerBase | ||||||
|  | { | ||||||
|  |     [HttpGet] | ||||||
|  |     [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(MetaResponse))] | ||||||
|  |     public async Task<IActionResult> GetMeta() | ||||||
|  |     { | ||||||
|  |         var userCount = await db.Users.CountAsync(); | ||||||
|  |         var memberCount = await db.Members.CountAsync(); | ||||||
|  | 
 | ||||||
|  |         return Ok(new MetaResponse(userCount, memberCount, BuildInfo.Version, BuildInfo.Hash)); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private record MetaResponse(int Users, int Members, string Version, string Hash); | ||||||
|  | } | ||||||
							
								
								
									
										4
									
								
								Foxnouns.Frontend/.env.example
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								Foxnouns.Frontend/.env.example
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | ||||||
|  | # The API base that the server itself should call, this should not be behind a reverse proxy. | ||||||
|  | PRIVATE_API_BASE=http://localhost:5000/api | ||||||
|  | # The API base that clients should call, behind a reverse proxy. | ||||||
|  | PUBLIC_API_BASE=https://pronouns.cc/api | ||||||
							
								
								
									
										10
									
								
								Foxnouns.Frontend/.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Foxnouns.Frontend/.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | ||||||
|  | .DS_Store | ||||||
|  | node_modules | ||||||
|  | /build | ||||||
|  | /.svelte-kit | ||||||
|  | /package | ||||||
|  | .env | ||||||
|  | .env.* | ||||||
|  | !.env.example | ||||||
|  | vite.config.js.timestamp-* | ||||||
|  | vite.config.ts.timestamp-* | ||||||
							
								
								
									
										1
									
								
								Foxnouns.Frontend/.npmrc
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Foxnouns.Frontend/.npmrc
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | engine-strict=true | ||||||
							
								
								
									
										4
									
								
								Foxnouns.Frontend/.prettierignore
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								Foxnouns.Frontend/.prettierignore
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | ||||||
|  | # Ignore files for PNPM, NPM and YARN | ||||||
|  | pnpm-lock.yaml | ||||||
|  | package-lock.json | ||||||
|  | yarn.lock | ||||||
							
								
								
									
										6
									
								
								Foxnouns.Frontend/.prettierrc
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								Foxnouns.Frontend/.prettierrc
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | ||||||
|  | { | ||||||
|  | 	"useTabs": true, | ||||||
|  | 	"printWidth": 100, | ||||||
|  | 	"plugins": ["prettier-plugin-svelte"], | ||||||
|  | 	"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] | ||||||
|  | } | ||||||
							
								
								
									
										38
									
								
								Foxnouns.Frontend/README.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								Foxnouns.Frontend/README.md
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,38 @@ | ||||||
|  | # create-svelte | ||||||
|  | 
 | ||||||
|  | Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/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. | ||||||
							
								
								
									
										33
									
								
								Foxnouns.Frontend/eslint.config.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								Foxnouns.Frontend/eslint.config.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,33 @@ | ||||||
|  | import js from '@eslint/js'; | ||||||
|  | import ts from 'typescript-eslint'; | ||||||
|  | import svelte from 'eslint-plugin-svelte'; | ||||||
|  | import prettier from 'eslint-config-prettier'; | ||||||
|  | import globals from 'globals'; | ||||||
|  | 
 | ||||||
|  | /** @type {import('eslint').Linter.FlatConfig[]} */ | ||||||
|  | export default [ | ||||||
|  | 	js.configs.recommended, | ||||||
|  | 	...ts.configs.recommended, | ||||||
|  | 	...svelte.configs['flat/recommended'], | ||||||
|  | 	prettier, | ||||||
|  | 	...svelte.configs['flat/prettier'], | ||||||
|  | 	{ | ||||||
|  | 		languageOptions: { | ||||||
|  | 			globals: { | ||||||
|  | 				...globals.browser, | ||||||
|  | 				...globals.node | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	}, | ||||||
|  | 	{ | ||||||
|  | 		files: ['**/*.svelte'], | ||||||
|  | 		languageOptions: { | ||||||
|  | 			parserOptions: { | ||||||
|  | 				parser: ts.parser | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	}, | ||||||
|  | 	{ | ||||||
|  | 		ignores: ['build/', '.svelte-kit/', 'dist/'] | ||||||
|  | 	} | ||||||
|  | ]; | ||||||
							
								
								
									
										36
									
								
								Foxnouns.Frontend/package.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								Foxnouns.Frontend/package.json
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,36 @@ | ||||||
|  | { | ||||||
|  | 	"name": "foxnouns.frontend", | ||||||
|  | 	"version": "0.0.1", | ||||||
|  | 	"private": true, | ||||||
|  | 	"scripts": { | ||||||
|  | 		"dev": "vite dev", | ||||||
|  | 		"build": "vite build", | ||||||
|  | 		"preview": "vite preview", | ||||||
|  | 		"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", | ||||||
|  | 		"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", | ||||||
|  | 		"lint": "prettier --check . && eslint .", | ||||||
|  | 		"format": "prettier --write ." | ||||||
|  | 	}, | ||||||
|  | 	"devDependencies": { | ||||||
|  | 		"@sveltejs/adapter-node": "^5.0.1", | ||||||
|  | 		"@sveltejs/kit": "^2.0.0", | ||||||
|  | 		"@sveltejs/vite-plugin-svelte": "^3.0.0", | ||||||
|  | 		"@sveltestrap/sveltestrap": "^6.2.7", | ||||||
|  | 		"@types/eslint": "^8.56.7", | ||||||
|  | 		"bootstrap": "^5.3.3", | ||||||
|  | 		"eslint": "^9.0.0", | ||||||
|  | 		"eslint-config-prettier": "^9.1.0", | ||||||
|  | 		"eslint-plugin-svelte": "^2.36.0", | ||||||
|  | 		"globals": "^15.0.0", | ||||||
|  | 		"prettier": "^3.1.1", | ||||||
|  | 		"prettier-plugin-svelte": "^3.1.2", | ||||||
|  | 		"svelte": "^4.2.7", | ||||||
|  | 		"svelte-check": "^3.6.0", | ||||||
|  | 		"tslib": "^2.4.1", | ||||||
|  | 		"typescript": "^5.0.0", | ||||||
|  | 		"typescript-eslint": "^8.0.0-alpha.20", | ||||||
|  | 		"vite": "^5.0.3" | ||||||
|  | 	}, | ||||||
|  | 	"type": "module", | ||||||
|  | 	"dependencies": {} | ||||||
|  | } | ||||||
							
								
								
									
										16
									
								
								Foxnouns.Frontend/src/app.d.ts
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								Foxnouns.Frontend/src/app.d.ts
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | ||||||
|  | // See https://kit.svelte.dev/docs/types#app
 | ||||||
|  | // for information about these interfaces
 | ||||||
|  | declare global { | ||||||
|  | 	namespace App { | ||||||
|  | 		// interface Error {}
 | ||||||
|  | 		// interface Locals {}
 | ||||||
|  | 		interface Locals { | ||||||
|  | 			token?: string; | ||||||
|  | 		} | ||||||
|  | 		// interface PageData {}
 | ||||||
|  | 		// interface PageState {}
 | ||||||
|  | 		// interface Platform {}
 | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | export {}; | ||||||
							
								
								
									
										12
									
								
								Foxnouns.Frontend/src/app.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Foxnouns.Frontend/src/app.html
									
										
									
									
									
										Normal file
									
								
							|  | @ -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, initial-scale=1" /> | ||||||
|  | 		%sveltekit.head% | ||||||
|  | 	</head> | ||||||
|  | 	<body data-sveltekit-preload-data="hover"> | ||||||
|  | 		<div style="display: contents">%sveltekit.body%</div> | ||||||
|  | 	</body> | ||||||
|  | </html> | ||||||
							
								
								
									
										15
									
								
								Foxnouns.Frontend/src/hooks.server.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								Foxnouns.Frontend/src/hooks.server.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | ||||||
|  | import { PRIVATE_API_BASE } from "$env/static/private"; | ||||||
|  | import { PUBLIC_API_BASE } from "$env/static/public"; | ||||||
|  | 
 | ||||||
|  | export async function handle({ event, resolve }) { | ||||||
|  | 	event.locals.token = event.cookies.get("pronounscc-token"); | ||||||
|  | 	return await resolve(event); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | export function handleFetch({ event, request, fetch }) { | ||||||
|  | 	if (request.url.startsWith(PUBLIC_API_BASE)) | ||||||
|  | 		request = new Request(request.url.replace(PUBLIC_API_BASE, PRIVATE_API_BASE), request); | ||||||
|  | 	if (event.locals.token) request.headers.set("Authorization", event.locals.token); | ||||||
|  | 
 | ||||||
|  | 	return fetch(request); | ||||||
|  | } | ||||||
							
								
								
									
										1
									
								
								Foxnouns.Frontend/src/lib/index.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Foxnouns.Frontend/src/lib/index.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | // place files you want to import through the `$lib` alias in this folder.
 | ||||||
							
								
								
									
										2
									
								
								Foxnouns.Frontend/src/routes/+page.svelte
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								Foxnouns.Frontend/src/routes/+page.svelte
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,2 @@ | ||||||
|  | <h1>Welcome to SvelteKit</h1> | ||||||
|  | <p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p> | ||||||
							
								
								
									
										
											BIN
										
									
								
								Foxnouns.Frontend/static/favicon.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Foxnouns.Frontend/static/favicon.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 1.5 KiB | 
							
								
								
									
										21
									
								
								Foxnouns.Frontend/svelte.config.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								Foxnouns.Frontend/svelte.config.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,21 @@ | ||||||
|  | import adapter from "@sveltejs/adapter-node"; | ||||||
|  | import { vitePreprocess } from "@sveltejs/vite-plugin-svelte"; | ||||||
|  | 
 | ||||||
|  | /** @type {import('@sveltejs/kit').Config} */ | ||||||
|  | const config = { | ||||||
|  | 	// Consult https://kit.svelte.dev/docs/integrations#preprocessors
 | ||||||
|  | 	// for more information about preprocessors
 | ||||||
|  | 	preprocess: vitePreprocess(), | ||||||
|  | 
 | ||||||
|  | 	kit: { | ||||||
|  | 		// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
 | ||||||
|  | 		// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
 | ||||||
|  | 		// See https://kit.svelte.dev/docs/adapters for more information about adapters.
 | ||||||
|  | 		adapter: adapter(), | ||||||
|  | 		env: { | ||||||
|  | 			privatePrefix: "PRIVATE_", | ||||||
|  | 		}, | ||||||
|  | 	}, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | export default config; | ||||||
							
								
								
									
										19
									
								
								Foxnouns.Frontend/tsconfig.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								Foxnouns.Frontend/tsconfig.json
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,19 @@ | ||||||
|  | { | ||||||
|  | 	"extends": "./.svelte-kit/tsconfig.json", | ||||||
|  | 	"compilerOptions": { | ||||||
|  | 		"allowJs": true, | ||||||
|  | 		"checkJs": true, | ||||||
|  | 		"esModuleInterop": true, | ||||||
|  | 		"forceConsistentCasingInFileNames": true, | ||||||
|  | 		"resolveJsonModule": true, | ||||||
|  | 		"skipLibCheck": true, | ||||||
|  | 		"sourceMap": true, | ||||||
|  | 		"strict": true, | ||||||
|  | 		"moduleResolution": "bundler" | ||||||
|  | 	} | ||||||
|  | 	// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias | ||||||
|  | 	// except $lib which is handled by https://kit.svelte.dev/docs/configuration#files | ||||||
|  | 	// | ||||||
|  | 	// 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 | ||||||
|  | } | ||||||
							
								
								
									
										6
									
								
								Foxnouns.Frontend/vite.config.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								Foxnouns.Frontend/vite.config.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | ||||||
|  | import { sveltekit } from '@sveltejs/kit/vite'; | ||||||
|  | import { defineConfig } from 'vite'; | ||||||
|  | 
 | ||||||
|  | export default defineConfig({ | ||||||
|  | 	plugins: [sveltekit()] | ||||||
|  | }); | ||||||
							
								
								
									
										1885
									
								
								Foxnouns.Frontend/yarn.lock
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1885
									
								
								Foxnouns.Frontend/yarn.lock
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue