mirror of
https://github.com/tiennm99/claude-code-usage-bubble.git
synced 2026-10-14 04:16:02 +00:00
feat: clean-room rewrite — replace ported modules with original implementations
Every Rust module under src/ that previously contained upstream-derivative
code has been replaced by a from-scratch implementation:
diag/ log + simplelog file appender (was: diagnose.rs)
os/ color, dpi, registry, string, theme (was: theme.rs, native_interop.rs)
net/ WinHTTP-based HTTP client (was: ureq + native-tls)
i18n/ TOML-embedded locale tables (was: localization/*.rs)
usage/ trait UsageProvider + ClaudeProvider + ChatGptProvider + refresh
orchestrator + registry (was: poller.rs, models.rs)
creds/ trait CredentialSource + local/WSL/Codex impls (was: poller.rs)
tray/ stateless tray manager + tiny-skia anti-aliased badge renderer
(was: tray_icon.rs)
update/ release fetch + inline cmd /c handoff installer
(was: updater.rs's helper-exe pattern)
Application files (app.rs, bubble.rs, panel.rs, settings.rs) migrated to
the new modules. main.rs declares only the new modules.
NOTICE deleted; LICENSE is plain Apache-2.0; README updated to credit
inspiration rather than claim derivation. Cargo.toml drops ureq + native-tls
+ winres in favour of log + simplelog + thiserror + toml + tiny-skia +
embed-resource. Build script swapped to embed-resource via res/icon.rc.
External contracts preserved unchanged: Anthropic + ChatGPT endpoints and
headers, ~/.claude/.credentials.json + Codex auth.json paths, WSL bridging
via wsl.exe, CLI-driven token refresh, GitHub Releases JSON shape, Windows
registry path for startup, single-instance mutex name.
Phase docs: plans/260516-0707-cleanroom-rewrite/.
This commit is contained in:
1 parent
c0f3e3f860
commit
aa6217d2cf
72 files changed
+6265
-3788
No files matched your search
@@ -1,24 +1,16 @@
|
||||
use winres::{VersionInfo, WindowsResource};
|
||||
// Compiles `res/icon.rc` into the binary as Windows PE resources.
|
||||
//
|
||||
// `embed-resource` shells out to `rc.exe` (when a Windows SDK is on PATH) or
|
||||
// `windres` (MinGW) to produce a .res object that the linker bakes into the
|
||||
// .exe alongside our Rust code. The .rc file references `src/icons/icon.ico`
|
||||
// via a relative path; keep that path stable.
|
||||
|
||||
fn main() {
|
||||
let version = env!("CARGO_PKG_VERSION");
|
||||
let mut res = WindowsResource::new();
|
||||
let numeric_version = pack_version(version);
|
||||
|
||||
res.set_icon("src/icons/icon.ico")
|
||||
.set("FileVersion", version)
|
||||
.set("ProductVersion", version)
|
||||
.set_version_info(VersionInfo::FILEVERSION, numeric_version)
|
||||
.set_version_info(VersionInfo::PRODUCTVERSION, numeric_version);
|
||||
|
||||
res.compile().expect("Failed to compile Windows resources");
|
||||
}
|
||||
|
||||
fn pack_version(version: &str) -> u64 {
|
||||
let core = version.split('-').next().unwrap_or(version);
|
||||
let mut parts = core.split('.').map(|p| p.parse::<u64>().unwrap_or(0));
|
||||
let major = parts.next().unwrap_or(0).min(u16::MAX as u64);
|
||||
let minor = parts.next().unwrap_or(0).min(u16::MAX as u64);
|
||||
let patch = parts.next().unwrap_or(0).min(u16::MAX as u64);
|
||||
(major << 48) | (minor << 32) | (patch << 16)
|
||||
// `compile` returns a `CompilationResult` annotated `#[must_use]` on
|
||||
// embed-resource 3.x. `manifest_optional()` collapses Linux/Mac no-op
|
||||
// cases (where there's no `rc.exe`) into Ok while still surfacing real
|
||||
// failures on Windows.
|
||||
embed_resource::compile("res/icon.rc", embed_resource::NONE)
|
||||
.manifest_optional()
|
||||
.expect("Failed to compile Windows resources");
|
||||
}
|
||||
Reference in new issue
Block a user