@lethevimlet/sshift 0.9.3 → 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.
- package/README.md +6 -8
- package/example.config.json +3 -0
- package/package.json +8 -1
- package/src/server/endpoints/rest/config.js +21 -1
- package/src/server/endpoints/rest/system.js +36 -0
- package/src/server/endpoints/ws/ssh.js +6 -2
- package/src/server/index.js +39 -9
- package/src/server/plugins/plugin-manager.js +7 -1
- package/src/server/services/ssh-manager.js +50 -29
- package/src/server/utils/config.js +40 -13
- package/src/server/utils/env-loader.js +6 -17
- package/src/webapp/css/style.css +87 -29
- package/src/webapp/index.html +187 -29
- package/src/webapp/js/app.js +647 -108
- package/src/webapp/js/mobile-terminal.js +6 -0
- package/src/webapp/js/terminal-worker.js +211 -0
- package/src/webapp/libs/xterm/xterm-addon-fit.js +2 -2
- package/src/webapp/libs/xterm/xterm-addon-image.js +3 -0
- package/src/webapp/libs/xterm/xterm-addon-search.js +2 -2
- package/src/webapp/libs/xterm/xterm-addon-serialize-worker.js +2 -0
- package/src/webapp/libs/xterm/xterm-addon-web-links.js +2 -2
- package/src/webapp/libs/xterm/xterm-addon-webgl.js +2 -0
- package/src/webapp/libs/xterm/xterm-headless-prefix.js +6 -0
- package/src/webapp/libs/xterm/xterm-headless.js +2 -0
- package/src/webapp/libs/xterm/xterm.css +81 -5
- package/src/webapp/libs/xterm/xterm.js +1 -1
- package/src/webapp/sw.js +11 -4
package/src/webapp/css/style.css
CHANGED
|
@@ -465,6 +465,30 @@ body {
|
|
|
465
465
|
display: none;
|
|
466
466
|
flex: 1;
|
|
467
467
|
position: relative;
|
|
468
|
+
gap: 4px;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
.mobile-force-resize-btn {
|
|
472
|
+
display: none;
|
|
473
|
+
align-items: center;
|
|
474
|
+
justify-content: center;
|
|
475
|
+
min-width: 32px;
|
|
476
|
+
min-height: 32px;
|
|
477
|
+
padding: 4px 10px;
|
|
478
|
+
background: var(--bg-tertiary);
|
|
479
|
+
border: 1px solid var(--border-color);
|
|
480
|
+
border-radius: var(--radius-md);
|
|
481
|
+
color: var(--text-secondary);
|
|
482
|
+
font-size: 12px;
|
|
483
|
+
cursor: pointer;
|
|
484
|
+
transition: var(--transition-fast);
|
|
485
|
+
flex-shrink: 0;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.mobile-force-resize-btn:hover {
|
|
489
|
+
background: var(--bg-hover);
|
|
490
|
+
color: var(--accent-primary);
|
|
491
|
+
border-color: var(--border-light);
|
|
468
492
|
}
|
|
469
493
|
|
|
470
494
|
.mobile-tabs-toggle {
|
|
@@ -2306,6 +2330,7 @@ body.dragging-tabs .tabs-container {
|
|
|
2306
2330
|
|
|
2307
2331
|
.terminal-container .xterm-viewport {
|
|
2308
2332
|
height: 100% !important;
|
|
2333
|
+
background-color: #0d1117;
|
|
2309
2334
|
}
|
|
2310
2335
|
|
|
2311
2336
|
.terminal-container .xterm-screen {
|
|
@@ -2323,22 +2348,44 @@ body.dragging-tabs .tabs-container {
|
|
|
2323
2348
|
opacity: 0;
|
|
2324
2349
|
}
|
|
2325
2350
|
|
|
2326
|
-
/*
|
|
2327
|
-
.terminal-container .xterm-
|
|
2328
|
-
|
|
2351
|
+
/* xterm v6 custom scrollbar: always visible */
|
|
2352
|
+
.terminal-container .xterm-scrollable-element > .scrollbar {
|
|
2353
|
+
opacity: 1 !important;
|
|
2354
|
+
pointer-events: auto !important;
|
|
2355
|
+
transition: none !important;
|
|
2356
|
+
background-color: var(--terminal-scrollbar-track, #151b23) !important;
|
|
2329
2357
|
}
|
|
2330
2358
|
|
|
2331
|
-
.terminal-container .xterm-
|
|
2332
|
-
|
|
2359
|
+
.terminal-container .xterm-scrollable-element > .scrollbar.invisible {
|
|
2360
|
+
opacity: 1 !important;
|
|
2361
|
+
pointer-events: auto !important;
|
|
2362
|
+
transition: none !important;
|
|
2363
|
+
background-color: var(--terminal-scrollbar-track, #151b23) !important;
|
|
2333
2364
|
}
|
|
2334
2365
|
|
|
2335
|
-
.terminal-container .xterm-
|
|
2336
|
-
|
|
2337
|
-
|
|
2366
|
+
.terminal-container .xterm-scrollable-element > .scrollbar.invisible.fade {
|
|
2367
|
+
opacity: 1 !important;
|
|
2368
|
+
transition: none !important;
|
|
2369
|
+
background-color: var(--terminal-scrollbar-track, #151b23) !important;
|
|
2338
2370
|
}
|
|
2339
2371
|
|
|
2340
|
-
.terminal-container .xterm-
|
|
2341
|
-
|
|
2372
|
+
.terminal-container .xterm-scrollable-element > .scrollbar > .slider {
|
|
2373
|
+
border-radius: 3px;
|
|
2374
|
+
background-color: var(--terminal-scrollbar-thumb, #3d444d) !important;
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2377
|
+
.terminal-container .xterm-scrollable-element > .shadow {
|
|
2378
|
+
display: none !important;
|
|
2379
|
+
}
|
|
2380
|
+
|
|
2381
|
+
/* Hide native viewport scrollbar (xterm v6 uses custom scrollbar) */
|
|
2382
|
+
.terminal-container .xterm-viewport::-webkit-scrollbar {
|
|
2383
|
+
width: 0;
|
|
2384
|
+
height: 0;
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
.terminal-container .xterm-viewport {
|
|
2388
|
+
scrollbar-width: none;
|
|
2342
2389
|
}
|
|
2343
2390
|
|
|
2344
2391
|
/* Ensure terminal screen is properly positioned */
|
|
@@ -3174,6 +3221,14 @@ body.dragging-tabs .tabs-container {
|
|
|
3174
3221
|
margin-left: 4px;
|
|
3175
3222
|
}
|
|
3176
3223
|
|
|
3224
|
+
.mobile-force-resize-btn {
|
|
3225
|
+
display: flex;
|
|
3226
|
+
min-width: 28px;
|
|
3227
|
+
min-height: 28px;
|
|
3228
|
+
padding: 4px 6px;
|
|
3229
|
+
font-size: 12px;
|
|
3230
|
+
}
|
|
3231
|
+
|
|
3177
3232
|
.mobile-tabs-toggle {
|
|
3178
3233
|
min-height: 28px;
|
|
3179
3234
|
padding: 4px 6px;
|
|
@@ -3895,38 +3950,38 @@ body.dragging-tabs .tabs-container {
|
|
|
3895
3950
|
}
|
|
3896
3951
|
|
|
3897
3952
|
.terminal-container .xterm-viewport {
|
|
3898
|
-
overflow-y:
|
|
3953
|
+
overflow-y: hidden !important;
|
|
3899
3954
|
overflow-x: hidden !important;
|
|
3900
3955
|
overscroll-behavior: contain;
|
|
3901
|
-
-
|
|
3902
|
-
touch-action: pan-y;
|
|
3903
|
-
/* Fill available space */
|
|
3956
|
+
touch-action: none;
|
|
3904
3957
|
flex: 1;
|
|
3905
3958
|
min-height: 0;
|
|
3906
|
-
/* Override the height: 100% !important from general styles */
|
|
3907
3959
|
height: auto !important;
|
|
3908
|
-
|
|
3909
|
-
scrollbar-width: thin;
|
|
3910
|
-
scrollbar-color: var(--bg-hover) var(--bg-primary);
|
|
3960
|
+
scrollbar-width: none;
|
|
3911
3961
|
}
|
|
3912
3962
|
|
|
3913
|
-
/* Ensure scrollbars are visible on mobile */
|
|
3914
3963
|
.terminal-container .xterm-viewport::-webkit-scrollbar {
|
|
3915
|
-
width:
|
|
3916
|
-
height:
|
|
3964
|
+
width: 0;
|
|
3965
|
+
height: 0;
|
|
3917
3966
|
}
|
|
3918
3967
|
|
|
3919
|
-
.terminal-container .xterm-
|
|
3920
|
-
|
|
3968
|
+
.terminal-container .xterm-scrollable-element > .scrollbar {
|
|
3969
|
+
opacity: 1 !important;
|
|
3970
|
+
pointer-events: auto !important;
|
|
3971
|
+
transition: none !important;
|
|
3972
|
+
background-color: var(--terminal-scrollbar-track, #151b23) !important;
|
|
3921
3973
|
}
|
|
3922
3974
|
|
|
3923
|
-
.terminal-container .xterm-
|
|
3924
|
-
|
|
3925
|
-
|
|
3975
|
+
.terminal-container .xterm-scrollable-element > .scrollbar.invisible {
|
|
3976
|
+
opacity: 1 !important;
|
|
3977
|
+
pointer-events: auto !important;
|
|
3978
|
+
transition: none !important;
|
|
3979
|
+
background-color: var(--terminal-scrollbar-track, #151b23) !important;
|
|
3926
3980
|
}
|
|
3927
3981
|
|
|
3928
|
-
.terminal-container .xterm-
|
|
3929
|
-
|
|
3982
|
+
.terminal-container .xterm-scrollable-element > .scrollbar > .slider {
|
|
3983
|
+
min-height: 30px !important;
|
|
3984
|
+
background-color: var(--terminal-scrollbar-thumb, #3d444d) !important;
|
|
3930
3985
|
}
|
|
3931
3986
|
|
|
3932
3987
|
.terminal-container .xterm-screen {
|
|
@@ -4317,7 +4372,6 @@ body.dragging-tabs .tabs-container {
|
|
|
4317
4372
|
/* Enable native touch selection on mobile for terminal */
|
|
4318
4373
|
.terminal-container .xterm,
|
|
4319
4374
|
.terminal-container .xterm-screen,
|
|
4320
|
-
.terminal-container .xterm-viewport,
|
|
4321
4375
|
.terminal-container .xterm-rows,
|
|
4322
4376
|
.terminal-container .xterm-helpers {
|
|
4323
4377
|
-webkit-touch-callout: default !important;
|
|
@@ -4328,6 +4382,10 @@ body.dragging-tabs .tabs-container {
|
|
|
4328
4382
|
touch-action: manipulation !important;
|
|
4329
4383
|
}
|
|
4330
4384
|
|
|
4385
|
+
.terminal-container .xterm-viewport {
|
|
4386
|
+
touch-action: none !important;
|
|
4387
|
+
}
|
|
4388
|
+
|
|
4331
4389
|
/* Allow text selection in terminal on mobile */
|
|
4332
4390
|
.terminal-container {
|
|
4333
4391
|
-webkit-touch-callout: default !important;
|
package/src/webapp/index.html
CHANGED
|
@@ -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
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
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').
|
|
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>
|