mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-22 11:25:56 +00:00
Phase 6c: update commands and Settings > Server updates UI (preview, conflicts, progress, rollback)
Verified in the native window on the fixture: modified file kept by choice, new file added, server restarted healthy, version bumped. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
961dc1b6ba
commit
981ee4d4d9
5 files changed
+336
-1
No files matched your search
@@ -0,0 +1,25 @@
|
||||
//! Build and sign a small update package. usage: mkpkg <out dir> <version> <path=content>...
|
||||
use base64::{engine::general_purpose::STANDARD, Engine};
|
||||
use coa_core::manifest::Kind;
|
||||
use coa_core::package::{build, BuildOptions};
|
||||
use ed25519_dalek::{Signer, SigningKey};
|
||||
|
||||
fn main() {
|
||||
let a: Vec<String> = std::env::args().skip(1).collect();
|
||||
let out = std::path::PathBuf::from(&a[0]);
|
||||
let src = out.with_file_name(format!("{}-src", out.file_name().unwrap().to_string_lossy()));
|
||||
let _ = std::fs::remove_dir_all(&src);
|
||||
let _ = std::fs::remove_dir_all(&out);
|
||||
for spec in &a[2..] {
|
||||
let (p, c) = spec.split_once('=').expect("path=content");
|
||||
let f = src.join(p);
|
||||
std::fs::create_dir_all(f.parent().unwrap()).unwrap();
|
||||
std::fs::write(f, c.replace("\n", "\n")).unwrap();
|
||||
}
|
||||
build(&src, &out, &BuildOptions { kind: Kind::Update, version: a[1].clone(), core_commit: None, built_at: chrono::Utc::now().to_rfc3339(), part_size: 1 << 20 }, &|_| {}).unwrap();
|
||||
let key = format!("{}/.coa-manager/signing/manifest-signing.key", std::env::var("USERPROFILE").unwrap());
|
||||
let seed: [u8; 32] = STANDARD.decode(std::fs::read_to_string(key).unwrap().trim()).unwrap().try_into().unwrap();
|
||||
let sig = SigningKey::from_bytes(&seed).sign(&std::fs::read(out.join("manifest.json")).unwrap());
|
||||
std::fs::write(out.join("manifest.json.sig"), STANDARD.encode(sig.to_bytes())).unwrap();
|
||||
println!("package {} at {}", a[1], out.display());
|
||||
}
|
||||
Reference in new issue
Block a user