mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2024-11-27 03:48:52 +03:00
footer: link to src of build version
This commit is contained in:
parent
5963df19f2
commit
50234435ec
3 changed files with 32 additions and 4 deletions
|
@ -88,8 +88,6 @@ $ docker-compose -d up
|
|||
|
||||
It takes a while to build the image so please be patient :)
|
||||
|
||||
A hosted demo server is in the works...
|
||||
|
||||
## Development:
|
||||
|
||||
See [DEVELOPMENT.md](./DEVELOPMENT.md)
|
||||
|
|
29
src/main.rs
29
src/main.rs
|
@ -50,7 +50,7 @@ pub use crate::middleware::auth::CheckLogin;
|
|||
|
||||
lazy_static! {
|
||||
pub static ref SETTINGS: Settings = Settings::new().unwrap();
|
||||
pub static ref S: String = env::var("S").unwrap();
|
||||
// pub static ref S: String = env::var("S").unwrap();
|
||||
pub static ref FILES: FileMap = FileMap::new();
|
||||
pub static ref JS: &'static str =
|
||||
FILES.get("./static-assets/bundle/bundle.js").unwrap();
|
||||
|
@ -58,6 +58,19 @@ lazy_static! {
|
|||
FILES.get("./static-assets/bundle/bundle.css").unwrap();
|
||||
pub static ref MOBILE_CSS: &'static str =
|
||||
FILES.get("./static-assets/bundle/mobile.css").unwrap();
|
||||
|
||||
/// points to source files matching build commit
|
||||
pub static ref SOURCE_FILES_OF_INSTANCE: String = {
|
||||
let mut url = SETTINGS.source_code.clone();
|
||||
if url.chars().last() != Some('/') {
|
||||
url.push('/');
|
||||
}
|
||||
let mut base = url::Url::parse(&url).unwrap();
|
||||
base = base.join("tree/").unwrap();
|
||||
base = base.join(GIT_COMMIT_HASH).unwrap();
|
||||
base.into()
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
pub static OPEN_API_DOC: &str = env!("OPEN_API_DOCS");
|
||||
|
@ -127,3 +140,17 @@ pub fn get_identity_service() -> IdentityService<CookieIdentityPolicy> {
|
|||
.secure(false),
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
#[test]
|
||||
fn version_source_code_url_works() {
|
||||
assert_eq!(
|
||||
&*crate::SOURCE_FILES_OF_INSTANCE,
|
||||
&format!(
|
||||
"https://github.com/mCaptcha/guard/tree/{}",
|
||||
crate::GIT_COMMIT_HASH
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,10 @@
|
|||
href="<.= crate::PKG_HOMEPAGE .><.= crate::PAGES.thanks .>">Thanks</a>
|
||||
</li>
|
||||
<li class="details__item">
|
||||
v<.= crate::VERSION .>-<.= crate::GIT_COMMIT_HASH[0..8] .>
|
||||
<a class="details__link"
|
||||
href="<.= &*crate::SOURCE_FILES_OF_INSTANCE .>">
|
||||
v<.= crate::VERSION .>-<.= crate::GIT_COMMIT_HASH[0..8] .>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</footer>
|
||||
|
|
Loading…
Reference in a new issue