diff --git a/packages/hoppscotch-agent/src-tauri/src/lib.rs b/packages/hoppscotch-agent/src-tauri/src/lib.rs
index e7ead68f..24e34209 100644
--- a/packages/hoppscotch-agent/src-tauri/src/lib.rs
+++ b/packages/hoppscotch-agent/src-tauri/src/lib.rs
@@ -181,6 +181,20 @@ pub fn run() {
.unwrap();
};
+ let app_handle_ref = app_handle.clone();
+ app_handle.listen("maximize-window", move |_| {
+ tracing::info!("Maximize window event triggered");
+ if let Some(window) = app_handle_ref.get_webview_window("main") {
+ if let Err(e) = window.emit("show-otp-view", ()) {
+ tracing::error!("Failed to emit show-otp-view event: {}", e);
+ }
+
+ if let Err(e) = show_main_window(&app_handle_ref) {
+ tracing::error!("Failed to maximize window: {}", e);
+ }
+ }
+ });
+
let app_handle_ref = app_handle.clone();
app_handle.listen("registration-received", move |_| {
tracing::info!("Registration received event triggered");
diff --git a/packages/hoppscotch-agent/src-tauri/src/tray.rs b/packages/hoppscotch-agent/src-tauri/src/tray.rs
index afd08441..94952991 100644
--- a/packages/hoppscotch-agent/src-tauri/src/tray.rs
+++ b/packages/hoppscotch-agent/src-tauri/src/tray.rs
@@ -23,6 +23,13 @@ pub fn create_tray(app: &AppHandle) -> tauri::Result<()> {
true,
None::<&str>,
)?;
+ let maximize_window = MenuItem::with_id(
+ app,
+ "maximize_window",
+ "Maximize Window",
+ true,
+ None::<&str>,
+ )?;
let show_registrations = MenuItem::with_id(
app,
"show_registrations",
@@ -48,9 +55,12 @@ pub fn create_tray(app: &AppHandle) -> tauri::Result<()> {
.item(&app_name_item)
.item(&app_version_item)
.separator()
+ .item(&maximize_window)
+ .separator()
.item(&clear_registrations)
.item(&show_registrations)
.separator()
+ .separator()
.item(&quit_i)
.build()?;
@@ -63,7 +73,7 @@ pub fn create_tray(app: &AppHandle) -> tauri::Result<()> {
})
.icon_as_template(cfg!(target_os = "macos"))
.menu(&menu)
- .menu_on_left_click(true)
+ .show_menu_on_left_click(true)
.on_menu_event(move |app, event| match event.id.as_ref() {
"quit" => {
tracing::info!("Exiting the agent...");
@@ -85,6 +95,15 @@ pub fn create_tray(app: &AppHandle) -> tauri::Result<()> {
tracing::error!("Failed to show window: {}", e);
}
}
+ "maximize_window" => {
+ app.emit("maximize-window", ())
+ .unwrap_or_else(|e| {
+ tracing::error!("Failed to emit maximize-window event: {}", e);
+ });
+ if let Err(e) = show_main_window(&app) {
+ tracing::error!("Failed to maximize window: {}", e);
+ }
+ }
_ => {
tracing::warn!("Unhandled menu event: {:?}", event.id);
}
diff --git a/packages/hoppscotch-agent/src/App.vue b/packages/hoppscotch-agent/src/App.vue
index e558e7f8..b54b57f6 100644
--- a/packages/hoppscotch-agent/src/App.vue
+++ b/packages/hoppscotch-agent/src/App.vue
@@ -2,23 +2,18 @@
{{ pipe(state(), getTitle) }}
-
-
+
+
An app is trying to register against the Hoppscotch Agent. If this was intentional, copy the given code into
- the app to complete the registration process. Please hide the window if you did not initiate this request.
- Do not hide this window until the verification code is entered. The window will hide automatically once done.
+ the app to complete the registration process. Please cancel the registration if you did not initiate this request.
+ The window will hide automatically once registration succeeds. If you minimize this window during registration,
+ you can access it again from the tray by selecting "Maximize Window".
{{ pipe(state().otp, O.getOrElse(() => "")) }}
-
-
Waiting for registration requests...
-
You can hide this window and access it again from the tray icon.
-
@@ -38,7 +33,27 @@
:icon="copyIcon"
@click="copyOtp"
/>
-
+
+
+
+
+
+
+
+
@@ -94,10 +109,9 @@ const appState = ref({
const state = () => appState.value
-const isOtpView = (s: AppState): boolean => s.view === "otp"
const getTitle = (s: AppState): string =>
- s.view === "otp" ? "Agent Registration Request" : "Agent Registrations"
-const shouldShowCopy = (s: AppState): boolean => isOtpView(s) && O.isSome(s.otp)
+ O.isSome(s.otp) ? "Agent Registration Request" : "Agent Registrations"
+const shouldShowCopy = (s: AppState): boolean => O.isSome(s.otp)
const formatDate = (date: string): string => new Date(date).toLocaleString()
const getOtp = TE.tryCatch(
@@ -166,7 +180,11 @@ onMounted(async () => {
await pipe(
getOtp,
TE.map((otp: string) => {
- if (otp) appState.value = { ...state(), otp: O.some(otp) }
+ if (otp) {
+ appState.value = { ...state(), otp: O.some(otp) }
+ } else {
+ updateRegistrations();
+ }
})
)()
@@ -181,6 +199,18 @@ onMounted(async () => {
),
listen("authenticated", handleAuthenticated),
listen("show-registrations", handleShowRegistrations),
+ listen("show-otp-view", async () => {
+ await pipe(
+ getOtp,
+ TE.map((otp: string) => {
+ if (otp) {
+ appState.value = { ...state(), otp: O.some(otp) };
+ } else {
+ updateRegistrations();
+ }
+ })
+ )();
+ }),
])
})
diff --git a/packages/hoppscotch-agent/src/pages/otp.vue b/packages/hoppscotch-agent/src/pages/otp.vue
index 2265faf7..8d6ef7de 100644
--- a/packages/hoppscotch-agent/src/pages/otp.vue
+++ b/packages/hoppscotch-agent/src/pages/otp.vue
@@ -24,7 +24,13 @@
:icon="copyIcon"
@click="copyCode"
/>
-
+
+
+
diff --git a/packages/hoppscotch-common/locales/en.json b/packages/hoppscotch-common/locales/en.json
index ba4643c7..fbd57566 100644
--- a/packages/hoppscotch-common/locales/en.json
+++ b/packages/hoppscotch-common/locales/en.json
@@ -882,14 +882,15 @@
"account_email_description": "Your primary email address.",
"account_name_description": "This is your display name.",
"additional": "Additional Settings",
- "agent_not_running": "Hoppscotch Agent not detected - click `Retry` to check again.",
+ "agent_not_running": "Hoppscotch Agent not detected. Please check if the Agent is running.",
"agent_not_running_short": "Check Agent's status.",
"agent_running": "Hoppscotch Agent is live.",
"agent_running_short": "Hoppscotch Agent is live.",
- "agent_reset_registration": "Reset Registration",
+ "agent_discard_registration": "Discard Agent Registration",
"agent_registered": "Agent Registered",
"agent_registration_successful": "Agent Registered Successfully",
- "agent_registration_fetch_failed": "Couldn't fetch Agent registration information",
+ "agent_registration_fetch_failed": "Couldn't fetch Agent registration information. Please re-register the Agent.",
+ "agent_registration_already_in_progress": "Agent registration is already in progress. Please complete or cancel the current registration and try again.",
"auto_encode_mode": "Auto",
"auto_encode_mode_tooltip": "Encode the parameters in the request only if some special characters are present",
"background": "Background",
@@ -928,6 +929,7 @@
"proxy_url": "Proxy URL",
"proxy_use_toggle": "Use the proxy middleware to send requests",
"read_the": "Read the",
+ "register_agent": "Register Agent",
"reset_default": "Use Default Proxy",
"short_codes": "Short codes",
"short_codes_description": "Short codes which were created by you.",
diff --git a/packages/hoppscotch-common/src/components/settings/AgentSubtitle.vue b/packages/hoppscotch-common/src/components/settings/AgentSubtitle.vue
index 5b52abb1..fad75125 100644
--- a/packages/hoppscotch-common/src/components/settings/AgentSubtitle.vue
+++ b/packages/hoppscotch-common/src/components/settings/AgentSubtitle.vue
@@ -6,51 +6,16 @@
-
- {{ t("settings.agent_not_running_short") }}
-
-
-
-
-
-
- {{ t("settings.agent_running") }}
-
-
-
-
-
-
+
{{ t("settings.agent_registered") }}
- {{ maskedAuthKey }}
+ {{ store.maskedAuthKey.value }}
+
+
+
+