Use organization-neutral names in code and browser keys
- The timeline's ngu-tl classes and keyframes are site-tl; nguLogo is siteLogo; the event card's ngu grid area is org; window.__NGU_SITE__ is window.__SITE__; QR downloads are qr-<page>.png - Browser keys (theme, closed banner and privacy notice, chunk reload) start site-; the page's first script moves any old ngu- values over once, so nobody loses their theme or sees a closed notice again - Session and Google sign-in cookies are site_session and site_oauth (__Host- over https); everyone signs in again once Record ids, server paths, the service and the database file keep their names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
92e7938b64
commit
2b009beac1
23 changed files with 191 additions and 181 deletions
|
|
@ -39,7 +39,7 @@ export const SECURE_COOKIE = (process.env.COOKIE_SECURE ?? "true") !== "false";
|
|||
// path /, with no Domain, so a sibling subdomain can't plant or
|
||||
// overwrite it. Plain http (local work, COOKIE_SECURE=false) can't
|
||||
// use the prefix, so it keeps the plain name.
|
||||
export const COOKIE_NAME = SECURE_COOKIE ? "__Host-ngu_session" : "ngu_session";
|
||||
export const COOKIE_NAME = SECURE_COOKIE ? "__Host-site_session" : "site_session";
|
||||
|
||||
const IP_SALT = process.env.IP_SALT ?? randomBytes(16).toString("hex");
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ app.use("/api/admin/*", logger());
|
|||
/api/csp-report (journalctl -u ngu-api). Once a while of real use
|
||||
logs nothing unexpected, switch contentSecurityPolicyReportOnly to
|
||||
contentSecurityPolicy. 'unsafe-inline' scripts cover the page's
|
||||
window.__NGU_SITE__ and the theme script in index.html. */
|
||||
window.__SITE__ and the theme script in index.html. */
|
||||
const EMBEDS = [
|
||||
"https://www.youtube-nocookie.com",
|
||||
"https://www.youtube.com",
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
site_settings table, 035), where anything set wins and anything
|
||||
blank falls back to site.json. siteFor(db) does the merge. The
|
||||
pages read the same merged values (renderPage writes them into
|
||||
the HTML as window.__NGU_SITE__, see src/lib/site.ts), so a
|
||||
the HTML as window.__SITE__, see src/lib/site.ts), so a
|
||||
heading and its search title can't drift.
|
||||
The database: records' names, taglines, first paragraphs and
|
||||
images. A blank site description falls back to the front page's
|
||||
|
|
@ -468,7 +468,7 @@ export function renderPage(html, meta) {
|
|||
),
|
||||
// Read by src/lib/site.ts before the app's module runs (a plain
|
||||
// script in the head runs during parsing; modules wait).
|
||||
`<script>window.__NGU_SITE__ = ${scriptJson(forBrowser(site))}</script>`,
|
||||
`<script>window.__SITE__ = ${scriptJson(forBrowser(site))}</script>`,
|
||||
site.themeCss && `<style id="site-colors">${site.themeCss}</style>`,
|
||||
].filter(Boolean);
|
||||
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ auth.get("/me", (c) => {
|
|||
// the redirect from Google, which is a top-level navigation.
|
||||
// __Host- (Secure, path /, no Domain) when over https, like the
|
||||
// session cookie, so a sibling subdomain can't plant its own state.
|
||||
const OAUTH_COOKIE = SECURE_COOKIE ? "__Host-ngu_oauth" : "ngu_oauth";
|
||||
const OAUTH_COOKIE = SECURE_COOKIE ? "__Host-site_oauth" : "site_oauth";
|
||||
const OAUTH_COOKIE_OPTIONS = {
|
||||
httpOnly: true,
|
||||
secure: SECURE_COOKIE,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue