Compare commits
	
		
			3 commits
		
	
	
		
			b2095e98fb
			...
			a0b1b20c26
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | a0b1b20c26 | ||
|   | 37ff3da023 | ||
|   | 757e670dbb | 
					 7 changed files with 27 additions and 20 deletions
				
			
		|  | @ -1,5 +1,5 @@ | |||
| <!doctype html> | ||||
| <html lang="en" data-theme="dracula"> | ||||
| <html lang="en"> | ||||
| 
 | ||||
| <head> | ||||
|   <meta charset="UTF-8" /> | ||||
|  |  | |||
|  | @ -4,8 +4,8 @@ import { LoginContext, ModalContext } from "./Root"; | |||
| export function LoginForm() { | ||||
|   const modal_ctx = useContext(ModalContext); | ||||
|   const login_ctx = useContext(LoginContext); | ||||
|   const [username, setUsername] = createSignal(""); | ||||
|   const [password, setPassword] = createSignal(""); | ||||
|   const [username, setUsername] = createSignal<string>(""); | ||||
|   const [password, setPassword] = createSignal<string>(""); | ||||
|   const [waiting, setWaiting] = createSignal(false); | ||||
|   const [error, setError] = createSignal(false); | ||||
| 
 | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ import { LoginForm } from "./Login"; | |||
| function Menu() { | ||||
|   let login_ctx = useContext(LoginContext); | ||||
|   return ( | ||||
|     <ul class="menu menu-horizontal bg-base-200 rounded-box space-x-2"> | ||||
|     <ul class="menu menu-horizontal bg-base-100 rounded-box space-x-2"> | ||||
|       <li> | ||||
|         <A href="/" end> | ||||
|           Home | ||||
|  | @ -31,21 +31,20 @@ export function Navbar() { | |||
|   let login_ctx = useContext(LoginContext); | ||||
| 
 | ||||
|   return ( | ||||
|     <div class="navbar bg-base-100 max-w-3xl max-w flex"> | ||||
|     <div class="navbar text-neutral-content max-w-3xl max-w"> | ||||
|       <div class="flex-1"> | ||||
|         <A href={"/"} class="btn btn-ghost normal-case text-xl"> | ||||
|           FrostByte | ||||
|         </A> | ||||
|       </div> | ||||
|       <div class=""> | ||||
|       <div class="hidden md:flex"> | ||||
|         <Menu /> | ||||
|       </div> | ||||
|       <div class="flex-1 justify-end"> | ||||
|       <div class="flex-1 justify-end hidden md:flex"> | ||||
|         <A | ||||
|           href="#" | ||||
|           class="btn btn-ghost normal-case text-sm" | ||||
|           onClick={(b) => { | ||||
|             b.preventDefault(); | ||||
|           onClick={() => { | ||||
|             if (login_ctx?.token() != "") { | ||||
|               localStorage.setItem("token", ""); | ||||
|               localStorage.setItem("username", ""); | ||||
|  |  | |||
|  | @ -8,15 +8,15 @@ export default { | |||
|     themes: [ | ||||
|       { | ||||
|         mytheme: { | ||||
|           "primary": "#86e8d9", | ||||
|           "secondary": "#b5385d", | ||||
|           "accent": "#88ed5a", | ||||
|           "neutral": "#14171f", | ||||
|           "base-100": "#343154", | ||||
|           "info": "#9bc3e9", | ||||
|           "success": "#1f9363", | ||||
|           "warning": "#f2ce4a", | ||||
|           "error": "#e77d6a", | ||||
|           "primary": "#64279e", | ||||
|           "secondary": "#9454af", | ||||
|           "accent": "#6ff7c5", | ||||
|           "neutral": "#1f2329", | ||||
|           "base-100": "#2a3a47", | ||||
|           "info": "#8b9be5", | ||||
|           "success": "#79e2b4", | ||||
|           "warning": "#efb261", | ||||
|           "error": "#e1604c", | ||||
|         }, | ||||
|       }, | ||||
|     ], | ||||
|  |  | |||
|  | @ -28,6 +28,8 @@ RUN addgroup -S user && adduser -S user -G user | |||
| WORKDIR /runner | ||||
| # Copy the server binary and the public directory, note the debug binary | ||||
| COPY --from=builder /build/target/x86_64-unknown-linux-musl/debug/server /runner/server | ||||
| RUN mkdir /runner/public | ||||
| RUN echo "Debug build!" > /runner/public/index.html | ||||
| 
 | ||||
| # Make sure the user can access the files | ||||
| RUN chown -R user:user /runner | ||||
|  |  | |||
							
								
								
									
										4
									
								
								justfile
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								justfile
									
										
									
									
									
								
							|  | @ -22,7 +22,7 @@ build-container-server-debug: | |||
| # Builds a debug container and runs it
 | ||||
| [private] | ||||
| start-debug: build-container-server-debug remove-podman-containers | ||||
|     {{runtime}} run -d -p 8080:8080 --name frostbyte-debug fb-server-debug | ||||
|     {{runtime}} run -d -e DATABASE_URL=sqlite:debug.db -p 8080:8080 --name frostbyte-debug fb-server-debug | ||||
|     @echo "Debug server started." | ||||
| 
 | ||||
| # Builds a release container
 | ||||
|  | @ -32,6 +32,7 @@ build-container-release: | |||
| 
 | ||||
| # Builds a release container and runs it
 | ||||
| start-release: build-container-release remove-podman-containers | ||||
|     {{runtime}} network create fb_network --ignore | ||||
|     {{runtime}} run -d --network fb_network -e DATABASE_URL=sqlite:release.db -p 8080:8080 --name frostbyte fb-server | ||||
| 
 | ||||
| init-sqlx: | ||||
|  | @ -43,6 +44,7 @@ init-sqlx: | |||
| # Removes and stops any containers related to the project
 | ||||
| [private] | ||||
| remove-podman-containers: | ||||
|     {{runtime}} network rm -f fb_network | ||||
|     {{runtime}} container rm -f frostbyte | ||||
|     {{runtime}} container rm -f frostbyte-debug | ||||
| 
 | ||||
|  |  | |||
|  | @ -31,7 +31,11 @@ impl ServerState { | |||
|     pub async fn new() -> Self { | ||||
|         // This is almost certainly bad practice for more reasons than I can count
 | ||||
|         dotenvy::dotenv().ok(); | ||||
|         let db_url = dotenvy::var("DATABASE_URL").unwrap_or(":memory:".to_string()); | ||||
|         let db_url = dotenvy::var("DATABASE_URL").unwrap_or_else(|_| { | ||||
|             error!("DATABASE_URL not set in environment!"); | ||||
|             std::process::exit(1); | ||||
|         }); | ||||
| 
 | ||||
|         info!("Using db_url: {}", &db_url); | ||||
| 
 | ||||
|         if !sqlx::Sqlite::database_exists(&db_url).await.unwrap() { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue