updates, move main.rs to bin/web.rs

Signed-off-by: Christine Dodrill <me@christine.website>
This commit is contained in:
Cadey Ratio 2021-01-10 15:31:54 -05:00
parent b816e73bf3
commit 3384d81832
9 changed files with 468 additions and 556 deletions

981
backend/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
#![allow(unreachable_code)]
#[macro_use]
extern crate tracing;

View File

@ -11,9 +11,9 @@ use rocket_contrib::helmet::SpaceHelmet;
use rocket_cors::{AllowedHeaders, AllowedOrigins};
use rocket_prometheus::PrometheusMetrics;
use ::mi::{api, frontend, paseto, rocket_trace::*, web::*, MainDatabase, APPLICATION_NAME};
mod wellknown;
use ::mi::{
api, frontend, paseto, rocket_trace::*, web::*, wellknown, MainDatabase, APPLICATION_NAME,
};
fn main() -> Result<()> {
color_eyre::install()?;
@ -27,7 +27,6 @@ fn main() -> Result<()> {
"http://mi.akua",
]);
// You can also deserialize this
let cors = rocket_cors::CorsOptions {
allowed_origins,
allowed_methods: vec![Method::Get, Method::Post]

View File

@ -25,6 +25,7 @@ pub mod paseto;
pub mod rocket_trace;
pub mod schema;
pub mod web;
pub mod wellknown;
#[database("main_data")]
pub struct MainDatabase(SqliteConnection);

View File

@ -1,14 +1,14 @@
#[get("/.within/botinfo")]
fn botinfo() -> &'static str {
pub fn botinfo() -> &'static str {
include_str!("./botinfo.txt")
}
#[get("/robots.txt")]
fn robots() -> String {
include_str!("./robots.txt").into_string()
pub fn robots() -> String {
include_str!("./robots.txt").to_string()
}
#[get("/security.txt")]
fn security() -> String {
include_str!("./security.txt").into_string()
pub fn security() -> String {
include_str!("./security.txt").to_string()
}

View File

@ -39,7 +39,7 @@ let
${composite}/bin/migrate_database
${composite}/bin/bridgy_migrate || true
export ROCKET_ASSET_PATH=${composite}/public
exec ${composite}/bin/mi
exec ${composite}/bin/web
'';
in symlinkJoin {
name = "mi";

View File

@ -4,7 +4,7 @@ let
pkgs =
import sources.nixpkgs { overlays = [ (import sources.nixpkgs-mozilla) ]; };
channel = "nightly";
date = "2020-10-25";
date = "2021-01-10";
targets = [ ];
chan = pkgs.rustChannelOfTargets channel date targets;
in chan

View File

@ -17,10 +17,10 @@
"homepage": "",
"owner": "nmattia",
"repo": "naersk",
"rev": "d645515b7159c75087b3d51f23a68047c2c09699",
"sha256": "16hjyf1nkvwhb5nw989qhm3gdlim5wfw515bnvxpix5ff8jfbh9x",
"rev": "a76924cbbb17c387e5ae4998a4721d88a3ac95c0",
"sha256": "09b5g2krf8mfpajgz2bgapkv3dpimg0qx1nfpjafcrsk0fhxmqay",
"type": "tarball",
"url": "https://github.com/nmattia/naersk/archive/d645515b7159c75087b3d51f23a68047c2c09699.tar.gz",
"url": "https://github.com/nmattia/naersk/archive/a76924cbbb17c387e5ae4998a4721d88a3ac95c0.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"niv": {
@ -29,10 +29,10 @@
"homepage": "https://github.com/nmattia/niv",
"owner": "nmattia",
"repo": "niv",
"rev": "20c899271f288d33114760bc298838575fc6c7f9",
"sha256": "07zswk6dhlydihl9g6skmy52grjvqpra8r98f2dmbgwzc1yhjhxq",
"rev": "94dadba1a3a6a2f0b8ca2963e49daeec5d4e3098",
"sha256": "1y2h9wl7w60maa2m4xw9231xdr325xynzpph8xr4j5vsznygv986",
"type": "tarball",
"url": "https://github.com/nmattia/niv/archive/20c899271f288d33114760bc298838575fc6c7f9.tar.gz",
"url": "https://github.com/nmattia/niv/archive/94dadba1a3a6a2f0b8ca2963e49daeec5d4e3098.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {

View File

@ -8,14 +8,18 @@ in pkgs.mkShell rec {
buildInputs = with pkgs; [
# rust
rust
cargo-watch
# system deps
pkgconfig
openssl
cmake
zlib
diesel-cli
sqlite
libsodium
cargo-watch
# tools
diesel-cli
# elm
elmPackages.elm