diff --git a/AGENTS.md b/AGENTS.md
index de821e6..4b8ee5a 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -72,7 +72,7 @@ target/debug/admincraft --screenshot shots/now.png --lang en --data shots/demo
```
`--screenshot` draws about 120 frames (longer while an embedded window or a scan is pending), saves
-the window as PNG and exits; the window opens without focus. `--open help[:CHAPTER]|settings|recordings[:FILE]|whois:Q|http:URL|snmp:HOST|netscan:RANGE|cert:HOST|
+the window as PNG and exits; the window opens without focus. `--open help[:CHAPTER]|settings|web:URL|recordings[:FILE]|whois:Q|http:URL|snmp:HOST|netscan:RANGE|cert:HOST|
subnet:CIDR|tunnels|export|transfer|shell` opens a tab at start (for checks and screenshots).
`--data
` uses another data folder — use a fresh one for screenshots, so no personal
connections, hosts or paths end up in pictures or commits.
diff --git a/Cargo.toml b/Cargo.toml
index 6fe136a..e9ad6c1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -43,7 +43,7 @@ zeroize = "1.8"
winit = "0.30"
[target."cfg(windows)".dependencies]
-windows-sys = { version = "0.61", features = ["Win32_Foundation", "Win32_UI_WindowsAndMessaging", "Win32_Graphics_Gdi", "Win32_UI_Input_KeyboardAndMouse", "Win32_System_Console", "Win32_Security_Credentials", "Win32_Storage_Xps"] }
+windows-sys = { version = "0.61", features = ["Win32_Foundation", "Win32_UI_WindowsAndMessaging", "Win32_Graphics_Gdi", "Win32_UI_Input_KeyboardAndMouse", "Win32_System_Console", "Win32_Security_Credentials", "Win32_Storage_Xps", "Win32_System_Diagnostics_ToolHelp"] }
[build-dependencies]
embed-resource = "3.0.12"
diff --git a/README.md b/README.md
index 3883966..b0b34a2 100644
--- a/README.md
+++ b/README.md
@@ -58,7 +58,8 @@
user / domain / password on to everything inside.
- **In a tab:** SSH (OpenSSH), Telnet, PowerShell Remoting, local shell, serial console, raw TCP, rlogin.
- **Window in a tab (Windows):** Remote Desktop (mstsc, automatic login), PuTTY, VNC viewers and web
- interfaces (Edge/Chrome app window) are embedded into the tab; a click gives them the keyboard.
+ interfaces are embedded into the tab; a click gives them the keyboard. Web interfaces open in Edge,
+ Chrome or **your own browser** (Brave, Vivaldi, Firefox …) with its own profile per connection.
- **Jump hosts:** log in to a jump host and continue there with `ssh user@target` (the key can live
on the jump host), or tunnel with `ssh -J`; works in the terminal tab, with PuTTY and in an own window.
- **SSH tunnels** (port forwarding) per connection, started by hand or together with the connection.
diff --git a/ROADMAP.md b/ROADMAP.md
index 26ecb01..1bdb613 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -72,6 +72,17 @@ first, run `cargo fmt --check`, `cargo clippy --all-targets --locked -- -D warni
Tab) for PuTTY too. `src/embed.rs` and `src/app_control.rs`.
11. **Releases:** add an Intel macOS build; sign the Windows and macOS programs once
certificates exist.
+12. **Own browser for web interfaces** — started. Settings » *Web interfaces*: the program of any
+ Chromium browser (Brave, Brave Origin, Vivaldi, Chromium, Opera) or Firefox browser (Firefox,
+ LibreWolf, Waterfox, Zen …), the kind recognised from its file name or chosen, the profile (own per
+ connection in the data folder, own temporary, or the browser's normal one, which can't go into a
+ tab) and own arguments (`src/launch.rs` `web_args`, `src/app_web.rs`); every web interface opens
+ in a tab unless switched off. The window is also found when it belongs to a process the started
+ one launched (launchers, browsers that hand over), `embed::descendants`. Tried live: Edge in the
+ tab. Still to do: try it with Brave Origin and a Firefox browser on Windows (window found and
+ placed in the tab, focus, size, logins kept); hide the browser's own title bar inside the tab; a browser per connection instead of one for all; on Linux/macOS use the chosen
+ browser too instead of the system one. A built-in webview (WebView2) is not an option: the Rust
+ house rules allow no webview in native Craft apps.
Done and to be tried against real servers: the Remote Desktop login through the Credential
Manager (`src/wincred.rs`) — log in to a real host with *Pass the login automatically* and check
@@ -82,7 +93,7 @@ that the entry is gone from the Credential Manager about two minutes later.
| Principle | Status |
|---|---|
| Open source | Yes — MIT OR Apache-2.0, everything on GitHub. |
-| Native, not wrapped | Yes — pure Rust + egui, no Electron. Optional extras start the system's own programs (mstsc, PuTTY, Edge app window for web interfaces) and place their windows in a tab. |
+| Native, not wrapped | Yes — pure Rust + egui, no Electron, no webview. Optional extras start the system's own programs (mstsc, PuTTY, your browser for web interfaces) and place their windows in a tab. |
| Familiar from day one | Yes — the mRemoteNG / Royal TS layout (tree, tabs, properties), right-click menus, tab drag & drop and the usual shortcuts. |
| Your files, your machine | Yes — local data next to the program; central storage (SMB/WebDAV) only when chosen. |
| Agent-ready | Yes — `admincraft cli …` (JSON), `admincraft mcp` (MCP server) and a local control channel into the open window (tabs, read, type when allowed, open tools). |
diff --git a/docs/README.de.md b/docs/README.de.md
index 78ff8ed..83489b0 100644
--- a/docs/README.de.md
+++ b/docs/README.de.md
@@ -44,7 +44,8 @@ Portabler Verbindungs-Manager für Windows, Linux und macOS – ähnlich mRemote
* **Windows-Verwaltung** per Rechtsklick (Dienste, Ereignisanzeige, Computerverwaltung, C$),
**Neu starten / Herunterfahren** (Windows per `shutdown /m`, Linux per `sudo reboot` über SSH)
* Weitere Verbindungsarten: **Seriell** (COM/ttyUSB), **Raw TCP**, **Rlogin** (über PuTTY/plink),
- **Weboberflächen im Tab** (Edge/Chrome-Fenster, Windows)
+ **Weboberflächen im Tab** (Windows) – in Edge, Chrome oder **Ihrem eigenen Browser** (Brave, Vivaldi,
+ Firefox …), mit eigenem Profil je Verbindung
* **Subnetz-Rechner**, **Zertifikats-Prüfer** (Ablaufdatum, Aussteller, vertrauenswürdig?),
**Passwort-Generator**, **2FA-Codes (TOTP)** aus KeePass-Einträgen
* **Gemeinsame Verbindungsliste** im Team (Ordner auf Netzlaufwerk, Änderungen werden neu geladen)
diff --git a/docs/help/de.md b/docs/help/de.md
index fbec539..35359e0 100644
--- a/docs/help/de.md
+++ b/docs/help/de.md
@@ -75,7 +75,7 @@ Rechtsklick auf einen Ordner » **Alle Verbindungen im Ordner öffnen** öffnet
| VNC | Viewer-Fenster im Tab | einen VNC-Viewer wie TigerVNC oder TightVNC |
| Telnet | Terminal-Tab | — |
| PowerShell | Terminal-Tab mit `Enter-PSSession` | PowerShell, WinRM auf dem Ziel |
-| HTTP / HTTPS | Browser-App-Fenster im Tab | Edge oder Chrome (sonst der normale Browser) |
+| HTTP / HTTPS | Browser-App-Fenster im Tab | Edge, Chrome oder Ihr eigener Browser (Brave, Vivaldi, Firefox …); sonst der normale Browser |
| SFTP / SCP / FTP / FTPS | Dateiübertragungs-Tab | OpenSSH oder PuTTY für SFTP/SCP; FTP ist eingebaut |
| Seriell, Raw-TCP, rlogin | PuTTY im Tab oder ein Terminal-Tab | PuTTY/plink (Windows); picocom, nc … anderswo |
| Lokale Shell | Terminal-Tab auf diesem Computer | — |
@@ -238,6 +238,13 @@ Datei » OpenSSH-Konfiguration importieren (`~/.ssh/config`, einschließlich Pro
- **Darstellung** – dunkel oder hell, Größe der Terminal-Schrift.
- **SSH, Remotedesktop und Dateien** – welcher Client SSH öffnet (eingebautes Terminal, PuTTY, eigenes Fenster),
welche Programme Dateien übertragen, ob Fenster in Tabs eingebettet werden.
+- **Weboberflächen** – welcher Browser Webseiten im Tab öffnet: leer für Edge oder Chrome, oder das Programm
+ Ihres eigenen Browsers (z. B. `brave.exe`, `vivaldi.exe`, `firefox.exe`). Chromium-Browser öffnen ein
+ schlichtes Fenster, Firefox-Browser behalten Tab- und Adressleiste. Mit eigenem Profil je Verbindung kommt
+ das Fenster in den Tab und Anmeldungen bleiben im Datenordner; das normale Profil bringt Ihre gespeicherten
+ Passwörter und Erweiterungen mit, öffnet aber außerhalb des Tabs.
+ *Jede Weboberfläche im Tab öffnen* ist standardmäßig an; ausgeschaltet nutzen nur Verbindungen mit Haken bei
+ *Im Tab öffnen* den Tab.
- **Programme** – wo AdminCraft die einzelnen Hilfsprogramme gefunden hat. Einen eigenen Pfad angeben oder einfach
portable Programme in den **Programme-Ordner** legen (`AdminCraftTools` neben AdminCraft).
- **Speicherort** – wo die Liste liegt, Masterpasswort, zentrale Speicherung.
@@ -351,3 +358,7 @@ schaltet das Einbetten ab.
**AdminCraft fragt beim Start nach einem KeePass-Passwort** – die Verbindungsliste liegt in KeePass. Das
KeePass-Masterpasswort eingeben oder auf *Ohne KeePass* klicken, um mit der eigenen (leeren) Liste zu starten.
+
+**Eine Webseite öffnet in einem eigenen Fenster statt im Tab** – Einstellungen » Weboberflächen prüfen:
+*Jede Weboberfläche im Tab öffnen* an, ein Profil *je Verbindung* (das normale Profil bleibt immer außerhalb)
+und als Browser das Programm selbst (z. B. `brave.exe`), keine Verknüpfung. Dem Fenster ein paar Sekunden geben.
diff --git a/docs/help/en.md b/docs/help/en.md
index a9e557e..a006379 100644
--- a/docs/help/en.md
+++ b/docs/help/en.md
@@ -75,7 +75,7 @@ Right-click a folder » **Open all connections in the folder** opens them all at
| VNC | viewer window inside the tab | a VNC viewer such as TigerVNC or TightVNC |
| Telnet | terminal tab | — |
| PowerShell | terminal tab with `Enter-PSSession` | PowerShell, WinRM on the target |
-| HTTP / HTTPS | browser app window inside the tab | Edge or Chrome (otherwise the normal browser) |
+| HTTP / HTTPS | browser app window inside the tab | Edge, Chrome or your own browser (Brave, Vivaldi, Firefox …); otherwise the normal browser |
| SFTP / SCP / FTP / FTPS | file transfer tab | OpenSSH or PuTTY for SFTP/SCP; FTP is built in |
| Serial, raw TCP, rlogin | PuTTY in the tab or a terminal tab | PuTTY/plink (Windows); picocom, nc … elsewhere |
| Local shell | terminal tab on this computer | — |
@@ -237,6 +237,13 @@ Open with the **Settings** button, **Ctrl+,** or Tools » Settings.
- **Appearance** — dark or light, size of the terminal font.
- **SSH, remote desktop and files** — which client opens SSH (built-in terminal, PuTTY, own window),
which programs transfer files, whether windows are embedded into tabs.
+- **Web interfaces** — which browser opens web pages in a tab: empty for Edge or Chrome, or the program
+ of your own browser (e.g. `brave.exe`, `vivaldi.exe`, `firefox.exe`). Chromium browsers open a plain
+ window, Firefox browsers keep their tab and address bar. With an own profile per connection the window
+ goes into the tab and logins are kept in the data folder; the normal profile brings your saved
+ passwords and extensions, but opens outside the tab.
+ *Open every web interface in a tab* is on by default; switched off, only connections with *Open in a tab*
+ ticked use the tab.
- **Programs** — where AdminCraft found each helper program. Give your own path, or simply drop
portable programs into the **programs folder** (`AdminCraftTools` next to AdminCraft).
- **Storage location** — where the list lives, master password, central storage.
@@ -347,3 +354,7 @@ KeePass master password, or press *Without KeePass* to start with AdminCraft's o
(move the file in `AdminCraftData` away) and import an export.
**Where is my data?** — File » Open data folder.
+
+**A web page opens in its own window, not in the tab** — check Settings » Web interfaces: *Open every web
+interface in a tab* on, a profile *per connection* (the normal profile always stays outside), and as
+browser the program itself (e.g. `brave.exe`), not a shortcut. Give the window a few seconds to appear.
diff --git a/docs/help/fr.md b/docs/help/fr.md
index a593018..363c50f 100644
--- a/docs/help/fr.md
+++ b/docs/help/fr.md
@@ -75,7 +75,7 @@ Clic droit sur un dossier » **Ouvrir toutes les connexions du dossier** les ouv
| VNC | fenêtre de la visionneuse dans l'onglet | une visionneuse VNC comme TigerVNC ou TightVNC |
| Telnet | onglet terminal | — |
| PowerShell | onglet terminal avec `Enter-PSSession` | PowerShell, WinRM sur la cible |
-| HTTP / HTTPS | fenêtre d'application du navigateur dans l'onglet | Edge ou Chrome (sinon le navigateur habituel) |
+| HTTP / HTTPS | fenêtre d'application du navigateur dans l'onglet | Edge, Chrome ou votre propre navigateur (Brave, Vivaldi, Firefox …) ; sinon le navigateur habituel |
| SFTP / SCP / FTP / FTPS | onglet de transfert de fichiers | OpenSSH ou PuTTY pour SFTP/SCP ; FTP est intégré |
| Série, TCP brut, rlogin | PuTTY dans l'onglet ou un onglet terminal | PuTTY/plink (Windows) ; picocom, nc … ailleurs |
| Shell local | onglet terminal sur cet ordinateur | — |
@@ -240,6 +240,13 @@ Ouvrez-les avec le bouton **Paramètres**, **Ctrl+,** ou Outils » Paramètres.
- **Apparence** — sombre ou clair, taille de la police du terminal.
- **SSH, bureau à distance et fichiers** — quel client ouvre SSH (terminal intégré, PuTTY, fenêtre séparée),
quels programmes transfèrent les fichiers, si les fenêtres sont intégrées dans les onglets.
+- **Interfaces web** — quel navigateur ouvre les pages web dans un onglet : vide pour Edge ou Chrome, ou le
+ programme de votre navigateur (p. ex. `brave.exe`, `vivaldi.exe`, `firefox.exe`). Les navigateurs Chromium
+ ouvrent une fenêtre simple, les navigateurs Firefox gardent leur barre d'onglets et d'adresse. Avec un profil
+ propre par connexion, la fenêtre va dans l'onglet et les connexions restent dans le dossier de données ; le
+ profil normal apporte vos mots de passe et extensions, mais s'ouvre hors de l'onglet.
+ *Ouvrir chaque interface web dans un onglet* est activé par défaut ; désactivé, seules les connexions avec
+ *Ouvrir dans un onglet* coché utilisent l'onglet.
- **Programmes** — où AdminCraft a trouvé chaque programme d'aide. Indiquez votre propre chemin, ou déposez simplement
des programmes portables dans le **dossier des programmes** (`AdminCraftTools` à côté d'AdminCraft).
- **Emplacement de stockage** — où se trouve la liste, mot de passe maître, stockage centralisé.
@@ -355,3 +362,8 @@ dans l'onglet* désactive l'intégration.
**AdminCraft demande un mot de passe KeePass au démarrage** — la liste des connexions est dans KeePass.
Saisissez le mot de passe maître KeePass, ou cliquez sur *Sans KeePass* pour démarrer avec la liste propre
(vide) d'AdminCraft.
+
+**Une page web s'ouvre dans sa propre fenêtre et pas dans l'onglet** — vérifiez Paramètres » Interfaces web :
+*Ouvrir chaque interface web dans un onglet* activé, un profil *par connexion* (le profil normal reste toujours
+dehors) et comme navigateur le programme lui-même (p. ex. `brave.exe`), pas un raccourci. Laissez quelques
+secondes à la fenêtre pour apparaître.
diff --git a/docs/help/it.md b/docs/help/it.md
index 306fec5..6575395 100644
--- a/docs/help/it.md
+++ b/docs/help/it.md
@@ -75,7 +75,7 @@ Clic destro su una cartella » **Apri tutte le connessioni nella cartella** le a
| VNC | finestra del viewer dentro la scheda | un VNC viewer come TigerVNC o TightVNC |
| Telnet | scheda terminale | — |
| PowerShell | scheda terminale con `Enter-PSSession` | PowerShell, WinRM sulla destinazione |
-| HTTP / HTTPS | finestra app del browser dentro la scheda | Edge o Chrome (altrimenti il browser normale) |
+| HTTP / HTTPS | finestra app del browser dentro la scheda | Edge, Chrome o il tuo browser (Brave, Vivaldi, Firefox …); altrimenti il browser normale |
| SFTP / SCP / FTP / FTPS | scheda di trasferimento file | OpenSSH o PuTTY per SFTP/SCP; FTP è integrato |
| Seriale, TCP raw, rlogin | PuTTY nella scheda o una scheda terminale | PuTTY/plink (Windows); picocom, nc … altrove |
| Shell locale | scheda terminale su questo computer | — |
@@ -239,6 +239,13 @@ Si aprono con il pulsante **Impostazioni**, con **Ctrl+,** o con Strumenti » Im
- **Aspetto** — scuro o chiaro, dimensione del carattere del terminale.
- **SSH, desktop remoto e file** — quale client apre SSH (terminale integrato, PuTTY, finestra separata),
quali programmi trasferiscono i file, se le finestre vengono incorporate nelle schede.
+- **Interfacce web** — quale browser apre le pagine web in una scheda: vuoto per Edge o Chrome, oppure il
+ programma del tuo browser (ad es. `brave.exe`, `vivaldi.exe`, `firefox.exe`). I browser Chromium aprono una
+ finestra semplice, i browser Firefox mantengono la barra delle schede e degli indirizzi. Con un profilo proprio
+ per connessione la finestra va nella scheda e gli accessi restano nella cartella dati; il profilo normale porta
+ le tue password salvate e le estensioni, ma si apre fuori dalla scheda.
+ *Apri ogni interfaccia web in una scheda* è attivo per impostazione predefinita; disattivato, solo le connessioni
+ con *Apri in una scheda* spuntato usano la scheda.
- **Programmi** — dove AdminCraft ha trovato ogni programma di supporto. Indica un percorso personalizzato, oppure metti semplicemente
i programmi portatili nella **cartella programmi** (`AdminCraftTools` accanto ad AdminCraft).
- **Posizione di archiviazione** — dove si trova l'elenco, password principale, archiviazione centrale.
@@ -353,3 +360,8 @@ nella scheda* disattiva l'incorporamento.
**AdminCraft chiede una password KeePass all'avvio** — l'elenco delle connessioni è in KeePass. Inserisci
la password principale di KeePass, oppure fai clic su *Senza KeePass* per partire con l'elenco proprio
(vuoto) di AdminCraft.
+
+**Una pagina web si apre in una finestra propria e non nella scheda** — controlla Impostazioni » Interfacce web:
+*Apri ogni interfaccia web in una scheda* attivo, un profilo *per connessione* (il profilo normale resta sempre
+fuori) e come browser il programma stesso (ad es. `brave.exe`), non un collegamento. Lascia alla finestra
+qualche secondo per comparire.
diff --git a/docs/help/uk.md b/docs/help/uk.md
index b43200f..43e0b61 100644
--- a/docs/help/uk.md
+++ b/docs/help/uk.md
@@ -75,7 +75,7 @@ AdminCraft зберігає всі ваші сервери, комутатори
| VNC | вікно переглядача у вкладці | переглядач VNC, наприклад TigerVNC або TightVNC |
| Telnet | вкладка термінала | — |
| PowerShell | вкладка термінала з `Enter-PSSession` | PowerShell, WinRM на цільовому комп'ютері |
-| HTTP / HTTPS | вікно браузера у вкладці | Edge або Chrome (інакше звичайний браузер) |
+| HTTP / HTTPS | вікно браузера у вкладці | Edge, Chrome або ваш власний браузер (Brave, Vivaldi, Firefox …); інакше звичайний браузер |
| SFTP / SCP / FTP / FTPS | вкладка передавання файлів | OpenSSH або PuTTY для SFTP/SCP; FTP вбудовано |
| Serial, raw TCP, rlogin | PuTTY у вкладці або вкладка термінала | PuTTY/plink (Windows); picocom, nc … в інших системах |
| Локальна оболонка | вкладка термінала на цьому комп'ютері | — |
@@ -238,6 +238,13 @@ SSH, Telnet, PowerShell і оболонки записується з таймі
- **Оформлення** — темне чи світле, розмір шрифту термінала.
- **SSH, віддалений робочий стіл і файли** — який клієнт відкриває SSH (вбудований термінал, PuTTY, окреме вікно),
які програми передають файли, чи вбудовуються вікна у вкладки.
+- **Вебінтерфейси** — який браузер відкриває вебсторінки у вкладці: порожньо для Edge або Chrome, або програма
+ вашого браузера (напр. `brave.exe`, `vivaldi.exe`, `firefox.exe`). Браузери Chromium відкривають просте вікно,
+ браузери Firefox зберігають панель вкладок і адресний рядок. З окремим профілем для кожного підключення вікно
+ потрапляє у вкладку, а входи зберігаються в папці даних; звичайний профіль має ваші збережені паролі й
+ розширення, але відкривається поза вкладкою.
+ *Відкривати кожен вебінтерфейс у вкладці* увімкнено за замовчуванням; якщо вимкнути, вкладку використовують лише
+ підключення з позначкою *Відкривати у вкладці*.
- **Програми** — де AdminCraft знайшов кожну допоміжну програму. Укажіть власний шлях або просто покладіть
портативні програми в папку **Папка програм** (`AdminCraftTools` поруч з AdminCraft).
- **Місце зберігання** — де зберігається список, майстер-пароль, централізоване зберігання.
@@ -351,3 +358,8 @@ MCP-сервер пропонує те саме як інструменти `win
**AdminCraft під час запуску запитує пароль KeePass** — список підключень зберігається в KeePass. Введіть
майстер-пароль KeePass або натисніть *Без KeePass*, щоб почати з власного (порожнього) списку AdminCraft.
+
+**Вебсторінка відкривається в окремому вікні, а не у вкладці** — перевірте Налаштування » Вебінтерфейси:
+увімкнено *Відкривати кожен вебінтерфейс у вкладці*, профіль *для кожного підключення* (звичайний профіль
+завжди лишається поза вкладкою), а як браузер — сама програма (напр. `brave.exe`), не ярлик. Дайте вікну
+кілька секунд, щоб з'явитися.
diff --git a/lang/de.lang b/lang/de.lang
index 818efe1..6eda808 100644
--- a/lang/de.lang
+++ b/lang/de.lang
@@ -831,3 +831,28 @@ No. = Nr.
No random numbers available: {0} = Keine Zufallszahlen verfügbar: {0}
the random source repeats itself = die Zufallsquelle wiederholt sich
– old PuTTY: the password is on its command line, please update PuTTY = – altes PuTTY: Passwort steht auf dessen Kommandozeile, bitte PuTTY aktualisieren
+Browser profile folder could not be made: {0} = Profilordner für den Browser konnte nicht angelegt werden: {0}
+Web interfaces = Weboberflächen
+HTTP/HTTPS connections with "Open in a tab" start this browser in a window of its own and put it into the tab (Windows). = HTTP/HTTPS-Verbindungen mit „Im Tab öffnen“ starten diesen Browser in einem eigenen Fenster und setzen es in den Tab (Windows).
+Browser = Browser
+empty = Edge or Chrome => leer = Edge oder Chrome
+The browser's program, e.g. brave.exe, vivaldi.exe or firefox.exe. Take the program itself, not a portable launcher. = Das Programm des Browsers, z. B. brave.exe, vivaldi.exe oder firefox.exe. Das Programm selbst nehmen, keinen Portable-Starter.
+Kind = Art
+Recognise = Erkennen
+Chromium-based = Chromium-basiert
+Firefox-based = Firefox-basiert
+Profile = Profil
+Own profile per connection, kept in the data folder = Eigenes Profil je Verbindung, im Datenordner aufbewahrt
+Logins and certificate exceptions stay and travel with AdminCraft. = Anmeldungen und Zertifikats-Ausnahmen bleiben und wandern mit AdminCraft mit.
+Own profile per connection, temporary = Eigenes Profil je Verbindung, vorübergehend
+The browser's normal profile (not in the tab) = Normales Profil des Browsers (nicht im Tab)
+Your saved passwords and extensions, but the page opens in the browser already running, so it can't be put into a tab. = Ihre gespeicherten Passwörter und Erweiterungen, aber die Seite öffnet im schon laufenden Browser und lässt sich daher nicht in einen Tab setzen.
+Own arguments = Eigene Parameter
+optional, separated by spaces = optional, durch Leerzeichen getrennt
+Uses: {0} ({1}) = Verwendet: {0} ({1})
+Firefox browsers show their tab and address bar in the tab; Chromium browsers open a plain window. = Firefox-Browser zeigen im Tab ihre Tab- und Adressleiste; Chromium-Browser öffnen ein schlichtes Fenster.
+No browser found – web interfaces open in the system's browser. = Kein Browser gefunden – Weboberflächen öffnen im Browser des Systems.
+Open in a tab (browser window, see Settings » Web interfaces) = Im Tab öffnen (Browserfenster, siehe Einstellungen » Weboberflächen)
+Open every web interface in a tab = Jede Weboberfläche im Tab öffnen
+Off: only connections with "Open in a tab" ticked; the others open in the system's browser. = Aus: nur Verbindungen mit Haken bei „Im Tab öffnen“; die anderen öffnen im Browser des Systems.
+Web interface (test) = Weboberfläche (Test)
diff --git a/lang/fr.lang b/lang/fr.lang
index 754d50a..b6769b3 100644
--- a/lang/fr.lang
+++ b/lang/fr.lang
@@ -849,3 +849,28 @@ No. = N°
No random numbers available: {0} = Aucun nombre aléatoire disponible : {0}
the random source repeats itself = la source aléatoire se répète
– old PuTTY: the password is on its command line, please update PuTTY = – ancien PuTTY : le mot de passe est sur sa ligne de commande, veuillez mettre PuTTY à jour
+Browser profile folder could not be made: {0} = Le dossier de profil du navigateur n'a pas pu être créé : {0}
+Web interfaces = Interfaces web
+HTTP/HTTPS connections with "Open in a tab" start this browser in a window of its own and put it into the tab (Windows). = Les connexions HTTP/HTTPS avec « Ouvrir dans un onglet » lancent ce navigateur dans sa propre fenêtre et la placent dans l'onglet (Windows).
+Browser = Navigateur
+empty = Edge or Chrome => vide = Edge ou Chrome
+The browser's program, e.g. brave.exe, vivaldi.exe or firefox.exe. Take the program itself, not a portable launcher. = Le programme du navigateur, p. ex. brave.exe, vivaldi.exe ou firefox.exe. Prenez le programme lui-même, pas un lanceur portable.
+Kind = Type
+Recognise = Reconnaître
+Chromium-based = Basé sur Chromium
+Firefox-based = Basé sur Firefox
+Profile = Profil
+Own profile per connection, kept in the data folder = Profil propre par connexion, gardé dans le dossier de données
+Logins and certificate exceptions stay and travel with AdminCraft. = Les connexions et exceptions de certificat restent et voyagent avec AdminCraft.
+Own profile per connection, temporary = Profil propre par connexion, temporaire
+The browser's normal profile (not in the tab) = Le profil normal du navigateur (pas dans l'onglet)
+Your saved passwords and extensions, but the page opens in the browser already running, so it can't be put into a tab. = Vos mots de passe enregistrés et extensions, mais la page s'ouvre dans le navigateur déjà lancé et ne peut donc pas être placée dans un onglet.
+Own arguments = Arguments propres
+optional, separated by spaces = facultatif, séparés par des espaces
+Uses: {0} ({1}) = Utilise : {0} ({1})
+Firefox browsers show their tab and address bar in the tab; Chromium browsers open a plain window. = Les navigateurs Firefox montrent leur barre d'onglets et d'adresse dans l'onglet ; les navigateurs Chromium ouvrent une fenêtre simple.
+No browser found – web interfaces open in the system's browser. = Aucun navigateur trouvé – les interfaces web s'ouvrent dans le navigateur du système.
+Open in a tab (browser window, see Settings » Web interfaces) = Ouvrir dans un onglet (fenêtre de navigateur, voir Paramètres » Interfaces web)
+Open every web interface in a tab = Ouvrir chaque interface web dans un onglet
+Off: only connections with "Open in a tab" ticked; the others open in the system's browser. = Désactivé : seules les connexions avec « Ouvrir dans un onglet » coché ; les autres s'ouvrent dans le navigateur du système.
+Web interface (test) = Interface web (test)
diff --git a/lang/it.lang b/lang/it.lang
index f773e7d..740cefe 100644
--- a/lang/it.lang
+++ b/lang/it.lang
@@ -849,3 +849,28 @@ No. = N.
No random numbers available: {0} = Nessun numero casuale disponibile: {0}
the random source repeats itself = la sorgente casuale si ripete
– old PuTTY: the password is on its command line, please update PuTTY = – PuTTY vecchio: la password è sulla sua riga di comando, aggiorna PuTTY
+Browser profile folder could not be made: {0} = Impossibile creare la cartella del profilo del browser: {0}
+Web interfaces = Interfacce web
+HTTP/HTTPS connections with "Open in a tab" start this browser in a window of its own and put it into the tab (Windows). = Le connessioni HTTP/HTTPS con "Apri in una scheda" avviano questo browser in una finestra propria e la mettono nella scheda (Windows).
+Browser = Browser
+empty = Edge or Chrome => vuoto = Edge o Chrome
+The browser's program, e.g. brave.exe, vivaldi.exe or firefox.exe. Take the program itself, not a portable launcher. = Il programma del browser, ad es. brave.exe, vivaldi.exe o firefox.exe. Usa il programma stesso, non un avviatore portatile.
+Kind = Tipo
+Recognise = Riconosci
+Chromium-based = Basato su Chromium
+Firefox-based = Basato su Firefox
+Profile = Profilo
+Own profile per connection, kept in the data folder = Profilo proprio per connessione, conservato nella cartella dati
+Logins and certificate exceptions stay and travel with AdminCraft. = Accessi ed eccezioni dei certificati restano e viaggiano con AdminCraft.
+Own profile per connection, temporary = Profilo proprio per connessione, temporaneo
+The browser's normal profile (not in the tab) = Il profilo normale del browser (non nella scheda)
+Your saved passwords and extensions, but the page opens in the browser already running, so it can't be put into a tab. = Le tue password salvate e le estensioni, ma la pagina si apre nel browser già in esecuzione e quindi non può essere messa in una scheda.
+Own arguments = Argomenti propri
+optional, separated by spaces = facoltativo, separati da spazi
+Uses: {0} ({1}) = Usa: {0} ({1})
+Firefox browsers show their tab and address bar in the tab; Chromium browsers open a plain window. = I browser Firefox mostrano nella scheda la loro barra delle schede e degli indirizzi; i browser Chromium aprono una finestra semplice.
+No browser found – web interfaces open in the system's browser. = Nessun browser trovato – le interfacce web si aprono nel browser del sistema.
+Open in a tab (browser window, see Settings » Web interfaces) = Apri in una scheda (finestra del browser, vedi Impostazioni » Interfacce web)
+Open every web interface in a tab = Apri ogni interfaccia web in una scheda
+Off: only connections with "Open in a tab" ticked; the others open in the system's browser. = Disattivato: solo le connessioni con "Apri in una scheda" spuntato; le altre si aprono nel browser del sistema.
+Web interface (test) = Interfaccia web (test)
diff --git a/lang/uk.lang b/lang/uk.lang
index 5346a66..cc98c8e 100644
--- a/lang/uk.lang
+++ b/lang/uk.lang
@@ -849,3 +849,28 @@ No. = №
No random numbers available: {0} = Немає доступних випадкових чисел: {0}
the random source repeats itself = джерело випадковості повторюється
– old PuTTY: the password is on its command line, please update PuTTY = – старий PuTTY: пароль у його командному рядку, оновіть PuTTY
+Browser profile folder could not be made: {0} = Не вдалося створити папку профілю браузера: {0}
+Web interfaces = Вебінтерфейси
+HTTP/HTTPS connections with "Open in a tab" start this browser in a window of its own and put it into the tab (Windows). = Підключення HTTP/HTTPS з «Відкривати у вкладці» запускають цей браузер в окремому вікні й вставляють його у вкладку (Windows).
+Browser = Браузер
+empty = Edge or Chrome => порожньо = Edge або Chrome
+The browser's program, e.g. brave.exe, vivaldi.exe or firefox.exe. Take the program itself, not a portable launcher. = Програма браузера, напр. brave.exe, vivaldi.exe або firefox.exe. Вкажіть саму програму, а не портативний запускач.
+Kind = Тип
+Recognise = Розпізнати
+Chromium-based = На основі Chromium
+Firefox-based = На основі Firefox
+Profile = Профіль
+Own profile per connection, kept in the data folder = Окремий профіль для кожного підключення, у папці даних
+Logins and certificate exceptions stay and travel with AdminCraft. = Входи та винятки сертифікатів зберігаються й переносяться разом з AdminCraft.
+Own profile per connection, temporary = Окремий профіль для кожного підключення, тимчасовий
+The browser's normal profile (not in the tab) = Звичайний профіль браузера (не у вкладці)
+Your saved passwords and extensions, but the page opens in the browser already running, so it can't be put into a tab. = Ваші збережені паролі та розширення, але сторінка відкривається у вже запущеному браузері, тож її не можна вставити у вкладку.
+Own arguments = Власні параметри
+optional, separated by spaces = необов'язково, через пробіл
+Uses: {0} ({1}) = Використовується: {0} ({1})
+Firefox browsers show their tab and address bar in the tab; Chromium browsers open a plain window. = Браузери Firefox показують у вкладці свою панель вкладок і адресний рядок; браузери Chromium відкривають просте вікно.
+No browser found – web interfaces open in the system's browser. = Браузер не знайдено – вебінтерфейси відкриваються в системному браузері.
+Open in a tab (browser window, see Settings » Web interfaces) = Відкривати у вкладці (вікно браузера, див. Налаштування » Вебінтерфейси)
+Open every web interface in a tab = Відкривати кожен вебінтерфейс у вкладці
+Off: only connections with "Open in a tab" ticked; the others open in the system's browser. = Вимкнено: лише підключення з позначкою «Відкривати у вкладці»; інші відкриваються в системному браузері.
+Web interface (test) = Вебінтерфейс (тест)
diff --git a/src/app.rs b/src/app.rs
index 4b99000..36210ce 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -19,6 +19,8 @@ use std::sync::{Arc, Mutex};
#[path = "app_control.rs"]
mod app_control;
+#[path = "app_web.rs"]
+mod app_web;
const ACCENT: Color32 = Color32::from_rgb(33, 132, 230);
const OK_GREEN: Color32 = Color32::from_rgb(76, 175, 80);
@@ -475,6 +477,19 @@ impl AdminApp {
}
"tunnels" => app.open_tunnels(),
"recordings" => app.open_recordings((!host.is_empty()).then(|| PathBuf::from(&host))),
+ "web" => {
+ // check of a web interface in a tab with the browser from the settings
+ let e = Entry {
+ id: 9_000_001,
+ name: tr("Web interface (test)").into(),
+ protocol: Protocol::Https,
+ host: if host.is_empty() { "https://example.com".into() } else { host.clone() },
+ port: 443,
+ web_in_tab: true,
+ ..Default::default()
+ };
+ app.open_session(e, Creds::default(), Vec::new(), &ctx, 0.0);
+ }
"whois" => app.open_net_tool(crate::tooltabs::ToolKind::Whois, host.clone(), &ctx),
"http" => app.open_net_tool(crate::tooltabs::ToolKind::Http, host.clone(), &ctx),
"snmp" => app.open_net_tool(crate::tooltabs::ToolKind::Snmp, host.clone(), &ctx),
@@ -2534,7 +2549,7 @@ impl AdminApp {
}
Protocol::Http | Protocol::Https => {
section(ui, tr("Web"));
- ui.add_enabled(cfg!(windows), egui::Checkbox::new(&mut e.web_in_tab, tr("Open in a tab (Edge/Chrome window)")))
+ ui.add_enabled(cfg!(windows), egui::Checkbox::new(&mut e.web_in_tab, tr("Open in a tab (browser window, see Settings » Web interfaces)")))
.on_disabled_hover_text(tr("Only possible on Windows."));
if e.protocol == Protocol::Https && ui.button(tr("Check certificate")).clicked() {
act = Some(Act::CheckCert(id));
@@ -3734,6 +3749,8 @@ impl AdminApp {
.changed();
changed |= ui.checkbox(&mut self.store.data.settings.show_hidden, tr("Show hidden files (.name) in the file transfer")).changed();
+ changed |= self.web_settings_ui(ui);
+
section_help(ui, tr("Programs"), crate::help::Topic::Settings, &mut self.help_request);
ui.label(tr("AdminCraft looks for each program here: 1. own path below, 2. programs folder next to AdminCraft, 3. system."));
ui.horizontal(|ui| {
@@ -4253,8 +4270,12 @@ impl eframe::App for AdminApp {
&& let Ok(Some(status)) = child.try_wait()
{
crate::secretfile::process_ended(child.id());
- // mstsc hands over to an already running copy sometimes: keep the tab if its window is ours
- if !p.embed.as_ref().map(|e| e.attached()).unwrap_or(false) {
+ // mstsc hands over to an already running copy sometimes: keep the tab if its window is ours.
+ // Browsers and launchers end their first process and show the window from a child: keep
+ // looking for it a while before calling the session over.
+ let attached = p.embed.as_ref().map(|e| e.attached()).unwrap_or(false);
+ let still_looking = p.want_embed && !p.detached && now - p.started < 20.0;
+ if !attached && !still_looking {
p.exited = Some(if status.success() {
tr("Session ended.").into()
} else {
diff --git a/src/app_web.rs b/src/app_web.rs
new file mode 100644
index 0000000..d9b6738
--- /dev/null
+++ b/src/app_web.rs
@@ -0,0 +1,80 @@
+//! Settings for web interfaces: which browser opens them in a tab, its profile and arguments.
+//! A child module of `app`, so it can reach the window's state.
+
+use super::*;
+use crate::model::{BrowserFamily, WebProfile};
+
+impl AdminApp {
+ /// The "Web interfaces" section of the settings; true when something changed.
+ pub(super) fn web_settings_ui(&mut self, ui: &mut egui::Ui) -> bool {
+ let mut changed = false;
+ section_help(ui, tr("Web interfaces"), crate::help::Topic::Settings, &mut self.help_request);
+ ui.weak(tr("HTTP/HTTPS connections with \"Open in a tab\" start this browser in a window of its own and put it into the tab (Windows)."));
+ changed |= ui
+ .add_enabled(cfg!(windows), egui::Checkbox::new(&mut self.store.data.settings.web_all_in_tab, tr("Open every web interface in a tab")))
+ .on_hover_text(tr("Off: only connections with \"Open in a tab\" ticked; the others open in the system's browser."))
+ .changed();
+ let s = &mut self.store.data.settings;
+ egui::Grid::new("web_settings").num_columns(2).spacing([10.0, 6.0]).show(ui, |ui| {
+ ui.label(tr("Browser"));
+ ui.horizontal(|ui| {
+ let own = s.programs.entry("browser".to_string()).or_default();
+ changed |= ui
+ .add(egui::TextEdit::singleline(own).hint_text(tr("empty = Edge or Chrome")).desired_width(360.0))
+ .on_hover_text(tr(
+ "The browser's program, e.g. brave.exe, vivaldi.exe or firefox.exe. Take the program itself, not a portable launcher.",
+ ))
+ .changed();
+ if own.trim().is_empty() {
+ s.programs.remove("browser");
+ }
+ });
+ ui.end_row();
+ ui.label(tr("Kind"));
+ ui.horizontal(|ui| {
+ for (v, label) in [
+ (BrowserFamily::Auto, tr("Recognise")),
+ (BrowserFamily::Chromium, tr("Chromium-based")),
+ (BrowserFamily::Firefox, tr("Firefox-based")),
+ ] {
+ changed |= ui.radio_value(&mut s.web_family, v, label).changed();
+ }
+ });
+ ui.end_row();
+ ui.label(tr("Profile"));
+ ui.vertical(|ui| {
+ changed |= ui
+ .radio_value(&mut s.web_profile, WebProfile::Kept, tr("Own profile per connection, kept in the data folder"))
+ .on_hover_text(tr("Logins and certificate exceptions stay and travel with AdminCraft."))
+ .changed();
+ changed |= ui.radio_value(&mut s.web_profile, WebProfile::Temporary, tr("Own profile per connection, temporary")).changed();
+ changed |= ui
+ .radio_value(&mut s.web_profile, WebProfile::Normal, tr("The browser's normal profile (not in the tab)"))
+ .on_hover_text(tr(
+ "Your saved passwords and extensions, but the page opens in the browser already running, so it can't be put into a tab.",
+ ))
+ .changed();
+ });
+ ui.end_row();
+ ui.label(tr("Own arguments"));
+ changed |=
+ ui.add(egui::TextEdit::singleline(&mut s.web_args).hint_text(tr("optional, separated by spaces")).desired_width(360.0)).changed();
+ ui.end_row();
+ });
+ let found = programs::find("browser", &self.store.data.settings);
+ match &found {
+ Some(p) => {
+ let family = launch::browser_family(p, self.store.data.settings.web_family);
+ let kind = if family == BrowserFamily::Firefox { tr("Firefox-based") } else { tr("Chromium-based") };
+ ui.weak(tf("Uses: {0} ({1})", &[&p.display(), &kind]));
+ if family == BrowserFamily::Firefox {
+ ui.weak(tr("Firefox browsers show their tab and address bar in the tab; Chromium browsers open a plain window."));
+ }
+ }
+ None => {
+ ui.colored_label(WARN, tr("No browser found – web interfaces open in the system's browser."));
+ }
+ }
+ changed
+ }
+}
diff --git a/src/embed.rs b/src/embed.rs
index f28240c..d1aa52a 100644
--- a/src/embed.rs
+++ b/src/embed.rs
@@ -186,7 +186,9 @@ mod imp {
unsafe impl Send for Embedded {}
struct Search {
- pid: u32,
+ /// The program started and every process it started in turn (browsers and launchers
+ /// often open their window from a child process and end the first one).
+ pids: Vec,
hints: &'static [&'static str],
best: HWND,
best_score: i64,
@@ -203,7 +205,7 @@ mod imp {
let s = &mut *(lp as *mut Search);
let mut pid = 0u32;
GetWindowThreadProcessId(h, &mut pid);
- if pid != s.pid || IsWindowVisible(h) == 0 {
+ if !s.pids.contains(&pid) || IsWindowVisible(h) == 0 {
return 1;
}
let class = class_name(h);
@@ -232,6 +234,35 @@ mod imp {
}
}
+ /// `root` and its descendants, from a snapshot of all processes (at most 256).
+ fn process_tree(root: u32) -> Vec {
+ use windows_sys::Win32::Foundation::{CloseHandle, INVALID_HANDLE_VALUE};
+ use windows_sys::Win32::System::Diagnostics::ToolHelp::{
+ CreateToolhelp32Snapshot, PROCESSENTRY32W, Process32FirstW, Process32NextW, TH32CS_SNAPPROCESS,
+ };
+ let mut pairs: Vec<(u32, u32)> = Vec::new();
+ // SAFETY: the snapshot handle is checked before use and closed once; the entry is a
+ // plain struct with its size set as the API requires.
+ unsafe {
+ let snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ if snap == INVALID_HANDLE_VALUE || snap.is_null() {
+ return vec![root];
+ }
+ let mut e: PROCESSENTRY32W = std::mem::zeroed();
+ e.dwSize = std::mem::size_of::() as u32;
+ if Process32FirstW(snap, &mut e) != 0 {
+ loop {
+ pairs.push((e.th32ProcessID, e.th32ParentProcessID));
+ if Process32NextW(snap, &mut e) == 0 || pairs.len() > 100_000 {
+ break;
+ }
+ }
+ }
+ CloseHandle(snap);
+ }
+ super::descendants(root, &pairs)
+ }
+
impl Embedded {
pub fn new(pid: u32, class_hint: &'static [&'static str]) -> Self {
Embedded {
@@ -263,7 +294,7 @@ mod imp {
if self.attached {
return true;
}
- let mut s = Search { pid: self.pid, hints: self.class_hint, best: std::ptr::null_mut(), best_score: 0 };
+ let mut s = Search { pids: process_tree(self.pid), hints: self.class_hint, best: std::ptr::null_mut(), best_score: 0 };
unsafe {
EnumWindows(Some(enum_cb), &mut s as *mut Search as LPARAM);
}
@@ -455,6 +486,28 @@ pub use imp::{Embedded, capture, capture_window, install_focus_hook, set_active}
/// Can this system put other programs' windows into tabs?
pub const SUPPORTED: bool = cfg!(windows);
+/// `root` and every process below it, from (process, parent) pairs; at most 256, so a broken
+/// snapshot can't grow it without end.
+// only the Windows embedding uses it; elsewhere the tests keep it honest
+#[cfg_attr(not(windows), allow(dead_code))]
+pub fn descendants(root: u32, pairs: &[(u32, u32)]) -> Vec {
+ let mut tree = vec![root];
+ let mut i = 0;
+ while i < tree.len() && tree.len() < 256 {
+ let parent = tree[i];
+ for &(child, pp) in pairs {
+ if tree.len() >= 256 {
+ break;
+ }
+ if pp == parent && child != 0 && child != parent && !tree.contains(&child) {
+ tree.push(child);
+ }
+ }
+ i += 1;
+ }
+ tree
+}
+
/// Our window handle as a number (Windows HWND), when there is one.
pub fn parent_handle(frame: &eframe::Frame) -> Option {
use raw_window_handle::{HasWindowHandle, RawWindowHandle};
diff --git a/src/launch.rs b/src/launch.rs
index abebaff..8a98bcb 100644
--- a/src/launch.rs
+++ b/src/launch.rs
@@ -3,10 +3,10 @@
#[allow(unused_imports)]
use crate::i18n::{t as tr, tf};
-use crate::model::{Entry, JumpMode, Protocol, Settings, SshClient};
+use crate::model::{BrowserFamily, Entry, JumpMode, Protocol, Settings, SshClient, WebProfile};
use crate::programs;
use portable_pty::CommandBuilder;
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
use std::process::{Child, Command};
#[derive(Clone, Debug, Default)]
@@ -130,6 +130,57 @@ fn hidden(cmd: &mut Command) -> &mut Command {
cmd
}
+/// Main window classes of the two browser families (to find the window to put into the tab).
+const CHROMIUM_WINDOW: &[&str] = &["Chrome_WidgetWin_1"];
+const FIREFOX_WINDOW: &[&str] = &["MozillaWindowClass"];
+
+/// Firefox and its relatives are told by the program's file name; everything else is taken for
+/// a Chromium browser (Edge, Chrome, Brave, Vivaldi, Chromium, Opera).
+pub fn browser_family(program: &Path, chosen: BrowserFamily) -> BrowserFamily {
+ if chosen != BrowserFamily::Auto {
+ return chosen;
+ }
+ let name = program.file_stem().map(|s| s.to_string_lossy().to_lowercase()).unwrap_or_default();
+ const FIREFOX: &[&str] = &["firefox", "librewolf", "waterfox", "floorp", "zen", "palemoon", "basilisk", "mullvadbrowser", "tor"];
+ if FIREFOX.iter().any(|f| name.contains(f)) { BrowserFamily::Firefox } else { BrowserFamily::Chromium }
+}
+
+/// Where the profile of a web interface lives: None = the browser's normal profile.
+pub fn web_profile_dir(family: BrowserFamily, choice: WebProfile, id: u64) -> Option {
+ let kind = if family == BrowserFamily::Firefox { "firefox" } else { "chromium" };
+ match choice {
+ WebProfile::Kept => Some(crate::model::data_dir(false).join("browser").join(format!("{kind}-{id}"))),
+ WebProfile::Temporary => Some(std::env::temp_dir().join("admincraft").join(format!("web-{kind}-{id}"))),
+ WebProfile::Normal => None,
+ }
+}
+
+/// The arguments that open `url` in a browser window of its own. Chromium browsers get a window
+/// without tabs and address bar (`--app`); Firefox browsers a normal window. `extra` are the
+/// person's own arguments, separated by spaces.
+pub fn web_args(family: BrowserFamily, url: &str, profile: Option<&Path>, extra: &str) -> Vec {
+ let mut a: Vec = Vec::new();
+ match family {
+ BrowserFamily::Firefox => {
+ if let Some(p) = profile {
+ // its own process, so the window belongs to the program AdminCraft started
+ a.extend(["-no-remote".to_string(), "-profile".to_string(), p.display().to_string()]);
+ }
+ a.extend(extra.split_whitespace().map(str::to_string));
+ a.extend(["-new-window".to_string(), url.to_string()]);
+ }
+ _ => {
+ a.push(format!("--app={url}"));
+ if let Some(p) = profile {
+ a.push(format!("--user-data-dir={}", p.display()));
+ }
+ a.extend(["--no-first-run", "--no-default-browser-check", "--disable-features=Translate"].map(str::to_string));
+ a.extend(extra.split_whitespace().map(str::to_string));
+ }
+ }
+ a
+}
+
fn spawn(program: &PathBuf, args: &[String]) -> Result {
Command::new(program).args(args).spawn().map_err(|e| tf("{0} could not be started: {1}", &[&(program.display()), &e]))
}
@@ -301,22 +352,23 @@ pub fn launch(e: &Entry, c: &Creds, settings: &Settings, jumps: &[JumpHop], tab_
} else {
format!("{scheme}://{host}:{}", e.port)
};
- if e.web_in_tab
- && settings.embed_windows
+ if (e.web_in_tab || settings.web_all_in_tab)
&& cfg!(windows)
&& let Some(browser) = programs::find("browser", settings)
{
- // own profile per connection: a new browser process whose window we can take in
- let profile = std::env::temp_dir().join("admincraft").join(format!("web-{}", e.id));
- let args = vec![
- format!("--app={url}"),
- format!("--user-data-dir={}", profile.display()),
- "--no-first-run".to_string(),
- "--no-default-browser-check".to_string(),
- "--disable-features=Translate".to_string(),
- ];
+ let family = browser_family(&browser, settings.web_family);
+ // an own profile per connection makes a new browser process whose window can be
+ // taken into the tab; the normal profile opens in the browser already running
+ let profile = web_profile_dir(family, settings.web_profile, e.id);
+ if let Some(dir) = &profile {
+ std::fs::create_dir_all(dir).map_err(|err| tf("Browser profile folder could not be made: {0}", &[&err]))?;
+ }
+ let args = web_args(family, &url, profile.as_deref(), &settings.web_args);
let child = spawn(&browser, &args)?;
- return Ok(Launch::Process { child, label: tf("Web in tab: {0}", &[&url]), embed: Some(&["Chrome_WidgetWin_1"]) });
+ let classes: &'static [&'static str] = if family == BrowserFamily::Firefox { FIREFOX_WINDOW } else { CHROMIUM_WINDOW };
+ let embed = (settings.embed_windows && profile.is_some()).then_some(classes);
+ let label = if embed.is_some() { tf("Web in tab: {0}", &[&url]) } else { tf("Browser opened: {0}", &[&url]) };
+ return Ok(Launch::Process { child, label, embed });
}
open_url(&url)?;
Ok(Launch::Done(tf("Browser opened: {0}", &[&url])))
diff --git a/src/model.rs b/src/model.rs
index 3ed5842..f7e79ec 100644
--- a/src/model.rs
+++ b/src/model.rs
@@ -435,6 +435,38 @@ pub struct Settings {
pub record_sessions: bool,
/// The connections live in the KeePass database `keepass_path` (group "AdminCraft").
pub keepass_db: bool,
+ /// Which kind of browser opens web interfaces in a tab (its program: `programs["browser"]`).
+ pub web_family: BrowserFamily,
+ /// Which browser profile web interfaces use.
+ pub web_profile: WebProfile,
+ /// Extra arguments for the browser, separated by spaces.
+ pub web_args: String,
+ /// Every HTTP/HTTPS connection opens in a tab (Windows), not only those with "Open in a tab".
+ pub web_all_in_tab: bool,
+}
+
+/// The browser a web interface opens in decides the arguments AdminCraft gives it.
+#[derive(Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Debug, Default)]
+pub enum BrowserFamily {
+ /// Told by the program's file name (firefox, librewolf, waterfox … = Firefox, else Chromium).
+ #[default]
+ Auto,
+ /// Edge, Chrome, Brave, Vivaldi, Chromium, Opera: a window without tabs (`--app`).
+ Chromium,
+ /// Firefox and its relatives: a normal window with tabs.
+ Firefox,
+}
+
+/// Where the browser keeps logins and cookies for web interfaces.
+#[derive(Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Debug, Default)]
+pub enum WebProfile {
+ /// One profile per connection in the data folder: logins stay, and goes along on the USB stick.
+ #[default]
+ Kept,
+ /// A fresh profile per connection in the temp folder, gone after a restart of the computer.
+ Temporary,
+ /// The browser's normal profile (its passwords and extensions); its window can't be put into a tab.
+ Normal,
}
impl Default for Settings {
@@ -458,6 +490,10 @@ impl Default for Settings {
agent_typing: false,
record_sessions: false,
keepass_db: false,
+ web_family: BrowserFamily::Auto,
+ web_profile: WebProfile::Kept,
+ web_args: String::new(),
+ web_all_in_tab: true,
snippets: default_snippets(),
restore_session: false,
session_log: false,
diff --git a/src/tests.rs b/src/tests.rs
index 97b1230..df00ee7 100644
--- a/src/tests.rs
+++ b/src/tests.rs
@@ -800,3 +800,44 @@ fn agents_can_look_at_and_type_into_embedded_windows() {
// outside our own window there is nothing to take a picture of
assert!(crate::embed::capture_window(0, crate::embed::PxRect { x: 0, y: 0, w: 10, h: 10 }).is_none());
}
+
+#[test]
+fn own_browser_for_web_interfaces() {
+ use crate::launch::{browser_family, web_args, web_profile_dir};
+ use crate::model::{BrowserFamily, WebProfile};
+ use std::path::Path;
+ let fam = |p: &str| browser_family(Path::new(p), BrowserFamily::Auto);
+ assert_eq!(fam(r"C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe"), BrowserFamily::Chromium);
+ assert_eq!(fam(r"D:\Portable\LibreWolf\librewolf.exe"), BrowserFamily::Firefox);
+ assert_eq!(fam("/usr/bin/firefox"), BrowserFamily::Firefox);
+ assert_eq!(fam("vivaldi.exe"), BrowserFamily::Chromium);
+ assert_eq!(browser_family(Path::new("mybrowser.exe"), BrowserFamily::Firefox), BrowserFamily::Firefox, "a chosen kind wins");
+ let dir = Path::new("profiles").join("chromium-7");
+ let c = web_args(BrowserFamily::Chromium, "https://10.0.0.1/", Some(&dir), "--incognito --lang=de");
+ assert_eq!(c[0], "--app=https://10.0.0.1/");
+ assert!(c.contains(&format!("--user-data-dir={}", dir.display())));
+ assert_eq!(&c[c.len() - 2..], ["--incognito", "--lang=de"]);
+ let f = web_args(BrowserFamily::Firefox, "https://10.0.0.1/", Some(&dir), "");
+ assert_eq!(f, vec!["-no-remote", "-profile", &dir.display().to_string(), "-new-window", "https://10.0.0.1/"]);
+ let normal = web_args(BrowserFamily::Firefox, "http://x/", None, "");
+ assert_eq!(normal, vec!["-new-window", "http://x/"], "the normal profile: no own process");
+ assert!(web_profile_dir(BrowserFamily::Chromium, WebProfile::Normal, 3).is_none());
+ let kept = web_profile_dir(BrowserFamily::Firefox, WebProfile::Kept, 3).unwrap();
+ assert!(kept.ends_with(Path::new("browser").join("firefox-3")));
+ assert_ne!(kept, web_profile_dir(BrowserFamily::Chromium, WebProfile::Kept, 3).unwrap(), "the two kinds never share a profile");
+}
+
+#[test]
+fn embedding_finds_windows_of_child_processes() {
+ use crate::embed::descendants;
+ // launcher 10 starts the browser 11, which starts helpers 12 and 13; 20 is someone else's
+ let pairs = [(11, 10), (12, 11), (13, 11), (20, 4), (10, 4)];
+ let mut t = descendants(10, &pairs);
+ t.sort_unstable();
+ assert_eq!(t, vec![10, 11, 12, 13]);
+ // a loop in a broken snapshot doesn't hang
+ assert_eq!(descendants(1, &[(2, 1), (1, 2)]).len(), 2);
+ // never more than 256
+ let many: Vec<(u32, u32)> = (2..2000).map(|i| (i, 1)).collect();
+ assert_eq!(descendants(1, &many).len(), 256);
+}