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