fix(branding): app icon follows the Nav Icon upload (#773) #774

Merged
jmiller merged 3 commits from fix/app-icon-follows-nav-icon into main 2026-07-13 00:43:46 +00:00
Owner

Fixes #773.

The app icon (logo.png) is the 512x512 PWA / web-manifest icon (SiteManifest) and the navbar fallback (head_navbar.tmpl onerror), but it had no Admin Branding control — so a fully branded instance still advertised the shipped default MokoGitea mark as its installable app icon.

Change

  • routers/web/admin/branding.go: uploading the Nav Icon now writes the image to both logo-small.png and logo.png in a single io.MultiWriter pass; resetting the Nav Icon removes both, reverting to the built-in default.
  • templates/admin/branding.tmpl: note that the Nav Icon also sets the app icon and recommend >=512x512px.

Verification

  • go build ./routers/web/admin/: pass.
Fixes #773. The **app icon** (`logo.png`) is the 512x512 PWA / web-manifest icon (`SiteManifest`) and the navbar fallback (`head_navbar.tmpl` `onerror`), but it had no Admin **Branding** control — so a fully branded instance still advertised the shipped default MokoGitea mark as its installable app icon. ### Change - `routers/web/admin/branding.go`: uploading the **Nav Icon** now writes the image to both `logo-small.png` and `logo.png` in a single `io.MultiWriter` pass; resetting the Nav Icon removes both, reverting to the built-in default. - `templates/admin/branding.tmpl`: note that the Nav Icon also sets the app icon and recommend >=512x512px. ### Verification - `go build ./routers/web/admin/`: **pass**.
jmiller added 1 commit 2026-07-12 23:45:39 +00:00
fix(branding): app icon follows the Nav Icon upload
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 38s
Universal: Build & Release / Promote to RC (pull_request) Failing after 9s
Universal: Build & Release / Build & Release Pipeline (pull_request) Has been skipped
Generic: Project CI / Lint & Validate (pull_request) Has been cancelled
Generic: Project CI / Tests (pull_request) Has been cancelled
PR RC Release / Build RC Release (pull_request) Has been cancelled
Universal: PR Check / Branch Policy (pull_request) Has been cancelled
Universal: PR Check / Require Docs Update (pull_request) Has been cancelled
Universal: PR Check / Wiki Update Reminder (pull_request) Has been cancelled
Universal: PR Check / Secret Scan (pull_request) Has been cancelled
Universal: PR Check / Validate PR (pull_request) Has been cancelled
Generic: Repo Health / Access control (pull_request) Has been cancelled
Generic: Repo Health / Site Health (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report: Scripts Governance (pull_request) Has been cancelled
Generic: Repo Health / Report: Repository Health (pull_request) Has been cancelled
3d0cb7d98c
The app icon (logo.png) is the PWA/web-manifest icon and the navbar
fallback, but had no Branding control, so it stayed the shipped default
even on a fully branded instance. Uploading the Nav Icon now also writes
logo.png (single io.MultiWriter pass), and resetting the Nav Icon reverts
both to the built-in default.

Closes #773
jmiller added 1 commit 2026-07-13 00:02:41 +00:00
refactor(branding): write each icon target independently on upload
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 32s
Universal: Build & Release / Promote to RC (pull_request) Has been skipped
Universal: Build & Release / Build & Release Pipeline (pull_request) Has been skipped
PR RC Release / Build RC Release (pull_request) Successful in 24s
Universal: PR Check / Branch Policy (pull_request) Successful in 1s
Generic: Project CI / Lint & Validate (pull_request) Successful in 34s
Generic: Project CI / Tests (pull_request) Successful in 34s
Universal: PR Check / Wiki Update Reminder (pull_request) Successful in 2s
Universal: PR Check / Validate PR (pull_request) Successful in 7s
Generic: Repo Health / Access control (pull_request) Successful in 2s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Universal: PR Check / Require Docs Update (pull_request) Failing after 25s
Universal: PR Check / Secret Scan (pull_request) Successful in 26s
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report: Scripts Governance (pull_request) Has been cancelled
Generic: Repo Health / Report: Repository Health (pull_request) Has been cancelled
f4be31183f
Rewind the uploaded stream between targets and write/close each file in
turn instead of a shared io.MultiWriter, so a failure writing a later
target (e.g. logo.png) can never leave an earlier one (logo-small.png)
truncated. Addresses review feedback on #774.
Author
Owner

Wiki reminder: docs are wiki-first -- if this PR changes behavior, usage, config, or standards, please update the repo wiki before/after merge. (non-blocking)

<!-- wiki-reminder --> **Wiki reminder:** docs are wiki-first -- if this PR changes behavior, usage, config, or standards, please update the repo wiki before/after merge. _(non-blocking)_
jmiller reviewed 2026-07-13 00:24:26 +00:00
jmiller left a comment
Author
Owner

Code review (targeting main): clean — approve on correctness.

  • Upload writes each target independently, rewinding the stream (file.Seek(0, io.SeekStart)) between targets, so a failure on a later target (logo.png) can't leave an earlier one (logo-small.png) truncated. Every file handle is Close()d on all paths (copy-error path closes before return) — no leak.
  • Only nav-icon also targets logo.png; favicon/login-logo remain isolated.
  • Reset reverts both files with correct failed / removedAny / default flash precedence.
  • SVG-strip name[:len(name)-4] is panic-safe (all target names end in .png).

Verified go build ./routers/web/admin/ passes. No code blockers.

⚠️ Do not merge yet — CI red is the offline-runner infra issue, not this change.

**Code review (targeting `main`): clean — approve on correctness.** - Upload writes each target independently, rewinding the stream (`file.Seek(0, io.SeekStart)`) between targets, so a failure on a later target (logo.png) can't leave an earlier one (logo-small.png) truncated. Every file handle is `Close()`d on all paths (copy-error path closes before return) — no leak. - Only `nav-icon` also targets `logo.png`; favicon/login-logo remain isolated. - Reset reverts both files with correct `failed` / `removedAny` / default flash precedence. - SVG-strip `name[:len(name)-4]` is panic-safe (all target names end in `.png`). Verified `go build ./routers/web/admin/` passes. No code blockers. :warning: Do not merge yet — CI red is the offline-runner infra issue, not this change.
jmiller added 1 commit 2026-07-13 00:43:08 +00:00
Merge remote-tracking branch 'origin/main' into fix/app-icon-follows-nav-icon
Generic: Project CI / Lint & Validate (pull_request) Successful in 33s
Generic: Project CI / Tests (pull_request) Successful in 39s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Failing after 1m41s
Universal: Build & Release / Promote to RC (pull_request) Has been skipped
PR RC Release / Build RC Release (pull_request) Successful in 1m10s
Universal: PR Check / Branch Policy (pull_request) Successful in 2s
Universal: PR Check / Require Docs Update (pull_request) Failing after 43s
Universal: PR Check / Wiki Update Reminder (pull_request) Successful in 1s
Universal: PR Check / Validate PR (pull_request) Successful in 7s
Generic: Repo Health / Access control (pull_request) Successful in 1s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Universal: PR Check / Secret Scan (pull_request) Successful in 30s
RC Revert / Rename rc/ back to dev/ (pull_request) Has been skipped
Universal: Workflow Sync Trigger / Sync workflows to live repos (pull_request) Has been skipped
Branch Cleanup / Delete merged branch (pull_request) Successful in 1s
Universal: Build & Release / Build & Release Pipeline (pull_request) Failing after 1m54s
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report: Scripts Governance (pull_request) Has been cancelled
Generic: Repo Health / Report: Repository Health (pull_request) Has been cancelled
dc14a3fcfc
# Conflicts:
#	CHANGELOG.md
jmiller merged commit 3ce6fd3e08 into main 2026-07-13 00:43:46 +00:00
jmiller deleted branch fix/app-icon-follows-nav-icon 2026-07-13 00:43:48 +00:00
Sign in to join this conversation.
No Reviewers
Priority -
Type -
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoGitea-Fork#774