tabby-rdp 0.5.5 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/README.md +15 -5
- package/dist/desktop.service.js +201 -26
- package/dist/desktops.js +46 -11
- package/dist/diagnosticLog.js +106 -0
- package/dist/ironrdp.js +3 -2
- package/dist/rdpProfile.js +14 -6
- package/dist/sessionLog.js +5 -0
- package/dist/settingsPage.js +17 -0
- package/dist/signin.js +56 -31
- package/dist/ui.js +3 -0
- package/package.json +5 -3
- package/vendor/SHA256SUMS +6 -3
- package/vendor/iron-remote-desktop-rdp.js +297 -297
- package/vendor/ironrdp-factory.js +299 -299
- package/vendor/ironrdp_web_bg.wasm +0 -0
- package/npm-shrinkwrap.json +0 -53
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.7
|
|
4
|
+
|
|
5
|
+
**Added**
|
|
6
|
+
- **A log file for bug reports** (Settings › Remote Desktop › Settings › Diagnostics). With **Write a log file** on, each
|
|
7
|
+
desktop opened from then on writes its connection log, with IronRDP's own log at the chosen level (Debug, or Trace),
|
|
8
|
+
to a file of its own, readable by you alone, in a `tabby-rdp-logs` folder next to Tabby's config; the setting links
|
|
9
|
+
to the folder. What goes in is washed first: IronRDP's licensing exchange no longer prints its keys, randoms,
|
|
10
|
+
encrypted hardware id, platform challenge or the license itself at any level, only their lengths (IronRDP patch 56),
|
|
11
|
+
and the plugin leaves out anything else shaped like a key, a token or a string of bytes. Names and addresses stay.
|
|
12
|
+
|
|
13
|
+
**Fixed**
|
|
14
|
+
- **Windows Server hosts with Remote Desktop Services licensing connect again**
|
|
15
|
+
([#106](https://github.com/meanaverage/tabby-rdp/issues/106)). Such a host runs the whole licensing exchange, and
|
|
16
|
+
sends network auto-detection requests in the middle of it, and again before it sends its capabilities. The remote
|
|
17
|
+
desktop answered them only in the connection phase meant for them, and took the ones that came later for the
|
|
18
|
+
message it was waiting for, so the connection failed with "invalid security header flags" during
|
|
19
|
+
`SERVER_NEW_LICENSE`. They are answered whenever they come now, as mstsc does. Hosts without licensing, which end
|
|
20
|
+
the exchange with one message, were not affected.
|
|
21
|
+
|
|
22
|
+
**Changed**
|
|
23
|
+
- **The published package says how its tests run again.** Its `package.json` keeps its `test` script, the one script it
|
|
24
|
+
publishes, as 0.5.3 and earlier did with all of them; 0.5.5 and 0.5.6 published none, and Socket took the package for
|
|
25
|
+
having no tests ([#101](https://github.com/meanaverage/tabby-rdp/issues/101)). The tests are in the source repository,
|
|
26
|
+
not the package, and CI runs them for every change and release; npm never runs the script when the plugin is
|
|
27
|
+
installed. Development dependencies, and build and lifecycle scripts, stay out of the package.
|
|
28
|
+
|
|
29
|
+
## 0.5.6
|
|
30
|
+
|
|
31
|
+
**Fixed**
|
|
32
|
+
- **Profiles for one address sign in as their own users** ([#104](https://github.com/meanaverage/tabby-rdp/issues/104)).
|
|
33
|
+
A saved password was kept for the address, so every remote desktop profile for it signed in with the first one
|
|
34
|
+
saved, whatever user name the profile gave. Each user's password is now saved on its own, profiles for different
|
|
35
|
+
users open side by side rather than bringing the first one's tab forward (for Windows, `Alice` and `alice` are one
|
|
36
|
+
user), and editing or removing one profile leaves the others' passwords and the address's certificate. A password
|
|
37
|
+
saved before goes to the profile of the user it is for the first time that profile connects; the others ask once,
|
|
38
|
+
and so do profiles for the same user name in different domains when it was saved without one. Signing in from a
|
|
39
|
+
profile's form as someone else keeps that login for that user, not as the profile's. A profile that names no user
|
|
40
|
+
signs in with the address's password, as before.
|
|
41
|
+
|
|
42
|
+
**Changed**
|
|
43
|
+
- **No shrinkwrap is published.** The plugin's runtime dependencies, `semver` and `ws`, are pinned to exact versions
|
|
44
|
+
in `package.json`, and packing refuses a runtime dependency that isn't exact or that brings dependencies of its own,
|
|
45
|
+
so `package.json` alone decides what npm installs. The development lock is `package-lock.json`, which npm never
|
|
46
|
+
publishes. Release checks still compare the packed package with the tagged commit.
|
|
47
|
+
|
|
48
|
+
**Documentation**
|
|
49
|
+
- Saved accounts are described as what they are, a login defined once to pick in any desktop, rather than mainly a
|
|
50
|
+
way to share one, and the README says that several profiles for one address each keep their own user's password.
|
|
51
|
+
|
|
52
|
+
**Compatibility notes**
|
|
53
|
+
- **Going back to 0.5.5 or earlier** after 0.5.6 has saved passwords for profiles that name a user: those versions
|
|
54
|
+
look for a profile's password under its address alone, so such profiles ask for it again there, and removing one of
|
|
55
|
+
them there leaves the password 0.5.6 saved for its user behind. It is listed in Tabby's Vault (as the address and
|
|
56
|
+
user), or under `tabby-rdp` in the system keychain, where it can be deleted.
|
|
57
|
+
|
|
3
58
|
## 0.5.5
|
|
4
59
|
|
|
5
60
|
**Fixed**
|
package/README.md
CHANGED
|
@@ -167,7 +167,7 @@ connecting again.
|
|
|
167
167
|
| **Screenshots** | **Save a screenshot** in the desktop's menus saves the remote screen at its full resolution as a PNG in Downloads, and copies it to the clipboard. |
|
|
168
168
|
| **Connection status** | Optionally, a small line in the corner of the desktop with the throughput each way, frames per second, the SSH round trip, and how it is connected (desktop, host, resolution, graphics mode, sharpness). |
|
|
169
169
|
| **Reconnecting** | After sleep or a network change, the desktop reconnects by itself once the connection is back. |
|
|
170
|
-
| **Sign-in** | GNOME desktops need none: the plugin manages their credentials. Windows and xrdp desktops ask for the account once and can remember it, in Tabby's Vault when that is on and in the system keychain otherwise; **Sign in again…** in the menu replaces it.
|
|
170
|
+
| **Sign-in** | GNOME desktops need none: the plugin manages their credentials. Windows and xrdp desktops ask for the account once and can remember it, in Tabby's Vault when that is on and in the system keychain otherwise; **Sign in again…** in the menu replaces it. A [saved account](#saved-accounts) defines a login once, to pick in any desktop. |
|
|
171
171
|
| **Shortcuts** | Switching between the desktop and the console, view only, a screenshot, Ctrl+Alt+Del, typing into or pasting to all desktops of a tab, the connection status and Disconnect each have a hotkey, set on the settings page or in Tabby's Hotkeys. They work while the desktop has the keyboard; a key another hotkey has is refused. |
|
|
172
172
|
| **Certificates** | GNOME desktops accept only the certificate the plugin made for them. A desktop you connect to directly, and an RD Gateway, connect without a question when their certificate is valid for their name by the certificate authorities this computer trusts; any other is shown, with why it can't be verified, its fingerprint and what it says of itself (whom it was issued to and by, and its dates), and connected only once you trust it. What it says of itself is its own word, unless its chain leads to an authority this computer trusts (another machine's certificate then shows that machine's name) and the TLS library didn't refuse it for a reason of its own (a limit set on the authority, say): an issuer you would expect there proves nothing, since anyone can make a certificate that names it; only the fingerprint, checked with whoever runs the server some other way, does. Desktops behind an SSH host remember theirs on first use. A different certificate later stops the connection and asks, but for one an authority vouches for in place of one it vouched for (a renewal); and one remembered on an authority's word is asked about again once it no longer validates. |
|
|
173
173
|
| **Passwords stay with servers that know them** | Windows signs in with Network Level Authentication: a proof both ways, where the password only reaches a server that knows it already. A Windows desktop whose server doesn't use it would get the password as it is, so the connection stops and asks first, before your password or user name is sent. xrdp signs in that way by design, so desktops you made xrdp ones aren't asked about; one that is xrdp only by a host's word (a VM it lists, a machine reached through it, the host's own desktop) is asked about once. The answer is kept with the certificate of the server you gave it for: another certificate, a new address or a forgotten certificate asks again. |
|
|
@@ -246,7 +246,10 @@ xrdp or GNOME Remote Desktop), and optionally the user name and domain. It then
|
|
|
246
246
|
SSH profiles do, and opens in a tab of its own that the desktop fills; there is no console under it. Sign-in, the
|
|
247
247
|
keychain, certificates, resize, sharpness, clipboard, files, sound, microphone, **Send keys**, view only, screenshots
|
|
248
248
|
and reconnecting work as in SSH tabs. After **Disconnect**, the tab offers **Connect**. In the profile selector you can
|
|
249
|
-
also type `user@host:port` and pick **Quick connect (REMOTE DESKTOP (RDP))**.
|
|
249
|
+
also type `user@host:port` and pick **Quick connect (REMOTE DESKTOP (RDP))**. Several profiles can lead to one address,
|
|
250
|
+
each signing in as another user: each user's password is saved on its own, their desktops open side by side, and
|
|
251
|
+
editing or removing one profile leaves the others' passwords and the address's certificate alone. A profile that names
|
|
252
|
+
no user asks who, and signs in with the password saved for the address by another such profile.
|
|
250
253
|
|
|
251
254
|
**Import an .rdp file…** (in the menu's **Settings**, or **Remote desktop: import an .rdp file…** in Tabby's command
|
|
252
255
|
palette) makes such a profile from a file saved by Remote Desktop Connection or handed out by an admin: its address,
|
|
@@ -355,8 +358,10 @@ and one-time codes at the gateway are not supported.
|
|
|
355
358
|
|
|
356
359
|
## Saved accounts
|
|
357
360
|
|
|
358
|
-
|
|
359
|
-
|
|
361
|
+
A saved account is a login defined on its own: a name, a user name (and domain), and its password, stored once. Any
|
|
362
|
+
desktop can pick it instead of typing a user name into its profile, and both ways work: a profile's own user name keeps
|
|
363
|
+
its own saved password, per user, for that address. An account is handy for keeping logins in one place, and for one
|
|
364
|
+
used on several desktops (a domain admin, a lab user), whose password is then changed once for all of them.
|
|
360
365
|
|
|
361
366
|
**Settings › Remote Desktop › Accounts** lists them, with the desktops that use each one (click a name to open its
|
|
362
367
|
settings), and adds, edits and removes them. A desktop picks its account in its profile's **Account** field, or in the
|
|
@@ -551,6 +556,7 @@ are local to this computer:
|
|
|
551
556
|
| Session backend (`sessionBackend`) | `native` | For `desk`: `native` (trd-pty) or `tmux`. Config file only. |
|
|
552
557
|
| Find virtual machines on SSH hosts (`discoverVMs`) | On | Lists a host's libvirt VMs with a desktop in its menu ([VMs on a host](#vms-on-a-host)). |
|
|
553
558
|
| Shut down VMs it started (`shutDownIdle`) | Never | 5, 15 or 60: minutes without a desktop open after which a VM the plugin started is shut down again ([VMs on a host](#vms-on-a-host)). |
|
|
559
|
+
| Write a log file (`diagnosticLog`) | Off | `debug` or `trace`: each desktop opened from then on writes its connection log, with IronRDP's log at that level, to a file of its own in the log folder (`tabby-rdp-logs` next to Tabby's config), readable by you alone, for a bug report. Keys, passwords, licenses, tokens and other byte strings are left out of the file. [Questions and problems](#questions-and-problems) |
|
|
554
560
|
| Check for updates automatically (Updates tab) | On, Stable | Checks npm once a day; choose Stable or Preview, check manually, and install a compatible version explicitly. [Versions and recovery](#versions-and-recovery). |
|
|
555
561
|
| Desktop name overlay (`osd`) | When it helps | `show` (`auto`, `always`, `off`), `font`, `size`, `position`, `color` (empty: white; else a color name, `#hex`, or a color function of numbers such as `rgb()`) and `seconds`; the settings page previews it, at a resolution you pick. |
|
|
556
562
|
|
|
@@ -692,7 +698,11 @@ npm run build:ironrdp # rebuild vendor/ from IronRDP and ironrdp/patches:
|
|
|
692
698
|
|
|
693
699
|
Questions ("how do I…", "is this expected?") go to [Discussions › Q&A](https://github.com/meanaverage/tabby-rdp/discussions/categories/q-a);
|
|
694
700
|
bugs and feature requests to the [issues](https://github.com/meanaverage/tabby-rdp/issues). A bug report is most useful
|
|
695
|
-
with the connection log: **Settings › Remote Desktop › Desktops › Open desktops › Copy log**.
|
|
701
|
+
with the connection log: **Settings › Remote Desktop › Desktops › Open desktops › Copy log**. For a connection that fails
|
|
702
|
+
before the desktop opens, turn on **Settings › Diagnostics › Write a log file** (Debug) and open the desktop again: it
|
|
703
|
+
writes a file of its own, with IronRDP's log, in the log folder the setting links to (`tabby-rdp-logs` next to Tabby's
|
|
704
|
+
config). Keys, passwords, licenses, tokens and other byte strings are left out of the file; names and addresses stay, so
|
|
705
|
+
look through it before you attach it.
|
|
696
706
|
Start with the [troubleshooting guide](TROUBLESHOOTING.md) for common connection and installation problems.
|
|
697
707
|
|
|
698
708
|
## License
|
package/dist/desktop.service.js
CHANGED
|
@@ -48,6 +48,8 @@ const gateway_1 = require("./gateway");
|
|
|
48
48
|
const authorities_1 = require("./authorities");
|
|
49
49
|
const vms_1 = require("./vms");
|
|
50
50
|
const sessionLog_1 = require("./sessionLog");
|
|
51
|
+
const updates_1 = require("./updates");
|
|
52
|
+
const diagnosticLog_1 = require("./diagnosticLog");
|
|
51
53
|
const hostCompat_1 = require("./hostCompat");
|
|
52
54
|
const unshowable_1 = require("./unshowable");
|
|
53
55
|
/**
|
|
@@ -189,25 +191,46 @@ class DesktopSession {
|
|
|
189
191
|
return this.spec.hyperv ? this.key.replace(/#hyperv:[^#]*$/, '#hyperv') : this.key;
|
|
190
192
|
}
|
|
191
193
|
/**
|
|
192
|
-
* Where a saved password is kept: under authKey,
|
|
193
|
-
* gateway too (see gatewayScope), whether the gateway
|
|
194
|
-
* password saved for one gateway (or for a connection
|
|
195
|
-
*
|
|
196
|
-
*
|
|
194
|
+
* Where a saved password is kept: under authKey, for a direct desktop the user it signs in as (see userScope), and
|
|
195
|
+
* whenever the desktop is reached through an RD Gateway, that gateway too (see gatewayScope), whether the gateway
|
|
196
|
+
* takes the desktop's sign-in or an account of its own: a password saved for one gateway (or for a connection
|
|
197
|
+
* without one) is never sent through a different gateway named for the same address without asking, and one saved
|
|
198
|
+
* for one user is never another profile's for the same address. The certificate and the "without NLA" decision
|
|
199
|
+
* stay keyed by authKey: those are the server's, whoever signs in, not the gateway's.
|
|
197
200
|
*/
|
|
198
201
|
get credentialKey() {
|
|
199
|
-
return this.
|
|
202
|
+
return this.credentialKeyFor(this.user);
|
|
200
203
|
}
|
|
201
|
-
/** `
|
|
202
|
-
|
|
204
|
+
/** Where a password for `user` (see signsInAs) is kept for this desktop: its credentialKey, for that user. */
|
|
205
|
+
credentialKeyFor(user) {
|
|
206
|
+
return this.authKey + (0, desktops_1.userScope)(user) + (0, signin_1.gatewayScope)(this.spec.gateway);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Where a direct desktop that names its user kept its saved password before 0.5.6: under the address alone,
|
|
210
|
+
* whoever it was for (see adoptCredentials). Null for one that doesn't name a user: its key is still that one.
|
|
211
|
+
*/
|
|
212
|
+
get formerCredentialKey() {
|
|
213
|
+
return this.user ? this.authKey + (0, signin_1.gatewayScope)(this.spec.gateway) : null;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* `key`: see sessionKey(). `user`: who a direct desktop's saved password is for (see signsInAs), '' for any other.
|
|
217
|
+
* `who`: who it signs in as (its saved account's name, else `user`, or whoever its form signed in as instead): one
|
|
218
|
+
* desktop per key and user, since each user of a server (a Windows server's, xrdp's) has a session of their own
|
|
219
|
+
* there.
|
|
220
|
+
*/
|
|
221
|
+
constructor(container, key, spec, user = '', who = user) {
|
|
203
222
|
this.key = key;
|
|
204
223
|
this.spec = spec;
|
|
224
|
+
this.user = user;
|
|
225
|
+
this.who = who;
|
|
205
226
|
this.state = 'connecting';
|
|
206
227
|
this.visible = false;
|
|
207
228
|
this.proxy = null;
|
|
208
229
|
this.ui = null;
|
|
209
230
|
/** The connection's log (Copy log): its first lines and its latest, however many the remote brings about. */
|
|
210
231
|
this.log = new sessionLog_1.SessionLog();
|
|
232
|
+
/** The log file written for a bug report, while the diagnostic log setting is on (see diagnosticLog.ts). */
|
|
233
|
+
this.diagnostics = null;
|
|
211
234
|
/** What the remote display was last set to. */
|
|
212
235
|
this.remoteSize = null;
|
|
213
236
|
this.remote = null;
|
|
@@ -523,6 +546,7 @@ class DesktopSession {
|
|
|
523
546
|
this.endConnection(false);
|
|
524
547
|
this.proxy?.close();
|
|
525
548
|
this.overlay.remove();
|
|
549
|
+
void this.diagnostics?.close();
|
|
526
550
|
}
|
|
527
551
|
}
|
|
528
552
|
exports.DesktopSession = DesktopSession;
|
|
@@ -1220,11 +1244,29 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
1220
1244
|
* desktop as it was unused, until it can be read while this window is open (see forgetLater). That is said, of that
|
|
1221
1245
|
* store. After a new address the certificate stays at the old one as well as going along (below), whichever
|
|
1222
1246
|
* passwords stayed there.
|
|
1223
|
-
|
|
1224
|
-
|
|
1247
|
+
*
|
|
1248
|
+
* A direct desktop (an RDP profile, `users` given) keeps a password for each user at an address (see
|
|
1249
|
+
* credentialKey), and other profiles can lead to the same address: its password goes as above only where it was
|
|
1250
|
+
* for the user it signed in as before (`users.from`, see signsInAs), and only where no other profile (the edited
|
|
1251
|
+
* one, `users.except`, aside) signs in with it; another user's, a profile's whose user is now another, stays for
|
|
1252
|
+
* the profiles that still sign in as them. Its saved account, if it has one, is the account's, whatever the edit. Nor
|
|
1253
|
+
* do the certificate, sharpness and "without NLA" decision leave an address another profile still leads to.
|
|
1254
|
+
*/
|
|
1255
|
+
async desktopEdited(fromId, toId, accountChanged, direct, gateways, users) {
|
|
1225
1256
|
const scope = (0, signin_1.gatewayScope)(gateways.from);
|
|
1257
|
+
const inUse = users ? this.directInUse(users.except) : null;
|
|
1226
1258
|
let waiting = [];
|
|
1227
|
-
if (
|
|
1259
|
+
if (users && inUse) {
|
|
1260
|
+
const which = { direct: true, user: (0, desktops_1.userScope)(users.from), owns: (c) => (0, desktops_1.isLoginOf)(c.username, users.from), scope, keep: inUse.keys };
|
|
1261
|
+
// A profile that names no user keeps the address's password: a new domain or account drops it, as before.
|
|
1262
|
+
if (users.from !== users.to || scope !== (0, signin_1.gatewayScope)(gateways.to) || accountChanged && !users.from) {
|
|
1263
|
+
waiting = await (0, signin_1.forgetCredentialsFor)(fromId, which);
|
|
1264
|
+
}
|
|
1265
|
+
else if (fromId !== toId) {
|
|
1266
|
+
waiting = await (0, signin_1.moveCredentialsFor)(fromId, toId, which, key => this.trustedCertificates().some(e => e.desktop === key));
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
else if (accountChanged || scope !== (0, signin_1.gatewayScope)(gateways.to)) {
|
|
1228
1270
|
waiting = await (0, signin_1.forgetCredentialsFor)(fromId, { direct, scope });
|
|
1229
1271
|
}
|
|
1230
1272
|
else if (fromId !== toId) {
|
|
@@ -1247,6 +1289,8 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
1247
1289
|
return id === fromId && (direct ? target === desktops_1.DIRECT_KEY : target !== desktops_1.DIRECT_KEY && target !== 'gateway');
|
|
1248
1290
|
};
|
|
1249
1291
|
const store = this.config.store.remoteDesktop;
|
|
1292
|
+
// Another profile still leads to the old address: what is kept there stays for it, as well as going along.
|
|
1293
|
+
const stays = !!inUse?.ids.has(fromId);
|
|
1250
1294
|
// The certificates go along and stay at the old address too. What is kept there still goes only to the machine
|
|
1251
1295
|
// it was saved for, and another machine answering there meets the certificate question rather than being
|
|
1252
1296
|
// trusted as a first use: the password of another desktop at that address, reached another way (a certificate
|
|
@@ -1258,7 +1302,7 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
1258
1302
|
// entry is dropped rather than put next to it, where either could be the one found.
|
|
1259
1303
|
const isMoved = (e) => typeof e?.desktop === 'string' && moved(e.desktop);
|
|
1260
1304
|
const taken = new Set(store[list].filter((e) => !isMoved(e)).map((e) => e?.desktop));
|
|
1261
|
-
const kept = list === 'trustedCertificates';
|
|
1305
|
+
const kept = list === 'trustedCertificates' || stays;
|
|
1262
1306
|
store[list] = store[list].flatMap((e) => {
|
|
1263
1307
|
if (!isMoved(e)) {
|
|
1264
1308
|
return [e];
|
|
@@ -1268,7 +1312,7 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
1268
1312
|
});
|
|
1269
1313
|
}
|
|
1270
1314
|
}
|
|
1271
|
-
if (Array.isArray(store.withoutNla)) {
|
|
1315
|
+
if (Array.isArray(store.withoutNla) && !stays) {
|
|
1272
1316
|
store.withoutNla = store.withoutNla.filter((e) => !(typeof e?.desktop === 'string' && moved(e.desktop)));
|
|
1273
1317
|
}
|
|
1274
1318
|
this.config.save();
|
|
@@ -1555,18 +1599,62 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
1555
1599
|
* password from going to a machine that isn't the one it was saved for, where a desktop behind a host trusts the
|
|
1556
1600
|
* first certificate it meets unasked. The user is told, and can forget them in Settings › Remote Desktop ›
|
|
1557
1601
|
* Certificates. `what` names the desktop for that.
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1602
|
+
*
|
|
1603
|
+
* A direct desktop (an RDP profile, `users` given) whose address another profile (`users.except`, the one going,
|
|
1604
|
+
* aside) still leads to takes only the passwords of its own user (`users.user`, see signsInAs) that no such
|
|
1605
|
+
* profile signs in with, and leaves the certificate to them.
|
|
1606
|
+
*/
|
|
1607
|
+
async forgetDesktop(id, direct, what, users) {
|
|
1608
|
+
const inUse = direct && users ? this.directInUse(users.except) : null;
|
|
1609
|
+
const shared = !!inUse?.ids.has(id);
|
|
1610
|
+
const own = shared && users ? { user: (0, desktops_1.userScope)(users.user), owns: (c) => (0, desktops_1.isLoginOf)(c.username, users.user), keep: inUse.keys } : {};
|
|
1611
|
+
const waiting = await (0, signin_1.forgetCredentialsFor)(id, direct ? { direct: true, ...own } : {});
|
|
1561
1612
|
if (waiting.length) {
|
|
1562
1613
|
this.notifications.info(`If a password was saved for ${what}, ${this.passwordWaits(waiting)} Its remembered certificate stays, ` +
|
|
1563
1614
|
'so that the password can only go to that machine: Settings › Remote Desktop › Certificates can forget it.');
|
|
1564
1615
|
return;
|
|
1565
1616
|
}
|
|
1617
|
+
if (shared) {
|
|
1618
|
+
return;
|
|
1619
|
+
}
|
|
1566
1620
|
this.forgetCertificatesFor(id, direct);
|
|
1567
1621
|
this.config.save();
|
|
1568
1622
|
this.changed$.next();
|
|
1569
1623
|
}
|
|
1624
|
+
/**
|
|
1625
|
+
* What the direct desktops (RDP profiles of their own, not through an SSH host) other than the profile `except`
|
|
1626
|
+
* use, as Tabby opens them (their group's defaults included): the keys of their saved passwords (see
|
|
1627
|
+
* credentialKey: each user's, for each gateway), their addresses, and each one's address, user (see signsInAs) and
|
|
1628
|
+
* gateway (see gatewayScope). A profile in a shape nothing reads is left out.
|
|
1629
|
+
*/
|
|
1630
|
+
directInUse(except) {
|
|
1631
|
+
const keys = new Set();
|
|
1632
|
+
const ids = new Set();
|
|
1633
|
+
const found = [];
|
|
1634
|
+
const profiles = this.config.store.profiles;
|
|
1635
|
+
for (const p of Array.isArray(profiles) ? profiles : []) {
|
|
1636
|
+
if (p?.type !== targets_1.RDP_PROFILE_TYPE || except !== undefined && p.id === except) {
|
|
1637
|
+
continue;
|
|
1638
|
+
}
|
|
1639
|
+
let options = p.options;
|
|
1640
|
+
try {
|
|
1641
|
+
options = this.profiles.getConfigProxyForProfile(p).options;
|
|
1642
|
+
}
|
|
1643
|
+
catch { }
|
|
1644
|
+
try {
|
|
1645
|
+
const spec = options?.host && !(0, desktops_1.configText)(options.via) ? (0, desktops_1.specOf)({ ...options, wake: undefined }) : null;
|
|
1646
|
+
if (spec) {
|
|
1647
|
+
const who = (0, desktops_1.signsInAs)(spec);
|
|
1648
|
+
const scope = (0, signin_1.gatewayScope)(spec.gateway);
|
|
1649
|
+
ids.add(spec.id);
|
|
1650
|
+
keys.add(`${desktops_1.DIRECT_KEY}#${spec.id}${(0, desktops_1.userScope)(who)}${scope}`);
|
|
1651
|
+
found.push({ id: spec.id, who, scope });
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
catch { }
|
|
1655
|
+
}
|
|
1656
|
+
return { keys, ids, profiles: found };
|
|
1657
|
+
}
|
|
1570
1658
|
/**
|
|
1571
1659
|
* What becomes of a desktop's saved password that couldn't be removed from `waiting`, the stores that can't be read
|
|
1572
1660
|
* just now (see forgetCredentialsFor), as the end of a sentence.
|
|
@@ -1617,9 +1705,10 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
1617
1705
|
}
|
|
1618
1706
|
this.lastUsed.set(target.key, spec.id);
|
|
1619
1707
|
const key = (0, desktops_1.sessionKey)(target, spec);
|
|
1620
|
-
|
|
1708
|
+
const { user, who } = this.signsInAs(target, spec);
|
|
1709
|
+
// One desktop per key and user: another client would only get an extra, empty monitor (GNOME), or take
|
|
1621
1710
|
// over the session (Windows).
|
|
1622
|
-
const existing = this.paneWithDesktopFor(key);
|
|
1711
|
+
const existing = this.paneWithDesktopFor(key, who);
|
|
1623
1712
|
if (existing) {
|
|
1624
1713
|
if (existing.parent instanceof tabby_core_1.SplitTabComponent && existing.parent === pane.parent) {
|
|
1625
1714
|
// Next to it, moving the focus there would go unnoticed.
|
|
@@ -1635,8 +1724,9 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
1635
1724
|
this.selectPane(existing);
|
|
1636
1725
|
return this.showDesktop(existing);
|
|
1637
1726
|
}
|
|
1638
|
-
const created = new DesktopSession(pane.element.nativeElement, key, spec);
|
|
1727
|
+
const created = new DesktopSession(pane.element.nativeElement, key, spec, user, who);
|
|
1639
1728
|
created.onHelp = message => this.help.explain(message);
|
|
1729
|
+
this.startDiagnostics(created);
|
|
1640
1730
|
// The remote it is opened on, from the start: reopening one whose connection ended before it got as far as
|
|
1641
1731
|
// a sign-in (cancelled, or a setup that failed) goes there again, not to the tab's own host.
|
|
1642
1732
|
created.remote = target;
|
|
@@ -1972,11 +2062,27 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
1972
2062
|
if (!target || this.has(pane)) {
|
|
1973
2063
|
return false;
|
|
1974
2064
|
}
|
|
1975
|
-
|
|
2065
|
+
const desktop = spec ?? this.defaultDesktop(target);
|
|
2066
|
+
return !!this.paneWithDesktopFor((0, desktops_1.sessionKey)(target, desktop), this.signsInAs(target, desktop).who);
|
|
2067
|
+
}
|
|
2068
|
+
/**
|
|
2069
|
+
* Who a desktop opened from `target` signs in as, where that tells desktops at one address apart (see
|
|
2070
|
+
* DesktopSession's `user` and `who`): a direct one's own user (see signsInAs), and its saved account's sign-in name,
|
|
2071
|
+
* if it has one, in any case for Windows, whose user names and domains are (`Alice` is alice, and signing in as
|
|
2072
|
+
* her takes her session over). Nobody for one behind an SSH host, which is the only desktop at its address there
|
|
2073
|
+
* (its form refuses a second, see addressTaken).
|
|
2074
|
+
*/
|
|
2075
|
+
signsInAs(target, spec) {
|
|
2076
|
+
if (target.key !== desktops_1.DIRECT_KEY) {
|
|
2077
|
+
return { user: '', who: '' };
|
|
2078
|
+
}
|
|
2079
|
+
const user = (0, desktops_1.signsInAs)(spec);
|
|
2080
|
+
const account = spec.account ? this.accounts().find(a => a.id === spec.account) : undefined;
|
|
2081
|
+
return { user, who: whoOf(spec, account ? (0, accounts_1.signInName)(account) : user) };
|
|
1976
2082
|
}
|
|
1977
|
-
paneWithDesktopFor(key) {
|
|
2083
|
+
paneWithDesktopFor(key, who = '') {
|
|
1978
2084
|
for (const [pane, session] of this.sessions) {
|
|
1979
|
-
if (session.key === key && session.state !== 'ended') {
|
|
2085
|
+
if (session.key === key && session.who === who && session.state !== 'ended') {
|
|
1980
2086
|
return pane;
|
|
1981
2087
|
}
|
|
1982
2088
|
}
|
|
@@ -2154,6 +2260,7 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
2154
2260
|
discoverVMs: store.discoverVMs !== false,
|
|
2155
2261
|
checkUpdates: store.checkUpdates !== false,
|
|
2156
2262
|
shutDownIdle: [5, 15, 60].includes((0, osd_1.configNumber)(store.shutDownIdle)) ? (0, osd_1.configNumber)(store.shutDownIdle) : 0,
|
|
2263
|
+
diagnosticLog: (0, diagnosticLog_1.diagnosticLevel)(store.diagnosticLog),
|
|
2157
2264
|
};
|
|
2158
2265
|
}
|
|
2159
2266
|
/** The folders shared with remote desktops as drives (`remoteDesktop.sharedFolders`), tidied. */
|
|
@@ -2799,7 +2906,47 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
2799
2906
|
logOf(pane) {
|
|
2800
2907
|
return this.sessions.get(pane)?.log ?? [];
|
|
2801
2908
|
}
|
|
2802
|
-
|
|
2909
|
+
/**
|
|
2910
|
+
* The diagnostic log file of a desktop just opened, while the setting is on: the lines of its log (status, errors)
|
|
2911
|
+
* as they come, and IronRDP's log at the chosen level (see loadIronRDP), stamped and washed (see diagnosticLog.ts).
|
|
2912
|
+
*/
|
|
2913
|
+
startDiagnostics(session) {
|
|
2914
|
+
const level = this.settings().diagnosticLog;
|
|
2915
|
+
if (level === 'off') {
|
|
2916
|
+
return;
|
|
2917
|
+
}
|
|
2918
|
+
const versions = process.versions;
|
|
2919
|
+
const header = [
|
|
2920
|
+
`tabby-rdp ${(0, updates_1.installedVersion)()} on ${process.platform} ${os.release()} (${process.arch}); Electron ${versions.electron ?? 'unknown'}, Node ${versions.node ?? 'unknown'}`,
|
|
2921
|
+
];
|
|
2922
|
+
const diagnostics = new diagnosticLog_1.DiagnosticLog(this.logFolder(), session.spec.name, level, () => session.proxy?.token, header);
|
|
2923
|
+
session.diagnostics = diagnostics;
|
|
2924
|
+
// The status lines carry a stamp of their own already.
|
|
2925
|
+
session.log.tee = line => diagnostics.line('plugin', line.replace(/^\d{4}-\d\d-\d\dT[\d:.]+Z /, ''));
|
|
2926
|
+
session.log.push(`diagnostics: writing ${diagnostics.file}`);
|
|
2927
|
+
}
|
|
2928
|
+
/** Where the diagnostic log files go (see diagnosticLog.ts). */
|
|
2929
|
+
logFolder() {
|
|
2930
|
+
return (0, diagnosticLog_1.logDirectory)(this.platform.getConfigPath());
|
|
2931
|
+
}
|
|
2932
|
+
/** Opens the diagnostic log folder in the file manager, making it first. */
|
|
2933
|
+
showLogFolder() {
|
|
2934
|
+
const dir = this.logFolder();
|
|
2935
|
+
try {
|
|
2936
|
+
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
2937
|
+
}
|
|
2938
|
+
catch (error) {
|
|
2939
|
+
this.notifications.error(`The log folder could not be made: ${error?.message ?? error}`);
|
|
2940
|
+
return;
|
|
2941
|
+
}
|
|
2942
|
+
this.platform.openPath(dir);
|
|
2943
|
+
}
|
|
2944
|
+
/** IronRDP for a session: at the diagnostic log's level, into its file, while one is written; else the console. */
|
|
2945
|
+
loadIronRDP(session) {
|
|
2946
|
+
const diagnostics = session.diagnostics;
|
|
2947
|
+
if (diagnostics) {
|
|
2948
|
+
return this.ironrdp.create(diagnostics.level.toUpperCase(), line => diagnostics.line('ironrdp', line));
|
|
2949
|
+
}
|
|
2803
2950
|
let level = 'INFO';
|
|
2804
2951
|
try {
|
|
2805
2952
|
level = localStorage.getItem('trdLogLevel') || level;
|
|
@@ -2877,6 +3024,23 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
2877
3024
|
const again = this.askAgain.delete(pane);
|
|
2878
3025
|
// A desktop whose account is gone asks, rather than falling back to a login of its own saved earlier.
|
|
2879
3026
|
let saved = retryError || again || spec.account && !account ? null : await (0, signin_1.loadCredentials)(account ? (0, accounts_1.accountKey)(account.id) : session.credentialKey);
|
|
3027
|
+
// Saved before 0.5.6, under the address alone, by whichever profile for it signed in first: this desktop's
|
|
3028
|
+
// once it is for this desktop's user (another profile's is left for that one), and from now on kept as such.
|
|
3029
|
+
if (saved && !account && session.user && !(0, desktops_1.isLoginOf)(saved.username, session.user)) {
|
|
3030
|
+
// Kept for this desktop's user by a version that saved another login there: not this desktop's.
|
|
3031
|
+
session.log.push(`sign-in: the saved password is for ${saved.username}, not ${session.user}; asking`);
|
|
3032
|
+
saved = null;
|
|
3033
|
+
}
|
|
3034
|
+
// A password saved before 0.5.6 named its user without a domain where the profile gave the domain on its own: one
|
|
3035
|
+
// another profile at the address could be for too (alice, of another domain) stays where it is, and this asks.
|
|
3036
|
+
const former = session.formerCredentialKey;
|
|
3037
|
+
if (!saved && !retryError && !again && !spec.account && former) {
|
|
3038
|
+
const others = this.directInUse().profiles.filter(p => p.id === spec.id && p.scope === (0, signin_1.gatewayScope)(spec.gateway) && p.who !== session.user);
|
|
3039
|
+
saved = await (0, signin_1.adoptCredentials)(former, session.credentialKey, found => (0, desktops_1.isLoginOf)(found.username, session.user) && !others.some(p => (0, desktops_1.isLoginOf)(found.username, p.who)));
|
|
3040
|
+
if (saved) {
|
|
3041
|
+
session.log.push(`sign-in: the password saved for this address as ${saved.username}, now kept for that user`);
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
2880
3044
|
if (saved && account && saved.username !== (0, accounts_1.signInName)(account)) {
|
|
2881
3045
|
// Kept for an earlier user name of the account (its change didn't reach the store): not this one's.
|
|
2882
3046
|
session.log.push(`sign-in: the account's saved password is for ${saved.username}, not ${(0, accounts_1.signInName)(account)}; asking`);
|
|
@@ -2908,9 +3072,16 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
2908
3072
|
setTimeout(() => session.visible && this.showsInFront(session) && session.focusDesktop());
|
|
2909
3073
|
}
|
|
2910
3074
|
const entered = await asked;
|
|
3075
|
+
// Signed in as another user than the desktop names: kept for that user, not as this desktop's own, and that
|
|
3076
|
+
// user's desktop from now on (see paneWithDesktopFor).
|
|
3077
|
+
const as = entered && !account && session.user ? (0, desktops_1.signsInAs)({ username: entered.username, domain: spec.domain }) : '';
|
|
3078
|
+
if (as && as !== session.user) {
|
|
3079
|
+
session.who = whoOf(spec, as);
|
|
3080
|
+
}
|
|
2911
3081
|
return entered && {
|
|
2912
3082
|
host: spec.host, port: spec.port, credentials: entered, remember: entered.remember, domain: account ? account.domain ?? '' : undefined,
|
|
2913
3083
|
saveKey: account && (0, accounts_1.accountKey)(account.id), saveLabel: account && `saved account ${account.name}`, saveFor: account && (0, accounts_1.signInName)(account),
|
|
3084
|
+
...as && as !== session.user ? { saveUser: as } : {},
|
|
2914
3085
|
hyperv, mark, accountRevision,
|
|
2915
3086
|
};
|
|
2916
3087
|
}
|
|
@@ -2938,7 +3109,7 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
2938
3109
|
}
|
|
2939
3110
|
// Signing in to a Windows account can take a few tries; a GNOME desktop the plugin set up can't fail that way.
|
|
2940
3111
|
for (let attempt = 0;; attempt++) {
|
|
2941
|
-
const [asked, rdp] = await Promise.all([endpoint ?? this.endpointFor(pane, target, spec, session, automatic, retryError), this.loadIronRDP()]);
|
|
3112
|
+
const [asked, rdp] = await Promise.all([endpoint ?? this.endpointFor(pane, target, spec, session, automatic, retryError), this.loadIronRDP(session)]);
|
|
2942
3113
|
if (!alive()) {
|
|
2943
3114
|
return;
|
|
2944
3115
|
}
|
|
@@ -3777,13 +3948,13 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
3777
3948
|
const key = endpoint.saveKey;
|
|
3778
3949
|
(0, signin_1.saveCredentialsIf)(key, credentials, () => this.accountCurrent(key, endpoint.saveFor, endpoint.accountRevision), endpoint.saveLabel).then(saved => session.log.push(saved ? `sign-in: saved as the account's password in ${(0, signin_1.storeName)()}` : 'sign-in: not saved: the account changed meanwhile'), e => session.log.push(`sign-in: ${(0, signin_1.storeName)()}: ${e?.message ?? e}`));
|
|
3779
3950
|
}
|
|
3780
|
-
else if (endpoint.remember && endpoint.mark !== undefined && (0, signin_1.forgottenSince)(session.credentialKey, endpoint.mark)) {
|
|
3951
|
+
else if (endpoint.remember && endpoint.mark !== undefined && (0, signin_1.forgottenSince)(endpoint.saveUser !== undefined ? session.credentialKeyFor(endpoint.saveUser) : session.credentialKey, endpoint.mark)) {
|
|
3781
3952
|
// Edited (its user name, gateway or address) or removed while the server delayed the sign-in: what was
|
|
3782
3953
|
// forgotten then stays forgotten, and the desktop asks the next time.
|
|
3783
3954
|
session.log.push('sign-in: not saved: the desktop was changed or removed meanwhile');
|
|
3784
3955
|
}
|
|
3785
3956
|
else if (endpoint.remember) {
|
|
3786
|
-
const key = endpoint.saveKey ?? session.credentialKey;
|
|
3957
|
+
const key = endpoint.saveKey ?? (endpoint.saveUser !== undefined ? session.credentialKeyFor(endpoint.saveUser) : session.credentialKey);
|
|
3787
3958
|
const writing = (0, signin_1.forgetMark)();
|
|
3788
3959
|
(0, signin_1.saveCredentials)(key, credentials, endpoint.saveLabel).then(() => {
|
|
3789
3960
|
// A forget that came while it was being written (an edit, a removal) found nothing to forget
|
|
@@ -3849,6 +4020,10 @@ exports.RemoteDesktopService = RemoteDesktopService = RemoteDesktopService_1 = _
|
|
|
3849
4020
|
tabby_core_1.SelectorService,
|
|
3850
4021
|
tabby_core_1.PlatformService])
|
|
3851
4022
|
], RemoteDesktopService);
|
|
4023
|
+
/** A desktop's `who` (see DesktopSession) as compared: in any case for Windows, whose user names and domains are. */
|
|
4024
|
+
function whoOf(spec, who) {
|
|
4025
|
+
return spec.kind === 'windows' ? who.toLowerCase() : who;
|
|
4026
|
+
}
|
|
3852
4027
|
let styleInstalled = false;
|
|
3853
4028
|
function installStyle() {
|
|
3854
4029
|
if (styleInstalled) {
|
package/dist/desktops.js
CHANGED
|
@@ -19,8 +19,12 @@ exports.keyFields = keyFields;
|
|
|
19
19
|
exports.nestedKey = nestedKey;
|
|
20
20
|
exports.shownKey = shownKey;
|
|
21
21
|
exports.keyUser = keyUser;
|
|
22
|
+
exports.signsInAs = signsInAs;
|
|
23
|
+
exports.isLoginOf = isLoginOf;
|
|
24
|
+
exports.userScope = userScope;
|
|
22
25
|
exports.keyParts = keyParts;
|
|
23
26
|
exports.rekeyed = rekeyed;
|
|
27
|
+
const accounts_1 = require("./accounts");
|
|
24
28
|
const clipboard_1 = require("./clipboard");
|
|
25
29
|
const hyperv_1 = require("./hyperv");
|
|
26
30
|
const osd_1 = require("./osd");
|
|
@@ -274,36 +278,67 @@ function shownKey(key) {
|
|
|
274
278
|
function keyUser(key) {
|
|
275
279
|
return keyFields(key).user;
|
|
276
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* Who a direct desktop signs in as, as its saved password's key names it (see userScope): DOMAIN\user, or the user
|
|
283
|
+
* name as typed where it names its domain itself (as signInName has it); '' for one that names no user (its sign-in
|
|
284
|
+
* asks who, its domain or not), which keeps the address's password. From its own user name and domain: a saved
|
|
285
|
+
* account's password is the account's (see accountKey), not the desktop's.
|
|
286
|
+
*/
|
|
287
|
+
function signsInAs(extra) {
|
|
288
|
+
const username = configText(extra?.username);
|
|
289
|
+
return username ? (0, accounts_1.signInName)({ username, domain: configText(extra?.domain) }) : '';
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Whether a login saved with `username` (as typed at a sign-in, the desktop's domain going with one that names none)
|
|
293
|
+
* is for `who` (see signsInAs): how a password saved for an address alone, before each user had their own there, is
|
|
294
|
+
* told to be a profile's.
|
|
295
|
+
*/
|
|
296
|
+
function isLoginOf(username, who) {
|
|
297
|
+
const slash = who.indexOf('\\');
|
|
298
|
+
return !!who && (0, accounts_1.signInName)({ username, domain: slash > 0 ? who.slice(0, slash) : '' }) === who;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* What a direct desktop's saved password's key adds for who it signs in as (`@user#<who>`, see signsInAs), or '' for a
|
|
302
|
+
* desktop that doesn't say: several profiles can lead to one address, each signing in as someone else, and each finds
|
|
303
|
+
* the password of its own user there. The user is written as keyField writes a target's, so it has no `#`.
|
|
304
|
+
*/
|
|
305
|
+
function userScope(who) {
|
|
306
|
+
return who ? `@user#${keyField(who, ESCAPED_USER)}` : '';
|
|
307
|
+
}
|
|
277
308
|
/**
|
|
278
309
|
* A session, trust or credential key split into the target it belongs to and the desktop id after it, so matching is
|
|
279
310
|
* anchored on whole parts rather than an `endsWith('#'+id)` that a different key could also satisfy. A key is
|
|
280
311
|
* `<target>#<id>`: the target is `rdp` for a direct desktop, `gateway` for a gateway certificate, or `user@host:port`
|
|
281
312
|
* for a desktop behind an SSH host (`<tab's key>><user@host:port>` for a machine reached through one, see nestedKey;
|
|
282
313
|
* no target's key has a `#`, see keyField); the own desktop's key is the bare target, with no id. A credential key
|
|
283
|
-
* may carry a
|
|
284
|
-
*
|
|
314
|
+
* may carry a user suffix (`…@user#<who>`, see userScope), which names who a direct desktop's password is for, and then
|
|
315
|
+
* a gateway suffix (`…@gateway#<host:port>`), which names where it is sent; both are returned separately, so the id
|
|
316
|
+
* still compares equal. Neither the id nor the user has a `#`, so neither suffix can be taken for part of either.
|
|
285
317
|
*/
|
|
286
318
|
function keyParts(key) {
|
|
287
319
|
const hash = key.indexOf('#');
|
|
288
320
|
if (hash < 0) {
|
|
289
|
-
return { target: key, desktopId: '', gateway: '' };
|
|
321
|
+
return { target: key, desktopId: '', user: '', gateway: '' };
|
|
290
322
|
}
|
|
323
|
+
const target = key.slice(0, hash);
|
|
291
324
|
const rest = key.slice(hash + 1);
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
325
|
+
const scoped = /^([^#]*?)(@user#[^#]*?)?(@gateway#[^#]*)?$/.exec(rest);
|
|
326
|
+
if (scoped) {
|
|
327
|
+
return { target, desktopId: scoped[1], user: scoped[2] ?? '', gateway: scoped[3] ?? '' };
|
|
328
|
+
}
|
|
329
|
+
// More `#` than a key of the plugin's has: compared whole, so that it matches no desktop's.
|
|
330
|
+
return { target, desktopId: rest, user: '', gateway: '' };
|
|
296
331
|
}
|
|
297
332
|
/**
|
|
298
333
|
* A session, trust or credential key of the target `from`, as the same key of `to` (see RemoteTargets.keyChanged,
|
|
299
|
-
* which moves what was kept under a target's former key): `from` itself (its own desktop), or `from#<id>`, with a
|
|
300
|
-
* gateway suffix on a saved password's key. Null for any other key. Desktop ids have no `#` (see
|
|
301
|
-
* has more of them isn't one of `from`'s desktops, whatever it starts with.
|
|
334
|
+
* which moves what was kept under a target's former key): `from` itself (its own desktop), or `from#<id>`, with a user
|
|
335
|
+
* and a gateway suffix on a saved password's key (see keyParts). Null for any other key. Desktop ids have no `#` (see
|
|
336
|
+
* specOf), so a key that has more of them isn't one of `from`'s desktops, whatever it starts with.
|
|
302
337
|
*/
|
|
303
338
|
function rekeyed(key, from, to) {
|
|
304
339
|
if (key === from) {
|
|
305
340
|
return to;
|
|
306
341
|
}
|
|
307
342
|
const rest = key.startsWith(`${from}#`) ? key.slice(from.length + 1) : null;
|
|
308
|
-
return rest !== null && /^[^#]*(@gateway#[^#]*)?$/.test(rest) ? `${to}#${rest}` : null;
|
|
343
|
+
return rest !== null && /^[^#]*(@user#[^#]*)?(@gateway#[^#]*)?$/.test(rest) ? `${to}#${rest}` : null;
|
|
309
344
|
}
|