Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
services:
duskmeter:
# Use the published image from GitHub Container Registry (default).
# Remove the `image` line and uncomment `build: .` to build locally instead.
image: ghcr.io/thelinuxguy-ssh/duskmeter:latest
# build: .
# Build locally from source.
# To use the published image instead, comment `build:` and uncomment `image:`.
build: .
# image: ghcr.io/thelinuxguy-ssh/duskmeter:latest
ports:
- "3000:3000"
environment:
Expand Down
5 changes: 3 additions & 2 deletions src/lib/components/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@
<div class="flex items-center gap-2 ml-auto">
<button
onclick={onRefresh}
class="flex items-center gap-1.5 h-7 px-2.5 text-[11px] font-medium text-text-dim hover:text-accent transition-colors duration-150"
disabled={$refreshing}
class="flex items-center gap-1.5 h-7 px-2.5 text-[11px] font-medium transition-colors duration-150 {$refreshing ? 'text-text-faint cursor-wait opacity-60' : 'text-text-dim hover:text-accent'}"
aria-label="Refresh data"
title="Refresh data from satellite and ground sources"
title={$refreshing ? "Syncing data from satellite and ground sources" : "Refresh data from satellite and ground sources"}
>
<RefreshCw size={13} class={$refreshing ? "animate-spin" : ""} />
<span class="hidden md:inline">{$refreshing ? "Syncing…" : "Refresh"}</span>
Expand Down
3 changes: 0 additions & 3 deletions src/routes/(marketing)/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<svelte:head>
<title>Duskmeter — Corrected Sky Brightness Estimates</title>
<meta name="description" content="Duskmeter fuses VIIRS satellite radiance with ground-truth sky brightness observations from Globe at Night to produce corrected light pollution estimates for observatories, dark-sky parks, and researchers." />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous" />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&family=Space+Grotesk:wght@500;600;700&display=swap" rel="stylesheet" />
</svelte:head>

<script lang="ts">
Expand Down
8 changes: 0 additions & 8 deletions src/routes/api/assess-all/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ export async function GET() {

export async function POST({ url }) {
try {
const lastAssess = db.prepare("SELECT value FROM sync_state WHERE key = 'last_assess_at'").get() as { value: string } | undefined;
if (lastAssess) {
const elapsed = Date.now() - Date.parse(lastAssess.value);
if (elapsed < 30 * 60 * 1000) {
return json({ error: "Assessment ran recently. Wait 30 minutes between runs." }, { status: 429 });
}
}

const runLlm = url.searchParams.get("llm") === "true";
const results = await assessAllSites(runLlm);
db.prepare("INSERT OR REPLACE INTO sync_state (key, value) VALUES ('last_assess_at', ?)").run(new Date().toISOString());
Expand Down
10 changes: 0 additions & 10 deletions src/routes/api/sites/[id]/assess/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,11 @@ import { checkSite } from "$lib/server/alerts";

export async function POST({ params, url }) {
try {
const lastKey = `assess_${params.id}_at`;
const last = db.prepare("SELECT value FROM sync_state WHERE key = ?").get(lastKey) as { value: string } | undefined;
if (last) {
const elapsed = Date.now() - Date.parse(last.value);
if (elapsed < 5 * 60 * 1000) {
return json({ error: "Assessment ran recently. Wait 5 minutes between runs for this site." }, { status: 429 });
}
}

const runLlm = url.searchParams.get("llm") === "true";
const result = await assessSite(params.id, runLlm);
if (!result) {
return json({ error: "Site not found" }, { status: 404 });
}
db.prepare("INSERT OR REPLACE INTO sync_state (key, value) VALUES (?, ?)").run(lastKey, new Date().toISOString());
const alerts = checkSite(params.id);
return json({ ...result, alertsCreated: alerts.created, alerts: alerts.alerts });
} catch (e: any) {
Expand Down
Loading