mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-03-29 04:38:59 +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 :)
|
It takes a while to build the image so please be patient :)
|
||||||
|
|
||||||
A hosted demo server is in the works...
|
|
||||||
|
|
||||||
## Development:
|
## Development:
|
||||||
|
|
||||||
See [DEVELOPMENT.md](./DEVELOPMENT.md)
|
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! {
|
lazy_static! {
|
||||||
pub static ref SETTINGS: Settings = Settings::new().unwrap();
|
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 FILES: FileMap = FileMap::new();
|
||||||
pub static ref JS: &'static str =
|
pub static ref JS: &'static str =
|
||||||
FILES.get("./static-assets/bundle/bundle.js").unwrap();
|
FILES.get("./static-assets/bundle/bundle.js").unwrap();
|
||||||
|
@ -58,6 +58,19 @@ lazy_static! {
|
||||||
FILES.get("./static-assets/bundle/bundle.css").unwrap();
|
FILES.get("./static-assets/bundle/bundle.css").unwrap();
|
||||||
pub static ref MOBILE_CSS: &'static str =
|
pub static ref MOBILE_CSS: &'static str =
|
||||||
FILES.get("./static-assets/bundle/mobile.css").unwrap();
|
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");
|
pub static OPEN_API_DOC: &str = env!("OPEN_API_DOCS");
|
||||||
|
@ -127,3 +140,17 @@ pub fn get_identity_service() -> IdentityService<CookieIdentityPolicy> {
|
||||||
.secure(false),
|
.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>
|
href="<.= crate::PKG_HOMEPAGE .><.= crate::PAGES.thanks .>">Thanks</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="details__item">
|
<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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
Loading…
Add table
Reference in a new issue