Skip to content

feat(public-pages): the server's own accent colour and background on its public member pages - #368

Open
Ferdinand99 wants to merge 10 commits into
v5.3from
feat/53-public-page-look
Open

Ferdinand99 wants to merge 10 commits into
v5.3from
feat/53-public-page-look

Conversation

@Ferdinand99

Copy link
Copy Markdown
Owner

What

A server can give the pages its members open without the dashboard its own accent colour and a background. The community owns the content, Sylo owns the frame: only those two things change. Layout, type, components, light/dark, readability and a small "Powered by Sylo" link (always on, not configurable) stay Sylo's. The dashboard and the app are never restyled.

  • Settings: per server, accent (hex) and background none | upload | discord-splash. Server settings -> Public pages, Edit level only (the reads too), live preview of the application form page, contrast check.
  • Upload: the collectible picture pipeline (2 MB, magic bytes, header size check, decoded-size recheck, decode queue), re-encoded to a WebP of at most 1920 px, metadata gone. Stored in the database (one per source, replace deletes the old one), purged with the server.
  • Invite splash (Discord and Fluxer both have guild.splash): downloaded once through safeFetch, re-encoded and stored by Sylo, checked against the platform hash at most once a day (when a page that uses it is opened, or from the "check now" button), dropped when the server no longer has one. Visitors never load anything from the platform CDN.
  • Serving: /look/<server>.<hash>.css and .webp, guild-scoped, named by content hash, immutable, no cookie, one plain 404 for everything else. The style sheet carries custom properties only (--accent, --on-accent, --look-image); the card, the dim overlay and the buttons are Sylo's own rules. CSP is unchanged (styles and images from this site only; no inline style).
  • Contrast: an accent under 3:1 against the card falls back to Sylo's colour in that theme and the settings say so. No colour reaches 4.5:1 on both the dark and the light card, so 3:1 (WCAG for interface elements; links on these pages are underlined) is the bar. The text on an accent button is black or white, always at least 4.58:1.
  • Pages: application form and web shop (React member pages), ban appeal, quote page, both leaderboards. The event pages take no look: they deliberately carry no server id, and the look address has one. "Powered by Sylo" is now a link on every public page (rel="noopener noreferrer", so the page address and tokens are never sent on); the two existing "no outward links" tests allow exactly that link.
  • API / iOS: GET/POST /api/v2/guilds/:id/public-page-look, /image, /image/delete, /splash/refresh; feature string public-page-look; documented in docs/mobile-app.md. Also docs/dashboard-v2.md and the privacy policy.
  • Migration 81 (guild_public_look, public_look_images), Postgres bootstrap included.

Checks

SQLite npm test 3914 pass / 0 fail; Postgres 16 npm test 4170 pass / 0 fail; npm run test:v2 all pass; lint, prettier and build:v2 clean. New tests: test/publicLook.lib.test.js, test/publicLook.web.test.js (upload limits and metadata stripping, fake-CDN splash, addresses and headers, cross-guild, contrast fallback, rendered pages, purge), access-level and cross-server cases in test/v2.accessLevels.test.js, and web-v2 tests for the settings section, the hook and the footer.

…its public member pages

A server can give the pages its members open without the dashboard an accent
colour and a background (none, an uploaded picture, or a copy of the server's
invite splash that Sylo downloads itself, checks daily and serves itself).
Only those two things change: the layout, type, components, themes and the
always-on "Powered by Sylo" link stay Sylo's.

- migration 81: guild_public_look and public_look_images (purged with the server)
- /look/<server>.<hash>.css and .webp: guild-scoped, hash-named, immutable,
  no cookie; the style sheet carries custom properties only, the CSP is unchanged
- the upload goes through the collectible picture pipeline (2 MB, magic bytes,
  header size check, decode queue, re-encoded WebP, metadata gone)
- an accent below 3:1 against the card falls back to Sylo's colour in that theme
- GET/POST /api/v2/guilds/:id/public-page-look (Edit only) and the
  public-page-look feature string for the app
- Server settings -> Public pages with a live preview of the application form
- applied to the application form, web shop, ban appeal, quote page and both leaderboards

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Graphify reviewed this change.

Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.

Not checked: tests were not run; no formal proof of the changed code.


Graphify review — findings

Adds a per-server look for public member pages (application form, web shop, ban appeal, quotes, both leaderboards): a custom accent colour plus a background that is none, an uploaded image re-encoded to WebP at most 1920px wide, or a Sylo-held copy of the server's Discord/Fluxer invite splash refreshed daily, so visitors' browsers only ever talk to Sylo. The look is served as /look/<server>.<hash>.css and .webp, with edit-level dashboard and mobile public-page-look routes, new guild_public_look and public_look_images tables, and a live preview. An accent that falls under 3:1 contrast against the card falls back to Sylo's own colour for that theme, and the "Powered by Sylo" link and event pages stay unstyled, but the accent is written into the generated CSS by lookCss, so that path is where a bad value could slip through.

Worth a look

  • lookCss writes an unvalidated accent straight into CSS — src/lib/publicLook.js:128 · Escalate · medium
    • NOT verified (no proof, no reproducing execution) — needs human review

Review partial — this diff was larger than one review pass covers, so later files were not reviewed; some findings may be missing.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 951 functions depend on the 575 functions this change touches.

Health — this change adds coupling hotspots:

  • worse: apiFetch() — 64 callers, 3 callees
  • worse: startWebApp() — 45 callers, 3 callees
  • new: lookFor() — 10 callers, 8 callees
  • new: PublicPagesSettings() — 4 callers, 12 callees
  • worse: Settings() — 3 callers, 13 callees
  • worse: renderLeaderboard() — 3 callers, 12 callees
  • worse: processImage() — 6 callers, 5 callees
  • worse: PublicShell() — 3 callers, 7 callees
  • …and 8 more — each is listed as a finding

Verification — 951 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 947 function(s) in the blast radius were not formally verified this run

Test selection

Test selection

676 of 676 test file(s) selected (100%) via static blast radius.

Escalated to a full run for safety (noncode-change, uncovered-code) — the selection is not trustworthy on its own (see below). CI should run the whole suite.

  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Access/DashboardAccessTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Access/Round3Tests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Account/AccountConnectTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Account/AccountModelTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Account/ConnectCallbackSourceTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Account/NoDashboardLinkSourceTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Appeals/AppealsReviewTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Applications/ApplicationFormsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Applications/ApplicationPassthroughTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Applications/ApplicationSubmissionsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Applications/ApplicationWireTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Audit/AuditHistoryTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Audit/AuditLogTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/CallbackIssuerAddressTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/CallbackIssuerTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/KeychainTokenStoreTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/PKCETests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/SignInRequestTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/TokenStoreTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Changelog/ChangelogTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Commands/CommandOverridesTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/CollectiblePictureTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/EconomyAdminTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/EconomyMembersTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/InventoryTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/ShopExtrasTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/ShopItemsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/ShopModelTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Embeds/EmbedDraftTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Embeds/ModuleLimitsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Events/CommunityReviewFixesTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Events/EventEndpointsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Giveaways/GiveawayActionsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/GuildSettings/CommandPrefixTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/GuildSettings/GuildSettingsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Health/HealthTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Import/P6Tests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Insights/InsightsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Leaderboard/LeaderboardTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Members/MemberDataTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Members/MemberSearchTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Messages/ComposedMessagesModelTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Messages/ComposedMessagesTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/ModelDecodingTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/ServerListTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/Sylo52PolishTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/UnknownKeysTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/Utf16TextLimitTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Moderation/ModerationTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/ModuleSettings/AfkSettingsTests.swift — full-run-safety
  • … and 626 more

non-code file(s) changed (docs/dashboard-v2.md, docs/mobile-app.md, docs/privacy-policy.md, src/web/public/public.css, web-v2/src/styles/p3-look.css) → running the full suite for safety (a code graph can't see config/fixture/data deps)

changed code file(s) with no mapped test (docs/dashboard-v2.md, docs/mobile-app.md, docs/privacy-policy.md, src/web/lib/routeAccess.js, src/web/routes/appeal.js …) — a coverage gap or a missing link — running the full suite rather than only the selected tests

Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.

…, product link, test gaps

- text uses of the accent read --accent-text (the accent, or the same hue lightened/darkened
  to 4.5:1 on card, page and tinted card); fills, borders and focus rings keep the 3:1 bar
- hovered buttons keep 4.5:1 for their text (--accent-hover moves away from the text colour)
- light theme over a picture: a light veil, a 99 % panel, the top bar glass always on
- "Powered by Sylo" links to sylobot.com, one muted style on every page
- lookCss refuses a stored accent that is not #rrggbb
- a forced splash check no longer takes the answer of a running unforced one
- pictures are cached for a day; public_look_images copied in small chunks to Postgres
- docs, comments and tests: readability, upload route in the access matrix, Fluxer end to end,
  leaderboard/Apply/Shop with a look, migration 81 upgrade
…ext colour

- --accent-text is declared in both themes of public.css and dashux.css, so a look sheet
  that only has a dark block can no longer leak its text colour into the light theme
- accent text is also held to 4.5:1 on the page tinted with the accent (the active pill)
- test resolves the cascade per theme for the server-rendered and the dashboard pages
- comments point at the real contrast test; a slow settings test gets a longer wait
…with the page, say it in plain words

On a phone the panel over a background picture now has a 12px margin all
round, and the dashboard-app pages size the panel to their content so a
short page leaves the picture showing. The Public pages settings are saved
with the Settings page's save bar, so leaving with unsaved changes asks
first. The contrast numbers give way to plain wording (readable in both
themes, too dark or too light for a theme) with the figures in a tooltip,
and a colour that is replaced is shown as a warning. The application page
shows the **bold** words of its intro as bold text instead of raw markdown,
and the leaderboard period pills are no longer underlined.
…ts retry gate

Saving the look with the invite background forced a download of the server's
splash on every save, outside the check button's limit and past the
15-minute failure gate, so a save loop could start many downloads. The save
now counts against the same per-minute limit as the check button and no
longer forces the download; only the check button does.
The picture route sent the mime column as Content-Type. Sylo only writes
image/webp, but a restored or imported row could carry another value, so the
type is now a constant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant