Files
BetterDesk/dev_modules/patch_peer_remove.py
T
UNITRONIX b14a8cf162 Add CI, build scripts, docs, and dev utilities
Add a full automated build pipeline, interactive build scripts, documentation and development utilities.

- Add GitHub Actions workflow (.github/workflows/build.yml) to build BetterDesk (hbbs/hbbr) for Linux x64, Linux ARM64 and Windows x64, upload artifacts, optionally create a release and update repository binaries.
- Add interactive build scripts for Windows and Unix (build-betterdesk.ps1, build-betterdesk.sh) supporting download, patch application, cross-build and checksum generation.
- Add build and status docs (docs/BUILD_GUIDE.md, docs/STATUS_TRACKING_v3.md) and update project README/instructions (.github/copilot-instructions.md) with new items and updated timestamp.
- Add development utilities under dev_modules/ (multiple database/patch/test helpers) and move test_generator.py into dev_modules/test_generator.py.
- Update .gitignore to exclude archive/ folder.
- Modify hbbs-patch-v2 sources (database.rs, http_api.rs, main.rs, peer.rs and add rendezvous_server.rs) and remove legacy fixed files; update web UI backend and static files (web/app.py, web/static/*, web/templates/index.html).

These changes set up CI/CD for multi-platform builds, provide local build tooling, expand docs for v3 status tracking and ID-change features, and add developer test/patch utilities.
2026-02-06 23:34:35 +01:00

31 lines
944 B
Python

#!/usr/bin/env python3
"""Patch peer.rs to add remove function"""
with open("peer.rs", "r") as f:
content = f.read()
# Find place to add remove function (after is_in_memory)
marker = ''' #[inline]
pub(crate) async fn is_in_memory(&self, id: &str) -> bool {
self.map.read().await.contains_key(id)
}'''
new_code = ''' #[inline]
pub(crate) async fn is_in_memory(&self, id: &str) -> bool {
self.map.read().await.contains_key(id)
}
/// Remove peer from memory (used during ID change)
pub(crate) async fn remove(&self, id: &str) {
self.map.write().await.remove(id);
log::debug!("Removed peer {} from memory", id);
}'''
if marker in content:
content = content.replace(marker, new_code)
with open("peer.rs", "w") as f:
f.write(content)
print("SUCCESS: Added remove function to peer.rs")
else:
print("ERROR: Could not find target marker in peer.rs")