moved goalposts LULW

This commit is contained in:
shockrahwow
2019-11-12 11:19:44 -08:00
parent 1e525e3c05
commit d3fd575b32
10 changed files with 848 additions and 1243 deletions

1169
website/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +0,0 @@
[package]
name = "client"
version = "0.1.0"
authors = ["shockrah <alejandros714@protonmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rocket = "0.4.2"
serde = "1.0"
serde_derive = "1.0"
[dependencies.rocket_contrib]
version = "0.4.2"
default-features = false
features = ["json", "tera_templates"]

View File

@@ -1,8 +0,0 @@
[development]
address="localhost"
port=8080
templates_dir="static/html/"
[production]
address="localhost"
port=8080
templates_dir="static/html/"

5
website/readme.md Normal file
View File

@@ -0,0 +1,5 @@
# Client Build
This will be where we keep the code for the web-based-client.
This client comms with our server code base found under `/server/` in this repository.

View File

@@ -1,107 +0,0 @@
// This client code really just serves as the url router for the main website where we describe what the project is about
#![feature(proc_macro_hygiene, decl_macro, plugin)]
//#[macro_use] extern crate serde_derive;
#[macro_use] extern crate serde_derive;
#[macro_use] extern crate rocket;
extern crate rocket_contrib;
use rocket_contrib::templates::Template;
use rocket::response::NamedFile;
use std::io;
// Purely for backend purposes
#[derive(Serialize)]
struct PageAttrs {
og_title: &'static str,
og_type: &'static str,
og_desc: &'static str,
og_url: &'static str,
og_image: &'static str,
// General settings
favicon: &'static str, // path to the favicon
// Branding things
brand_url: &'static str, // default is freechat.io - clean url of domain
brand_motto: &'static str,
brand_quip: &'static str
}
macro_rules! html {
($page:expr) => {
NamedFile::open(format!("static/html/{}", $page))
}
}
macro_rules! css {
($style:expr) => {
NamedFile::open(format!("static/css/{}", $style))
}
}
macro_rules! js {
($js:expr) => {
NamedFile::open(format!("static/js/{}", $js))
}
}
// Pages themselves
#[get("/")]
fn homepage() -> Template {
// Be sure to include some kind of prompt
// TODO: read this type of data from a config or provide some function/macro that
// does that for us so that we don't hardcode these values in like ever
let context = PageAttrs {
og_title: "Freechat",
og_type: "Decentralized Chat",
og_desc: "Privacy and Freedom Respecting Chat Platform",
og_url: "freechat.io",
og_image: "https://images.pexels.com/photos/146071/pexels-photo-146071.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260",// recall this is meant to be a path to the favicon
favicon: "https://images.pexels.com/photos/146071/pexels-photo-146071.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260",
brand_url: "freechat.io",
brand_motto: "Freedom respecting chat platform",
brand_quip: "Join an realm",
};
Template::render("index", &context)
}
// Handles logging in a user to their home instance
#[get("/login")]
fn login_page() -> io::Result<NamedFile> {
html!("login")
}
#[get("/servers")]
fn server_info() -> Template {
let context = PageAttrs{
og_title: "title",
og_type: "title",
og_image: "asdf",
og_desc: "title",
og_url: "title",
favicon: "title",
brand_url: "title",
brand_motto: "title",
brand_quip: "title",
};
Template::render("servers", &context)
}
// General resources
#[get("/static/css/<stylesheet>")]
fn static_css(stylesheet: String) -> io::Result<NamedFile> {
println!("{}", stylesheet);
css!(stylesheet)
}
#[get("/static/js/<javascript>")]
fn static_js(javascript: String) -> io::Result<NamedFile> {
js!(javascript)
}
fn main() {
rocket::ignite()
.mount("/", routes![
homepage, login_page, server_info,
static_css, static_js
])
.attach(Template::fairing())
.launch();
}