Rust fmt
This commit is contained in:
@@ -90,8 +90,7 @@ impl Config {
|
||||
disable_service_worker: env_nonempty("SB_DISABLE_SERVICE_WORKER").is_some(),
|
||||
log_push: env_nonempty("SB_LOG_PUSH").is_some(),
|
||||
additional_head_html: env::var("SB_HEAD_HTML").unwrap_or_default(),
|
||||
theme_color: env_nonempty("SB_THEME_COLOR")
|
||||
.unwrap_or_else(|| "#e1e1e1".to_string()),
|
||||
theme_color: env_nonempty("SB_THEME_COLOR").unwrap_or_else(|| "#e1e1e1".to_string()),
|
||||
space_description: env_nonempty("SB_DESCRIPTION")
|
||||
.unwrap_or_else(|| "Powerful and programmable note taking app".to_string()),
|
||||
host_url_prefix: normalize_prefix(&env::var("SB_URL_PREFIX").unwrap_or_default()),
|
||||
|
||||
@@ -123,7 +123,9 @@ fn build_runtime(
|
||||
let logs = silverbullet_server::runtime::LogBuffer::new();
|
||||
match silverbullet_server_runtime_chrome::ChromeTransport::launch(chrome_cfg, logs.clone()) {
|
||||
Ok(transport) => {
|
||||
tracing::info!("headless Chrome runtime configured (launches on first runtime request)");
|
||||
tracing::info!(
|
||||
"headless Chrome runtime configured (launches on first runtime request)"
|
||||
);
|
||||
Some(Box::new(silverbullet_server::runtime::ClientRuntime::new(
|
||||
transport, logs,
|
||||
)))
|
||||
|
||||
@@ -88,7 +88,11 @@ fn do_upgrade(
|
||||
.map_err(|e| format!("failed to read response: {e}"))?;
|
||||
std::fs::write(&zip_path, &bytes).map_err(|e| format!("failed to save zip file: {e}"))?;
|
||||
|
||||
println!("Replacing {} binary in {}", spec.binary, install_dir.display());
|
||||
println!(
|
||||
"Replacing {} binary in {}",
|
||||
spec.binary,
|
||||
install_dir.display()
|
||||
);
|
||||
|
||||
extract_zip(&zip_path, install_dir)?;
|
||||
|
||||
|
||||
@@ -41,7 +41,10 @@ impl ChromeConfig {
|
||||
env("SB_CHROME_SHOW").is_some(),
|
||||
// On by default; disabled only with SB_CHROME_LOG_CONSOLE=0/false
|
||||
// (matches the SB_RUNTIME_API opt-out convention).
|
||||
!matches!(env("SB_CHROME_LOG_CONSOLE").as_deref(), Some("0") | Some("false")),
|
||||
!matches!(
|
||||
env("SB_CHROME_LOG_CONSOLE").as_deref(),
|
||||
Some("0") | Some("false")
|
||||
),
|
||||
read_only,
|
||||
runtime_api_enabled,
|
||||
)
|
||||
|
||||
@@ -183,9 +183,7 @@ mod tests {
|
||||
match self.eval.as_ref().err().unwrap() {
|
||||
RuntimeErrorKind::NotReady => RuntimeError::NotReady,
|
||||
RuntimeErrorKind::Timeout => RuntimeError::Timeout,
|
||||
RuntimeErrorKind::Eval => {
|
||||
RuntimeError::Eval("attempt to call a nil value".into())
|
||||
}
|
||||
RuntimeErrorKind::Eval => RuntimeError::Eval("attempt to call a nil value".into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -267,7 +265,10 @@ mod tests {
|
||||
assert_eq!(status, StatusCode::INTERNAL_SERVER_ERROR);
|
||||
assert!(body.contains("script_error"), "{body}");
|
||||
// The clean message flows verbatim into the `error` field (no Debug dump).
|
||||
assert!(body.contains(r#""error":"attempt to call a nil value""#), "{body}");
|
||||
assert!(
|
||||
body.contains(r#""error":"attempt to call a nil value""#),
|
||||
"{body}"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
@@ -46,10 +46,10 @@ impl<T: ClientTransport> RuntimeBackend for ClientRuntime<T> {
|
||||
// evalLuaScript, objectsAPI), so a failure here — the runtime not
|
||||
// coming up, a timeout, or a thrown error in the client (e.g. a Lua
|
||||
// error) — always leaves a trace in the server log.
|
||||
let result = self
|
||||
.transport
|
||||
.wait_ready(timeout)
|
||||
.and_then(|()| self.transport.eval_js(&build_global_call_js(fn_name, arg), timeout));
|
||||
let result = self.transport.wait_ready(timeout).and_then(|()| {
|
||||
self.transport
|
||||
.eval_js(&build_global_call_js(fn_name, arg), timeout)
|
||||
});
|
||||
if let Err(e) = &result {
|
||||
tracing::warn!("runtime call {fn_name} failed: {e}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user