23 Commits
Author SHA1 Message Date
Claude 695ccf6980 Where users call from: filled in at sign-up, shared with sysops if they agree
A new user's "Where are you calling from?" starts filled in with where
their caller ID (area code and exchange) or address (GeoIP) says they are,
on the BBS and the web forum's sign-up; geoip_prefill = no turns it off.

New users are asked whether the sysop may see where they call from (no
unless they say yes), and can change it in their profile or the API
(share_location).  For those who share it the place, how it was found and
the date are kept at each login, shown to sysops on the user's pages, in
bbs config's user editor and the API's geo; stopping forgets it.
geoip_users = no stops asking and keeping.

A modem call by VoIP without a caller ID is placed by the address the call
came from, if the modem server sends it (DMODEM_PEER / MODEM_PEER).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRSVXNfvCFNooYkqeMp
2026-11-09 13:45:49 +00:00
Claude 7399e0fa36 Point repository references at the D-Modem organisation
The repositories moved from Neo-Desktop to the D-Modem GitHub
organisation: D-Modem-RE is now D-Modem/D-Modem, pico-serial is
D-Modem/hardware, modemmenu (PBX-Modem) is D-Modem/menu, bbs-sec is
D-Modem/bbs and go3270-sec is D-Modem/go3270.  Update links, module
paths, submodule URLs and source-location strings to match.  Copyright
notices still name Neo-Desktop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRUwD2JJ5d6fgHmpVTw
2026-10-29 09:02:40 +00:00
Claude 6abf4cf347 Comment and test cleanups
- Comments that named something else now name their own function:
  ircd member, imageboard srcPath and linker, forum when, redirect and
  errNoArea, textui sheetDraw.first; a stray comment in rest.go gone.
- confui: changeLines uses diffLines instead of repeating it.
- nntp: accept_from names are looked up when the configuration loads
  (start and reload), now said in the code and the wiki.
- Tests: tnClient.read grows its buffer for a command split at its end
  (a full buffer read nothing for ever); freeAddr folded into freeTCP;
  zipOf is a helper.
- go3270-sec 6c7224e: its comment fixes and gfxtest tidying.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 22:40:48 +00:00
Claude ffee2509a2 REST page agrees with the WebSocket; OpenAPI FileAreas has can_download
- POST /api/v1/page that reaches no sysop is now 503 "unavailable" (the
  page withdrawn), as the WebSocket's Page request answers, not 200 with
  waiting false.
- The OpenAPI FileAreas schema lists can_download, which GET
  /file-areas has sent all along.
- HTTP-API wiki notes the 503.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 22:15:41 +00:00
Claude fc3977ae11 API: file names escaped in Content-Disposition
A download's and a QWK packet's names went into Content-Disposition in
quotes as they were, so a name with a quote, a backslash or a control
character broke the header.  attachment (mime.FormatMediaType) quotes and
escapes it, percent-encoding (RFC 2231) what quoting cannot carry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 21:48:10 +00:00
Claude 9218f3e5d7 API PATCH: all or nothing
patchUser, patchArea and patchMe saved each change as they came to it,
so a request refused for a later field (a bad level, a bad echo tag, a
wrong old password) left the earlier ones made: a password or a lock
set by a request answered 400.  Every change is now checked first (an
area's newsgroup and echo tag against the other areas too), patchMe
changes the password before saving the rest, and the store's errors are
no longer ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 21:47:32 +00:00
Claude 93d9db5602 API downloads: a Range request no longer skips the limits
A request with a Range header was checked only for access, not for the
day's downloads or the ratio, and was not counted, so Range: bytes=0-
fetched a whole file past the limits uncounted.  A Range request is now
free only when it resumes the user's download of that file counted in
the last day (BBS.Resuming, remembered by Downloaded); any other is a
download like the rest, checked and counted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 21:41:47 +00:00
Claude 8cac5066f6 Doc comments on every function
Every function and method, tests included, has a doc comment: what it
is or does, what it returns and anything a caller needs to know.  Only
comments are added; gofmt split a few aligned blocks of one-line
functions once each had its own comment.  The generated protobuf code
is left as protoc writes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 21:26:18 +00:00
Claude 34c8757d0d Live settings: snapshot reads through Conf, Reconfigure hooks
The BBS, image boards and forum read their settings through an atomic
snapshot (Conf, conf, opts), so a new configuration can be swapped in
while callers are on. Menus and [strings] swap the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 18:36:52 +00:00
Claude 4d49631d37 Where callers are: GeoIP for the forums, caller ID decoding
- internal/phone reads modem caller IDs with its own tables: the ITU's
  country calling codes (shared ones told apart), the NANP's area codes
  by state and province, toll-free and other services, and how each
  country dials, so national numbers read as [general] phone_country
- [general] geoip (with geoip_credit) is the BBS's country database;
  [chan] geoip falls back to it.  geoip.File keeps a database file up
  to date for both
- bbs.Locate and Node.Place: a caller's place by caller ID, else by
  address; the connect log, who's online (the country), the sysop's node
  list (number and state) and the API's /who show it
- messages keep the poster's country (messages.country); the web forum
  shows its flag by the poster's name in every theme and on Online
  Users, with the database's credit at the foot ([http] forum_flags)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 08:05:27 +00:00
Claude 546af1eee3 Web forum: the message areas as a bulletin board in the browser
The HTTP API's server serves /forum/ (and / when it is on): the areas as
categories of forums, topics and posts with their authors beside them,
laid out in the manner of Invision Power Board 3's default skin with CSS
of its own (no code or assets taken from it, no scripts on the pages).

- store: messages carry their topic (thread), set on posting, found for
  messages from before, mended when a topic's first post or a reply's
  parent goes; per-user topic read marks; topic lists and counts
- forum: board index with groups, statistics and who's online; area
  topic lists with unread marks and pages; topics with quotes, likes
  (the BBS's votes), polls, deleting, replies; new topics with polls and
  aliases; profiles, search, who's online, login and sign-up
- logins are the API's session tokens in an HttpOnly, SameSite cookie;
  every logged-in form carries a CSRF token; strict CSP, no framing
- [http] forum and forum_guests settings
- bbs.WrapBody: text typed in paragraphs (the forum, the API's posts and
  mail) wrapped to the terminals' 79 columns instead of cut, quotes
  carried onto wrapped lines
- docs: Web-Forum wiki page, configuration, HTTP API, development

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-12 23:22:17 +00:00
Claude 09e9152049 QWK networking: the BBS as a hub, and as a node
As a hub: an account flagged qwk_node (bbs user qwknode NAME, or the
API's qwk_node) is another BBS's.  What its REPs bring is posted under
its writers' names, with its access checked, and its packets leave out
what came from it.

As a node: [qwknet NAME] calls the hub by FTP (FTPS explicit or
implicit) every so often, or on bbs qwknet call and POST
/api/v1/admin/qwknet/call.  It puts a REP of what was written here in
the network's areas since the last call (nothing from before joining,
nothing that came by a network or peer), then takes the hub's packet
and posts it in the areas of its conferences (CONFERENCE = AREA).
Messages are known by conference and number (qwk_msgs), so nothing
comes twice and answers keep their threads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-12 18:30:41 +00:00
Claude a00b469b5e QWK offline mail: packets of new messages and mail, REP replies
internal/qwk reads and writes QWK packets and REPs: MESSAGES.DAT's
blocks, CONTROL.DAT, conference and personal indexes (MBF floats),
QWKE kludges for long names and subjects, CP437 text.

A caller's packet holds their unread mail (conference 0) and the new
messages of the areas in their new scan (an area's ID its conference);
they count as read only once the packet has gone.  A REP's messages are
posted and mailed as the caller, with their access checked; one brought
twice posts once (qwk_seen, kept 90 days).  BBSID: qwk_id, or made of
the name.

Offline mail is O on the main menu (qwk in the sysop's menus): by
X/Y/ZMODEM or Kermit on the text BBS, IND$FILE GET and PUT on a 3270,
/qwk over FTP, and GET /api/v1/qwk, POST /api/v1/qwk/rep.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-12 18:21:59 +00:00
Claude bccdf2cc6a Deepen the message base: threads, votes, polls, aliases, signatures, groups, retention
For every front end (internal/app), the API and the CLI:

- Threads: from a message, the one it answers (O, PF2) and its whole
  thread (T, PF6), replies under what they answer; GET
  /messages/{id}/thread.
- Votes: up, down or none on a message (V, PF1), shown by its number;
  POST /messages/{id}/vote.
- Polls: a question and 2 to 10 answers posted in an area (L, PF9),
  answered (A, PF12) and shown with each answer's share; POST with
  "poll", POST /messages/{id}/answer.
- Aliases: a user's alias (checked like a new name, no one's name or
  alias) posted under in areas that allow it; the message's From is the
  alias everywhere, newsgroup articles included (they used the real
  name), while the sysop keeps whose it is.
- Signatures: up to three lines under posts and mail written on the BBS.
- Groups: areas listed by group, with a Group column.
- Retention: an area keeps its newest N messages and/or those of the
  last D days, purged hourly and by bbs area purge.

Tested on SQLite, PostgreSQL, MySQL and MariaDB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-12 18:06:52 +00:00
Claude a93a2cf303 Add the sysop's tools: watching nodes, chat, users, statistics, events
A sysop's main menu has * (and custom menus a sysop action), on every
terminal:

- Watch a node: what a text caller is sent, as it is sent (the text
  terminal's connection echoes to bbs.Node.Echo; a slow watcher misses
  some, never slows the caller).  A key stops; the caller leaving ends
  it.  Text terminals only.
- Chat with a node: the caller is told and taken into a private chat
  (their page's room) at their next menu; the sysop waits there.
- Kick a node.
- Users: level, flags, lock, sysop rights, a new password (not one's
  own lock or rights).
- Statistics: totals, and calls, new users, posts and uploads for each
  of the last 14 days as bars.
- The bans (lifted by number) and the hack log.
- Scheduled events ([event NAME]: a program run without a shell, daily
  at a time or every N minutes, with a timeout; internal/events): when
  they run next, the last run's end and output, run now.
- Available: whether pages reach the sysop; when not, a caller who pages
  may leave a message.

The API: GET /admin/events, POST /admin/events/{name}/run, PUT
/admin/available.  Sysop-Tools is the wiki page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-12 17:45:05 +00:00
Claude dd788e26a3 Add the last callers, feedback, user details, a line about oneself, expert menus
- Last callers (L, and a callers menu action): each login is recorded
  (calls: the newest 10000 kept); GET /api/v1/callers.
- Feedback to the sysop (K, a feedback action): mail any caller may
  send, whatever their level allows.
- The user list picks a user: their details (a sysop sees their access
  and files too), and mail to them from there.
- A line about oneself, on the profile (Y; - clears it) and PATCH /me's
  about, shown with one's details.
- Expert menus (the expert setting, X on a text terminal's profile): a
  menu is its prompt, "Command (? for the menu): ", and ? shows it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-12 17:33:55 +00:00
Claude 8ab9e8a24b Keep callers out: deny lists, bans, a name filter, the hack log, telnet over TLS
[security] in bbs.conf (internal/guard):

- deny_file: addresses and networks (IPv4, IPv6, CIDR) whose
  connections every service closes at once: the terminal listeners and
  SSH, FTP, NNTP, the HTTP API, finger, gopher and binkp.  Read again
  when it changes; bbs check warns of bad lines.  Unix-socket callers
  (modem servers, menus) are never refused.
- ban_minutes: an address the login throttle turns away is banned from
  every service for that long.  The API lists bans and lifts them.
- name_deny_file: name patterns (* wildcards, any case) no new account,
  nor one an upstream menu makes, may take; the text BBS says so as the
  name is typed.
- hack_log: failed logins and the names tried, locked accounts,
  throttles, bans, refused connections and names, one a line; the API
  shows its end.

A telnet or raw listener with tls_cert and tls_key is telnet over TLS
(1.2 or later; port 992), with 15 seconds for the handshake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-12 17:27:43 +00:00
Claude 0cce335b88 Deepen the file base: DIZ, archive views, new files, search, batches, ratios
- FILE_ID.DIZ: an archive uploaded by any way (the BBS, IND$FILE, FTP,
  the API, the CLI) is described by its DIZ, kept as the file's longer
  description (CP437 decoded, colors and control characters out, at
  most 20 lines); its first line that says something is the description
  unless the uploader gave one.
- Archives: what is in a ZIP, tar or tar.gz, from a file's details (V,
  PF6) and GET /files/{id}/listing.
- New files since the caller's last call (N, PF5) and finding files by
  name and descriptions (F, PF10), across the areas they may see; the
  API's GET /files?since= and ?q=.
- A batch: files tagged (T, by numbers such as 1 3 5-7, or from a
  file's details) download together by YMODEM, ZMODEM or Kermit; a file
  counts once the protocol has gone on past it.  Frontend.Download takes
  a list of files.
- Ratios: [level] ratio and ratio_free (files downloadable for each
  upload, and before the ratio counts), checked with the day's limit for
  a whole batch.  Users' lifetime downloads and uploads are counted.

The store gains a {plain} token: PostgreSQL's LIKE refuses the
case-insensitive collation of {name} columns.  Tested on SQLite,
PostgreSQL, MySQL and MariaDB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-12 14:41:19 +00:00
Claude de134e3308 Keep each user's terminal settings for their next call
What a caller switches on their profile (ANSI, UTF-8, sixel, RIP, a
Commodore's width) is kept with their account as settings (users.prefs,
"key=value" pairs) and applied after the next login: ANSI and UTF-8 as
set, sixel and RIP kept off when turned off and on only where the
terminal has them.  An editor setting (full or line) is there for the
full-screen editor.

The API shows them at GET /me and changes them with PATCH /me ("":
forgets one); unknown settings and values are refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-12 14:13:25 +00:00
Claude b41f59ec55 Add access levels: levels, flags, requirements, limits, validation
Users have a level (0-255) and flags (A-Z).  [level N] sections say what
a range of levels may do: time online a day (warned at 5 and 1 minutes,
hung up at the end; doors' limits cut to what is left), downloads a day
(counted by every way: the BBS, 3270, FTP, the API), and whether they
may post, mail (else only the sysop), chat, page, download, upload and
open doors.

Requirements ("30 F !X", "sysop") are put on message areas (reading and
posting), file areas (downloading and uploading), doors, menus and menu
items ("x = menu:extras Extras | 50 X").  They are checked in the core,
so the text BBS, 3270s, FTP, NNTP and the API keep them alike: an area a
user may not read is not listed, opened or found by number or
Message-ID.

New users start at new_user_level and are told they wait; the sysop
validates them on the BBS (V on the main menu), by bbs user
waiting/validate/level/flags, or by PATCH /api/v1/admin/users.  Users
see their access in the profile and /api/v1/me; no one changes their
own.  Drop files carry the caller's level.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-12 08:49:46 +00:00
Claude b20533e6ff Identify VT terminals as DEC's were asked
internal/vt asks an ANSI terminal everything at once (ENQ answerback,
DA1, DA2, XTVERSION, its cell size), with a cursor position report last
so the answers are complete when it comes, and reads them into a name
(XTVERSION, SyncTERM's CTerm, DEC models by DA2 and firmware, tmux,
screen, mintty, rxvt, xterm, VTE, the answerback, the VT class), a VT
level, sixel and color.  A terminal that is not ANSI is asked ESC Z: a
VT52 answers.

What it said changes what the caller gets: a VT without UTF-8 (not a
PC's CP437 BBS terminal) gets line drawing in DEC Special Graphics and
Latin-1 on a VT220 or later; a DEC monochrome terminal gets bold for
color; a VT52 its own escapes (VT52Writer) with its cursor keys ignored.
Sixel now comes from the same answers.  The name shows in the profile,
the log and the API's who (terminal).  A listener's vt = no asks nothing.

Also: the terminal type and rlogin's rate are set under the BBS's lock
(who's online reads them).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-12 07:07:23 +00:00
Claude 41e16cd38b Add an SSH listener, with users' keys
[listen NAME] type = ssh serves the text BBS over SSH.  Users log in
with their BBS password (password or keyboard-interactive, throttled
and delayed as on a terminal) or with one of their public keys; the
user "new" gets the BBS's own prompt to sign up.  The pty's terminal
type and size go to the text BBS.  Commands, SFTP, forwarding and
second sessions are refused.

Host keys (ed25519 and RSA by default, beside the database) are made
0600 the first time and refused when others may read them; legacy = yes
adds CBC ciphers and group1 DH for old clients.

Keys live in a new ssh_keys table and are managed by bbs sshkey
add/list/del, the profile on the text BBS (after the password again),
and /api/v1/me/keys (from a login's session only, not an API key).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-11 21:42:16 +00:00
Claude 284d0e08f5 Add an HTTP API with JSON and protobuf WebSockets
[http] serves a REST API under /api/v1 (accounts, message areas, mail,
file areas with uploads and ranged downloads, chat rooms, paging, and
sysop administration including FidoNet polls and news syncs), with
server-sent events and two WebSocket endpoints speaking the bbs.v1
protocol from proto/bbs.proto: JSON text frames at /api/v1/ws and
binary protobuf at /api/v1/ws/proto.  Stream clients get a real node,
so web users chat with terminal callers, get node messages and page
the sysop.

Tokens are login sessions or API keys (bbs token add/list/revoke),
stored as SHA-256 hashes, with scopes.  TLS by default, per-token and
per-address rate limits, strict bodies, one CORS origin at most,
Prometheus metrics on their own address, and an OpenAPI 3.1 document
checked against the routes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-11 16:40:57 +00:00