|
1 | | -# Custom logviewer image: upstream logviewer + an Apple dark-mode skin. |
| 1 | +# Custom logviewer image: upstream logviewer + an Apple dark-mode skin and |
| 2 | +# Pebble link-preview (Open Graph) branding. |
2 | 3 | # |
3 | 4 | # We keep the upstream app and all of its message-rendering templates untouched, |
4 | | -# and only overlay one extra stylesheet (applemode.css) that overrides the look. |
5 | | -# The stylesheet is injected as the LAST <link> in each template so it wins the |
6 | | -# CSS cascade — no template logic is modified. |
| 5 | +# and only overlay one extra stylesheet (applemode.css) plus replace the page |
| 6 | +# metadata. No template logic is modified. |
7 | 7 | FROM ghcr.io/modmail-dev/logviewer:master |
8 | 8 |
|
| 9 | +# Apple dark-mode skin + the link-preview image (served at /static/img/og.png). |
9 | 10 | COPY static/css/applemode.css /logviewer/static/css/applemode.css |
| 11 | +COPY static/img/og.png /logviewer/static/img/og.png |
10 | 12 |
|
11 | | -# Append the Apple stylesheet right before </head> in both page templates. |
12 | | -RUN sed -i 's#</head># <link href="/static/css/applemode.css" type="text/css" rel="stylesheet" media="screen,projection" />\n</head>#' \ |
13 | | - /logviewer/templates/base.html \ |
14 | | - /logviewer/templates/logbase.html |
| 13 | +# Inject the Apple stylesheet, set the Pebble link-preview (Open Graph) tags, |
| 14 | +# and rebrand the page title. The og:* tags shown when a log link is shared |
| 15 | +# (e.g. in Discord) become a fixed Pebble card instead of leaking recipient |
| 16 | +# details — and point at our own self-hosted image so they never expire. |
| 17 | +RUN set -eux; \ |
| 18 | + for f in base.html logbase.html; do \ |
| 19 | + t="/logviewer/templates/$f"; \ |
| 20 | + # drop the upstream per-thread og:* tags and any existing theme-color |
| 21 | + sed -i '/property=.og:/d; /name=.theme-color./d' "$t"; \ |
| 22 | + # rebrand the browser/tab title |
| 23 | + sed -i 's#<title>[^<]*</title>#<title>Pebble</title>#' "$t"; \ |
| 24 | + # inject our stylesheet + Open Graph card just before </head> |
| 25 | + sed -i 's@</head>@\ |
| 26 | + <link href="/static/css/applemode.css" type="text/css" rel="stylesheet" media="screen,projection" />\ |
| 27 | + <meta property="og:type" content="website" />\ |
| 28 | + <meta property="og:site_name" content="Pebble" />\ |
| 29 | + <meta property="og:title" content="Pebble" />\ |
| 30 | + <meta property="og:description" content="Pebble logs are used by Plover contributors to assist in customer support inquiries." />\ |
| 31 | + <meta property="og:image" content="https://pebble.getplover.com/static/img/og.png" />\ |
| 32 | + <meta name="twitter:card" content="summary_large_image" />\ |
| 33 | + <meta name="theme-color" content="#0A84FF" />\ |
| 34 | +</head>@' "$t"; \ |
| 35 | + done |
0 commit comments