This commit is contained in:
Zef Hemel
2026-06-23 09:19:30 +02:00
parent 55f53fc9a6
commit eb2c76400a
6 changed files with 22 additions and 13 deletions
+1 -2
View File
@@ -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()),
+3 -1
View File
@@ -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,
)))
+5 -1
View File
@@ -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)?;
+4 -1
View File
@@ -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,
)
+5 -4
View File
@@ -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]
+4 -4
View File
@@ -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}");
}