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
10 changes: 10 additions & 0 deletions web/includes/View/LoginView.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
* the actual login wiring posts via
* `sb.api.call(Actions.AuthLogin, …)` with a hardcoded
* `redirect: ''` (post-login destination is the dashboard).
* - `$brand_logo_url` — Pre-resolved URL for the brand mark image
* in the sign-in card header (`<img src="-{$brand_logo_url}-">`).
* The page handler joins `$theme_url` (`themes/<theme>`, set by
* init.php) with `Config::get('template.logo')` (the v1.x setting
* resurrected by #1235 — default `images/favicon.svg`, the new
* SourceBans++ shield mark; admins can repoint at any
* theme-relative path). Pre-resolving here keeps `theme_url` and
* `logo` out of the View property surface (`core/header.tpl`'s
* globally-assigned `$theme_url` doesn't bleed into page Views).
*/
final class LoginView extends View
{
Expand All @@ -56,6 +65,7 @@ public function __construct(
public readonly bool $normallogin_show,
public readonly bool $steamlogin_show,
public readonly string $redir,
public readonly string $brand_logo_url,
) {
}

Expand Down
Binary file modified web/install/images/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion web/install/includes/sql/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ INSERT INTO `{prefix}_settings` (`setting`, `value`) VALUES
('bans.customreasons', ''),
('config.password.minlength', '7'),
('config.debug', '0'),
('template.logo', 'logos/sb-large.png'),
('template.logo', 'images/favicon.svg'),
('template.title', 'SourceBans++'),
('config.enableprotest', '1'),
('config.enablecomms', '1'),
Expand Down
13 changes: 13 additions & 0 deletions web/pages/page.login.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,23 @@
// (post-login destination is the dashboard). Any third-party theme
// that forked the pre-v2.0.0 default and still calls `DoLogin(...)`
// from removed legacy bulk JS would no-op there.
// `template.logo` is the operator-configurable brand mark path,
// resolved relative to the active theme directory. Default ships as
// `images/favicon.svg` (the SourceBans++ shield from the favicon set);
// admins can override via Admin → Settings → General → Logo path. The
// theme-relative join mirrors what `core/navbar.tpl` does at runtime
// for the in-panel sidebar; pre-resolving here keeps `$theme_url` /
// `$logo` out of `LoginView`'s property surface (the chrome's globally-
// assigned `$theme_url` doesn't bleed into page Views).
$themeName = (string) (Config::get('config.theme') ?: 'default');
$brandLogoPath = (string) Config::get('template.logo');
$brandLogoUrl = 'themes/' . $themeName . '/' . ltrim($brandLogoPath, '/');

$loginView = new \Sbpp\View\LoginView(
normallogin_show: Config::getBool('config.enablenormallogin'),
steamlogin_show: Config::getBool('config.enablesteamlogin'),
redir: "DoLogin('');",
brand_logo_url: $brandLogoUrl,
);

// `page_login.tpl` renders with the custom `-{ … }-` delimiter pair so
Expand Down
26 changes: 17 additions & 9 deletions web/themes/default/core/header.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,27 @@
<meta name="x-apple-data-detectors" content="false">
<title>{$title}</title>
{*
Favicon set (#1235): the SVG is the primary — Chrome/Firefox/Safari
prefer it and the @media (prefers-color-scheme: dark) rule baked
into the file lightens the orange to --brand-400 (#fb923c) when
the OS chrome is dark, matching the dark-theme accent. The .ico
is the legacy fallback. apple-touch-icon-180 covers iOS home
screens. The two theme-color metas paint the mobile chrome
bar: --brand-600 (#ea580c) by default, --zinc-950 (#09090b —
the value html.dark resolves --bg-page to in theme.css) when
the OS is dark.
Favicon set (#1235): the icon artwork ships byte-faithful
from the favicon.zip rumblefrog attached to #1235 — orange shield
(`#ea580c`) with a black "+" centred and a small white "++" tucked
in the bottom-right (the "++" in SourceBans++). The SVG is the
primary — Chrome/Firefox/Safari prefer it; the .ico (3-icon:
48x48 + 32x32 + 16x16) is the legacy fallback; favicon-96x96
covers higher-DPI tab strips that pick a 96px source over the
SVG; apple-touch-icon-180 covers iOS home screens. The web app
manifest wires up the install-as-PWA path on Edge/Chrome with
maskable 192x192 + 512x512 sources. The two theme-color metas
paint the in-browser chrome bar: --brand-600 (`#ea580c`) by
default, --zinc-950 (`#09090b` — the value html.dark resolves
--bg-page to in theme.css) when the OS is dark; HTML metas
win over the manifest's static theme_color for the in-browser
case.
*}
<link rel="icon" type="image/svg+xml" href="{$theme_url}/images/favicon.svg">
<link rel="icon" type="image/png" sizes="96x96" href="{$theme_url}/images/favicon-96x96.png">
<link rel="alternate icon" type="image/x-icon" href="{$theme_url}/images/favicon.ico">
<link rel="apple-touch-icon" sizes="180x180" href="{$theme_url}/images/apple-touch-icon-180.png">
<link rel="manifest" href="{$theme_url}/images/site.webmanifest">
<meta name="theme-color" content="#ea580c">
<meta name="theme-color" content="#09090b" media="(prefers-color-scheme: dark)">
<link rel="stylesheet" href="{$theme_url}/css/theme.css">
Expand Down
18 changes: 16 additions & 2 deletions web/themes/default/core/navbar.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,23 @@
testid (rather than the `.sidebar__brand` class chain) keeps
the assertion compliant with AGENTS.md's "Selectors must use
testability hooks; never CSS class chains as the primary
selector" rule. *}
selector" rule.

#1235 — the brand mark renders the operator-configurable
`template.logo` setting (Admin → Settings → General → Logo
path), resolved relative to the active theme's directory.
`$logo` is assigned by `core/header.php` (which runs before
this template per page-builder.php's lifecycle:
header → navbar → title → page → footer), so it's always in
scope here. Default ships as `images/favicon.svg` — the
canonical SourceBans++ shield-with-cross mark from the
favicon set; admins can repoint at any theme-relative path
(PNG / SVG / etc). The setting was vestigial in v2.0 until
this PR wired it back in; sees `web/updater/data/809.php`
for the upgrade-path migration that converts the v1.x
`logos/sb-large.png` default forward. *}
<div class="sidebar__brand" data-testid="sidebar-brand">
<div class="sidebar__brand-mark">S</div>
<img class="sidebar__brand-mark" src="{$theme_url}/{$logo}" alt="">
<div>
<div class="font-semibold text-sm">SourceBans++</div>
</div>
Expand Down
8 changes: 7 additions & 1 deletion web/themes/default/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,13 @@ a { color: inherit; text-decoration: none; }
display: flex; flex-direction: column;
}
.sidebar__brand { height: 3.5rem; padding: 0 1rem; display: flex; align-items: center; gap: 0.625rem; border-bottom: 1px solid var(--border); }
.sidebar__brand-mark { width: 1.75rem; height: 1.75rem; border-radius: var(--radius-md); background: var(--brand-600); color: white; display: grid; place-items: center; font-weight: 700; font-size: var(--fs-sm); }
/* #1235 — the brand mark renders as `<img src="…/template.logo">`,
so the rule no longer needs the orange-rounded-square + centered-letter
background that was designed for the pre-#1235 `<div class="…">S</div>`
shape. The new mark's visual identity (orange shield + cross) lives in
the favicon SVG itself. Sizing + flex behaviour stay so the brand row's
layout is unchanged. */
.sidebar__brand-mark { width: 1.75rem; height: 1.75rem; flex-shrink: 0; }
.sidebar__nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; padding: 0.75rem 0.5rem; }
.sidebar__section { display: flex; flex-direction: column; gap: 0.125rem; margin-bottom: 1.25rem; }
.sidebar__section-label { padding: 0 0.75rem 0.375rem; font-size: 0.625rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
Expand Down
Binary file modified web/themes/default/images/apple-touch-icon-180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/themes/default/images/favicon-96x96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/themes/default/images/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion web/themes/default/images/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions web/themes/default/images/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "SourceBans++",
"short_name": "SourceBans++",
"icons": [
{
"src": "web-app-manifest-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "web-app-manifest-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion web/themes/default/page_admin_settings_settings.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@
</div>
<div data-testid="setting-row" data-key="template.logo">
<label class="label" for="template_logo">Logo path</label>
<input class="input" type="text" id="template_logo" name="template_logo" value="{$config_logo}">
<input class="input" type="text" id="template_logo" name="template_logo" value="{$config_logo}" aria-describedby="template_logo_help">
<p class="settings-fieldset__help"
id="template_logo_help"
data-testid="setting-help-template.logo">
Path to the brand mark image rendered in the sidebar and sign-in card, resolved relative to the active theme directory (<code class="font-mono">themes/&lt;theme&gt;/</code>). Default: <code class="font-mono">images/favicon.svg</code> &mdash; the SourceBans++ shield from the favicon set. Any theme-relative SVG / PNG works.
</p>
</div>
<div data-testid="setting-row" data-key="config.password.minlength">
<label class="label" for="config_password_minlength">Minimum password length</label>
Expand Down
7 changes: 6 additions & 1 deletion web/themes/default/page_login.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@
<div class="card login-shell__card">
<div class="card__body">
<div class="flex items-center gap-3 mb-6">
<div class="sidebar__brand-mark" aria-hidden="true">S</div>
-{* #1235 — brand mark is the operator-configurable
`template.logo` setting, theme-resolved in the page
handler (page.login.php) and passed in as
`$brand_logo_url`. Default ships as the SourceBans++
shield from the favicon set. *}-
<img class="sidebar__brand-mark" src="-{$brand_logo_url}-" alt="" aria-hidden="true">
<div>
<div class="font-semibold text-sm">SourceBans++</div>
<div class="text-xs text-muted">Admin panel</div>
Expand Down
12 changes: 11 additions & 1 deletion web/themes/default/updater.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,17 @@
<div class="p-6 space-y-6" style="max-width:48rem;margin:2.5rem auto;width:100%">

<header class="flex items-center gap-3" data-testid="updater-header">
<div class="sidebar__brand-mark">SB</div>
{* #1235 — the updater renders in its own bootstrap context
(web/updater/index.php) which doesn't load core/header.php,
so the operator-configurable `template.logo` setting and
the `$theme_url` Smarty global aren't in scope here. The
favicon path is therefore hardcoded — the updater is an
internal one-off page that runs once per upgrade, never
through the regular page-builder lifecycle, so threading
the setting through `UpdaterView` would be plumbing for a
single admin-facing screen that doesn't need theming.
Path is relative to /web/updater/ where the script runs. *}
<img class="sidebar__brand-mark" src="../themes/default/images/favicon.svg" alt="">
<div>
<h1 style="font-size:var(--fs-2xl);font-weight:600;margin:0">SourceBans++ updater</h1>
<p class="text-sm text-muted m-0 mt-2">Database migration log.</p>
Expand Down
29 changes: 29 additions & 0 deletions web/updater/data/809.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

// Issue #1235 follow-up: convert the v1.x `template.logo` default
// (`logos/sb-large.png`) to the new v2.0 default (`images/favicon.svg`).
// The v1 default points at `web/themes/<theme>/logos/sb-large.png`, a
// path the v2.0 default theme doesn't ship — the setting was vestigial
// in v2.0 (no template consumed `$logo`) until this PR wired it back
// into the sidebar / login / updater brand mark. Fresh installs get
// the new default via `web/install/includes/sql/data.sql`; this
// migration backfills upgrades.
//
// The WHERE clause pins the value to the v1.x default so admins who
// already customised `template.logo` in v1.x are NOT touched — their
// pointer survives the upgrade. Re-running the migration on an
// already-converged install is a no-op (the WHERE matches zero rows).
//
// `$this` is supplied by Updater::update() which loads this file inside
// the Updater instance scope; PHPStan can't see that, so the next two
// calls are suppressed in the same way every sibling migration would be
// (the others live in phpstan-baseline.neon).
// @phpstan-ignore variable.undefined
$this->dbs->query(
"UPDATE `:prefix_settings` SET `value` = 'images/favicon.svg' "
. "WHERE `setting` = 'template.logo' AND `value` = 'logos/sb-large.png'"
);
// @phpstan-ignore variable.undefined
$this->dbs->execute();

return true;
3 changes: 2 additions & 1 deletion web/updater/store.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@
"805": "805.php",
"806": "806.php",
"807": "807.php",
"808": "808.php"
"808": "808.php",
"809": "809.php"
}
Loading