Skip to content

Commit

Permalink
feat: 允许弹幕自定义设置样式
Browse files Browse the repository at this point in the history
  • Loading branch information
orangelckc committed Nov 16, 2023
1 parent 5ad78a6 commit f4d4f76
Show file tree
Hide file tree
Showing 18 changed files with 498 additions and 304 deletions.
100 changes: 12 additions & 88 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ edition = "2021"
tauri-build = { version = "1.4", features = [] }

[dependencies]
tauri = { version = "1.4", features = [ "window-start-dragging", "shell-open", "window-set-always-on-top", "http-all", "macos-private-api", "system-tray"] }
tauri = { version = "1.4", features = [ "clipboard-write-text", "window-start-dragging", "window-set-always-on-top", "http-all", "macos-private-api", "system-tray"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
tokio = "1.34.0"
tokio = {version = "1.34.0" }
futures-channel = "0.3.29"
futures-util = "0.3.29"
tungstenite = "0.20.1"
Expand Down
Binary file modified src-tauri/icons/icon.icns
Binary file not shown.
8 changes: 4 additions & 4 deletions src-tauri/src/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async fn handle_connection(peer_map: PeerMap, raw_stream: TcpStream, addr: Socke
let (tx, rx) = unbounded();
let tx2 = tx.clone();
peer_map.lock().unwrap().insert(addr, tx);
let m = Message::text(format!("欢迎你,{}", addr));
let m = Message::text(format!("连接成功"));
tx2.unbounded_send(m).unwrap();

let (outgoing, incoming) = ws_stream.split();
Expand All @@ -36,8 +36,8 @@ async fn handle_connection(peer_map: PeerMap, raw_stream: TcpStream, addr: Socke
// addr,
// msg.to_text().unwrap()
// );
// 如果是心跳包,就不用广播了
if msg.to_text().unwrap() == "ping" {
// 如果是心跳包(包含ping的字符串),就不用广播了
if msg.to_text().unwrap().contains("ping") {
return future::ok(());
}

Expand Down Expand Up @@ -65,7 +65,7 @@ async fn handle_connection(peer_map: PeerMap, raw_stream: TcpStream, addr: Socke
peer_map.lock().unwrap().remove(&addr);
}
pub async fn server() {
let addr = "127.0.0.1:1234";
let addr = "localhost:1234";
let state = PeerMap::new(Mutex::new(HashMap::new()));
// Create the event loop and TCP listener we'll accept connections on.
let try_socket = TcpListener::bind(&addr).await;
Expand Down
5 changes: 3 additions & 2 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
"setAlwaysOnTop": true,
"startDragging": true
},
"shell": {
"open": true
"clipboard": {
"all": false,
"writeText": true
}
},
"bundle": {
Expand Down
Loading

0 comments on commit f4d4f76

Please sign in to comment.