Skip to content
Closed
349 changes: 297 additions & 52 deletions apps/codex-plus-manager/src-tauri/src/commands.rs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions apps/codex-plus-manager/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ pub fn run() {
commands::fetch_relay_profile_models,
commands::fetch_sub2api_billing,
commands::switch_relay_profile,
commands::reapply_active_relay_profile,
commands::apply_relay_injection,
commands::apply_pure_api_injection,
commands::clear_relay_injection,
Expand Down
18 changes: 15 additions & 3 deletions apps/codex-plus-manager/src-tauri/tests/windows_subsystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,20 @@ fn relay_settings_keeps_profile_config_and_auth_files_isolated() {
let app_tsx = std::fs::read_to_string(&app_tsx).expect("read manager App.tsx");
let commands_rs = manifest_dir.join("src/commands.rs");
let commands_rs = std::fs::read_to_string(&commands_rs).expect("read manager commands.rs");
let relay_switch_rs = manifest_dir
.parent()
.and_then(std::path::Path::parent)
.and_then(std::path::Path::parent)
.unwrap()
.join("crates/codex-plus-core/src/relay_switch.rs");
let relay_switch_rs =
std::fs::read_to_string(&relay_switch_rs).expect("read relay switch core");

assert!(app_tsx.contains("snapshotActiveRelayFilesBeforeSwitch"));
assert!(app_tsx.contains("backfill_relay_profile_from_live"));
assert!(!app_tsx.contains("snapshotActiveRelayFilesBeforeSwitch"));
assert!(!app_tsx.contains("backfill_relay_profile_from_live"));
assert!(app_tsx.contains("relayProfileSwitchValidation(selectedBeforeSave, switchSettings)"));
assert!(app_tsx.contains("缺少独立 config.toml"));
assert!(app_tsx.contains("const command = relayProfileSwitchCommand(selectedAfterSave)"));
assert!(app_tsx.contains("const command = relayProfileSwitchCommand(selectedProfile)"));
assert!(app_tsx.contains("function relayProfileSwitchCommand"));
assert!(app_tsx.contains("return \"apply_pure_api_injection\""));
assert!(app_tsx.contains("return \"apply_relay_injection\""));
Expand All @@ -231,6 +239,10 @@ fn relay_settings_keeps_profile_config_and_auth_files_isolated() {
assert!(!commands_rs.contains("缺少独立 auth.json"));
assert!(commands_rs.contains("backfill_relay_profile_from_live"));
assert!(commands_rs.contains("apply_relay_profile_to_home_with_switch_rules"));
assert!(relay_switch_rs.contains("backfill_profile_before_switch"));
assert!(
relay_switch_rs.contains("previous_active_relay_id != selected_settings.active_relay_id")
);
}

#[test]
Expand Down
Loading