clocktopus 1.3.0 → 1.4.0
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 +9 -0
- package/dist/dashboard/routes/timer.js +19 -1
- package/dist/dashboard/server.js +2 -0
- package/dist/dashboard/views.js +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -152,6 +152,15 @@ Go to **System Settings > Notifications** and ensure **terminal-notifier** has n
|
|
|
152
152
|
|
|
153
153
|
Enable **Require password immediately** in System Settings > Lock Screen.
|
|
154
154
|
|
|
155
|
+
### Uninstall
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
bun remove -g clocktopus
|
|
159
|
+
|
|
160
|
+
# If the above doesn't work, delete the binary directly:
|
|
161
|
+
rm ~/.bun/bin/clocktopus
|
|
162
|
+
```
|
|
163
|
+
|
|
155
164
|
### Bun installs an old version
|
|
156
165
|
|
|
157
166
|
Bun caches registry data aggressively. Clear the cache and reinstall:
|
|
@@ -15,8 +15,26 @@ timerRoutes.get('/timer/active', async (c) => {
|
|
|
15
15
|
if (!user)
|
|
16
16
|
return c.json({ active: false });
|
|
17
17
|
const timer = await clockify.getActiveTimer(user.defaultWorkspace, user.id);
|
|
18
|
-
if (!timer)
|
|
18
|
+
if (!timer) {
|
|
19
|
+
// Timer stopped externally (e.g. in Clockify app) — close any lingering open session
|
|
20
|
+
const openSession = getOpenSession();
|
|
21
|
+
if (openSession) {
|
|
22
|
+
const completedAt = new Date().toISOString();
|
|
23
|
+
completeLatestSession(completedAt, false);
|
|
24
|
+
if (openSession.jiraTicket) {
|
|
25
|
+
const timeSpentSeconds = Math.round((new Date(completedAt).getTime() - new Date(openSession.startedAt).getTime()) / 1000);
|
|
26
|
+
if (timeSpentSeconds >= 60) {
|
|
27
|
+
try {
|
|
28
|
+
await stopJiraTimer(openSession.jiraTicket, timeSpentSeconds);
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
console.error('Error stopping Jira timer on external stop:', err);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
19
36
|
return c.json({ active: false });
|
|
37
|
+
}
|
|
20
38
|
// Sync externally-started timers (e.g. from Clockify app or Jira plugin) to DB
|
|
21
39
|
const timerStart = timer.timeInterval.start;
|
|
22
40
|
const jiraTicket = extractJiraTicket(timer.description ?? '');
|
package/dist/dashboard/server.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
|
+
import { cors } from 'hono/cors';
|
|
2
3
|
import { serve } from '@hono/node-server';
|
|
3
4
|
import { indexPage } from './views.js';
|
|
4
5
|
import statusRoutes from './routes/status.js';
|
|
@@ -10,6 +11,7 @@ import dataRoutes from './routes/data.js';
|
|
|
10
11
|
import monitorRoutes from './routes/monitor.js';
|
|
11
12
|
import calendarRoutes from './routes/calendar.js';
|
|
12
13
|
const app = new Hono();
|
|
14
|
+
app.use('*', cors());
|
|
13
15
|
app.get('/', (c) => c.html(indexPage()));
|
|
14
16
|
app.route('/api', statusRoutes);
|
|
15
17
|
app.route('/api', clockifyRoutes);
|
package/dist/dashboard/views.js
CHANGED
|
@@ -7,7 +7,7 @@ export function indexPage() {
|
|
|
7
7
|
<title>Clocktopus Dashboard</title>
|
|
8
8
|
<style>
|
|
9
9
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
10
|
-
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background:
|
|
10
|
+
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: transparent; color: #e1e4e8; padding: 2rem; }
|
|
11
11
|
h1 { font-size: 1.8rem; margin-bottom: 0; color: #fff; }
|
|
12
12
|
h2 { font-size: 1.1rem; color: #fff; margin-bottom: 1rem; }
|
|
13
13
|
|
|
@@ -106,7 +106,7 @@ export function indexPage() {
|
|
|
106
106
|
.toggle input:checked + .slider::before { transform: translateX(16px); background: #fff; }
|
|
107
107
|
</style>
|
|
108
108
|
</head>
|
|
109
|
-
<body>
|
|
109
|
+
<body oncontextmenu="return false;">
|
|
110
110
|
<div class="header">
|
|
111
111
|
<h1>Clocktopus</h1>
|
|
112
112
|
<div class="nav">
|
|
@@ -343,6 +343,11 @@ export function indexPage() {
|
|
|
343
343
|
</div>
|
|
344
344
|
|
|
345
345
|
<script>
|
|
346
|
+
// Disable WebKit's Back/Forward/Reload context menu. Capture-phase and
|
|
347
|
+
// attached on window so it runs before any app handler and wins the race
|
|
348
|
+
// with the native WKWebView menu.
|
|
349
|
+
window.addEventListener('contextmenu', e => e.preventDefault(), { capture: true });
|
|
350
|
+
|
|
346
351
|
let elapsedInterval = null;
|
|
347
352
|
let currentPage = 1;
|
|
348
353
|
let totalPages = 1;
|