@lethevimlet/sshift 1.3.0 → 1.3.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.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Web-based SSH + SFTP terminal client with tabs and bookmarks",
5
5
  "main": "src/server/index.js",
6
6
  "bin": {
@@ -17,6 +17,7 @@ function registerConfigEndpoints(app, io) {
17
17
  takeControlDefault: config.takeControlDefault !== false,
18
18
  sshKeepaliveInterval: config.sshKeepaliveInterval || 10000,
19
19
  sshKeepaliveCountMax: config.sshKeepaliveCountMax || 1000,
20
+ scrollback: config.scrollback || 10000,
20
21
  mobileKeysBarEnabled: config.mobileKeysBarEnabled !== false,
21
22
  webglRenderer: config.webglRenderer !== false,
22
23
  imageAddonEnabled: config.imageAddonEnabled !== false,
@@ -63,6 +64,11 @@ function registerConfigEndpoints(app, io) {
63
64
  config.imageAddonEnabled = req.body.imageAddonEnabled;
64
65
  }
65
66
 
67
+ if (req.body.hasOwnProperty('scrollback')) {
68
+ const val = parseInt(req.body.scrollback);
69
+ config.scrollback = (val >= 0 && val <= 100000) ? val : 10000;
70
+ }
71
+
66
72
  // Save config
67
73
  const saved = saveConfig(config);
68
74
  if (saved) {
@@ -72,6 +78,7 @@ function registerConfigEndpoints(app, io) {
72
78
  takeControlDefault: config.takeControlDefault !== false,
73
79
  sshKeepaliveInterval: config.sshKeepaliveInterval || 10000,
74
80
  sshKeepaliveCountMax: config.sshKeepaliveCountMax || 1000,
81
+ scrollback: config.scrollback || 10000,
75
82
  mobileKeysBarEnabled: config.mobileKeysBarEnabled !== false,
76
83
  webglRenderer: config.webglRenderer !== false,
77
84
  imageAddonEnabled: config.imageAddonEnabled !== false
@@ -241,10 +241,6 @@ function registerSystemEndpoints(app, io) {
241
241
  // API: Trigger update
242
242
  app.post('/api/update', async (req, res) => {
243
243
  try {
244
- const isLocalhost = req.hostname === 'localhost' || req.hostname === '127.0.0.1' || req.hostname === '::1';
245
- if (!isLocalhost && !req.headers.authorization && !req.query.token) {
246
- return res.status(403).json({ error: 'Remote update requires authentication. Set a password or use localhost.' });
247
- }
248
244
 
249
245
  const { spawn, execSync } = require('child_process');
250
246
  const platform = process.platform;
@@ -2,7 +2,7 @@
2
2
  * SSH WebSocket handlers
3
3
  */
4
4
 
5
- const { loadConfig, getStickySetting } = require('../../utils/config');
5
+ const { loadConfig, getStickySetting, getScrollback } = require('../../utils/config');
6
6
  const { addTab, getTab, addSocketToTab, removeSocketFromTab, removeTab, getTabOrder, setCloseTimer, clearCloseTimer, getCloseTimer } = require('../../utils/tab-manager');
7
7
  const { sshManager } = require('../../services');
8
8
 
@@ -28,12 +28,14 @@ function registerSSHHandlers(socket, io) {
28
28
  const config = loadConfig();
29
29
  const sshKeepaliveInterval = config.sshKeepaliveInterval || 10000;
30
30
  const sshKeepaliveCountMax = config.sshKeepaliveCountMax || 1000;
31
+ const scrollback = getScrollback();
31
32
 
32
- // Pass keepalive settings to SSH manager
33
+ // Pass keepalive and scrollback settings to SSH manager
33
34
  const connectionData = {
34
35
  ...data,
35
36
  sshKeepaliveInterval,
36
- sshKeepaliveCountMax
37
+ sshKeepaliveCountMax,
38
+ scrollback
37
39
  };
38
40
 
39
41
  const sessionId = await sshManager.connect(socket, connectionData);
@@ -48,11 +48,11 @@ class SSHManager {
48
48
  const rows = options.rows || 24;
49
49
 
50
50
  // Create a headless terminal to maintain state
51
- // Use scrollback 5000 to preserve full history for screen sync on reload
51
+ const scrollback = options.scrollback || 10000;
52
52
  const terminal = new Terminal({
53
53
  cols: cols,
54
54
  rows: rows,
55
- scrollback: 2000,
55
+ scrollback: scrollback,
56
56
  allowProposedApi: true,
57
57
  logLevel: 'off'
58
58
  });
@@ -337,7 +337,7 @@ class SSHManager {
337
337
  }
338
338
 
339
339
  // If full state is too large, fall back to viewport-only
340
- const fullMaxSize = 256 * 1024; // 256KB for full scrollback
340
+ const fullMaxSize = 512 * 1024; // 512KB for full scrollback
341
341
  const viewportMaxSize = 50 * 1024; // 50KB fallback for viewport only
342
342
 
343
343
  if (serializedState.length > fullMaxSize) {
@@ -39,6 +39,7 @@ const defaultConfig = {
39
39
  bookmarks: [],
40
40
  folders: [],
41
41
  passwordHash: null,
42
+ scrollback: 10000,
42
43
  webglRenderer: true,
43
44
  imageAddonEnabled: true
44
45
  };
@@ -212,6 +213,11 @@ function getMobileKeysBarEnabled() {
212
213
  * Get WebGL renderer setting from config
213
214
  * @returns {boolean} WebGL renderer setting
214
215
  */
216
+ function getScrollback() {
217
+ const config = loadConfig();
218
+ return config.scrollback || defaultConfig.scrollback;
219
+ }
220
+
215
221
  function getWebglRenderer() {
216
222
  const config = loadConfig();
217
223
  return config.webglRenderer !== false; // Default to true
@@ -343,6 +349,7 @@ module.exports = {
343
349
  getMobileKeysBarEnabled,
344
350
  getWebglRenderer,
345
351
  getImageAddonEnabled,
352
+ getScrollback,
346
353
  getLayouts,
347
354
  getEnableHttps,
348
355
  getHttpRedirect,
@@ -3720,10 +3720,6 @@ body.dragging-tabs .tabs-container {
3720
3720
  }
3721
3721
 
3722
3722
  /* Settings Modal Styles */
3723
- .setting-group {
3724
- margin-bottom: 20px;
3725
- }
3726
-
3727
3723
  .setting-item {
3728
3724
  display: flex;
3729
3725
  flex-direction: column;
@@ -3852,20 +3848,158 @@ body.dragging-tabs .tabs-container {
3852
3848
  transform: translateX(20px);
3853
3849
  }
3854
3850
 
3855
- .setting-group-title {
3851
+ /* Settings modal sidebar layout */
3852
+ .modal-settings {
3853
+ max-width: 780px;
3854
+ max-height: 80svh;
3855
+ height: 80svh;
3856
+ }
3857
+
3858
+ @supports not (height: 100svh) {
3859
+ .modal-settings {
3860
+ max-height: calc(var(--vh, 1vh) * 80);
3861
+ height: calc(var(--vh, 1vh) * 80);
3862
+ }
3863
+ }
3864
+
3865
+ .modal-settings-layout {
3866
+ display: flex;
3867
+ overflow: hidden;
3868
+ flex: 1;
3869
+ min-height: 0;
3870
+ }
3871
+
3872
+ .settings-nav {
3873
+ width: 180px;
3874
+ min-width: 180px;
3875
+ border-right: 1px solid var(--border-color);
3876
+ display: flex;
3877
+ flex-direction: column;
3878
+ overflow-y: auto;
3879
+ padding: 8px 0;
3880
+ background: var(--bg-tertiary);
3881
+ }
3882
+
3883
+ .settings-nav-item {
3884
+ display: flex;
3885
+ align-items: center;
3886
+ gap: 10px;
3887
+ width: 100%;
3888
+ padding: 10px 16px;
3889
+ background: none;
3890
+ border: none;
3891
+ color: var(--text-secondary);
3892
+ font-size: 13px;
3893
+ font-weight: 500;
3894
+ cursor: pointer;
3895
+ transition: var(--transition-fast);
3896
+ text-align: left;
3897
+ white-space: nowrap;
3898
+ }
3899
+
3900
+ .settings-nav-item:hover {
3901
+ background: var(--bg-hover);
3902
+ color: var(--text-primary);
3903
+ }
3904
+
3905
+ .settings-nav-item.active {
3906
+ color: var(--accent-primary);
3907
+ background: var(--bg-secondary);
3908
+ border-right: 2px solid var(--accent-primary);
3909
+ font-weight: 600;
3910
+ }
3911
+
3912
+ .settings-nav-item i {
3913
+ width: 16px;
3914
+ text-align: center;
3915
+ font-size: 13px;
3916
+ }
3917
+
3918
+ .settings-panel {
3919
+ flex: 1;
3920
+ overflow-y: auto;
3921
+ padding: 16px 20px;
3922
+ min-height: 0;
3923
+ }
3924
+
3925
+ .settings-category-title {
3856
3926
  display: flex;
3857
3927
  align-items: center;
3858
3928
  gap: 8px;
3859
- font-size: 14px;
3929
+ font-size: 15px;
3860
3930
  font-weight: 600;
3861
3931
  color: var(--text-primary);
3862
- margin-bottom: 12px;
3932
+ margin: 0 0 16px 0;
3933
+ padding-bottom: 10px;
3934
+ border-bottom: 1px solid var(--border-color);
3863
3935
  }
3864
3936
 
3865
- .setting-group-title i {
3937
+ .settings-category-title i {
3866
3938
  color: var(--accent-primary);
3867
3939
  }
3868
3940
 
3941
+ .settings-category .setting-item {
3942
+ margin-bottom: 12px;
3943
+ }
3944
+
3945
+ .settings-category .setting-item:last-child {
3946
+ margin-bottom: 0;
3947
+ }
3948
+
3949
+ /* Mobile: dropdown category selector */
3950
+ .settings-mobile-category {
3951
+ display: none;
3952
+ width: 100%;
3953
+ padding: 10px 12px;
3954
+ background: var(--bg-tertiary);
3955
+ border: 1px solid var(--border-color);
3956
+ border-radius: var(--radius-md);
3957
+ color: var(--text-primary);
3958
+ font-size: 14px;
3959
+ font-weight: 500;
3960
+ margin-bottom: 16px;
3961
+ cursor: pointer;
3962
+ appearance: none;
3963
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
3964
+ background-repeat: no-repeat;
3965
+ background-position: right 12px center;
3966
+ padding-right: 36px;
3967
+ }
3968
+
3969
+ @media (max-width: 768px) {
3970
+ .modal-settings {
3971
+ max-width: 100%;
3972
+ }
3973
+
3974
+ .modal-settings-layout {
3975
+ flex-direction: column;
3976
+ }
3977
+
3978
+ .settings-nav {
3979
+ display: none;
3980
+ }
3981
+
3982
+ .settings-mobile-category {
3983
+ display: block;
3984
+ }
3985
+
3986
+ .settings-panel {
3987
+ padding: 12px 16px;
3988
+ }
3989
+
3990
+ .modal-settings {
3991
+ height: auto;
3992
+ max-height: calc(100svh - 20px);
3993
+ max-width: 100%;
3994
+ }
3995
+
3996
+ @supports not (height: 100svh) {
3997
+ .modal-settings {
3998
+ max-height: calc(calc(var(--vh, 1vh) * 100) - 20px);
3999
+ }
4000
+ }
4001
+ }
4002
+
3869
4003
  .plugins-list {
3870
4004
  display: flex;
3871
4005
  flex-direction: column;
@@ -736,206 +736,236 @@
736
736
 
737
737
  <!-- Settings Modal -->
738
738
  <div class="modal" id="settingsModal">
739
- <div class="modal-content">
739
+ <div class="modal-content modal-settings">
740
740
  <div class="modal-header">
741
741
  <h2><i class="fas fa-cog"></i> Settings</h2>
742
742
  <button class="modal-close" id="closeSettingsModal">
743
743
  <i class="fas fa-times"></i>
744
744
  </button>
745
745
  </div>
746
- <div class="modal-body">
747
- <!-- Sticky Sessions Setting -->
748
- <div class="setting-group">
749
- <div class="setting-item">
750
- <label class="setting-label">
751
- <i class="fas fa-link"></i> Sticky Sessions
752
- </label>
753
- <div class="setting-description">
754
- When enabled, sessions and tabs are synchronized across browser windows. When disabled, each browser tab works independently with its own session.
755
- </div>
756
- <div class="setting-control">
757
- <label class="toggle-switch">
758
- <input type="checkbox" id="stickyToggle" checked>
759
- <span class="toggle-slider"></span>
746
+ <div class="modal-settings-layout">
747
+ <nav class="settings-nav" id="settingsNav">
748
+ <button class="settings-nav-item active" data-category="sessions">
749
+ <i class="fas fa-layer-group"></i> <span>Sessions</span>
750
+ </button>
751
+ <button class="settings-nav-item" data-category="terminal">
752
+ <i class="fas fa-terminal"></i> <span>Terminal</span>
753
+ </button>
754
+ <button class="settings-nav-item" data-category="ssh">
755
+ <i class="fas fa-network-wired"></i> <span>SSH</span>
756
+ </button>
757
+ <button class="settings-nav-item" data-category="mobile">
758
+ <i class="fas fa-mobile-alt"></i> <span>Mobile</span>
759
+ </button>
760
+ <button class="settings-nav-item" data-category="security">
761
+ <i class="fas fa-shield-alt"></i> <span>Security</span>
762
+ </button>
763
+ <button class="settings-nav-item" data-category="system">
764
+ <i class="fas fa-server"></i> <span>System</span>
765
+ </button>
766
+ <button class="settings-nav-item" data-category="plugins">
767
+ <i class="fas fa-puzzle-piece"></i> <span>Plugins</span>
768
+ </button>
769
+ </nav>
770
+ <div class="settings-panel" id="settingsPanel">
771
+ <select class="settings-mobile-category" id="settingsCategorySelect">
772
+ <option value="sessions">Sessions</option>
773
+ <option value="terminal">Terminal</option>
774
+ <option value="ssh">SSH</option>
775
+ <option value="mobile">Mobile</option>
776
+ <option value="security">Security</option>
777
+ <option value="system">System</option>
778
+ <option value="plugins">Plugins</option>
779
+ </select>
780
+ <div class="settings-category" id="settings-category-sessions">
781
+ <h3 class="settings-category-title"><i class="fas fa-layer-group"></i> Sessions</h3>
782
+ <div class="setting-item">
783
+ <label class="setting-label">
784
+ <i class="fas fa-link"></i> Sticky Sessions
760
785
  </label>
786
+ <div class="setting-description">
787
+ When enabled, sessions and tabs are synchronized across browser windows. When disabled, each browser tab works independently with its own session.
788
+ </div>
789
+ <div class="setting-control">
790
+ <label class="toggle-switch">
791
+ <input type="checkbox" id="stickyToggle" checked>
792
+ <span class="toggle-slider"></span>
793
+ </label>
794
+ </div>
761
795
  </div>
762
- </div>
763
-
764
- <div class="setting-item">
765
- <label class="setting-label">
766
- <i class="fas fa-hand-paper"></i> Take Control by Default
767
- </label>
768
- <div class="setting-description">
769
- When enabled, automatically take control of existing sessions when you open the app. When disabled, you'll need to click "Take Control" to interact with sessions.
770
- </div>
771
- <div class="setting-control">
772
- <label class="toggle-switch">
773
- <input type="checkbox" id="takeControlDefaultToggle" checked>
774
- <span class="toggle-slider"></span>
796
+ <div class="setting-item">
797
+ <label class="setting-label">
798
+ <i class="fas fa-hand-paper"></i> Take Control by Default
775
799
  </label>
800
+ <div class="setting-description">
801
+ When enabled, automatically take control of existing sessions when you open the app. When disabled, you'll need to click "Take Control" to interact with sessions.
802
+ </div>
803
+ <div class="setting-control">
804
+ <label class="toggle-switch">
805
+ <input type="checkbox" id="takeControlDefaultToggle" checked>
806
+ <span class="toggle-slider"></span>
807
+ </label>
808
+ </div>
776
809
  </div>
777
810
  </div>
778
- </div>
779
-
780
- <!-- SSH Keepalive Settings -->
781
- <div class="setting-group">
782
- <div class="setting-item">
783
- <label class="setting-label">
784
- <i class="fas fa-heartbeat"></i> SSH Keepalive Interval (ms)
785
- </label>
786
- <div class="setting-description">
787
- How often to send keepalive packets to maintain SSH connections. Default: 10000ms (10 seconds).
788
- </div>
789
- <div class="setting-control">
790
- <input type="number" id="sshKeepaliveInterval" class="setting-input" min="1000" max="60000" step="1000" value="10000">
791
- </div>
792
- </div>
793
-
794
- <div class="setting-item">
795
- <label class="setting-label">
796
- <i class="fas fa-exclamation-triangle"></i> SSH Keepalive Count Max
797
- </label>
798
- <div class="setting-description">
799
- Maximum number of missed keepalive responses before disconnecting. Higher values allow longer connection persistence. Default: 1000 (~2.7 hours).
800
- </div>
801
- <div class="setting-control">
802
- <input type="number" id="sshKeepaliveCountMax" class="setting-input" min="1" max="10000" step="1" value="1000">
803
- </div>
804
- </div>
805
- </div>
806
-
807
- <!-- Mobile Keys Bar Setting -->
808
- <div class="setting-group">
809
- <div class="setting-item">
810
- <label class="setting-label">
811
- <i class="fas fa-keyboard"></i> Mobile Keys Bar
812
- </label>
813
- <div class="setting-description">
814
- Show a fixed keyboard bar at the bottom on mobile devices with special keys like ESC, Tab, Ctrl, Alt, and arrow keys for easier terminal input.
815
- </div>
816
- <div class="setting-control">
817
- <label class="toggle-switch">
818
- <input type="checkbox" id="mobileKeysBarToggle" checked>
819
- <span class="toggle-slider"></span>
811
+
812
+ <div class="settings-category" id="settings-category-terminal" style="display:none;">
813
+ <h3 class="settings-category-title"><i class="fas fa-terminal"></i> Terminal</h3>
814
+ <div class="setting-item">
815
+ <label class="setting-label">
816
+ <i class="fas fa-scroll"></i> Scrollback Lines
820
817
  </label>
818
+ <div class="setting-description">
819
+ Number of lines kept in terminal history for scrolling back. Higher values use more memory but preserve more output. Default: 10000. Changes apply to new sessions only.
820
+ </div>
821
+ <div class="setting-control">
822
+ <input type="number" id="scrollbackLines" class="setting-input" min="0" max="100000" step="1000" value="10000">
823
+ </div>
821
824
  </div>
822
- </div>
823
- </div>
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.
825
+ <div class="setting-item">
826
+ <label class="setting-label">
827
+ <i class="fas fa-microchip"></i> WebGL Renderer
828
+ </label>
829
+ <div class="setting-description">
830
+ 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.
831
+ </div>
832
+ <div class="setting-control">
833
+ <label class="toggle-switch">
834
+ <input type="checkbox" id="webglRendererToggle" checked>
835
+ <span class="toggle-slider"></span>
836
+ </label>
837
+ </div>
833
838
  </div>
834
- <div class="setting-control">
835
- <label class="toggle-switch">
836
- <input type="checkbox" id="webglRendererToggle" checked>
837
- <span class="toggle-slider"></span>
839
+ <div class="setting-item">
840
+ <label class="setting-label">
841
+ <i class="fas fa-image"></i> Image Protocol
838
842
  </label>
843
+ <div class="setting-description">
844
+ 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.
845
+ </div>
846
+ <div class="setting-control">
847
+ <label class="toggle-switch">
848
+ <input type="checkbox" id="imageAddonToggle" checked>
849
+ <span class="toggle-slider"></span>
850
+ </label>
851
+ </div>
839
852
  </div>
840
853
  </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.
854
+
855
+ <div class="settings-category" id="settings-category-ssh" style="display:none;">
856
+ <h3 class="settings-category-title"><i class="fas fa-network-wired"></i> SSH</h3>
857
+ <div class="setting-item">
858
+ <label class="setting-label">
859
+ <i class="fas fa-heartbeat"></i> Keepalive Interval (ms)
860
+ </label>
861
+ <div class="setting-description">
862
+ How often to send keepalive packets to maintain SSH connections. Default: 10000ms (10 seconds).
863
+ </div>
864
+ <div class="setting-control">
865
+ <input type="number" id="sshKeepaliveInterval" class="setting-input" min="1000" max="60000" step="1000" value="10000">
866
+ </div>
851
867
  </div>
852
- <div class="setting-control">
853
- <label class="toggle-switch">
854
- <input type="checkbox" id="imageAddonToggle" checked>
855
- <span class="toggle-slider"></span>
868
+ <div class="setting-item">
869
+ <label class="setting-label">
870
+ <i class="fas fa-exclamation-triangle"></i> Keepalive Count Max
856
871
  </label>
872
+ <div class="setting-description">
873
+ Maximum number of missed keepalive responses before disconnecting. Higher values allow longer connection persistence. Default: 1000 (~2.7 hours).
874
+ </div>
875
+ <div class="setting-control">
876
+ <input type="number" id="sshKeepaliveCountMax" class="setting-input" min="1" max="10000" step="1" value="1000">
877
+ </div>
857
878
  </div>
858
879
  </div>
859
- </div>
860
880
 
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>
881
+ <div class="settings-category" id="settings-category-mobile" style="display:none;">
882
+ <h3 class="settings-category-title"><i class="fas fa-mobile-alt"></i> Mobile</h3>
883
+ <div class="setting-item">
884
+ <label class="setting-label">
885
+ <i class="fas fa-keyboard"></i> Mobile Keys Bar
886
+ </label>
887
+ <div class="setting-description">
888
+ Show a fixed keyboard bar at the bottom on mobile devices with special keys like ESC, Tab, Ctrl, Alt, and arrow keys for easier terminal input.
889
+ </div>
890
+ <div class="setting-control">
891
+ <label class="toggle-switch">
892
+ <input type="checkbox" id="mobileKeysBarToggle" checked>
893
+ <span class="toggle-slider"></span>
894
+ </label>
895
+ </div>
874
896
  </div>
875
897
  </div>
876
- </div>
877
898
 
878
- <!-- Password Protection -->
879
- <div class="setting-group">
880
- <div class="setting-item">
881
- <label class="setting-label">
882
- <i class="fas fa-lock"></i> Password Protection
883
- </label>
884
- <div class="setting-description">
885
- Require a password to access the application. When enabled, all endpoints are blocked until the correct password is provided.
886
- </div>
887
- <div class="setting-description password-disclaimer">
888
- <i class="fas fa-exclamation-triangle"></i> <strong>Disclaimer:</strong> This is a basic access restriction, not a substitute for proper authentication. If you expose sshift to a public network, you should use additional security measures such as a reverse proxy with authentication, a VPN, or firewall rules.
899
+ <div class="settings-category" id="settings-category-security" style="display:none;">
900
+ <h3 class="settings-category-title"><i class="fas fa-shield-alt"></i> Security</h3>
901
+ <div class="setting-item">
902
+ <label class="setting-label">
903
+ <i class="fas fa-shield-alt"></i> Trusted Connection
904
+ </label>
905
+ <div class="setting-description">
906
+ View service worker status and download the SSL certificate for trusted access over LAN.
907
+ </div>
908
+ <div class="setting-control">
909
+ <button class="btn btn-secondary" id="showSecurityInfoBtn">
910
+ <i class="fas fa-info-circle"></i> Security Info
911
+ </button>
912
+ </div>
889
913
  </div>
890
- <div class="setting-control">
891
- <button class="btn btn-secondary" id="togglePasswordBtn">
892
- <i class="fas fa-lock-open"></i> <span id="togglePasswordLabel">Enable Password</span>
893
- </button>
914
+ <div class="setting-item">
915
+ <label class="setting-label">
916
+ <i class="fas fa-lock"></i> Password Protection
917
+ </label>
918
+ <div class="setting-description">
919
+ Require a password to access the application. When enabled, all endpoints are blocked until the correct password is provided.
920
+ </div>
921
+ <div class="setting-description password-disclaimer">
922
+ <i class="fas fa-exclamation-triangle"></i> <strong>Disclaimer:</strong> This is a basic access restriction, not a substitute for proper authentication. If you expose sshift to a public network, you should use additional security measures such as a reverse proxy with authentication, a VPN, or firewall rules.
923
+ </div>
924
+ <div class="setting-control">
925
+ <button class="btn btn-secondary" id="togglePasswordBtn">
926
+ <i class="fas fa-lock-open"></i> <span id="togglePasswordLabel">Enable Password</span>
927
+ </button>
928
+ </div>
894
929
  </div>
895
930
  </div>
896
- </div>
897
-
898
- <!-- Manage Sessions -->
899
- <div class="setting-group">
900
- <div class="setting-item">
901
- <label class="setting-label">
902
- <i class="fas fa-tasks"></i> Active Sessions
903
- </label>
904
- <div class="setting-description">
905
- View and manage active SSH and SFTP sessions on the server.
931
+
932
+ <div class="settings-category" id="settings-category-system" style="display:none;">
933
+ <h3 class="settings-category-title"><i class="fas fa-server"></i> System</h3>
934
+ <div class="setting-item">
935
+ <label class="setting-label">
936
+ <i class="fas fa-tasks"></i> Active Sessions
937
+ </label>
938
+ <div class="setting-description">
939
+ View and manage active SSH and SFTP sessions on the server.
940
+ </div>
941
+ <div class="setting-control">
942
+ <button class="btn btn-secondary" id="manageSessionsBtn">
943
+ <i class="fas fa-list"></i> Manage Sessions
944
+ </button>
945
+ </div>
906
946
  </div>
907
- <div class="setting-control">
908
- <button class="btn btn-secondary" id="manageSessionsBtn">
909
- <i class="fas fa-list"></i> Manage Sessions
910
- </button>
947
+ <div class="setting-item">
948
+ <label class="setting-label">
949
+ <i class="fas fa-bug"></i> Debug Info
950
+ </label>
951
+ <div class="setting-description">
952
+ Show certificate and configuration file paths currently in use.
953
+ </div>
954
+ <div class="setting-control">
955
+ <button class="btn btn-secondary" id="showDebugInfoBtn">
956
+ <i class="fas fa-info-circle"></i> View Paths
957
+ </button>
958
+ </div>
911
959
  </div>
912
960
  </div>
913
- </div>
914
-
915
- <!-- Debug Info -->
916
- <div class="setting-group">
917
- <div class="setting-item">
918
- <label class="setting-label">
919
- <i class="fas fa-bug"></i> Debug Info
920
- </label>
921
- <div class="setting-description">
922
- Show certificate and configuration file paths currently in use.
923
- </div>
924
- <div class="setting-control">
925
- <button class="btn btn-secondary" id="showDebugInfoBtn">
926
- <i class="fas fa-info-circle"></i> View Paths
927
- </button>
961
+
962
+ <div class="settings-category" id="settings-category-plugins" style="display:none;">
963
+ <h3 class="settings-category-title"><i class="fas fa-puzzle-piece"></i> Plugins</h3>
964
+ <div id="pluginsList" class="plugins-list">
965
+ <div class="plugins-loading">Loading plugins...</div>
928
966
  </div>
929
967
  </div>
930
968
  </div>
931
-
932
- <!-- Plugins -->
933
- <div class="setting-group">
934
- <h3 class="setting-group-title"><i class="fas fa-puzzle-piece"></i> Plugins</h3>
935
- <div id="pluginsList" class="plugins-list">
936
- <div class="plugins-loading">Loading plugins...</div>
937
- </div>
938
- </div>
939
969
  </div>
940
970
  <div class="modal-footer" style="justify-content: space-between;">
941
971
  <button class="btn btn-danger" id="logoutBtn" style="display: none;">
@@ -97,6 +97,7 @@ class SSHIFTClient {
97
97
  const localMobileKeysBar = localStorage.getItem('mobileKeysBarEnabled');
98
98
  const localWebglRenderer = localStorage.getItem('webglRenderer');
99
99
  const localImageAddonEnabled = localStorage.getItem('imageAddonEnabled');
100
+ const localScrollback = localStorage.getItem('scrollback');
100
101
 
101
102
  // If we have localStorage values, use them
102
103
  if (localSticky !== null) {
@@ -107,13 +108,15 @@ class SSHIFTClient {
107
108
  this.mobileKeysBarEnabled = localMobileKeysBar !== null ? JSON.parse(localMobileKeysBar) : true;
108
109
  this.webglRenderer = localWebglRenderer !== null ? JSON.parse(localWebglRenderer) : true;
109
110
  this.imageAddonEnabled = localImageAddonEnabled !== null ? JSON.parse(localImageAddonEnabled) : true;
111
+ this.scrollback = localScrollback !== null ? parseInt(localScrollback) : 10000;
110
112
  console.log('[SSHIFT] Loaded from localStorage - Sticky:', this.sticky ? 'enabled' : 'disabled',
111
113
  'Take Control Default:', this.takeControlDefault ? 'enabled' : 'disabled',
112
114
  'Keepalive Interval:', this.sshKeepaliveInterval,
113
115
  'Keepalive Count Max:', this.sshKeepaliveCountMax,
114
116
  'Mobile Keys Bar:', this.mobileKeysBarEnabled ? 'enabled' : 'disabled',
115
117
  'WebGL Renderer:', this.webglRenderer ? 'enabled' : 'disabled',
116
- 'Image Addon:', this.imageAddonEnabled ? 'enabled' : 'disabled');
118
+ 'Image Addon:', this.imageAddonEnabled ? 'enabled' : 'disabled',
119
+ 'Scrollback:', this.scrollback);
117
120
  return;
118
121
  }
119
122
 
@@ -132,6 +135,7 @@ class SSHIFTClient {
132
135
  this.mobileKeysBarEnabled = config.mobileKeysBarEnabled !== undefined ? config.mobileKeysBarEnabled : true;
133
136
  this.webglRenderer = config.webglRenderer !== undefined ? config.webglRenderer : true;
134
137
  this.imageAddonEnabled = config.imageAddonEnabled !== undefined ? config.imageAddonEnabled : true;
138
+ this.scrollback = config.scrollback || 10000;
135
139
  this.passwordEnabled = config.passwordEnabled || false;
136
140
  console.log('[SSHIFT] Loaded from server - Sticky:', this.sticky ? 'enabled' : 'disabled',
137
141
  'Take Control Default:', this.takeControlDefault ? 'enabled' : 'disabled',
@@ -139,7 +143,8 @@ class SSHIFTClient {
139
143
  'Keepalive Count Max:', this.sshKeepaliveCountMax,
140
144
  'Mobile Keys Bar:', this.mobileKeysBarEnabled ? 'enabled' : 'disabled',
141
145
  'WebGL Renderer:', this.webglRenderer ? 'enabled' : 'disabled',
142
- 'Image Addon:', this.imageAddonEnabled ? 'enabled' : 'disabled');
146
+ 'Image Addon:', this.imageAddonEnabled ? 'enabled' : 'disabled',
147
+ 'Scrollback:', this.scrollback);
143
148
  } catch (err) {
144
149
  console.error('[SSHIFT] Failed to load config:', err);
145
150
  this.sticky = true; // Default to true
@@ -149,6 +154,7 @@ class SSHIFTClient {
149
154
  this.mobileKeysBarEnabled = true; // Default to true
150
155
  this.webglRenderer = true; // Default to true
151
156
  this.imageAddonEnabled = true; // Default to true
157
+ this.scrollback = 10000;
152
158
  }
153
159
  }
154
160
 
@@ -4746,6 +4752,23 @@ const wheelHandler = (e) => {
4746
4752
  }
4747
4753
 
4748
4754
  // Settings Modal
4755
+ switchSettingsCategory(category) {
4756
+ const categories = document.querySelectorAll('.settings-category');
4757
+ const navItems = document.querySelectorAll('.settings-nav-item');
4758
+ const select = document.getElementById('settingsCategorySelect');
4759
+
4760
+ categories.forEach(el => {
4761
+ el.style.display = 'none';
4762
+ });
4763
+ navItems.forEach(item => {
4764
+ item.classList.toggle('active', item.dataset.category === category);
4765
+ });
4766
+ if (select) select.value = category;
4767
+
4768
+ const target = document.getElementById('settings-category-' + category);
4769
+ if (target) target.style.display = 'block';
4770
+ }
4771
+
4749
4772
  openSettingsModal() {
4750
4773
  // Load current sticky setting
4751
4774
  const stickyToggle = document.getElementById('stickyToggle');
@@ -4795,10 +4818,28 @@ const wheelHandler = (e) => {
4795
4818
  // Load plugins
4796
4819
  this.loadPlugins();
4797
4820
 
4821
+ // Reset to first category
4822
+ this.switchSettingsCategory('sessions');
4823
+
4798
4824
  this.openModal('settingsModal');
4799
4825
  }
4800
4826
 
4801
4827
  initSettingsModalHandlers() {
4828
+ // Settings category navigation (sidebar + mobile dropdown)
4829
+ const navItems = document.querySelectorAll('.settings-nav-item');
4830
+ navItems.forEach(item => {
4831
+ item.addEventListener('click', () => {
4832
+ this.switchSettingsCategory(item.dataset.category);
4833
+ });
4834
+ });
4835
+
4836
+ const categorySelect = document.getElementById('settingsCategorySelect');
4837
+ if (categorySelect) {
4838
+ categorySelect.addEventListener('change', (e) => {
4839
+ this.switchSettingsCategory(e.target.value);
4840
+ });
4841
+ }
4842
+
4802
4843
  // Close button
4803
4844
  const closeBtn = document.getElementById('closeSettingsModal');
4804
4845
  if (closeBtn) {
@@ -4831,10 +4872,15 @@ const wheelHandler = (e) => {
4831
4872
  keepaliveIntervalInput.value = this.sshKeepaliveInterval;
4832
4873
  }
4833
4874
 
4834
- if (keepaliveCountMaxInput && this.sshKeepaliveCountMax) {
4875
+ if (keepaliveCountMaxInput && this.sshKeepaliveCountMax) {
4835
4876
  keepaliveCountMaxInput.value = this.sshKeepaliveCountMax;
4836
4877
  }
4837
4878
 
4879
+ const scrollbackInput = document.getElementById('scrollbackLines');
4880
+ if (scrollbackInput && this.scrollback) {
4881
+ scrollbackInput.value = this.scrollback;
4882
+ }
4883
+
4838
4884
  // Revert mobile keys bar setting
4839
4885
  const mobileKeysBarToggle = document.getElementById('mobileKeysBarToggle');
4840
4886
  if (mobileKeysBarToggle) {
@@ -4886,6 +4932,11 @@ const wheelHandler = (e) => {
4886
4932
  this.sshKeepaliveCountMax = parseInt(keepaliveCountMaxInput.value) || 1000;
4887
4933
  }
4888
4934
 
4935
+ const scrollbackInput = document.getElementById('scrollbackLines');
4936
+ if (scrollbackInput) {
4937
+ this.scrollback = Math.max(0, Math.min(100000, parseInt(scrollbackInput.value) || 10000));
4938
+ }
4939
+
4889
4940
  // Save mobile keys bar setting
4890
4941
  if (mobileKeysBarToggle) {
4891
4942
  this.mobileKeysBarEnabled = mobileKeysBarToggle.checked;
@@ -4909,6 +4960,7 @@ const wheelHandler = (e) => {
4909
4960
  'takeControlDefault:', this.takeControlDefault,
4910
4961
  'keepaliveInterval:', this.sshKeepaliveInterval,
4911
4962
  'keepaliveCountMax:', this.sshKeepaliveCountMax,
4963
+ 'scrollback:', this.scrollback,
4912
4964
  'mobileKeysBarEnabled:', this.mobileKeysBarEnabled,
4913
4965
  'webglRenderer:', this.webglRenderer,
4914
4966
  'imageAddonEnabled:', this.imageAddonEnabled);
@@ -5752,6 +5804,7 @@ const wheelHandler = (e) => {
5752
5804
  localStorage.setItem('mobileKeysBarEnabled', JSON.stringify(this.mobileKeysBarEnabled));
5753
5805
  localStorage.setItem('webglRenderer', JSON.stringify(this.webglRenderer));
5754
5806
  localStorage.setItem('imageAddonEnabled', JSON.stringify(this.imageAddonEnabled));
5807
+ localStorage.setItem('scrollback', this.scrollback || 10000);
5755
5808
 
5756
5809
  // Save to server config
5757
5810
  const headers = { 'Content-Type': 'application/json' };
@@ -5766,7 +5819,8 @@ const wheelHandler = (e) => {
5766
5819
  sshKeepaliveCountMax: this.sshKeepaliveCountMax || 1000,
5767
5820
  mobileKeysBarEnabled: this.mobileKeysBarEnabled,
5768
5821
  webglRenderer: this.webglRenderer,
5769
- imageAddonEnabled: this.imageAddonEnabled
5822
+ imageAddonEnabled: this.imageAddonEnabled,
5823
+ scrollback: this.scrollback || 10000
5770
5824
  })
5771
5825
  }).then(response => {
5772
5826
  if (!response.ok) {
@@ -6704,7 +6758,7 @@ const wheelHandler = (e) => {
6704
6758
  lineHeight: 1.0,
6705
6759
  cursorBlink: false,
6706
6760
  cursorStyle: 'block',
6707
- scrollback: 2000,
6761
+ scrollback: this.scrollback || 10000,
6708
6762
  allowProposedApi: true,
6709
6763
  convertEol: true,
6710
6764
  allowTransparency: false,