Compare commits

..

2 Commits

Author SHA1 Message Date
xfy
d826afbe15 fix(db): 为 deadpool-postgres 连接池指定 Tokio1 runtime
Some checks failed
CI / check (push) Failing after 6m5s
CI / build (push) Has been skipped
2026-06-17 11:07:23 +08:00
xfy
b045a1b978 fix build errors 2026-06-17 10:52:01 +08:00
4 changed files with 6 additions and 3 deletions

View File

@ -37,7 +37,7 @@ governor = { version = "0.8", optional = true }
md-5 = { version = "0.10", optional = true }
[target.'cfg(target_arch = "wasm32")'.dependencies]
web-sys = { version = "0.3", features = ["Document", "Window", "Storage", "Element", "DomTokenList", "MediaQueryList", "HtmlImageElement", "MouseEvent", "KeyboardEvent", "Node", "EventTarget", "Navigator"] }
web-sys = { version = "0.3", features = ["Document", "Window", "Storage", "Element", "HtmlElement", "DomTokenList", "MediaQueryList", "HtmlImageElement", "MouseEvent", "KeyboardEvent", "Node", "EventTarget", "Navigator"] }
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
js-sys = "0.3"

View File

@ -31,6 +31,8 @@ pub fn ImageViewer(
// 打开灯箱时聚焦关闭按钮,并监听 Escape 键关闭。
#[cfg(target_arch = "wasm32")]
{
use wasm_bindgen::{closure::Closure, JsCast};
use_effect(move || {
if !is_open() {
return;
@ -43,6 +45,7 @@ pub fn ImageViewer(
.and_then(|w| w.document())
.and_then(|d| d.query_selector(".image-viewer-close").ok())
.flatten()
.and_then(|e| e.dyn_into::<web_sys::HtmlElement>().ok())
{
let _ = btn.focus();
}

View File

@ -7,7 +7,7 @@
use std::sync::LazyLock;
use std::time::Duration;
use deadpool_postgres::{Manager, ManagerConfig, Pool, RecyclingMethod};
use deadpool_postgres::{Manager, ManagerConfig, Pool, RecyclingMethod, Runtime};
use tokio_postgres::NoTls;
/// 全局数据库连接池,基于 `DATABASE_URL` 环境变量延迟初始化。
@ -35,6 +35,7 @@ pub static DB_POOL: LazyLock<Pool> = LazyLock::new(|| {
.wait_timeout(Some(Duration::from_secs(10)))
.create_timeout(Some(Duration::from_secs(10)))
.recycle_timeout(Some(Duration::from_secs(5)))
.runtime(Runtime::Tokio1)
.build()
.expect("Failed to create database connection pool")
});

View File

@ -20,7 +20,6 @@ mod db;
#[cfg(feature = "server")]
mod highlight;
mod hooks;
#[cfg(feature = "server")]
mod models;
mod pages;
mod router;