mirror of
https://github.com/tiennm99/claude-code-usage-bubble.git
synced 2026-10-26 04:17:18 +00:00
refactor: rename the project to usage-monitor
Rename the crate, binary, product name, identifier, settings folder, log file, autostart entry, user agent, updater endpoint and release assets. Legacy Win32 clients still update: they fall back to the first .exe asset, and the legacy rollback workflow reads the package name from the ref it builds. Upgraded installs start with default settings.
This commit is contained in:
1 parent
88d39feeb1
commit
6afd603d5e
44 files changed
+224
-202
No files matched your search
+1
-1
@@ -39,7 +39,7 @@ const READY_FALLBACK: Duration = Duration::from_millis(1500);
|
||||
#[cfg(not(windows))]
|
||||
const MOVE_END_DEBOUNCE: Duration = Duration::from_millis(250);
|
||||
|
||||
const TITLE: &str = "Claude Code Usage Bubble";
|
||||
const TITLE: &str = "Usage Monitor";
|
||||
|
||||
/// Work area used when no monitor can be enumerated.
|
||||
const FALLBACK_SCREEN: Rect = Rect::new(0, 0, 1920, 1080);
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ impl LocaleStrings {
|
||||
|
||||
fn english_strings() -> LocaleStrings {
|
||||
LocaleStrings {
|
||||
window_title: "Claude Code Usage Bubble".into(),
|
||||
window_title: "Usage Monitor".into(),
|
||||
refresh: "Refresh".into(),
|
||||
update_frequency: "Update frequency".into(),
|
||||
one_minute: "1 minute".into(),
|
||||
|
||||
@@ -10,7 +10,7 @@ use crate::core::geom::{
|
||||
};
|
||||
use crate::usage::ProviderId;
|
||||
|
||||
pub const APP_DIR_NAME: &str = "ClaudeCodeUsageBubble";
|
||||
pub const APP_DIR_NAME: &str = "UsageMonitor";
|
||||
const SETTINGS_FILE: &str = "settings.json";
|
||||
|
||||
pub const POLL_1_MIN: u32 = 60_000;
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ use std::path::PathBuf;
|
||||
|
||||
use simplelog::{CombinedLogger, ConfigBuilder, LevelFilter, WriteLogger};
|
||||
|
||||
const LOG_FILE_NAME: &str = "claude-code-usage-bubble.log";
|
||||
const LOG_FILE_NAME: &str = "usage-monitor.log";
|
||||
|
||||
/// The updater plugin logs the proxy URL, credentials included, at debug
|
||||
/// level, so its messages are kept to info and above.
|
||||
|
||||
+7
-7
@@ -66,7 +66,7 @@ fn detach(command: &mut Command) {
|
||||
command.process_group(0);
|
||||
}
|
||||
|
||||
/// `data_local_dir()/ClaudeCodeUsageBubble/updates`, where updates are
|
||||
/// `data_local_dir()/UsageMonitor/updates`, where updates are
|
||||
/// staged and `update-error.log` lives.
|
||||
pub fn updates_dir() -> Option<PathBuf> {
|
||||
dirs::data_local_dir().map(|d| d.join(APP_DIR_NAME).join("updates"))
|
||||
@@ -153,14 +153,14 @@ mod tests {
|
||||
std::fs::create_dir_all(&install).expect("install dir");
|
||||
std::fs::create_dir_all(&updates).expect("updates dir");
|
||||
|
||||
let exe = install.join("claude-code-usage-bubble.exe");
|
||||
let exe = install.join("usage-monitor.exe");
|
||||
touch(&exe);
|
||||
touch(&install.join("claude-code-usage-bubble.exe.old.1234"));
|
||||
touch(&install.join("claude-code-usage-bubble.exe.old.99"));
|
||||
touch(&install.join("usage-monitor.exe.old.1234"));
|
||||
touch(&install.join("usage-monitor.exe.old.99"));
|
||||
touch(&install.join("other.exe.old.1"));
|
||||
touch(&install.join("settings.json"));
|
||||
// A directory with a matching name is left alone.
|
||||
std::fs::create_dir_all(install.join("claude-code-usage-bubble.exe.old.dir")).expect("dir");
|
||||
std::fs::create_dir_all(install.join("usage-monitor.exe.old.dir")).expect("dir");
|
||||
|
||||
touch(&updates.join("update.exe"));
|
||||
touch(&updates.join("updater-helper-4242.exe"));
|
||||
@@ -172,10 +172,10 @@ mod tests {
|
||||
assert_eq!(
|
||||
names(&install),
|
||||
[
|
||||
"claude-code-usage-bubble.exe",
|
||||
"claude-code-usage-bubble.exe.old.dir",
|
||||
"other.exe.old.1",
|
||||
"settings.json",
|
||||
"usage-monitor.exe",
|
||||
"usage-monitor.exe.old.dir",
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
//! Claude Code Usage Bubble on Tauri v2.
|
||||
//! Usage Monitor on Tauri v2.
|
||||
//!
|
||||
//! The binary in `src/main.rs` only calls [`run`]. Every module is `pub` so
|
||||
//! that items wired up incrementally do not trip `dead_code`.
|
||||
|
||||
+1
-1
@@ -3,5 +3,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
fn main() {
|
||||
claude_code_usage_bubble_lib::run();
|
||||
usage_monitor_lib::run();
|
||||
}
|
||||
+2
-2
@@ -16,7 +16,7 @@ use ureq::{Agent, Proxy, ProxyProtocol};
|
||||
use crate::core::proxy::SystemProxy;
|
||||
|
||||
/// Default User-Agent; a per-request `User-Agent` header replaces it.
|
||||
pub const USER_AGENT: &str = concat!("claude-code-usage-bubble/", env!("CARGO_PKG_VERSION"));
|
||||
pub const USER_AGENT: &str = concat!("usage-monitor/", env!("CARGO_PKG_VERSION"));
|
||||
|
||||
const CONNECT_TIMEOUT: Duration = Duration::from_secs(60);
|
||||
const RECEIVE_TIMEOUT: Duration = Duration::from_secs(30);
|
||||
@@ -375,7 +375,7 @@ mod tests {
|
||||
let request = received(&served).to_ascii_lowercase();
|
||||
let expected = format!("user-agent: {}\r\n", USER_AGENT.to_ascii_lowercase());
|
||||
assert!(request.contains(&expected), "{request}");
|
||||
assert!(USER_AGENT.starts_with("claude-code-usage-bubble/"));
|
||||
assert!(USER_AGENT.starts_with("usage-monitor/"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -661,8 +661,8 @@ mod tests {
|
||||
#[test]
|
||||
fn run_value_path_is_quoted() {
|
||||
assert_eq!(
|
||||
quoted_path(Path::new(r"D:\My Tools\claude-code-usage-bubble.exe")),
|
||||
r#""D:\My Tools\claude-code-usage-bubble.exe""#
|
||||
quoted_path(Path::new(r"D:\My Tools\usage-monitor.exe")),
|
||||
r#""D:\My Tools\usage-monitor.exe""#
|
||||
);
|
||||
}
|
||||
}
|
||||
+5
-8
@@ -53,12 +53,12 @@ const REFRESH_TIMEOUT: Duration = Duration::from_secs(8);
|
||||
|
||||
/// Name of the start-at-login entry: the Windows `Run` value name of every
|
||||
/// earlier release, so an existing entry is already the plugin's entry.
|
||||
pub const AUTOSTART_NAME: &str = "ClaudeCodeUsageBubble";
|
||||
pub const AUTOSTART_NAME: &str = "UsageMonitor";
|
||||
|
||||
#[cfg(windows)]
|
||||
const WEBVIEW2_MISSING_TITLE: &str = "Claude Code Usage Bubble";
|
||||
const WEBVIEW2_MISSING_TITLE: &str = "Usage Monitor";
|
||||
#[cfg(windows)]
|
||||
const WEBVIEW2_MISSING_TEXT: &str = "Claude Code Usage Bubble needs the Microsoft Edge \
|
||||
const WEBVIEW2_MISSING_TEXT: &str = "Usage Monitor needs the Microsoft Edge \
|
||||
WebView2 Runtime.\n\nDownload the Evergreen runtime from:\n\
|
||||
https://developer.microsoft.com/microsoft-edge/webview2/";
|
||||
|
||||
@@ -905,7 +905,7 @@ pub fn run() {
|
||||
Ok(app) => app,
|
||||
Err(err) => {
|
||||
log::error!("tauri builder failed: {err}");
|
||||
eprintln!("Claude Code Usage Bubble failed to start: {err}");
|
||||
eprintln!("Usage Monitor failed to start: {err}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
};
|
||||
@@ -1015,10 +1015,7 @@ fn register_notification_identity(app: &AppHandle) {
|
||||
return;
|
||||
};
|
||||
let config = app.config();
|
||||
let name = config
|
||||
.product_name
|
||||
.as_deref()
|
||||
.unwrap_or("Claude Code Usage Bubble");
|
||||
let name = config.product_name.as_deref().unwrap_or("Usage Monitor");
|
||||
match platform::windows::register_aumid(&config.identifier, name, ICON_PNG, &icon_path) {
|
||||
Ok(()) => log::info!("notification app id {} registered", config.identifier),
|
||||
Err(err) => log::warn!("notification app id registration incomplete: {err}"),
|
||||
|
||||
+1
-1
@@ -439,7 +439,7 @@ mod tests {
|
||||
assert_eq!(
|
||||
config.pointer("/plugins/updater/endpoints"),
|
||||
Some(&serde_json::json!([
|
||||
"https://github.com/tiennm99/claude-code-usage-bubble/releases/latest/download/latest.json"
|
||||
"https://github.com/tiennm99/usage-monitor/releases/latest/download/latest.json"
|
||||
]))
|
||||
);
|
||||
// The plugin parses this when it is registered; a parse error
|
||||
|
||||
Reference in new issue
Block a user