clocktopus 1.6.2 → 1.6.4

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 CHANGED
@@ -195,6 +195,44 @@ cd ~/.bun/install/global/node_modules/macos-notification-state && npx node-gyp r
195
195
  apt install libxss-dev pkg-config build-essential
196
196
  ```
197
197
 
198
+ ### node-gyp error: `Cannot find module './entry-index'`
199
+
200
+ During install you may see:
201
+
202
+ ```
203
+ gyp ERR! stack Error: Cannot find module './entry-index'
204
+ gyp ERR! stack Require stack:
205
+ gyp ERR! stack - .../node_modules/cacache/lib/get.js
206
+ ...
207
+ error: install script from "desktop-idle" exited with 1
208
+ ```
209
+
210
+ Caused by a broken `node-gyp@12.2.0` / `cacache` bundle fetched via `bunx` on newer Node versions (e.g. Node 25).
211
+
212
+ Fixes, in order:
213
+
214
+ 1. **Use Node 20 LTS** (most reliable):
215
+
216
+ ```bash
217
+ nvm install 20 && nvm use 20
218
+ bun i -g clocktopus@latest --trust
219
+ ```
220
+
221
+ 2. **Clear the bunx node-gyp cache** and retry:
222
+
223
+ ```bash
224
+ rm -rf /var/folders/**/bunx-*-node-gyp@latest
225
+ bun i -g clocktopus@latest --trust
226
+ ```
227
+
228
+ 3. **Install via npm** (uses its own node-gyp):
229
+
230
+ ```bash
231
+ npm i -g clocktopus@latest
232
+ ```
233
+
234
+ `desktop-idle` is a native addon and must be compiled at install time — skipping postinstall leaves idle detection disabled.
235
+
198
236
  ## License
199
237
 
200
238
  MIT
@@ -745,24 +745,40 @@ export function indexPage() {
745
745
  overlay.classList.add('active');
746
746
  setMsg('server-msg', '', true);
747
747
 
748
- let managed = false;
749
- try {
750
- const res = await fetch('/api/server/restart', { method: 'POST' });
751
- const data = await res.json();
752
- managed = !!data.managed;
753
- } catch {
754
- // Expected — server dies mid-response
755
- }
748
+ const tauriApi = window.__TAURI__ || window.__TAURI_INTERNALS__;
749
+ const inTauri = !!(tauriApi && tauriApi.core && tauriApi.core.invoke);
756
750
 
757
- if (!managed) {
758
- overlayText.textContent = 'Server stopped. Start it manually: clocktopus serve';
759
- setMsg('server-msg', 'Not managed by PM2 — restart manually.', false);
760
- setTimeout(function() {
761
- overlay.classList.remove('active');
762
- btn.disabled = false;
763
- btn.textContent = 'Restart Server';
764
- }, 3500);
765
- return;
751
+ if (inTauri) {
752
+ try {
753
+ await tauriApi.core.invoke('restart_server');
754
+ } catch (err) {
755
+ overlayText.textContent = 'Restart failed: ' + (err && err.message ? err.message : String(err));
756
+ setTimeout(function() {
757
+ overlay.classList.remove('active');
758
+ btn.disabled = false;
759
+ btn.textContent = 'Restart Server';
760
+ }, 4000);
761
+ return;
762
+ }
763
+ } else {
764
+ let managed = false;
765
+ try {
766
+ const res = await fetch('/api/server/restart', { method: 'POST' });
767
+ const data = await res.json();
768
+ managed = !!data.managed;
769
+ } catch {
770
+ // Expected — server dies mid-response
771
+ }
772
+ if (!managed) {
773
+ overlayText.textContent = 'Server stopped. Start it manually: clocktopus serve';
774
+ setMsg('server-msg', 'Not managed by PM2 — restart manually.', false);
775
+ setTimeout(function() {
776
+ overlay.classList.remove('active');
777
+ btn.disabled = false;
778
+ btn.textContent = 'Restart Server';
779
+ }, 3500);
780
+ return;
781
+ }
766
782
  }
767
783
 
768
784
  // Poll /api/status until server responds
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clocktopus",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {