A local-first private AI assistant for everyday use. Runs on-device models with encrypted P2P sync, and supports sharing chats publicly on ATProto.
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: fixed inverted logic in detecting already linked devices + other fixes

- Uses blocking process for reading from std read_line

madclaws 3495b96c acaf1ef7

+50 -31
+29 -23
Cargo.lock
··· 3303 3303 3304 3304 [[package]] 3305 3305 name = "itoa" 3306 - version = "1.0.17" 3306 + version = "1.0.18" 3307 3307 source = "registry+https://github.com/rust-lang/crates.io-index" 3308 - checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" 3308 + checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" 3309 3309 3310 3310 [[package]] 3311 3311 name = "jobserver" ··· 6076 6076 "tempfile", 6077 6077 "tilekit", 6078 6078 "tokio", 6079 - "toml 1.0.6+spec-1.1.0", 6079 + "toml 1.0.7+spec-1.1.0", 6080 6080 "uuid", 6081 6081 "wiremock", 6082 6082 ] ··· 6257 6257 "toml_datetime 0.7.5+spec-1.1.0", 6258 6258 "toml_parser", 6259 6259 "toml_writer", 6260 - "winnow", 6260 + "winnow 0.7.15", 6261 6261 ] 6262 6262 6263 6263 [[package]] 6264 6264 name = "toml" 6265 - version = "1.0.6+spec-1.1.0" 6265 + version = "1.0.7+spec-1.1.0" 6266 6266 source = "registry+https://github.com/rust-lang/crates.io-index" 6267 - checksum = "399b1124a3c9e16766831c6bba21e50192572cdd98706ea114f9502509686ffc" 6267 + checksum = "dd28d57d8a6f6e458bc0b8784f8fdcc4b99a437936056fa122cb234f18656a96" 6268 6268 dependencies = [ 6269 6269 "indexmap", 6270 6270 "serde_core", 6271 6271 "serde_spanned", 6272 - "toml_datetime 1.0.0+spec-1.1.0", 6272 + "toml_datetime 1.0.1+spec-1.1.0", 6273 6273 "toml_parser", 6274 6274 "toml_writer", 6275 - "winnow", 6275 + "winnow 1.0.0", 6276 6276 ] 6277 6277 6278 6278 [[package]] ··· 6286 6286 6287 6287 [[package]] 6288 6288 name = "toml_datetime" 6289 - version = "1.0.0+spec-1.1.0" 6289 + version = "1.0.1+spec-1.1.0" 6290 6290 source = "registry+https://github.com/rust-lang/crates.io-index" 6291 - checksum = "32c2555c699578a4f59f0cc68e5116c8d7cabbd45e1409b989d4be085b53f13e" 6291 + checksum = "9b320e741db58cac564e26c607d3cc1fdc4a88fd36c879568c07856ed83ff3e9" 6292 6292 dependencies = [ 6293 6293 "serde_core", 6294 6294 ] 6295 6295 6296 6296 [[package]] 6297 6297 name = "toml_edit" 6298 - version = "0.25.4+spec-1.1.0" 6298 + version = "0.25.5+spec-1.1.0" 6299 6299 source = "registry+https://github.com/rust-lang/crates.io-index" 6300 - checksum = "7193cbd0ce53dc966037f54351dbbcf0d5a642c7f0038c382ef9e677ce8c13f2" 6300 + checksum = "8ca1a40644a28bce036923f6a431df0b34236949d111cc07cb6dca830c9ef2e1" 6301 6301 dependencies = [ 6302 6302 "indexmap", 6303 - "toml_datetime 1.0.0+spec-1.1.0", 6303 + "toml_datetime 1.0.1+spec-1.1.0", 6304 6304 "toml_parser", 6305 - "winnow", 6305 + "winnow 1.0.0", 6306 6306 ] 6307 6307 6308 6308 [[package]] 6309 6309 name = "toml_parser" 6310 - version = "1.0.9+spec-1.1.0" 6310 + version = "1.0.10+spec-1.1.0" 6311 6311 source = "registry+https://github.com/rust-lang/crates.io-index" 6312 - checksum = "702d4415e08923e7e1ef96cd5727c0dfed80b4d2fa25db9647fe5eb6f7c5a4c4" 6312 + checksum = "7df25b4befd31c4816df190124375d5a20c6b6921e2cad937316de3fccd63420" 6313 6313 dependencies = [ 6314 - "winnow", 6314 + "winnow 1.0.0", 6315 6315 ] 6316 6316 6317 6317 [[package]] 6318 6318 name = "toml_writer" 6319 - version = "1.0.6+spec-1.1.0" 6319 + version = "1.0.7+spec-1.1.0" 6320 6320 source = "registry+https://github.com/rust-lang/crates.io-index" 6321 - checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607" 6321 + checksum = "f17aaa1c6e3dc22b1da4b6bba97d066e354c7945cac2f7852d4e4e7ca7a6b56d" 6322 6322 6323 6323 [[package]] 6324 6324 name = "tower" ··· 7247 7247 version = "0.7.15" 7248 7248 source = "registry+https://github.com/rust-lang/crates.io-index" 7249 7249 checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" 7250 + 7251 + [[package]] 7252 + name = "winnow" 7253 + version = "1.0.0" 7254 + source = "registry+https://github.com/rust-lang/crates.io-index" 7255 + checksum = "a90e88e4667264a994d34e6d1ab2d26d398dcdca8b7f52bec8668957517fc7d8" 7250 7256 dependencies = [ 7251 7257 "memchr", 7252 7258 ] ··· 7458 7464 7459 7465 [[package]] 7460 7466 name = "zerocopy" 7461 - version = "0.8.42" 7467 + version = "0.8.47" 7462 7468 source = "registry+https://github.com/rust-lang/crates.io-index" 7463 - checksum = "f2578b716f8a7a858b7f02d5bd870c14bf4ddbbcf3a4c05414ba6503640505e3" 7469 + checksum = "efbb2a062be311f2ba113ce66f697a4dc589f85e78a4aea276200804cea0ed87" 7464 7470 dependencies = [ 7465 7471 "zerocopy-derive", 7466 7472 ] 7467 7473 7468 7474 [[package]] 7469 7475 name = "zerocopy-derive" 7470 - version = "0.8.42" 7476 + version = "0.8.47" 7471 7477 source = "registry+https://github.com/rust-lang/crates.io-index" 7472 - checksum = "7e6cc098ea4d3bd6246687de65af3f920c430e236bee1e3bf2e441463f08a02f" 7478 + checksum = "0e8bc7269b54418e7aeeef514aa68f8690b8c0489a06b0136e5f57c4c5ccab89" 7473 7479 dependencies = [ 7474 7480 "proc-macro2", 7475 7481 "quote",
+20 -7
tiles/src/core/network/mod.rs
··· 1 1 //! The main module for networking 2 2 3 3 pub mod ticket; 4 - use std::{io, str::FromStr}; 4 + use std::{ 5 + io, 6 + str::FromStr, 7 + sync::{Arc, Mutex}, 8 + }; 5 9 6 10 use anyhow::Result; 7 11 use futures_util::TryStreamExt; ··· 18 22 use iroh_tickets::endpoint::EndpointTicket; 19 23 use rusqlite::Connection; 20 24 use tilekit::accounts::{get_did_from_public_key, get_random_bytes, get_secret_key}; 25 + use tokio::task::spawn_blocking; 21 26 22 27 use crate::core::{ 23 28 accounts::{self, get_current_user, get_user_by_user_id, save_self_account_db}, ··· 99 104 let user = get_current_user(&user_db_conn)?; 100 105 if let Some(ticket) = ticket { 101 106 let link_ticket = LinkTicket::from_str(&ticket)?; 102 - if get_user_by_user_id(&user_db_conn, &link_ticket.did).is_err() { 107 + if get_user_by_user_id(&user_db_conn, &link_ticket.did).is_ok() { 103 108 println!( 104 109 "Device {}({}) already linked", 105 110 link_ticket.nickname, link_ticket.did ··· 205 210 "Received link request from {}({}), Do you want to link Y/N ?", 206 211 nickname, did 207 212 ); 213 + let input: Arc<Mutex<String>> = Arc::new(Mutex::new(String::new())); 214 + 215 + let input_clone = input.clone(); 208 216 let stdin = io::stdin(); 209 - let mut input = String::new(); 210 - stdin.read_line(&mut input)?; 211 - input = input.trim().to_owned(); 212 - let link_res_resp = if input.to_lowercase() == "y" { 217 + spawn_blocking(move || { 218 + let mut input_clone = input_clone.lock().unwrap(); 219 + let _ = stdin.read_line(&mut input_clone); 220 + }) 221 + .await?; 222 + let input_resp = input.lock().unwrap().trim().to_owned(); 223 + 224 + let link_res_resp = if input_resp.to_lowercase() == "y" { 213 225 save_self_account_db(&db_conn, &did, &nickname)?; 214 226 println!( 215 227 "Device {}({}) is now linked\nYou can exit now by ctrl-c", ··· 226 238 nickname: user.username.clone(), 227 239 }) 228 240 }; 229 - input.clear(); 241 + input.lock().unwrap().clear(); 242 + 230 243 sender.broadcast(link_res_resp.to_bytes().into()).await?; 231 244 } 232 245 MessageBody::LinkAccepted { did, nickname } => {
+1 -1
tiles/src/core/network/ticket.rs
··· 18 18 const KIND: &'static str = "link"; 19 19 20 20 fn to_bytes(&self) -> Vec<u8> { 21 - postcard::to_stdvec(&self).expect("serde_json to bytes couldnt be done") 21 + postcard::to_stdvec(&self).expect("linkTicket to bytes couldnt be done") 22 22 } 23 23 24 24 fn from_bytes(bytes: &[u8]) -> Result<Self, iroh_tickets::ParseError> {