remove the commit display feature as it is more hassle than benefit

This commit is contained in:
blek 2023-10-09 23:08:01 +10:00
parent 3ba86697b7
commit 7a0b197dc6
Signed by: blek
GPG Key ID: 14546221E3595D0C
5 changed files with 5 additions and 14 deletions

View File

@ -8,7 +8,6 @@ services:
bfile: bfile:
volumes: volumes:
- './filed:/opt/code' - './filed:/opt/code'
- './.git:/opt/code/.git:ro' # for fetching the latest commit version
- '/opt/code/target' - '/opt/code/target'
- './volatile/files:/opt/user_uploads' - './volatile/files:/opt/user_uploads'
caddy: caddy:

View File

@ -4,8 +4,6 @@ FROM rust as builder
WORKDIR /opt/code WORKDIR /opt/code
COPY . . COPY . .
RUN apt install -y git
# No build is done during this step # No build is done during this step
# since the directory will be mounted anyways # since the directory will be mounted anyways
# to the dev's machine. # to the dev's machine.

View File

@ -7,8 +7,6 @@ use std::{env::var, net::SocketAddr, path::Path, fs};
use compile_time_run::run_command_str; use compile_time_run::run_command_str;
const LAST_COMMIT: &'static str = run_command_str!("git", "--no-pager", "log", "--pretty=format:%H", "-1");
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Redis { pub struct Redis {
pub pass: String, pub pass: String,
@ -24,8 +22,7 @@ pub struct Env {
pub redis: Redis, pub redis: Redis,
pub filedir: String, pub filedir: String,
pub instanceurl: String, pub instanceurl: String,
pub uploadspath: String, pub uploadspath: String
pub last_commit: &'static str
} }
fn get_var<T: Into<String>, O: From<String>>(name: T) -> Result<O, String> { fn get_var<T: Into<String>, O: From<String>>(name: T) -> Result<O, String> {
@ -60,8 +57,7 @@ pub fn loadenv() -> Result<Env, Box<dyn std::error::Error>> {
spath spath
}, },
instanceurl: get_var("INSTANCE_URL")?, instanceurl: get_var("INSTANCE_URL")?,
uploadspath: get_var("UPLOADS_PATH")?, uploadspath: get_var("UPLOADS_PATH")?
last_commit: LAST_COMMIT
} }
) )
} }
@ -70,8 +66,4 @@ impl Env {
pub fn usercontent_dir(self: &Self) -> Box<&Path> { pub fn usercontent_dir(self: &Self) -> Box<&Path> {
Box::new(Path::new(&self.filedir)) Box::new(Path::new(&self.filedir))
} }
pub fn shortcommit(self: &Self) -> String {
let commit = self.last_commit.to_string().clone();
commit.chars().take(6).collect()
}
} }

View File

@ -4,6 +4,7 @@
use std::env::current_dir; use std::env::current_dir;
use static_dir::static_dir;
use warp::{Filter, reply::Reply, reject::Rejection}; use warp::{Filter, reply::Reply, reject::Rejection};
use crate::{env::Env, files::lookup::FileManager}; use crate::{env::Env, files::lookup::FileManager};
@ -23,6 +24,7 @@ pub fn routes(state: SharedState) -> impl Filter<Extract = impl Reply, Error = R
pages::get_routes(state.clone()) pages::get_routes(state.clone())
.or(forms::get_routes(state.clone())) .or(forms::get_routes(state.clone()))
.or(api::get_routes(state)) .or(api::get_routes(state))
.or(static_dir!("static"))
.or(warp::fs::dir(staticpath.to_string())) .or(warp::fs::dir(staticpath.to_string()))
} }

View File

@ -31,7 +31,7 @@
<tbody> <tbody>
<tr> <tr>
<td> <td>
bleK! File {{ env.shortcommit() }} Made with Rust
</td> </td>
<td> <td>
Released under GPLv3 Released under GPLv3