open
https://gitlab.synchro.net/main/sbbs/-/work_items/1400
2026-11-22 13:50:15 -0800
## Summary
Improvements to `exec/webfileindex.ssjs`, the stock web file area index (`FileIndexScript`), in keeping with its goals: plain URLs to files, downloads served by the Web Server with all access and accounting done the Synchronet way (no script involved), and light pages that need no external resources.
(The `?view=` parameter bugs, an unescaped name in the page and a path outside the directory, are fixed separately.)
## Proposed
1. **Valid, mobile-friendly HTML.** Add `<!DOCTYPE html>` and proper `<head>`/`<body>` (the page now writes `</head>` and `</body>` without opening them, so browsers render it in quirks mode), and `<meta name="viewport" content="width=device-width, initial-scale=1">` (without it, listings render tiny on phones). Escape library and directory names and descriptions as the file descriptions already are.
2. **No JavaScript needed to use the listings.** Sort by clicking a column heading (links with `?sort=`), in place of the `onChange` drop-down; show extended descriptions with `<details>`/`<summary>`, which browsers open and close themselves, in place of the click handlers. Downloads already need none.
3. **Large directories.** Every listing loads the whole directory with extended descriptions. Add paging (`?page=`, with a page size setting), and answer `304 Not Modified` to a conditional request when the file base has not changed since (from its index file's date), which also cuts the load from crawlers. With that, the user-agent based 429 for `?view=` (a stopgap for the 32-bit SpiderMonkey heap) may be relaxed.
4. **Viewing an image counts as a download.** `view_image()` uses the file's download URL as the `<img>` source, so looking at a picture spends the viewer's credits and counts as a download. Either serve views by another path that does not charge (with its own access check), or decide that this is intended and say so.
5. **BBS-style features.** A "new files since" listing (by date, across the libraries the user may access), a search of names and descriptions, and a page per file (hash, size, dates, extended description, times downloaded), all as plain links and forms.
6. **Fitting into a site.** An optional sysop header, footer and style sheet (looked for in `mods/` or `text/`, for example), so the listings can match a site's look without editing the script.
7. **Clean-ups.** Undeclared globals (`s` in the sort loop), `const` inside a function, `var filename` redeclaring the parameter in `view_file()`.
## webv4
webv4 has its own Files page (`webv4/pages/002-files.xjs`) as well as a "Downloads" menu item that leads to `/files/` (`002-files.link`), with different looks and different sign-ins (webv4's cookie, HTTP Basic/Digest). With anonymous browsing (#1399), item 6, and server-owned sessions (#1398), webv4 (and its planned successor, SPAM) could leave file browsing and downloading to `/files/` and drop their own file pages, leaving one implementation.
## Related
- #1399: anonymous browsing of file area listings.
- #1398: browser sessions owned by the server.
- *Authored by Claude (Claude Code), on behalf of @rswindell*
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net