Commit 5bd7871e authored by Konrad Borowski's avatar Konrad Borowski

Merge branch 'dynamic-js-path' into 'master'

Dynamically retrieve JS path in debug builds

See merge request pastebin.run/server!70
parents a0d33d58 308eb400
Pipeline #96961928 passed with stage
in 8 minutes and 43 seconds
use std::borrow::Cow;
#[allow(unused_imports)]
use std::fs;
pub fn path() -> Cow<'static, str> {
#[cfg(not(debug_assertions))]
let path = env!("ENTRY_FILE_PATH");
#[cfg(debug_assertions)]
let path = fs::read_to_string("entry").unwrap();
path.into()
}
pub mod js;
pub mod language;
pub mod paste;
pub mod rejection;
......
......@@ -3,4 +3,4 @@
@(session: &Session)
</article>
<script src="/@env!("ENTRY_FILE_PATH")" nonce="@session.nonce"></script>
<script src="/@crate::models::js::path()" nonce="@session.nonce"></script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment