use otter::imports::*;
#[derive(Serialize,Debug)]
-struct FrontPageRenderContext { }
+struct FrontPageRenderContext {
+ debug_js_inject: Arc<String>,
+}
#[derive(Copy,Clone,Debug)]
enum ResourceLocation { Main, Wasm(&'static str), }
nick: String,
layout: PresentationLayout,
ptoken: &'r RawTokenVal,
+ debug_js_inject: Arc<String>,
}
#[get("/")]
#[throws(OE)]
nick: gpl.nick.clone(),
game: g.name.to_string(),
ptoken: &ia.raw_token,
+ debug_js_inject: config().debug_js_inject.clone(),
layout,
};
Template::render("loading", &c)
} else {
- let c = FrontPageRenderContext { };
+ let c = FrontPageRenderContext {
+ debug_js_inject: config().debug_js_inject.clone(),
+ };
Template::render("front", &c)
}
}
pub bundled_sources: Option<String>,
pub shapelibs: Option<Vec<shapelib::Config1>>,
pub sendmail: Option<String>,
+ pub debug_js_inject_file: Option<String>,
}
#[derive(Debug,Clone)]
pub bundled_sources: String,
pub shapelibs: Vec<shapelib::Config1>,
pub sendmail: String,
+ pub debug_js_inject: Arc<String>,
}
impl TryFrom<ServerConfigSpec> for WholeServerConfig {
http_port, public_url, sse_wildcard_url, rocket_workers,
template_dir, nwtemplate_dir, wasm_dir,
log, bundled_sources, shapelibs, sendmail,
+ debug_js_inject_file,
} = spec;
let defpath = |specd: Option<String>, leaf: &str| -> String {
let log = LogSpecification::from_toml(&log)
.context("log specification")?;
+ let debug_js_inject = Arc::new(match &debug_js_inject_file {
+ Some(f) => fs::read_to_string(f)
+ .with_context(|| f.clone()).context("debug_js_inject_file")?,
+ None => "".into(),
+ });
+
let server = ServerConfig {
save_dir, command_socket, debug,
http_port, public_url, sse_wildcard_url, rocket_workers,
template_dir, nwtemplate_dir, wasm_dir,
bundled_sources, shapelibs, sendmail,
+ debug_js_inject,
};
WholeServerConfig {
server: Arc::new(server),
#[throws(AE)]
fn main(){
- let (mut su, inst) = setup(module_path!()).always_context("setup")?;
- let [alice, bob] : [Window; 2] =
- su.setup_static_users(&inst)?.try_into().unwrap();
- debug!("ok {:?} {:?}", alice, bob);
+ {
+ let (mut su, inst) = setup(module_path!()).always_context("setup")?;
+ let [alice, bob] : [Window; 2] =
+ su.setup_static_users(&inst)?.try_into().unwrap();
+ debug!("ok {:?} {:?}", alice, bob);
- su.w(&alice)?.synch()?;
+ su.w(&alice)?.synch()?;
- sleep(750 * MS);
- debug!("finishing");
+ sleep(750 * MS);
+ debug!("finishing");
+ }
+ info!("ok");
}