@aion0/forge 0.2.17 → 0.2.18
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/app/api/version/route.ts +6 -4
- package/components/Dashboard.tsx +19 -10
- package/package.json +1 -1
package/app/api/version/route.ts
CHANGED
|
@@ -16,8 +16,8 @@ const CURRENT_VERSION = (() => {
|
|
|
16
16
|
let cachedLatest: { version: string; checkedAt: number } | null = null;
|
|
17
17
|
const CACHE_TTL = 10 * 60 * 1000; // 10 minutes
|
|
18
18
|
|
|
19
|
-
async function getLatestVersion(): Promise<string> {
|
|
20
|
-
if (cachedLatest && Date.now() - cachedLatest.checkedAt < CACHE_TTL) {
|
|
19
|
+
async function getLatestVersion(force = false): Promise<string> {
|
|
20
|
+
if (!force && cachedLatest && Date.now() - cachedLatest.checkedAt < CACHE_TTL) {
|
|
21
21
|
return cachedLatest.version;
|
|
22
22
|
}
|
|
23
23
|
try {
|
|
@@ -47,9 +47,11 @@ function compareVersions(a: string, b: string): number {
|
|
|
47
47
|
return 0;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
export async function GET() {
|
|
50
|
+
export async function GET(req: Request) {
|
|
51
|
+
const { searchParams } = new URL(req.url);
|
|
52
|
+
const force = searchParams.has('force');
|
|
51
53
|
const current = CURRENT_VERSION;
|
|
52
|
-
const latest = await getLatestVersion();
|
|
54
|
+
const latest = await getLatestVersion(force);
|
|
53
55
|
const hasUpdate = latest && compareVersions(current, latest) < 0;
|
|
54
56
|
|
|
55
57
|
return NextResponse.json({
|
package/components/Dashboard.tsx
CHANGED
|
@@ -127,6 +127,19 @@ export default function Dashboard({ user }: { user: any }) {
|
|
|
127
127
|
{upgrading ? 'Upgrading...' : `Update v${versionInfo.latest}`}
|
|
128
128
|
</button>
|
|
129
129
|
)}
|
|
130
|
+
{!versionInfo.hasUpdate && !upgradeResult && (
|
|
131
|
+
<button
|
|
132
|
+
onClick={async () => {
|
|
133
|
+
const res = await fetch('/api/version?force=1');
|
|
134
|
+
const data = await res.json();
|
|
135
|
+
setVersionInfo(data);
|
|
136
|
+
}}
|
|
137
|
+
className="text-[9px] px-1.5 py-0.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)]"
|
|
138
|
+
title="Check for updates"
|
|
139
|
+
>
|
|
140
|
+
↻
|
|
141
|
+
</button>
|
|
142
|
+
)}
|
|
130
143
|
{upgradeResult && (
|
|
131
144
|
<span className="text-[9px] text-[var(--green)] max-w-[200px] truncate" title={upgradeResult}>
|
|
132
145
|
{upgradeResult}
|
|
@@ -187,16 +200,6 @@ export default function Dashboard({ user }: { user: any }) {
|
|
|
187
200
|
>
|
|
188
201
|
Pipelines
|
|
189
202
|
</button>
|
|
190
|
-
<button
|
|
191
|
-
onClick={() => setViewMode('sessions')}
|
|
192
|
-
className={`text-[11px] px-2.5 py-0.5 rounded transition-colors ${
|
|
193
|
-
viewMode === 'sessions'
|
|
194
|
-
? 'bg-[var(--bg-secondary)] text-[var(--text-primary)] shadow-sm'
|
|
195
|
-
: 'text-[var(--text-secondary)] hover:text-[var(--text-primary)]'
|
|
196
|
-
}`}
|
|
197
|
-
>
|
|
198
|
-
Sessions
|
|
199
|
-
</button>
|
|
200
203
|
<button
|
|
201
204
|
onClick={() => setViewMode('preview')}
|
|
202
205
|
className={`text-[11px] px-2.5 py-0.5 rounded transition-colors ${
|
|
@@ -234,6 +237,12 @@ export default function Dashboard({ user }: { user: any }) {
|
|
|
234
237
|
)}
|
|
235
238
|
</span>
|
|
236
239
|
)}
|
|
240
|
+
<button
|
|
241
|
+
onClick={() => setViewMode('sessions')}
|
|
242
|
+
className={`text-xs ${viewMode === 'sessions' ? 'text-[var(--text-primary)]' : 'text-[var(--text-secondary)] hover:text-[var(--text-primary)]'}`}
|
|
243
|
+
>
|
|
244
|
+
System Status
|
|
245
|
+
</button>
|
|
237
246
|
<button
|
|
238
247
|
onClick={() => setShowSettings(true)}
|
|
239
248
|
className="text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)]"
|
package/package.json
CHANGED