Display version

This commit is contained in:
Matéo Duparc 2021-05-10 18:37:57 +02:00
parent fba9169ecf
commit e4d0362e5e
Signed by: hardcoresushi
GPG Key ID: 007F84120107191E
5 changed files with 34 additions and 18 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "aira"
version = "0.0.1"
version = "0.0.2"
authors = ["Hardcore Sushi <hardcore.sushi@disroot.org>"]
edition = "2018"

View File

@ -4,7 +4,7 @@
}
:root {
--accent: #FF3C00;
--accent: #19a52c;
--transparent: #00000000;
}

View File

@ -1,3 +1,6 @@
:root {
--button-background: #52585C
}
body {
margin: 0;
height: 100%;
@ -24,7 +27,7 @@ button {
cursor: pointer;
}
button::after {
background-color: #52585C;
background-color: var(--button-background);
border-radius: 100%;
display: block;
width: 20px;
@ -43,7 +46,7 @@ input[type="file"] {
cursor: pointer;
}
.file_picker::after {
content: url("/static/imgs/icons/attach/FF3C00");
content: url("/static/imgs/icons/attach/19a52c");
width: 2em;
}
.popup {
@ -102,7 +105,7 @@ input[type="file"] {
margin: 10px;
}
.popup button {
background-color: #52585C;
background-color: var(--button-background);
color: white;
cursor: pointer;
padding: 10px 20px;
@ -120,7 +123,7 @@ input[type="file"] {
font-size: 0.9em;
}
.popup h2.warning::before {
content: url("/static/imgs/icons/warning/FF3C00");
content: url("/static/imgs/icons/warning/19a52c");
width: 9%;
display: inline-block;
vertical-align: middle;
@ -208,7 +211,7 @@ input[type="file"] {
background-color: #333940;
}
#left_panel ul li p::after {
content: url("/static/imgs/icons/warning/FF3C00");
content: url("/static/imgs/icons/warning/19a52c");
display: inline-block;
width: 1em;
margin-left: 5px;
@ -218,7 +221,7 @@ input[type="file"] {
content: unset;
}
#left_panel ul li.is_verified p::after {
content: url("/static/imgs/icons/verified/FF3C00");
content: url("/static/imgs/icons/verified/19a52c");
}
#left_panel ul li .not_seen_marker {
width: 12px;
@ -226,12 +229,14 @@ input[type="file"] {
background-color: var(--accent);
border-radius: 12px;
}
#aira_version {
opacity: 0.5;
font-weight: bold;
margin: 8px;
}
#refresher button::after {
content: url("/static/imgs/icons/refresh");
}
#connect_box {
margin-bottom: 20px;
}
#refresher, #connect_box>div {
position: relative;
}
@ -250,7 +255,7 @@ input[type="file"] {
}
#show_local_ips:hover::after {
background-color: unset;
content: url("/static/imgs/icons/info/FF3C00");
content: url("/static/imgs/icons/info/19a52c");
}
.popup ul {
list-style-type: unset;
@ -275,7 +280,7 @@ input[type="file"] {
margin: 0;
}
#chat_header p::after {
content: url("/static/imgs/icons/warning/FF3C00");
content: url("/static/imgs/icons/warning/19a52c");
display: inline-block;
width: 1.2em;
vertical-align: middle;
@ -285,7 +290,7 @@ input[type="file"] {
content: unset;
}
#chat_header.is_verified p::after {
content: url("/static/imgs/icons/verified/FF3C00");
content: url("/static/imgs/icons/verified/19a52c");
}
#chat_header.is_contact #delete_conversation::after {
content: url("/static/imgs/icons/delete_conversation");
@ -337,7 +342,7 @@ input[type="file"] {
#file_cancel::after {
background-color: unset;
width: 20px;
content: url("/static/imgs/icons/cancel/FF3C00");
content: url("/static/imgs/icons/cancel/19a52c");
}
#file_progress {
display: none;
@ -411,7 +416,7 @@ input[type="file"] {
color: var(--accent);
}
#msg_log .file a::after {
content: url("/static/imgs/icons/download/FF3C00");
content: url("/static/imgs/icons/download/19a52c");
display: block;
width: 2em;
margin-left: 15px;

View File

@ -29,6 +29,7 @@
<p class="section_title">Add a new peer by IP:</p>
<input type="text" id="ip_input" placeholder="Enter IP address">
</div>
<p id="aira_version">AIRA vAIRA_VERSION</p>
</div>
<div id="right_panel" class="panel">
<div id="chat_header">

View File

@ -543,8 +543,13 @@ async fn handle_index(req: HttpRequest) -> HttpResponse {
let global_vars = req.app_data::<Data<Arc<RwLock<GlobalVars>>>>().unwrap();
if is_authenticated(&req) {
let global_vars_read = global_vars.read().unwrap();
#[cfg(debug_assertions)]
let html = fs::read_to_string("src/frontend/index.html").unwrap();
#[cfg(not(debug_assertions))]
let html = include_str!("frontend/index.html");
HttpResponse::Ok().body(
include_str!("frontend/index.html")
html
.replace("AIRA_VERSION", env!("CARGO_PKG_VERSION"))
.replace("IDENTITY_FINGERPRINT", &crypto::generate_fingerprint(&global_vars_read.session_manager.get_my_public_key()))
.replace("WEBSOCKET_PORT", &global_vars_read.websocket_port.to_string())
.replace("IS_IDENTITY_PROTECTED", &Identity::is_protected().unwrap().to_string())
@ -621,7 +626,12 @@ fn handle_static(req: HttpRequest) -> HttpResponse {
if splits.len() == 3 {
match splits[2] {
"script.js" => return response_builder.content_type(JS_CONTENT_TYPE).body(include_str!("frontend/commons/script.js")),
"style.css" => return response_builder.body(include_str!("frontend/commons/style.css")),
"style.css" => {
#[cfg(debug_assertions)]
return response_builder.body(fs::read_to_string("src/frontend/commons/style.css").unwrap());
#[cfg(not(debug_assertions))]
return response_builder.body(include_str!("frontend/commons/style.css"));
}
_ => {}
}
}