clocktopus 1.6.3 → 1.6.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.
@@ -11,7 +11,6 @@ import timerRoutes from './routes/timer.js';
11
11
  import dataRoutes from './routes/data.js';
12
12
  import monitorRoutes from './routes/monitor.js';
13
13
  import calendarRoutes from './routes/calendar.js';
14
- import serverRoutes from './routes/server.js';
15
14
  const app = new Hono();
16
15
  app.use('*', cors());
17
16
  app.get('/', (c) => c.html(indexPage()));
@@ -23,7 +22,6 @@ app.route('/api', timerRoutes);
23
22
  app.route('/api', dataRoutes);
24
23
  app.route('/api', monitorRoutes);
25
24
  app.route('/api', calendarRoutes);
26
- app.route('/api', serverRoutes);
27
25
  export function startDashboard() {
28
26
  console.log(`Clocktopus dashboard running at http://localhost:${DASHBOARD_PORT}`);
29
27
  serve({ fetch: app.fetch, port: DASHBOARD_PORT });
@@ -111,23 +111,9 @@ export function indexPage() {
111
111
  .toggle input:checked + .slider { background: #238636; }
112
112
  .toggle input:checked + .slider::before { transform: translateX(16px); background: #fff; }
113
113
 
114
- /* Server restart overlay */
115
- .overlay { position: fixed; inset: 0; background: rgba(13, 17, 23, 0.92); display: none; align-items: center; justify-content: center; z-index: 9999; }
116
- .overlay.active { display: flex; }
117
- .overlay-box { background: #1c1f26; border: 1px solid #30363d; border-radius: 12px; padding: 2rem 2.5rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
118
- .spinner { width: 32px; height: 32px; border: 3px solid #30363d; border-top-color: #d29922; border-radius: 50%; animation: spin 0.8s linear infinite; }
119
- .overlay-text { color: #e1e4e8; font-size: 0.95rem; }
120
- @keyframes spin { to { transform: rotate(360deg); } }
121
114
  </style>
122
115
  </head>
123
116
  <body oncontextmenu="return false;">
124
- <div id="server-overlay" class="overlay">
125
- <div class="overlay-box">
126
- <div class="spinner"></div>
127
- <div class="overlay-text" id="server-overlay-text">Restarting Server...</div>
128
- </div>
129
- </div>
130
-
131
117
  <div class="header">
132
118
  <h1>Clocktopus</h1>
133
119
  <div class="nav">
@@ -294,17 +280,6 @@ export function indexPage() {
294
280
  <div class="msg" id="google-msg"></div>
295
281
  </div>
296
282
 
297
- <!-- Server -->
298
- <div class="card">
299
- <div class="card-header">
300
- <div class="dot green"></div>
301
- <h2>Server</h2>
302
- </div>
303
- <p style="font-size:0.85rem;color:#8b949e;margin-bottom:0.5rem;">Restart the Clocktopus dashboard server.</p>
304
- <button id="server-restart-btn" onclick="restartServer()" style="background:#30363d;">Restart Server</button>
305
- <div class="msg" id="server-msg"></div>
306
- </div>
307
-
308
283
  <!-- Jira -->
309
284
  <div class="card">
310
285
  <div class="card-header">
@@ -734,78 +709,6 @@ export function indexPage() {
734
709
  }
735
710
  }
736
711
 
737
- // --- Server restart ---
738
- async function restartServer() {
739
- const btn = document.getElementById('server-restart-btn');
740
- const overlay = document.getElementById('server-overlay');
741
- const overlayText = document.getElementById('server-overlay-text');
742
- btn.disabled = true;
743
- btn.textContent = 'Restarting...';
744
- overlayText.textContent = 'Restarting Server...';
745
- overlay.classList.add('active');
746
- setMsg('server-msg', '', true);
747
-
748
- const inTauri = !!(window.__TAURI_INTERNALS__ || window.__TAURI__);
749
-
750
- if (inTauri) {
751
- try {
752
- await window.__TAURI__.core.invoke('restart_server');
753
- } catch (err) {
754
- overlayText.textContent = 'Restart failed.';
755
- setTimeout(function() {
756
- overlay.classList.remove('active');
757
- btn.disabled = false;
758
- btn.textContent = 'Restart Server';
759
- }, 2500);
760
- return;
761
- }
762
- } else {
763
- let managed = false;
764
- try {
765
- const res = await fetch('/api/server/restart', { method: 'POST' });
766
- const data = await res.json();
767
- managed = !!data.managed;
768
- } catch {
769
- // Expected — server dies mid-response
770
- }
771
- if (!managed) {
772
- overlayText.textContent = 'Server stopped. Start it manually: clocktopus serve';
773
- setMsg('server-msg', 'Not managed by PM2 — restart manually.', false);
774
- setTimeout(function() {
775
- overlay.classList.remove('active');
776
- btn.disabled = false;
777
- btn.textContent = 'Restart Server';
778
- }, 3500);
779
- return;
780
- }
781
- }
782
-
783
- // Poll /api/status until server responds
784
- const start = Date.now();
785
- const MAX_WAIT_MS = 30000;
786
- async function poll() {
787
- try {
788
- const r = await fetch('/api/status', { cache: 'no-store' });
789
- if (r.ok) {
790
- overlayText.textContent = 'Server back online. Reloading...';
791
- setTimeout(function() { window.location.reload(); }, 400);
792
- return;
793
- }
794
- } catch {}
795
- if (Date.now() - start > MAX_WAIT_MS) {
796
- overlayText.textContent = 'Server did not come back. Check logs.';
797
- setTimeout(function() {
798
- overlay.classList.remove('active');
799
- btn.disabled = false;
800
- btn.textContent = 'Restart Server';
801
- }, 3000);
802
- return;
803
- }
804
- setTimeout(poll, 500);
805
- }
806
- setTimeout(poll, 1000);
807
- }
808
-
809
712
  // --- Projects ---
810
713
  async function loadProjects() {
811
714
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clocktopus",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {