forkit-connect 0.1.3 → 0.1.5
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/dist/cli.js +11 -3
- package/dist/v1/credential-store.js +3 -0
- package/dist/v1/service.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -677,9 +677,17 @@ function shellLine(label, value) {
|
|
|
677
677
|
function shellListLine(value) {
|
|
678
678
|
return `• ${value}`;
|
|
679
679
|
}
|
|
680
|
+
function resolveInteractiveSessionState(service, sessionState) {
|
|
681
|
+
const overview = service.getConnectStatusOverview({ includeInbox: false });
|
|
682
|
+
if (sessionState === 'unavailable' && Boolean(service.readSessionRef()) && overview.device_paired) {
|
|
683
|
+
return 'authorized';
|
|
684
|
+
}
|
|
685
|
+
return sessionState;
|
|
686
|
+
}
|
|
680
687
|
function buildInteractiveOverviewSections(service, sessionState, accountLimits) {
|
|
681
|
-
const accountTrusted = sessionState === 'authorized';
|
|
682
688
|
const overview = service.getConnectStatusOverview({ includeInbox: false });
|
|
689
|
+
const effectiveSessionState = resolveInteractiveSessionState(service, sessionState);
|
|
690
|
+
const accountTrusted = effectiveSessionState === 'authorized';
|
|
683
691
|
const preparedWorkspace = accountTrusted ? String(overview.workspace_id || '').trim() : '';
|
|
684
692
|
const preparedProject = accountTrusted ? String(overview.project_id || '').trim() : '';
|
|
685
693
|
// Base section: always visible
|
|
@@ -687,7 +695,7 @@ function buildInteractiveOverviewSections(service, sessionState, accountLimits)
|
|
|
687
695
|
{
|
|
688
696
|
title: 'Overview',
|
|
689
697
|
lines: [
|
|
690
|
-
shellLine('Session', sessionState),
|
|
698
|
+
shellLine('Session', accountTrusted && sessionState === 'unavailable' ? 'connected' : effectiveSessionState),
|
|
691
699
|
shellLine('Device paired', overview.device_paired),
|
|
692
700
|
shellLine('Daemon', overview.daemon_status),
|
|
693
701
|
shellLine('Privacy mode', overview.privacy_mode),
|
|
@@ -2794,7 +2802,7 @@ async function run() {
|
|
|
2794
2802
|
}
|
|
2795
2803
|
while (true) {
|
|
2796
2804
|
process.exitCode = 0;
|
|
2797
|
-
const sessionState = await checkBackendSessionState(service);
|
|
2805
|
+
const sessionState = resolveInteractiveSessionState(service, await checkBackendSessionState(service));
|
|
2798
2806
|
const authenticated = sessionState === 'authorized';
|
|
2799
2807
|
if (!authenticated) {
|
|
2800
2808
|
await renderInteractiveStatusScreen(sessionState);
|
|
@@ -87,11 +87,13 @@ function isWindowsCredentialNotFound(stderr, status) {
|
|
|
87
87
|
const WINDOWS_DPAPI_SCRIPTS = {
|
|
88
88
|
status: [
|
|
89
89
|
"$ErrorActionPreference = 'Stop'",
|
|
90
|
+
'Add-Type -AssemblyName System.Security',
|
|
90
91
|
'[void][System.Security.Cryptography.DataProtectionScope]::CurrentUser',
|
|
91
92
|
"[Console]::Out.Write('windows-dpapi-ready')",
|
|
92
93
|
].join('; '),
|
|
93
94
|
read: [
|
|
94
95
|
"$ErrorActionPreference = 'Stop'",
|
|
96
|
+
'Add-Type -AssemblyName System.Security',
|
|
95
97
|
'$path = $env:FORKIT_CONNECT_WINDOWS_CREDENTIAL_PATH',
|
|
96
98
|
'if (-not (Test-Path -LiteralPath $path)) { exit 44 }',
|
|
97
99
|
'$raw = [System.IO.File]::ReadAllText($path, [System.Text.Encoding]::UTF8)',
|
|
@@ -104,6 +106,7 @@ const WINDOWS_DPAPI_SCRIPTS = {
|
|
|
104
106
|
].join('; '),
|
|
105
107
|
write: [
|
|
106
108
|
"$ErrorActionPreference = 'Stop'",
|
|
109
|
+
'Add-Type -AssemblyName System.Security',
|
|
107
110
|
'$path = $env:FORKIT_CONNECT_WINDOWS_CREDENTIAL_PATH',
|
|
108
111
|
'$directory = Split-Path -Parent $path',
|
|
109
112
|
'if ($directory) { [System.IO.Directory]::CreateDirectory($directory) | Out-Null }',
|
package/dist/v1/service.js
CHANGED
|
@@ -215,7 +215,7 @@ function defaultNotificationSender(title, message, candidate) {
|
|
|
215
215
|
'$title = [System.Security.SecurityElement]::Escape($env:FORKIT_CONNECT_NOTIFICATION_TITLE)',
|
|
216
216
|
'$body = [System.Security.SecurityElement]::Escape($env:FORKIT_CONNECT_NOTIFICATION_MESSAGE)',
|
|
217
217
|
'$xml = New-Object Windows.Data.Xml.Dom.XmlDocument',
|
|
218
|
-
'$xml.LoadXml("<toast><visual><binding template
|
|
218
|
+
'$xml.LoadXml("<toast><visual><binding template=\'ToastGeneric\'><text>$title</text><text>$body</text></binding></visual></toast>")',
|
|
219
219
|
"$toast = [Windows.UI.Notifications.ToastNotification]::new($xml)",
|
|
220
220
|
"$notifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('Forkit Connect')",
|
|
221
221
|
'$notifier.Show($toast)',
|