@lethevimlet/sshift 0.9.4 → 0.9.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.
@@ -5,6 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, interactive-widget=resizes-content">
6
6
  <meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' 'unsafe-eval' data: blob:;">
7
7
  <meta name="theme-color" content="#1a1b26">
8
+ <meta name="mobile-web-app-capable" content="yes">
8
9
  <meta name="apple-mobile-web-app-capable" content="yes">
9
10
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
10
11
  <meta name="apple-mobile-web-app-title" content="SSHIFT">
@@ -304,6 +305,9 @@
304
305
  <span class="mobile-tabs-label" id="mobileTabsLabel">No Active Tabs</span>
305
306
  <i class="fas fa-chevron-down dropdown-arrow"></i>
306
307
  </button>
308
+ <button class="mobile-force-resize-btn" id="mobileForceResizeBtn" title="Force Resize">
309
+ <i class="fas fa-expand-arrows-alt"></i>
310
+ </button>
307
311
  <div class="mobile-tabs-menu" id="mobileTabsMenu">
308
312
  <!-- Mobile tab options will be added here dynamically -->
309
313
  </div>
@@ -818,6 +822,59 @@
818
822
  </div>
819
823
  </div>
820
824
 
825
+ <!-- WebGL Renderer Setting -->
826
+ <div class="setting-group">
827
+ <div class="setting-item">
828
+ <label class="setting-label">
829
+ <i class="fas fa-microchip"></i> WebGL Renderer
830
+ </label>
831
+ <div class="setting-description">
832
+ Use GPU-accelerated WebGL rendering for the terminal. Improves performance and reduces CPU usage, especially on large terminals. Disable if you experience rendering issues or graphics driver problems.
833
+ </div>
834
+ <div class="setting-control">
835
+ <label class="toggle-switch">
836
+ <input type="checkbox" id="webglRendererToggle" checked>
837
+ <span class="toggle-slider"></span>
838
+ </label>
839
+ </div>
840
+ </div>
841
+ </div>
842
+
843
+ <!-- Image Protocol Setting -->
844
+ <div class="setting-group">
845
+ <div class="setting-item">
846
+ <label class="setting-label">
847
+ <i class="fas fa-image"></i> Image Protocol
848
+ </label>
849
+ <div class="setting-description">
850
+ Enable Sixel, iTerm2, and Kitty image protocol support in the terminal. Required for programs like notcurses-demo that render graphics inline. Disabling may slightly improve performance for text-only workloads.
851
+ </div>
852
+ <div class="setting-control">
853
+ <label class="toggle-switch">
854
+ <input type="checkbox" id="imageAddonToggle" checked>
855
+ <span class="toggle-slider"></span>
856
+ </label>
857
+ </div>
858
+ </div>
859
+ </div>
860
+
861
+ <!-- Trusted Connection -->
862
+ <div class="setting-group">
863
+ <div class="setting-item">
864
+ <label class="setting-label">
865
+ <i class="fas fa-shield-alt"></i> Trusted Connection
866
+ </label>
867
+ <div class="setting-description">
868
+ View service worker status and download the SSL certificate for trusted access over LAN.
869
+ </div>
870
+ <div class="setting-control">
871
+ <button class="btn btn-secondary" id="showSecurityInfoBtn">
872
+ <i class="fas fa-info-circle"></i> Security Info
873
+ </button>
874
+ </div>
875
+ </div>
876
+ </div>
877
+
821
878
  <!-- Password Protection -->
822
879
  <div class="setting-group">
823
880
  <div class="setting-item">
@@ -933,6 +990,61 @@
933
990
  </div>
934
991
  </div>
935
992
 
993
+ <!-- Security Info Modal -->
994
+ <div class="modal" id="securityInfoModal">
995
+ <div class="modal-content modal-lg">
996
+ <div class="modal-header">
997
+ <h2><i class="fas fa-shield-alt"></i> Security & Connection Info</h2>
998
+ <button class="modal-close" id="closeSecurityInfoModal">
999
+ <i class="fas fa-times"></i>
1000
+ </button>
1001
+ </div>
1002
+ <div class="modal-body">
1003
+ <div class="setting-group">
1004
+ <div id="swStatusContainer" class="setting-item" style="flex-direction: column; align-items: stretch;">
1005
+ <label class="setting-label"><i class="fas fa-hard-drive"></i> Service Worker</label>
1006
+ <div class="setting-description" id="swStatusText">
1007
+ <i class="fas fa-spinner fa-spin"></i> Checking...
1008
+ </div>
1009
+ </div>
1010
+
1011
+ <div class="setting-item" style="flex-direction: column; align-items: stretch;">
1012
+ <label class="setting-label"><i class="fas fa-lock"></i> SSL Certificate</label>
1013
+ <div class="setting-description">
1014
+ Service workers require a trusted HTTPS connection. To use this app over LAN with a self-signed certificate, install the certificate as a trusted root CA on your device.
1015
+ </div>
1016
+ <button class="btn btn-secondary" id="downloadCertBtn" style="margin-top: 8px;">
1017
+ <i class="fas fa-download"></i> Download Certificate
1018
+ </button>
1019
+ </div>
1020
+
1021
+ <div class="setting-item" style="flex-direction: column; align-items: stretch;">
1022
+ <label class="setting-label"><i class="fas fa-info-circle"></i> Instructions</label>
1023
+ <div class="setting-description" style="font-size: 12px; line-height: 1.5;">
1024
+ <strong>Chrome/Edge (Desktop):</strong> Open <a href="chrome://settings/certificates" style="color: var(--accent-primary); word-break: break-all;">chrome://settings/certificates</a> (or <a href="edge://settings/certificates" style="color: var(--accent-primary);">edge://settings/certificates</a>) in the address bar, then import the downloaded .crt file to "Trusted Root Certification Authorities".<br><br>
1025
+ <strong>Chrome (Android):</strong> Settings > Security > Install from SD card > Select the downloaded file.<br><br>
1026
+ <strong>Firefox:</strong> Open <a href="about:preferences#privacy" style="color: var(--accent-primary);">about:preferences#privacy</a> > View Certificates > Import > Trust for identifying websites.<br><br>
1027
+ <strong>macOS/iOS:</strong> Double-click the .crt file > Add to Keychain > Set trust to "Always Trust". On iOS: Settings > General > VPN & Device Management > Install profile, then Settings > General > About > Certificate Trust Settings > Enable full trust.
1028
+ </div>
1029
+ </div>
1030
+ </div>
1031
+
1032
+ <div class="setting-item" style="margin-top: 12px;">
1033
+ <label class="toggle-switch">
1034
+ <input type="checkbox" id="dontShowSecurityInfo">
1035
+ <span class="toggle-slider"></span>
1036
+ </label>
1037
+ <span style="margin-left: 8px; font-size: 13px;">Don't show this on startup</span>
1038
+ </div>
1039
+ </div>
1040
+ <div class="modal-footer">
1041
+ <button class="btn btn-primary" id="closeSecurityInfoBtn">
1042
+ <i class="fas fa-check"></i> Got it
1043
+ </button>
1044
+ </div>
1045
+ </div>
1046
+ </div>
1047
+
936
1048
  <!-- Mobile Keys Bar -->
937
1049
  <div class="mobile-keys-bar" id="mobileKeysBar">
938
1050
  <div class="mobile-keys-row">
@@ -980,6 +1092,8 @@
980
1092
  <script src="/libs/xterm/xterm-addon-web-links.js"></script>
981
1093
  <script src="/libs/xterm/xterm-addon-search.js"></script>
982
1094
  <script src="/libs/xterm/xterm-addon-serialize.js"></script>
1095
+ <script src="/libs/xterm/xterm-addon-webgl.js"></script>
1096
+ <script src="/libs/xterm/xterm-addon-image.js"></script>
983
1097
 
984
1098
  <!-- Mobile terminal support -->
985
1099
  <script src="/js/mobile-terminal.js"></script>
@@ -991,21 +1105,11 @@
991
1105
  // We need to extract the actual constructor
992
1106
 
993
1107
  (function() {
994
- console.log('[SSHIFT] Normalizing addon exports...');
995
- console.log('[SSHIFT] Before normalization:');
996
- console.log('[SSHIFT] Terminal:', typeof window.Terminal);
997
- console.log('[SSHIFT] FitAddon:', typeof window.FitAddon);
998
- console.log('[SSHIFT] WebLinksAddon:', typeof window.WebLinksAddon);
999
- console.log('[SSHIFT] SearchAddon:', typeof window.SearchAddon);
1000
-
1001
1108
  // Normalize Terminal - check if it's an object with Terminal property
1002
1109
  if (typeof window.Terminal === 'object' && window.Terminal !== null) {
1003
1110
  if (window.Terminal.Terminal) {
1004
- console.log('[SSHIFT] Terminal is object with .Terminal property, extracting...');
1005
1111
  window.Terminal = window.Terminal.Terminal;
1006
1112
  } else {
1007
- console.log('[SSHIFT] Terminal is object but no .Terminal property found');
1008
- // Check if it's already the Terminal class in a different location
1009
1113
  if (window.Terminal.default) {
1010
1114
  window.Terminal = window.Terminal.default;
1011
1115
  }
@@ -1015,13 +1119,11 @@
1015
1119
  // Normalize FitAddon
1016
1120
  if (typeof window.FitAddon === 'object' && window.FitAddon !== null) {
1017
1121
  if (window.FitAddon.FitAddon) {
1018
- console.log('[SSHIFT] FitAddon is object with .FitAddon property, extracting...');
1019
1122
  window.FitAddon = window.FitAddon.FitAddon;
1020
1123
  } else if (window.FitAddon.default) {
1021
1124
  window.FitAddon = window.FitAddon.default;
1022
1125
  }
1023
1126
  } else if (typeof window.FitAddon === 'undefined') {
1024
- // Try global scope
1025
1127
  if (typeof FitAddon !== 'undefined') {
1026
1128
  if (typeof FitAddon === 'object' && FitAddon !== null) {
1027
1129
  window.FitAddon = FitAddon.FitAddon || FitAddon.default || FitAddon;
@@ -1034,7 +1136,6 @@
1034
1136
  // Normalize WebLinksAddon
1035
1137
  if (typeof window.WebLinksAddon === 'object' && window.WebLinksAddon !== null) {
1036
1138
  if (window.WebLinksAddon.WebLinksAddon) {
1037
- console.log('[SSHIFT] WebLinksAddon is object with .WebLinksAddon property, extracting...');
1038
1139
  window.WebLinksAddon = window.WebLinksAddon.WebLinksAddon;
1039
1140
  } else if (window.WebLinksAddon.default) {
1040
1141
  window.WebLinksAddon = window.WebLinksAddon.default;
@@ -1052,7 +1153,6 @@
1052
1153
  // Normalize SearchAddon
1053
1154
  if (typeof window.SearchAddon === 'object' && window.SearchAddon !== null) {
1054
1155
  if (window.SearchAddon.SearchAddon) {
1055
- console.log('[SSHIFT] SearchAddon is object with .SearchAddon property, extracting...');
1056
1156
  window.SearchAddon = window.SearchAddon.SearchAddon;
1057
1157
  } else if (window.SearchAddon.default) {
1058
1158
  window.SearchAddon = window.SearchAddon.default;
@@ -1070,7 +1170,6 @@
1070
1170
  // Normalize SerializeAddon
1071
1171
  if (typeof window.SerializeAddon === 'object' && window.SerializeAddon !== null) {
1072
1172
  if (window.SerializeAddon.SerializeAddon) {
1073
- console.log('[SSHIFT] SerializeAddon is object with .SerializeAddon property, extracting...');
1074
1173
  window.SerializeAddon = window.SerializeAddon.SerializeAddon;
1075
1174
  } else if (window.SerializeAddon.default) {
1076
1175
  window.SerializeAddon = window.SerializeAddon.default;
@@ -1085,32 +1184,52 @@
1085
1184
  }
1086
1185
  }
1087
1186
 
1088
- console.log('[SSHIFT] After normalization:');
1089
- console.log('[SSHIFT] Terminal:', typeof window.Terminal);
1090
- console.log('[SSHIFT] FitAddon:', typeof window.FitAddon);
1091
- console.log('[SSHIFT] WebLinksAddon:', typeof window.WebLinksAddon);
1092
- console.log('[SSHIFT] SearchAddon:', typeof window.SearchAddon);
1187
+ // Normalize WebglAddon
1188
+ if (typeof window.WebglAddon === 'object' && window.WebglAddon !== null) {
1189
+ if (window.WebglAddon.WebglAddon) {
1190
+ window.WebglAddon = window.WebglAddon.WebglAddon;
1191
+ } else if (window.WebglAddon.default) {
1192
+ window.WebglAddon = window.WebglAddon.default;
1193
+ }
1194
+ } else if (typeof window.WebglAddon === 'undefined') {
1195
+ if (typeof WebglAddon !== 'undefined') {
1196
+ if (typeof WebglAddon === 'object' && WebglAddon !== null) {
1197
+ window.WebglAddon = WebglAddon.WebglAddon || WebglAddon.default || WebglAddon;
1198
+ } else if (typeof WebglAddon === 'function') {
1199
+ window.WebglAddon = WebglAddon;
1200
+ }
1201
+ }
1202
+ }
1203
+
1204
+ // Normalize ImageAddon
1205
+ if (typeof window.ImageAddon === 'object' && window.ImageAddon !== null) {
1206
+ if (window.ImageAddon.ImageAddon) {
1207
+ window.ImageAddon = window.ImageAddon.ImageAddon;
1208
+ } else if (window.ImageAddon.default) {
1209
+ window.ImageAddon = window.ImageAddon.default;
1210
+ }
1211
+ } else if (typeof window.ImageAddon === 'undefined') {
1212
+ if (typeof ImageAddon !== 'undefined') {
1213
+ if (typeof ImageAddon === 'object' && ImageAddon !== null) {
1214
+ window.ImageAddon = ImageAddon.ImageAddon || ImageAddon.default || ImageAddon;
1215
+ } else if (typeof ImageAddon === 'function') {
1216
+ window.ImageAddon = ImageAddon;
1217
+ }
1218
+ }
1219
+ }
1093
1220
 
1094
1221
  // Verify all required libraries are loaded
1095
1222
  if (typeof window.Terminal !== 'function') {
1096
1223
  console.error('[SSHIFT] CRITICAL: Terminal class not loaded! typeof:', typeof window.Terminal);
1097
- if (typeof window.Terminal === 'object') {
1098
- console.error('[SSHIFT] Terminal object keys:', window.Terminal ? Object.keys(window.Terminal) : 'null');
1099
- }
1100
1224
  alert('Failed to load terminal library. Please refresh the page.');
1101
1225
  return;
1102
1226
  }
1103
1227
 
1104
1228
  if (typeof window.FitAddon !== 'function') {
1105
1229
  console.error('[SSHIFT] CRITICAL: FitAddon class not loaded! typeof:', typeof window.FitAddon);
1106
- if (typeof window.FitAddon === 'object') {
1107
- console.error('[SSHIFT] FitAddon object keys:', window.FitAddon ? Object.keys(window.FitAddon) : 'null');
1108
- }
1109
1230
  alert('Failed to load terminal fit addon. Please refresh the page.');
1110
1231
  return;
1111
1232
  }
1112
-
1113
- console.log('[SSHIFT] ✓ All required libraries loaded successfully');
1114
1233
  })();
1115
1234
  </script>
1116
1235
 
@@ -1119,8 +1238,47 @@
1119
1238
  <script>
1120
1239
  if ('serviceWorker' in navigator) {
1121
1240
  window.addEventListener('load', () => {
1122
- navigator.serviceWorker.register('/sw.js').catch(() => {});
1241
+ navigator.serviceWorker.register('/sw.js').then((reg) => {
1242
+ console.log('[SSHIFT] Service Worker registered, scope:', reg.scope);
1243
+ window._swRegistration = reg;
1244
+ // Check the actual state
1245
+ if (reg.active) {
1246
+ window._swStatus = 'active';
1247
+ } else if (reg.installing) {
1248
+ window._swStatus = 'installing';
1249
+ } else if (reg.waiting) {
1250
+ window._swStatus = 'waiting';
1251
+ } else {
1252
+ window._swStatus = 'registered';
1253
+ }
1254
+ window._swError = null;
1255
+ // Listen for state changes
1256
+ reg.addEventListener('updatefound', () => {
1257
+ const newWorker = reg.installing;
1258
+ newWorker.addEventListener('statechange', () => {
1259
+ if (newWorker.state === 'activated') {
1260
+ window._swStatus = 'active';
1261
+ } else if (newWorker.state === 'redundant') {
1262
+ if (!navigator.serviceWorker.controller) {
1263
+ window._swStatus = 'redundant';
1264
+ window._swError = 'Service Worker became redundant. This usually means the certificate is not trusted.';
1265
+ }
1266
+ }
1267
+ });
1268
+ });
1269
+ // Also check if the page is controlled by a SW
1270
+ if (navigator.serviceWorker.controller) {
1271
+ window._swStatus = 'active';
1272
+ }
1273
+ }).catch((err) => {
1274
+ console.warn('[SSHIFT] Service Worker registration failed:', err.message);
1275
+ window._swStatus = 'failed';
1276
+ window._swError = err.message;
1277
+ });
1123
1278
  });
1279
+ } else {
1280
+ window._swStatus = 'unsupported';
1281
+ window._swError = 'Service Workers not supported in this browser';
1124
1282
  }
1125
1283
  </script>
1126
1284
  </body>