diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-11-23 05:51:00 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-11-23 05:51:00 -0500 |
commit | 69d725d56cb43d92042eecbcc6d306782799ab88 (patch) | |
tree | 519f63929af020effc0ed30eeba86375989a39ff /teleterm/src/web/view.rs | |
parent | 0650ecd21a522536c5dc3a764847583e0fae61df (diff) | |
download | teleterm-69d725d56cb43d92042eecbcc6d306782799ab88.tar.gz teleterm-69d725d56cb43d92042eecbcc6d306782799ab88.zip |
pass configuration from the web server to the web app
Diffstat (limited to 'teleterm/src/web/view.rs')
-rw-r--r-- | teleterm/src/web/view.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/teleterm/src/web/view.rs b/teleterm/src/web/view.rs new file mode 100644 index 0000000..5745614 --- /dev/null +++ b/teleterm/src/web/view.rs @@ -0,0 +1,37 @@ +use handlebars::handlebars_helper; +use lazy_static::lazy_static; +use lazy_static_include::*; + +lazy_static_include::lazy_static_include_bytes!( + pub INDEX_HTML_TMPL, + "static/index.html.tmpl" +); +lazy_static_include::lazy_static_include_bytes!( + pub TELETERM_WEB_JS, + "static/teleterm_web.js" +); +lazy_static_include::lazy_static_include_bytes!( + pub TELETERM_WEB_WASM, + "static/teleterm_web_bg.wasm" +); +lazy_static_include::lazy_static_include_bytes!( + pub TELETERM_CSS, + "static/teleterm.css" +); + +handlebars_helper!(json: |x: object| serde_json::to_string(x).unwrap()); + +pub const INDEX_HTML_TMPL_NAME: &str = "index"; +lazy_static::lazy_static! { + pub static ref HANDLEBARS: handlebars::Handlebars = { + let mut handlebars = handlebars::Handlebars::new(); + handlebars.register_helper("json", Box::new(json)); + handlebars + .register_template_string( + INDEX_HTML_TMPL_NAME, + String::from_utf8(INDEX_HTML_TMPL.to_vec()).unwrap(), + ) + .unwrap(); + handlebars + }; +} |