@lethevimlet/sshift 1.9.1 → 1.9.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lethevimlet/sshift",
3
- "version": "1.9.1",
3
+ "version": "1.9.2",
4
4
  "description": "Web-based SSH + SFTP terminal client with tabs and bookmarks",
5
5
  "main": "src/server/index.js",
6
6
  "bin": {
@@ -1315,9 +1315,15 @@
1315
1315
  <div id="customCertWarning" class="sw-custom-cert-warning" style="display: none; margin-top: 8px;">
1316
1316
  <i class="fas fa-exclamation-circle"></i> A custom certificate is configured. Download the certificate from your administrator.
1317
1317
  </div>
1318
- <button class="btn btn-secondary" id="downloadCertBtn" style="margin-top: 8px;">
1319
- <i class="fas fa-download"></i> Download CA Certificate
1320
- </button>
1318
+ <button class="btn btn-secondary" id="downloadCertBtn" style="margin-top: 8px;">
1319
+ <i class="fas fa-download"></i> Download CA Certificate
1320
+ </button>
1321
+ <a class="btn btn-secondary" id="acceptCertBtn" href="/api/version" target="_blank" rel="noopener noreferrer" style="margin-top: 8px;">
1322
+ <i class="fas fa-external-link-alt"></i> Re-accept Certificate
1323
+ </a>
1324
+ <div class="setting-description" style="margin-top: 8px;">
1325
+ If the app loaded but API requests fail, open this link, choose <strong>Advanced → Proceed</strong>, then return and reload SSHIFT. This exception is temporary; installing the CA is optional but permanent.
1326
+ </div>
1321
1327
  </div>
1322
1328
  </div>
1323
1329
  </div>
@@ -81,6 +81,7 @@ class SSHIFTClient {
81
81
  this.passwordEnabled = false;
82
82
  this.bookmarkEncryptionEnabled = false;
83
83
  this.authToken = localStorage.getItem('sshift_auth_token') || null;
84
+ this._certificateAcceptanceRequired = false;
84
85
 
85
86
  this._origFetch = window.fetch.bind(window);
86
87
  window.fetch = (url, options = {}) => {
@@ -7061,7 +7062,7 @@ if (keepaliveCountMaxInput && this.sshKeepaliveCountMax) {
7061
7062
  const swStatusContainer = document.getElementById('swStatusContainer');
7062
7063
 
7063
7064
  let swStatus = window._swStatus;
7064
- if (navigator.serviceWorker && navigator.serviceWorker.controller) {
7065
+ if (!this._certificateAcceptanceRequired && navigator.serviceWorker && navigator.serviceWorker.controller) {
7065
7066
  swStatus = 'active';
7066
7067
  window._swStatus = 'active';
7067
7068
  }
@@ -7090,7 +7091,7 @@ if (keepaliveCountMaxInput && this.sshKeepaliveCountMax) {
7090
7091
  '<li><i class="fas fa-times"></i> Installable as app (PWA)</li>' +
7091
7092
  '<li><i class="fas fa-times"></i> Clipboard API access</li>' +
7092
7093
  '</ul>' +
7093
- '<p class="sw-hint">Trust the HTTPS certificate to enable all features.</p>';
7094
+ '<p class="sw-hint">Re-accept the certificate to continue without installing it, or trust the local CA to enable all features.</p>';
7094
7095
  } else if (swStatus === 'redundant') {
7095
7096
  swStatusContainer.classList.add('sw-status-failed');
7096
7097
  swStatusIcon.innerHTML = '<i class="fas fa-exclamation-triangle"></i>';
@@ -7126,6 +7127,22 @@ if (keepaliveCountMaxInput && this.sshKeepaliveCountMax) {
7126
7127
  this.openModal('securityInfoModal');
7127
7128
  }
7128
7129
 
7130
+ handleApiFetchError(err) {
7131
+ const swError = String(window._swError || '').toLowerCase();
7132
+ const certificateFailure = window.location.protocol === 'https:' &&
7133
+ err instanceof TypeError &&
7134
+ window._swStatus === 'failed' &&
7135
+ (swError.includes('ssl') || swError.includes('certificate'));
7136
+
7137
+ if (!certificateFailure) return false;
7138
+
7139
+ this._certificateAcceptanceRequired = true;
7140
+ window._swError = 'The browser no longer accepts this HTTPS certificate. Re-accept it to continue, or install the local CA for permanent trust.';
7141
+ this.showToast('HTTPS certificate approval required', 'error');
7142
+ this.openSecurityInfoDialog();
7143
+ return true;
7144
+ }
7145
+
7129
7146
  // Debug Info Dialog
7130
7147
  initDebugInfoDialog() {
7131
7148
  const showBtn = document.getElementById('showDebugInfoBtn');
@@ -13131,7 +13148,9 @@ async syncTabsFromServer(tabs, isInitialSync = false, activeTabsByPanel = null,
13131
13148
  throw new Error('Failed to save bookmark');
13132
13149
  }
13133
13150
  } catch (err) {
13134
- this.showToast(err.message, 'error');
13151
+ if (!this.handleApiFetchError(err)) {
13152
+ this.showToast(err.message, 'error');
13153
+ }
13135
13154
  }
13136
13155
  }
13137
13156