Compare commits

..

No commits in common. "075a684ee341a39eaa2087cf135637265892d8c9" and "e9b215c686662e84db6414761c80b7b288d06d60" have entirely different histories.

4 changed files with 23 additions and 51 deletions

View file

@ -31,16 +31,9 @@ export function Navbar() {
let login_ctx = useContext(LoginContext);
return (
<div class="navbar bg-base-100 max-w-3xl max-w flex">
<div class="flex-1">
<A href={"/"} class="btn btn-ghost normal-case text-xl">
FrostByte
</A>
</div>
<div class="">
<div class="navbar bg-base-100 max-w-3xl max-w flex justify-around">
<A href={"/"} class="btn btn-ghost normal-case text-xl">FrostByte</A>
<Menu />
</div>
<div class="flex-1 justify-end">
<A
href="#"
class="btn btn-ghost normal-case text-sm"
@ -59,7 +52,6 @@ export function Navbar() {
{login_ctx?.token() != "" ? login_ctx?.username() : "Login"}
</A>
</div>
</div>
);
}

View file

@ -32,7 +32,7 @@ build-container-release:
# Builds a release container and runs it
start-release: build-container-release remove-podman-containers
{{runtime}} run -d -e DATABASE_URL=sqlite:release.db -p 8080:8080 --name frostbyte fb-server
{{runtime}} run -d -p 8080:8080 --name frostbyte fb-server
init-sqlx:
echo "DATABASE_URL=sqlite:debug.db" > server/.env

View file

@ -37,11 +37,7 @@ async fn main() -> std::io::Result<()> {
.app_data(Data::new(data.clone()))
.app_data(Data::new(capt_db.clone())),
)
.service(
Files::new("/", "./public")
.index_file("index.html")
.default_handler(actix_files::NamedFile::open("./public/index.html").unwrap()),
)
.service(Files::new("/", "./public").index_file("index.html"))
})
.bind("0.0.0.0:8080")?
.run()

View file

@ -2,11 +2,9 @@ use std::collections::BTreeMap;
use std::sync::Arc;
use std::sync::Mutex;
use log::error;
use log::info;
use sqlx::migrate::MigrateDatabase;
use sqlx::Pool;
use sqlx::Sqlite;
use sqlx::SqlitePool;
use sqlx::{self, sqlite};
#[derive(Clone)]
@ -32,11 +30,6 @@ impl ServerState {
// 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());
info!("Using db_url: {}", &db_url);
if !sqlx::Sqlite::database_exists(&db_url).await.unwrap() {
sqlx::Sqlite::create_database(&db_url).await.unwrap();
}
let pool = sqlite::SqlitePoolOptions::new()
.max_connections(5)
@ -46,12 +39,6 @@ impl ServerState {
sqlx::migrate!("./migrations").run(&pool).await.unwrap();
match crate::db::db_new_user("imbus".to_string(), "kartellen1234".to_string(), &pool).await
{
Some(u) => info!("Created default user {}", u.username),
None => error!("Failed to create default user..."),
}
#[cfg(debug_assertions)]
debug_setup(&pool).await.unwrap();
@ -59,9 +46,6 @@ impl ServerState {
}
}
#[cfg(debug_assertions)]
use sqlx::SqlitePool;
// Inserts a bunch of dummy data into the database
// Mostly useful for debugging new posts, as we need to satisfy foreign key constraints.
#[cfg(debug_assertions)]