This commit is contained in:
2026-04-21 05:49:34 +02:00
parent dc69f0f80a
commit c23c1e0b5f
9 changed files with 697 additions and 42 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "kb-app",
"private": true,
"version": "0.1.1",
"version": "0.2.0",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -330,38 +330,84 @@ fn kb_emit_app_log(app_handle: &tauri::AppHandle, message: &str) {
}
}
fn kb_format_ws_event(event: &kb_lib::WsEvent) -> std::string::String {
fn kb_format_ws_event(
event: &kb_lib::WsEvent,
) -> std::string::String {
match event {
kb_lib::WsEvent::Connected {
endpoint_name,
endpoint_url,
} => {
format!("[ws:{endpoint_name}] connected to {endpoint_url}")
}
},
kb_lib::WsEvent::TextMessage {
endpoint_name,
text,
} => {
format!("[ws:{endpoint_name}] text: {text}")
}
},
kb_lib::WsEvent::JsonRpcMessage {
endpoint_name,
message,
} => {
match message {
kb_lib::KbJsonRpcWsIncomingMessage::SuccessResponse(response) => {
format!(
"[ws:{endpoint_name}] json-rpc success id={} result={}",
response.id,
response.result
)
},
kb_lib::KbJsonRpcWsIncomingMessage::ErrorResponse(response) => {
format!(
"[ws:{endpoint_name}] json-rpc error id={} code={} message={}",
response.id,
response.error.code,
response.error.message
)
},
kb_lib::KbJsonRpcWsIncomingMessage::Notification(notification) => {
format!(
"[ws:{endpoint_name}] json-rpc notification method={} subscription={} result={}",
notification.method,
notification.params.subscription,
notification.params.result
)
},
}
},
kb_lib::WsEvent::JsonRpcParseError {
endpoint_name,
text,
error,
} => {
format!(
"[ws:{endpoint_name}] json-rpc parse error: {} | raw={}",
error,
text
)
},
kb_lib::WsEvent::BinaryMessage {
endpoint_name,
data,
} => {
format!("[ws:{endpoint_name}] binary message ({} bytes)", data.len())
}
format!(
"[ws:{endpoint_name}] binary message ({} bytes)",
data.len()
)
},
kb_lib::WsEvent::Ping {
endpoint_name,
data,
} => {
format!("[ws:{endpoint_name}] ping ({} bytes)", data.len())
}
},
kb_lib::WsEvent::Pong {
endpoint_name,
data,
} => {
format!("[ws:{endpoint_name}] pong ({} bytes)", data.len())
}
},
kb_lib::WsEvent::CloseReceived {
endpoint_name,
code,
@@ -369,18 +415,21 @@ fn kb_format_ws_event(event: &kb_lib::WsEvent) -> std::string::String {
} => {
format!(
"[ws:{endpoint_name}] close received code={:?} reason={:?}",
code, reason
code,
reason
)
}
kb_lib::WsEvent::Disconnected { endpoint_name } => {
},
kb_lib::WsEvent::Disconnected {
endpoint_name,
} => {
format!("[ws:{endpoint_name}] disconnected")
}
},
kb_lib::WsEvent::Error {
endpoint_name,
error,
} => {
format!("[ws:{endpoint_name}] error: {error}")
}
},
}
}

View File

@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "kb-bapp",
"version": "0.1.1",
"version": "0.2.0",
"identifier": "com.sasedev.kb-app",
"build": {
"beforeDevCommand": "npm run dev",

View File

@@ -56,7 +56,12 @@ export default defineConfig(async () => ({
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler',
quietDeps: true,
//silenceDeprecations: ["import", "color-functions", "global-builtin"] as const,
silenceDeprecations: ["import", "color-functions", "global-builtin",],
verbose: false,
//api: 'modern',
//api: 'modern-compiler',
importers: [new NodePackageImporter()],
}
}