Compare commits
	
		
			No commits in common. "a0b1b20c26e5f2aa4af0e17f13700027299b2cdf" and "b2095e98fb60fd7ea3e6cfa498ebe855d0e5a26f" have entirely different histories.
		
	
	
		
			a0b1b20c26
			...
			b2095e98fb
		
	
		
					 7 changed files with 20 additions and 27 deletions
				
			
		|  | @ -1,5 +1,5 @@ | ||||||
| <!doctype html> | <!doctype html> | ||||||
| <html lang="en"> | <html lang="en" data-theme="dracula"> | ||||||
| 
 | 
 | ||||||
| <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<string>(""); |   const [username, setUsername] = createSignal(""); | ||||||
|   const [password, setPassword] = createSignal<string>(""); |   const [password, setPassword] = createSignal(""); | ||||||
|   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-100 rounded-box space-x-2"> |     <ul class="menu menu-horizontal bg-base-200 rounded-box space-x-2"> | ||||||
|       <li> |       <li> | ||||||
|         <A href="/" end> |         <A href="/" end> | ||||||
|           Home |           Home | ||||||
|  | @ -31,20 +31,21 @@ export function Navbar() { | ||||||
|   let login_ctx = useContext(LoginContext); |   let login_ctx = useContext(LoginContext); | ||||||
| 
 | 
 | ||||||
|   return ( |   return ( | ||||||
|     <div class="navbar text-neutral-content max-w-3xl max-w"> |     <div class="navbar bg-base-100 max-w-3xl max-w flex"> | ||||||
|       <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="hidden md:flex"> |       <div class=""> | ||||||
|         <Menu /> |         <Menu /> | ||||||
|       </div> |       </div> | ||||||
|       <div class="flex-1 justify-end hidden md:flex"> |       <div class="flex-1 justify-end"> | ||||||
|         <A |         <A | ||||||
|           href="#" |           href="#" | ||||||
|           class="btn btn-ghost normal-case text-sm" |           class="btn btn-ghost normal-case text-sm" | ||||||
|           onClick={() => { |           onClick={(b) => { | ||||||
|  |             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": "#64279e", |           "primary": "#86e8d9", | ||||||
|           "secondary": "#9454af", |           "secondary": "#b5385d", | ||||||
|           "accent": "#6ff7c5", |           "accent": "#88ed5a", | ||||||
|           "neutral": "#1f2329", |           "neutral": "#14171f", | ||||||
|           "base-100": "#2a3a47", |           "base-100": "#343154", | ||||||
|           "info": "#8b9be5", |           "info": "#9bc3e9", | ||||||
|           "success": "#79e2b4", |           "success": "#1f9363", | ||||||
|           "warning": "#efb261", |           "warning": "#f2ce4a", | ||||||
|           "error": "#e1604c", |           "error": "#e77d6a", | ||||||
|         }, |         }, | ||||||
|       }, |       }, | ||||||
|     ], |     ], | ||||||
|  |  | ||||||
|  | @ -28,8 +28,6 @@ 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 -e DATABASE_URL=sqlite:debug.db -p 8080:8080 --name frostbyte-debug fb-server-debug |     {{runtime}} run -d -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,7 +32,6 @@ 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: | ||||||
|  | @ -44,7 +43,6 @@ 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,11 +31,7 @@ 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_else(|_| { |         let db_url = dotenvy::var("DATABASE_URL").unwrap_or(":memory:".to_string()); | ||||||
|             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