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
9 changes: 8 additions & 1 deletion app/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,15 @@ app.route("/api/stories", storiesRoutes);
app.use("/api/settings/*", requireAuth);
app.route("/api/settings", settingsRoutes);

// App version (read once at startup)
const appVersion = (() => {
try {
return JSON.parse(fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf-8")).version;
} catch { return "unknown"; }
})();

// Health check
app.get("/api/health", (c) => c.json({ status: "ok" }));
app.get("/api/health", (c) => c.json({ status: "ok", version: appVersion }));

// In production, serve the built frontend
const distPath = path.join(__dirname, "web", "dist");
Expand Down
9 changes: 8 additions & 1 deletion app/web/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ function WalletSetupPage({ token, onComplete }: { token: string; onComplete: ()
export function Layout({ token, onLogout }: { token: string; onLogout: () => void }) {
const [page, setPage] = useState<Page>("home");
const [storyCount, setStoryCount] = useState(0);
const [appVersion, setAppVersion] = useState<string | null>(null);

const authFetch = useCallback(async (url: string, opts?: RequestInit) => {
return fetch(url, {
Expand All @@ -80,6 +81,12 @@ export function Layout({ token, onLogout }: { token: string; onLogout: () => voi
});
}, [token]);

useEffect(() => {
fetch("/api/health").then((r) => r.json()).then((d) => {
if (d.version) setAppVersion(d.version);
}).catch(() => {});
}, []);

useEffect(() => {
async function checkSetup() {
try {
Expand Down Expand Up @@ -111,7 +118,7 @@ export function Layout({ token, onLogout }: { token: string; onLogout: () => voi
<button onClick={() => { if (page !== "wallet-setup") setPage("home"); }} className="flex items-center gap-2 hover:opacity-80">
<span className="text-accent text-sm font-bold tracking-tight">PlotLink OWS</span>
</button>
<span className="text-muted text-[10px] uppercase tracking-wider">writer</span>
<span className="text-muted text-[10px] uppercase tracking-wider">writer{appVersion ? ` v${appVersion}` : ""}</span>
</div>
{page !== "wallet-setup" && (
<nav className="flex items-center gap-4">
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plotlink-ows",
"version": "1.0.30",
"version": "1.0.31",
"bin": {
"plotlink-ows": "./bin/plotlink-ows.js"
},
Expand Down
Loading