mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-11-29 15:51:52 +00:00
Profullstack footer on the app.logicsrc.com sign-in page (#255)
Some checks are pending
CI / build (push) Waiting to run
Deploy to dev2 / deploy (push) Waiting to run
test / test (push) Waiting to run
Some checks are pending
CI / build (push) Waiting to run
Deploy to dev2 / deploy (push) Waiting to run
test / test (push) Waiting to run
* Profullstack footer on the app.logicsrc.com sign-in page (webring + built.indie + pwamart badges) Server-rendered @profullstack/footer (clearnet template) under the LogicSRC footer on the public sign-in page (/), bundled at boot and refreshed from the @latest template every 15 min. Serves /.well-known/openwebring.json for the Profullstack ring. Lockfile footer 0.2.1 -> 0.2.6 (checked with bun 1.4.2 --frozen-lockfile). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * PWA manifest + meta description: say what the app is (it carried a moshcode tagline) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(web): ring nav has previous/next only since footer 0.2.2 (no random hop) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
580817b06f
commit
ff0c903c6d
9 changed files with 69 additions and 4 deletions
|
|
@ -98,7 +98,8 @@ describe("server-rendered page markup", () => {
|
|||
const markup = renderPageMarkup("/", await siteFooterHtml());
|
||||
expect(markup).toContain("data-pfs-footer");
|
||||
const from = "from=https%3A%2F%2Flogicsrc.com%2F";
|
||||
for (const hop of ["previous", "next", "random"]) {
|
||||
// @profullstack/footer 0.2.2 dropped the random and vote links from the ring nav.
|
||||
for (const hop of ["previous", "next"]) {
|
||||
expect(markup).toContain(`https://rssamplifier.com/ring/profullstack/${hop}?${from}`);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
"test": "node --test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@profullstack/footer": "latest",
|
||||
"@profullstack/libsql-pg": "^0.1.2",
|
||||
"@simplewebauthn/browser": "^13.3.0",
|
||||
"@simplewebauthn/server": "^13.1.0",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "LogicSRC Credentials",
|
||||
"short_name": "LogicSRC",
|
||||
"description": "Human-in-the-loop approvals for your moshscript loops.",
|
||||
"description": "Share secrets with your team, end-to-end encrypted. The server never sees them.",
|
||||
"start_url": "/",
|
||||
"scope": "/",
|
||||
"display": "standalone",
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ export function page({ title = "LogicSRC ▸ credentials", body = "", head = ""
|
|||
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
|
||||
<meta name="theme-color" content="#101418">
|
||||
<title>${esc(title)}</title>
|
||||
<meta name="description" content="LogicSRC credentials: share secrets with your team, end-to-end encrypted. The server never sees them.">
|
||||
<link rel="manifest" href="/manifest.webmanifest">
|
||||
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
||||
<style>${BRAND_CSS}</style>
|
||||
|
|
|
|||
33
apps/pwa/src/lib/ring-footer.mjs
Normal file
33
apps/pwa/src/lib/ring-footer.mjs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// The Profullstack footer (links, copyright, the << Profullstack >> webring row and
|
||||
// the built.indie + pwamart badges) from @profullstack/footer, on the public
|
||||
// sign-in page. It is rendered into the HTML on the server because rssamplifier's
|
||||
// ring verifier reads the page and never runs script.
|
||||
//
|
||||
// Pages render synchronously, so the footer is kept as a string: the bundled
|
||||
// template at boot, then the @latest template from the CDN, refreshed every 15
|
||||
// minutes (a footer release reaches us with no redeploy). A failed refresh keeps
|
||||
// the last good copy. No CSP on this app, so the footer brings its own styles.
|
||||
import { footerHtml, footerHtmlSync } from "@profullstack/footer";
|
||||
|
||||
export const RING_FOOTER_OPTIONS = { site: "https://app.logicsrc.com/" };
|
||||
|
||||
let html = footerHtmlSync(RING_FOOTER_OPTIONS);
|
||||
|
||||
/** The footer markup; never empty. */
|
||||
export const ringFooter = () => html;
|
||||
|
||||
/** Accept a rendered footer only when it still links the ring. */
|
||||
export function setRingFooter(next) {
|
||||
if (typeof next !== "string" || !next.includes("/ring/profullstack") || next.length > 64_000) return false;
|
||||
html = next;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function startRingFooterRefresh(everyMs = 15 * 60_000) {
|
||||
if (process.env.PROFULLSTACK_FOOTER_OFFLINE === "1") return () => {};
|
||||
const run = () => footerHtml(RING_FOOTER_OPTIONS).then(setRingFooter, () => {});
|
||||
run();
|
||||
const timer = setInterval(run, everyMs);
|
||||
timer.unref?.();
|
||||
return () => clearInterval(timer);
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import { hashPassword, verifyPassword } from "../lib/crypto.mjs";
|
|||
import { createUserWithPassword, userByEmail } from "../lib/users.mjs";
|
||||
import { dashboardHandler } from "./pages.mjs";
|
||||
import { config } from "../config.mjs";
|
||||
import { ringFooter } from "../lib/ring-footer.mjs";
|
||||
|
||||
export const authRouter = Router();
|
||||
|
||||
|
|
@ -38,7 +39,7 @@ function authPage(req, { error = "", mode = "in" } = {}) {
|
|||
: `<button class="btn block" type="button" disabled title="Set COINPAY_OAUTH_* to enable">◆ Continue with CoinPay</button>`}
|
||||
<p id="passkey-msg" class="mono faint" style="font-size:.72rem;text-align:center;margin:12px 0 0"></p>
|
||||
</div></div>
|
||||
</main>${footer}
|
||||
</main>${footer}${ringFooter()}
|
||||
<script src="/vendor/simplewebauthn-browser.umd.js"></script>
|
||||
<script src="/passkey.js"></script>`;
|
||||
return page({ title: "LogicSRC ▸ sign in", body });
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import { apiKeysRouter } from "./routes/apikeys.mjs";
|
|||
import { opencredsRouter } from "./routes/opencreds.mjs";
|
||||
import { cliRouter } from "./routes/cli.mjs";
|
||||
import { pagesRouter } from "./routes/pages.mjs";
|
||||
import { descriptor } from "@profullstack/footer";
|
||||
import { RING_FOOTER_OPTIONS, startRingFooterRefresh } from "./lib/ring-footer.mjs";
|
||||
|
||||
const app = express();
|
||||
app.disable("x-powered-by");
|
||||
|
|
@ -48,6 +50,10 @@ const sodiumCore = createRequire(sodiumWrappers).resolve("libsodium");
|
|||
app.get("/vendor/libsodium.js", (_req, res) => res.sendFile(sodiumCore));
|
||||
app.get("/vendor/libsodium-wrappers.js", (_req, res) => res.sendFile(sodiumWrappers));
|
||||
|
||||
// The Profullstack webring descriptor (the ring footer is on the sign-in page, /).
|
||||
app.get("/.well-known/openwebring.json", (_req, res) =>
|
||||
res.json(descriptor({ site: RING_FOOTER_OPTIONS.site, name: "LogicSRC credentials" })));
|
||||
|
||||
app.get("/healthz", (_req, res) => res.json({ ok: true, env: config.env }));
|
||||
|
||||
app.use(sessionMiddleware);
|
||||
|
|
@ -74,6 +80,7 @@ app.use((err, _req, res, _next) => {
|
|||
|
||||
async function main() {
|
||||
await migrate();
|
||||
startRingFooterRefresh();
|
||||
app.listen(config.port, () => console.log(`🔐 logicsrc credentials on :${config.port} (${config.env}) — ${config.origin}`));
|
||||
}
|
||||
main().catch((e) => { console.error("boot failed:", e); process.exit(1); });
|
||||
|
|
|
|||
20
apps/pwa/test/ring-footer.test.mjs
Normal file
20
apps/pwa/test/ring-footer.test.mjs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// The sign-in page carries the Profullstack footer (webring row + badges), and
|
||||
// the refresh only ever swaps in a footer that still links the ring.
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
import { ringFooter, setRingFooter } from "../src/lib/ring-footer.mjs";
|
||||
|
||||
test("the bundled footer links the ring and both badges for app.logicsrc.com", () => {
|
||||
const html = ringFooter();
|
||||
assert.match(html, /rssamplifier\.com\/ring\/profullstack/);
|
||||
assert.match(html, /built\.indie\.pit\.world/);
|
||||
assert.match(html, /pwamart\.com\/for\.svg\?site=https%3A%2F%2Fapp\.logicsrc\.com%2F|pwamart\.com\/for\.svg\?site=https:\/\/app\.logicsrc\.com\//);
|
||||
});
|
||||
|
||||
test("a refresh without the ring row is ignored", () => {
|
||||
const before = ringFooter();
|
||||
assert.equal(setRingFooter("<footer>nope</footer>"), false);
|
||||
assert.equal(setRingFooter(undefined), false);
|
||||
assert.equal(ringFooter(), before);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue