authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-03-27 01:18:43-07:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-03-27 02:28:07-07:00
logc7ff451dfa7c20ba6d9b616eabf57d73eddf813e
tree0aa642d70e5c8f4764c6c0e85cfa79d605157738
parentb67239a5bef3dde78310721e6ff408a8e1faf902
signature Signed by SSH key SHA256:xbd+BjjhyBfwk7GVoURf9Yx0gzDerHbvYv7SddNWmAs

fix: make homepage and file viewer work better on w3m

resolves #92

6 files changed, 55 insertions(+), 33 deletions(-)

src/file-viewer/backend.tsx+2-1
......@@ -11,7 +11,7 @@ app.post("/file/cotyledon", async (c) => {
1111
1212app.get("/file/*", async (c, next) => {
1313 const ua = c.req.header("User-Agent")?.toLowerCase() ?? "";
14 const lofi = ua.includes("msie") || false;
14 const lofi = ua.includes("msie") || ua.startsWith('w3m/') || false;
1515
1616 let rawFilePath = c.req.path.slice(5) || "/";
1717
......@@ -19,6 +19,7 @@ app.get("/file/*", async (c, next) => {
1919 if (
2020 !rawFilePath.endsWith("thumbnail.jpeg") && (
2121 (!ua.startsWith("mozilla/") &&
22 !ua.startsWith("w3m/") &&
2223 // these two are for AirPlay
2324 !ua.includes("airplay") &&
2425 !ua.includes("applecoremedia")) ||
src/file-viewer/views/lofi.css-1
......@@ -38,6 +38,5 @@ li a:hover {
3838 opacity: 0.5;
3939}
4040.meta {
41 margin-left: 1em;
4241 opacity: 0.75;
4342}
src/file-viewer/views/lofi.marko+15-16
......@@ -22,9 +22,8 @@ export { meta, theme } from "./clofi.tsx";
2222 )/>
2323 <li class={ dir }>
2424 <a href=`/file${escapeUri(file.path)}` >
25 <code>${formatDate(file.date)}</>${" "}
26 ${file.basenameWithoutExt}<span class="ext">${file.extension}</>${dir ? '/' : ''}
27 <if=meta><span class='meta'>(${meta})</></>
25 <code>${formatDate(file.date)}</>${" "}<span>${file.basenameWithoutExt}</span><if=file.extension><span class="ext">${file.extension}</></><if=dir>/</>
26 <if=meta><span class='meta'>&nbsp;&nbsp;&nbsp;(${meta})</></>
2827 </a>
2928 </li>
3029</define>
......@@ -43,19 +42,19 @@ export { meta, theme } from "./clofi.tsx";
4342 <for|item| of=files><ListItem=item /></>
4443 </ul>
4544 </>
46 <if=!hasCotyledonCookie>
47 <br><br><br><br><br><br>
48 <p style={ opacity: 0.3 }>
49 would you like to
50 <a
51 href="/file/cotyledon"
52 style={
53 color: 'white',
54 'text-decoration': 'underline',
55 }
56 >dive deeper?</a>
57 </p>
58 </>
45 // <if=!hasCotyledonCookie>
46 // <br><br><br><br><br><br>
47 // <p style={ opacity: 0.3 }>
48 // would you like to
49 // <a
50 // href="/file/cotyledon"
51 // style={
52 // color: 'white',
53 // 'text-decoration': 'underline',
54 // }
55 // >dive deeper?</a>
56 // </p>
57 // </>
5958</><else>
6059 <ul>
6160 <li><a href=`/file${escapeUri(path.posix.dirname(fullPath))}`>[up one...]</a></li>
src/pages/index.css+17
......@@ -23,6 +23,23 @@ h2 {
2323p, h2 {
2424 margin: 0.75rem 0rem;
2525}
26.section-list {
27 margin: 0.75rem 0;
28 padding: 0;
29 list-style: none;
30}
31.section-list li + li {
32 margin-top: 0.75rem;
33}
34.link-list {
35 margin: 0.75rem 0;
36 padding: 0;
37 list-style: none;
38 display: flex;
39 gap: 1.5rem;
40 position: relative;
41 z-index: 2;
42}
2643hr {
2744 width: 100%;
2845 border: 1px solid #000b;
src/pages/index.marko+20-14
......@@ -21,22 +21,28 @@ export const meta = {
2121 this site contains my art.
2222 </p>
2323 <h2>posts</h2>
24 <p>video collab: <a href="/history-of-japan-reanimated">history of japan reanimated</a> (2026-02-02)</p>
25 <p style='display:flex'><span style='flex:0 0 max-content'>blog:&nbsp;</span><span style='flex: 1 0 0px'><a href="/blog/webdev/one-year-next-app-router">One Year with Next.js App Router — why we're moving on</a> (2025-10-21)</span></p>
26 <p>song: <a href="/in-the-summer">in the summer</a> (2025-08-08)</p>
27 <p>song: <a href="/waterfalls">waterfalls</a> (2025-01-01)</p>
24 <ul class="section-list">
25 <li>video collab: <a href="/history-of-japan-reanimated">history of japan reanimated</a> (2026-02-02)</li>
26 <li>blog: <a href="/blog/webdev/one-year-next-app-router">One Year with Next.js App Router — why we're moving on</a> (2025-10-21)</li>
27 <li>song: <a href="/in-the-summer">in the summer</a> (2025-08-08)</li>
28 <li>song: <a href="/waterfalls">waterfalls</a> (2025-01-01)</li>
29 </ul>
2830 <h2>things</h2>
29 <p><a href="/q+a">questions and answers</a></p>
30 <p><a href="/log">recent activity</a></p>
31 <p><a href="/file">file browser</a></p>
32 <p><a href="https://git.paperclover.net/clo">code forge</a></p>
33 <p><a href="/subscribe">mailing list</a></p>
31 <ul class="section-list">
32 <li><a href="/q+a">questions and answers</a></li>
33 <li><a href="/log">recent activity</a></li>
34 <li><a href="/file">file browser</a></li>
35 <li><a href="https://git.paperclover.net/clo">code forge</a></li>
36 <li><a href="/subscribe">mailing list</a></li>
37 </ul>
3438 <h2>links</h2>
35 <div style="display:flex;gap:1.5rem;position:relative;z-index:2">
36 <a href="mailto:hello@paperclover.net">email me</a>
37 <a href="/rss.xml">rss</a>
38 <a href="https://ko-fi.com/paper_clover">donate</a>
39 </div>
39 <nav>
40 <ul class="link-list">
41 <li><a href="mailto:hello@paperclover.net">email me</a></li>
42 <li><a href="/rss.xml">rss</a></li>
43 <li><a href="https://ko-fi.com/paper_clover">donate</a></li>
44 </ul>
45 </nav>
4046 <h1>paper clover</h1>
4147 </div>
4248</main>
src/q+a/tags/question.marko+1-1
......@@ -26,7 +26,7 @@ export const transitionDate = 1735639200000;
2626 <a>
2727 <time
2828 datetime=formatQuestionISOTimestamp(date)
29 >${formatQuestionTimestamp(date)}</time>
29 >${formatQuestionTimestamp(date)}</time><br />
3030 </a>
3131
3232 $!{markdown.renderMarkdown(question.text)}