Skip to content

Modernise the interface#50

Closed
miglen wants to merge 2 commits into
masterfrom
ui-modernize
Closed

Modernise the interface#50
miglen wants to merge 2 commits into
masterfrom
ui-modernize

Conversation

@miglen
Copy link
Copy Markdown
Member

@miglen miglen commented May 27, 2026

Summary

Visual refresh of the entry, settings, error, and auth views, plus a tabbed control panel and a manual theme toggle.

Closes the spirit of the user's own long-standing wish #4 (Better interface).

Independent of #49 — disjoint files.

Layout

PHProxy.                          [☀/🌙 SVG]    <- app bar
┌──────────────────────────────────────────┐
│ [ https://www.example.com/  ] [Proxify ] │    <- URL card, autofocused
└──────────────────────────────────────────┘
┌──────────────────────────────────────────┐
│  Options   Cookies   Headers             │    <- CSS-only tabs
│  ─────────                                │
│  ☐ Include Form   ☐ Remove Scripts ...    │    <- Options is the default
└──────────────────────────────────────────┘
                PHProxy v1.1.1

What changed

files/css/index.css — single source of truth

  • CSS custom properties for palette, two surfaces, mono font stack
  • Automatic dark mode via prefers-color-scheme: dark, overridable via [data-theme="dark"] / [data-theme="light"] on <html> (toggle wins, otherwise system pref)
  • Mobile-first responsive (options grid collapses to 1-col under 600px)
  • Accessible focus rings (3px accent halo on inputs)
  • accent-color on checkboxes
  • Tabs styling (active tab gets accent-color underline)
  • Cookie list with mono font + dashed empty state

files/php/index.inc.php — entry / error / auth template

  • XHTML 1.0 → HTML5
  • New app bar with logo + theme toggle button (two inline SVGs, currentColor stroke)
  • Three tabs: Options (default), Cookies, Headers
    • Options: existing flag checkboxes (now in a 2-col grid)
    • Cookies: enumerates non-settings $_COOKIE entries the proxy is holding for proxied sites, with a Clear all cookies action that POSTs ?action=clear-cookies and redirects back. Settings cookies (flags, userAgent, PHPSESSID) are preserved.
    • Headers: User-Agent picker (tidied UA list with current Chrome/Safari/iOS/Android). Save button uses formaction="edit.php" so the existing edit.php handler keeps working
  • URL field keeps autofocus and autocomplete="off"
  • Username/password fields get correct autocomplete tokens
  • Deprecated <center> dropped (replaced by styled .footer)

index.php — clear-cookies handler

Right after functions.inc.php is loaded, a small handler responds to POST /?action=clear-cookies. It iterates $_COOKIE, sends an expired Set-Cookie for each non-settings entry (under both / and .$HTTP_HOST to clean up under either domain scope), then redirects to the entry form.

index.phpinclude_form mini URL bar (still in this PR)

Restyled as a scoped dark slate bar with all:initial, z-index:2147483647, flexbox URL field + Go button, clean inline checkboxes. Self-contained inline styles only.

Theme toggle (new)

  • 36x36 button in the app bar, ghost styling
  • Inline JavaScript:
    • Early <script> in <head> reads localStorage['phproxy-theme'] and sets data-theme before paint — no flash of wrong theme on reload
    • Click flips light ⇄ dark and persists in localStorage
    • Wrapped in try/catch so private-mode browsers without storage still work

Test plan

Verified inside php:8.5-apache (PHP 8.5.6):

  • php -l clean on every *.php
  • Entry form: HTML5 doctype, linked CSS, URL field autofocused
  • Theme toggle button present with both SVG icons; data-theme flip + localStorage persistence verified
  • Tabs switch via CSS only (no JS needed for the tabs themselves); Options is the default
  • Cookies tab: list renders, empty state renders when no proxy cookies exist
  • Clear-cookies action returns 302 + emits expired Set-Cookie for non-settings cookies only (verified flags, userAgent, PHPSESSID are preserved)
  • Headers tab: Save button posts to edit.php which still works
  • Auth page: same look, warning-coloured header to differentiate
  • Error page: renders inside the new .card + p.error styles
  • edit.php still works standalone for backward compatibility (HTTP 200)
  • Proxied page with include_form flag on: restyled scoped mini bar injects correctly
  • Dev-mode error_reporting(E_ALL) + display_errors=1: zero deprecations / warnings / notices

Preview at http://localhost:8080/ if the dev container is up. Switch your OS dark mode or click the toggle to test theming.

🤖 Generated with Claude Code

Miglen Evlogiev and others added 2 commits May 27, 2026 23:56
Refreshes the look without changing any flows, form fields, or class
names. Same forms, same options menu, same buttons — just modern.

- files/css/index.css rewritten as the single source of truth:
  CSS custom properties for palette, system font stack, automatic
  prefers-color-scheme dark mode, mobile-first responsive, subtle
  shadows, accessible focus rings (3px accent halo on inputs),
  accent-color on checkboxes
- files/php/index.inc.php switched from XHTML 1.0 Transitional to
  HTML5; inline <style> block removed in favour of <link rel="stylesheet">
  to the shared sheet; deprecated <center> tag dropped; <ul>
  wrapper added to the options list; autofocus + autocomplete hints
  on the URL field; Username/Password fields get type="text" /
  type="password" with correct autocomplete tokens; footer moved
  to a styled .footer class
- edit.php given the HTML5 doctype + viewport meta and points at the
  same stylesheet so it visually matches the entry form; user-agent
  labels tidied
- Mini URL bar injected by index.php when include_form is on is
  restyled as a scoped dark slate bar with all:initial scoping,
  z-index:2147483647, flexbox layout for the URL field + Go button,
  and clean checkboxes for inline flag toggles. Self-contained
  inline styles only so the target page's CSS can't bleed into it

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Layout now mirrors a single-card-per-section model with a top app bar:

  PHProxy.                                   [sun/moon SVG]
  ┌─────────────────────────────────────────────┐
  │ [https://www.example.com/      ] [Proxify ] │
  └─────────────────────────────────────────────┘
  ┌─────────────────────────────────────────────┐
  │  Options   Cookies   Headers                │
  │  ─────────                                  │
  │  ☐ Include Form     ☐ Remove Scripts ...    │
  └─────────────────────────────────────────────┘

- CSS-only tabs (radio inputs + sibling selectors, no JS dependency).
  Options is the default tab.
- Cookies tab enumerates non-settings $_COOKIE entries the proxy is
  holding for proxied sites, with a "Clear all cookies" action that
  POSTs ?action=clear-cookies. The handler in index.php sends an
  expired Set-Cookie for each (under both / and .HTTP_HOST domains)
  and redirects back. Settings cookies (flags, userAgent, PHPSESSID)
  are preserved.
- Headers tab moves the User-Agent picker inline (with a tighter,
  modern UA list). The Save button submits via formaction="edit.php"
  formnovalidate so the existing edit.php handler keeps working —
  edit.php is unchanged for backward compatibility.
- Theme toggle: 36x36 ghost button in the app bar with two inline
  SVGs (sun/moon, currentColor stroke). Click flips a data-theme
  attribute on <html> between light/dark and persists in
  localStorage. An early inline <script> in <head> reads
  localStorage before paint to avoid a flash of the wrong theme.
- CSS: introduces --surface-2, --border-strong, --font-mono custom
  properties; ghost button variant; cookie-list styled with mono
  font and dashed-border empty state.

URL input keeps autofocus (carried over from previous commit), so
the page is immediately ready for typing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@miglen
Copy link
Copy Markdown
Member Author

miglen commented May 27, 2026

Superseded by #51, which contains everything in this PR plus the Proxify→Go rename, wider responsive layout, per-cookie add/delete, per-header add/delete with outbound forwarding, an improved User-Agent picker, and the always-visible top bar while browsing. Closing in favour of #51.

@miglen miglen closed this May 27, 2026
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