initial framework
This commit is contained in:
parent
7d16bc450d
commit
908a6e7547
6 changed files with 105 additions and 7 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -13,10 +13,3 @@ Cargo.lock
|
||||||
|
|
||||||
# MSVC Windows builds of rustc generate these, which store debugging information
|
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||||
*.pdb
|
*.pdb
|
||||||
|
|
||||||
# RustRover
|
|
||||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
||||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
||||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
||||||
#.idea/
|
|
||||||
|
|
9
Cargo.toml
Normal file
9
Cargo.toml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[package]
|
||||||
|
name = "simpleshout"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
rocket = { version = "0.5.1", features = ["json"] }
|
||||||
|
sled = { version = "0.34.7", features = ["mutex"] }
|
||||||
|
toml = "0.8.19"
|
0
src/channel.rs
Normal file
0
src/channel.rs
Normal file
0
src/client.rs
Normal file
0
src/client.rs
Normal file
96
src/main.rs
Normal file
96
src/main.rs
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
#[macro_use] extern crate rocket;
|
||||||
|
|
||||||
|
pub mod channel;
|
||||||
|
pub mod client;
|
||||||
|
pub mod message;
|
||||||
|
|
||||||
|
pub struct Config {
|
||||||
|
admin_password: String,
|
||||||
|
ratelimit: usize,
|
||||||
|
init_scrollback: usize,
|
||||||
|
sync_rate: usize,
|
||||||
|
reserved_usernames: Vec<String>,
|
||||||
|
banned_words: Vec<String>,
|
||||||
|
banned_users: Vec<String>,
|
||||||
|
banned_ips: Vec<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Config {
|
||||||
|
pub fn save(&self) -> bool {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
pub fn load(path: &str) -> Self {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct State {
|
||||||
|
config: Config,
|
||||||
|
db: sled::Db,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Display, Serialize)]
|
||||||
|
pub enum ChatResponseStatus {
|
||||||
|
SUCCESS,
|
||||||
|
FAILURE
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
pub struct ChatResponse {
|
||||||
|
status: ChatResponseStatus,
|
||||||
|
message: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[get("/init")]
|
||||||
|
fn init() -> Json {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[post("/login")]
|
||||||
|
fn login() -> Json {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[post("/create_channel")]
|
||||||
|
fn create_channel() -> Json {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[get("/channels")]
|
||||||
|
fn channels() -> Json {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[post("/join")]
|
||||||
|
fn join() -> Json {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[post("/sync")]
|
||||||
|
fn sync() -> Json {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[post("/send")]
|
||||||
|
fn send() -> Json {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[delete("/delete")]
|
||||||
|
fn delete() -> Json {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[post("/ban")]
|
||||||
|
fn ban() -> Json {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[launch]
|
||||||
|
fn rocket() -> _ {
|
||||||
|
// load config
|
||||||
|
// create shared config state
|
||||||
|
// init database, add to shared state
|
||||||
|
rocket::build().mount("/", routes![init, login, create_channel, channels, join, sync, send, delete, ban])
|
||||||
|
}
|
0
src/message.rs
Normal file
0
src/message.rs
Normal file
Loading…
Reference in a new issue