mirror of
https://github.com/UNITRONIX/BetterDesk.git
synced 2026-09-10 17:45:42 +00:00
b14a8cf162
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.
41 lines
1.5 KiB
Python
41 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Patch database.rs to add change_id function - simplified version"""
|
|
|
|
with open("database.rs", "r") as f:
|
|
content = f.read()
|
|
|
|
# Find place to add change_id function (after is_device_banned)
|
|
marker = ''' pub async fn is_device_banned(&self, id: &str) -> ResultType<bool> {'''
|
|
|
|
new_function = ''' /// Change device ID in database (for ID change feature)
|
|
pub async fn change_id(&self, old_id: &str, new_id: &str) -> ResultType<()> {
|
|
let old = old_id.to_string();
|
|
let new = new_id.to_string();
|
|
let url = self.url.clone();
|
|
|
|
let mut opt = SqliteConnectOptions::from_str(&url).unwrap();
|
|
opt.log_statements(log::LevelFilter::Debug);
|
|
let mut conn = SqliteConnection::connect_with(&opt).await?;
|
|
|
|
// Simple update - just change the ID and record timestamp
|
|
// The previous_ids tracking is already handled in http_api.rs
|
|
sqlx::query("UPDATE peer SET id = ?, id_changed_at = datetime('now') WHERE id = ?")
|
|
.bind(&new)
|
|
.bind(&old)
|
|
.execute(&mut conn)
|
|
.await?;
|
|
|
|
log::info!("Database: Changed ID {} -> {}", old, new);
|
|
Ok(())
|
|
}
|
|
|
|
''' + marker
|
|
|
|
if marker in content:
|
|
content = content.replace(marker, new_function)
|
|
with open("database.rs", "w") as f:
|
|
f.write(content)
|
|
print("SUCCESS: Added change_id function to database.rs")
|
|
else:
|
|
print("ERROR: Could not find target marker in database.rs")
|