mirror of
https://github.com/Dangoware/confetti-box.git
synced 2025-04-19 15:22:57 -05:00
Added bundled fonts Fira Code
and Roboto
This commit is contained in:
parent
338d320894
commit
44550eb2d7
5 changed files with 52 additions and 30 deletions
29
src/main.rs
29
src/main.rs
|
@ -15,32 +15,15 @@ use database::{clean_loop, Database, Mmid, MochiFile};
|
||||||
use endpoints::{file_info, lookup_mmid, lookup_mmid_name, lookup_mmid_noredir, server_info};
|
use endpoints::{file_info, lookup_mmid, lookup_mmid_name, lookup_mmid_noredir, server_info};
|
||||||
use log::info;
|
use log::info;
|
||||||
use maud::{html, Markup, PreEscaped};
|
use maud::{html, Markup, PreEscaped};
|
||||||
use pages::{about, api_info, footer, head};
|
use pages::{about, api_info, favicon, fira_code, footer, form_handler_js, head, roboto_flex, stylesheet};
|
||||||
use rocket::{
|
use rocket::{
|
||||||
data::{Limits, ToByteUnit}, form::Form, fs::TempFile, get, http::ContentType, post, response::content::{RawCss, RawJavaScript}, routes, serde::{json::Json, Serialize}, tokio, Config, FromForm, State
|
data::{Limits, ToByteUnit}, form::Form, fs::TempFile, get, post, routes, serde::{json::Json, Serialize}, tokio, Config, FromForm, State
|
||||||
};
|
};
|
||||||
use settings::Settings;
|
use settings::Settings;
|
||||||
use strings::{parse_time_string, to_pretty_time};
|
use strings::{parse_time_string, to_pretty_time};
|
||||||
use utils::hash_file;
|
use utils::hash_file;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
/// Stylesheet
|
|
||||||
#[get("/resources/main.css")]
|
|
||||||
fn stylesheet() -> RawCss<&'static str> {
|
|
||||||
RawCss(include_str!("../web/main.css"))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Upload handler javascript
|
|
||||||
#[get("/resources/request.js")]
|
|
||||||
fn form_handler_js() -> RawJavaScript<&'static str> {
|
|
||||||
RawJavaScript(include_str!("../web/request.js"))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[get("/resources/favicon.svg")]
|
|
||||||
fn favicon() -> (ContentType, &'static str) {
|
|
||||||
(ContentType::SVG, include_str!("../web/favicon.svg"))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[get("/")]
|
#[get("/")]
|
||||||
fn home(settings: &State<Settings>) -> Markup {
|
fn home(settings: &State<Settings>) -> Markup {
|
||||||
html! {
|
html! {
|
||||||
|
@ -237,17 +220,19 @@ async fn main() {
|
||||||
home,
|
home,
|
||||||
api_info,
|
api_info,
|
||||||
about,
|
about,
|
||||||
|
favicon,
|
||||||
|
form_handler_js,
|
||||||
|
stylesheet,
|
||||||
|
fira_code,
|
||||||
|
roboto_flex,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
.mount(
|
.mount(
|
||||||
config.server.root_path.clone() + "/",
|
config.server.root_path.clone() + "/",
|
||||||
routes![
|
routes![
|
||||||
handle_upload,
|
handle_upload,
|
||||||
form_handler_js,
|
|
||||||
stylesheet,
|
|
||||||
server_info,
|
server_info,
|
||||||
file_info,
|
file_info,
|
||||||
favicon,
|
|
||||||
lookup_mmid,
|
lookup_mmid,
|
||||||
lookup_mmid_noredir,
|
lookup_mmid_noredir,
|
||||||
lookup_mmid_name,
|
lookup_mmid_name,
|
||||||
|
|
37
src/pages.rs
37
src/pages.rs
|
@ -1,5 +1,5 @@
|
||||||
use maud::{html, Markup, DOCTYPE};
|
use maud::{html, Markup, DOCTYPE};
|
||||||
use rocket::{get, State};
|
use rocket::{get, http::ContentType, response::content::{RawCss, RawJavaScript}, State};
|
||||||
|
|
||||||
use crate::settings::Settings;
|
use crate::settings::Settings;
|
||||||
|
|
||||||
|
@ -26,6 +26,32 @@ pub fn footer() -> Markup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Stylesheet
|
||||||
|
#[get("/resources/main.css")]
|
||||||
|
pub fn stylesheet() -> RawCss<&'static str> {
|
||||||
|
RawCss(include_str!("../web/main.css"))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Upload handler javascript
|
||||||
|
#[get("/resources/request.js")]
|
||||||
|
pub fn form_handler_js() -> RawJavaScript<&'static str> {
|
||||||
|
RawJavaScript(include_str!("../web/request.js"))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[get("/resources/favicon.svg")]
|
||||||
|
pub fn favicon() -> (ContentType, &'static str) {
|
||||||
|
(ContentType::SVG, include_str!("../web/favicon.svg"))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[get("/resources/Roboto.woff2")]
|
||||||
|
pub fn roboto_flex() -> (ContentType, &'static [u8]) {
|
||||||
|
(ContentType::WOFF2, include_bytes!("../web/fonts/roboto.woff2"))
|
||||||
|
}
|
||||||
|
#[get("/resources/FiraCode.woff2")]
|
||||||
|
pub fn fira_code() -> (ContentType, &'static [u8]) {
|
||||||
|
(ContentType::WOFF2, include_bytes!("../web/fonts/fira-code.woff2"))
|
||||||
|
}
|
||||||
|
|
||||||
#[get("/api")]
|
#[get("/api")]
|
||||||
pub fn api_info(settings: &State<Settings>) -> Markup {
|
pub fn api_info(settings: &State<Settings>) -> Markup {
|
||||||
let domain = &settings.server.domain;
|
let domain = &settings.server.domain;
|
||||||
|
@ -154,11 +180,10 @@ pub fn about(settings: &State<Settings>) -> Markup {
|
||||||
software available under the terms of the "
|
software available under the terms of the "
|
||||||
a target="_blank" href="//www.gnu.org/licenses/agpl-3.0.txt" {"AGPL-3.0 license"}
|
a target="_blank" href="//www.gnu.org/licenses/agpl-3.0.txt" {"AGPL-3.0 license"}
|
||||||
". The source code is available on "
|
". The source code is available on "
|
||||||
a target="_blank" href="https://github.com/Dangoware/confetti-box" {"GitHub"}
|
a target="_blank" href="//github.com/Dangoware/confetti-box" {"GitHub"}
|
||||||
" and a couple of other places. The AGPL is very restrictive
|
". The AGPL is very restrictive when it comes to use on
|
||||||
when it comes to use on servers, so if you would like to use
|
servers, so if you would like to use Confetti-Box for a
|
||||||
Confetti-Box for a commercial purpose, please contact
|
commercial purpose, please contact Dangoware."
|
||||||
Dangoware."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
|
|
BIN
web/fonts/fira-code.woff2
Normal file
BIN
web/fonts/fira-code.woff2
Normal file
Binary file not shown.
BIN
web/fonts/roboto.woff2
Normal file
BIN
web/fonts/roboto.woff2
Normal file
Binary file not shown.
16
web/main.css
16
web/main.css
|
@ -1,7 +1,19 @@
|
||||||
@import url('https://fonts.googleapis.com/css2?family=Chokokutai&family=Fira+Code:wght@300..700&family=M+PLUS+Rounded+1c:wght@100;300;400;500;700;800;900&family=Roboto+Flex:opsz,wght@8..144,100..1000&display=swap');
|
@font-face {
|
||||||
|
font-family: "Roboto";
|
||||||
|
src:
|
||||||
|
/*local("Roboto"),*/
|
||||||
|
url("/resources/Roboto.woff2");
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Fira Code";
|
||||||
|
src:
|
||||||
|
/*local("Fira Code"),*/
|
||||||
|
url("/resources/FiraCode.woff2");
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: "Roboto Flex", sans-serif;
|
font-family: "Roboto", sans-serif;
|
||||||
font-size: 14pt;
|
font-size: 14pt;
|
||||||
font-optical-sizing: auto;
|
font-optical-sizing: auto;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue