Tommaso CasaburiandGitHub 69ee15786b fix(quotes): handle cross-thread quotes (publish + hover preview) (#1153)
* fix(quotes): publish only same-thread quoted cids

Quoting a post from another thread failed to publish with "One or more
quoted CIDs are not under the same post". That message is the protocol
error ERR_QUOTED_CID_NOT_UNDER_POST from @pkcprotocol/pkc-js, not a custom
5chan error: a reply's quotedCids must all live under the reply's own
thread.

The reply publish path resolved every >>number quotelink to a CID through
the board-scoped number map and sent them all as quotedCids, so any
cross-thread quotelink made the protocol reject the whole post.

Track each comment's thread (postCid) in usePostNumberStore and filter the
merged quotedCids to same-thread entries before publishing. Cross-thread
quotelinks still render and navigate via their >>number text; only the
published metadata changes. Same-thread replies resolved on demand by the
external-quote resolver are preserved because the resolver registers what
it finds.

Regression introduced in 9f14a6326 (populate quotedCids when publishing
replies with quote references).

* fix(quotes): show hover preview for cross-thread quotelinks

Hovering a >>number quote whose thread was not loaded showed nothing: the
quotelink rendered as an inert span with no floating preview. NumberQuoteLink
only fell back to the lazy resolver when the number->cid mapping was unknown.
When the cid was known but the comment body was not cached, it rendered
ReplyQuotePreview with an undefined comment, which is treated as pending
resolution and rendered as inert text that never fetched the body (the lookup
used onlyIfCached).

Load the body lazily on hover instead: NumberQuoteLink keeps onlyIfCached until
the quotelink is hovered, and ReplyQuotePreview's pending quotelink is now
hoverable when its cid is known so it can request that fetch and prime the
floating-preview position. Once the body resolves the preview appears without
re-hovering. Same-thread quotes stay cached, so this never fetches for them.

* fix(quotes): filter the final quotedCids payload to same-thread

Apply the same-thread filter to the merged publish options rather than only the
derived subset, so any quotedCids carried on stored publishCommentOptions cannot
bypass the guard. Defense in depth for the protocol's same-thread requirement
(ERR_QUOTED_CID_NOT_UNDER_POST); addresses PR review feedback.
2026-06-05 17:45:42 +07:00
2026-06-04 17:18:35 +07:00
2026-05-31 11:48:49 +07:00
2026-05-30 16:12:41 +07:00
2026-05-31 11:48:49 +07:00
2026-03-29 18:46:07 +07:00

Build Status Coverage React Doctor Release License Commitizen friendly Ask DeepWiki

Telegram group for this repo https://t.me/fivechandev

5chan

5chan is a serverless, adminless, decentralized and open-source imageboard built on the Bitsocial protocol. It features the classic imageboard directory structure, but with a crucial difference: anyone can create and own boards, and multiple boards can compete for each directory slot.

Key Features

Decentralized Board Ownership

Unlike traditional imageboards, 5chan has no global admins or central authority. Anyone can create unlimited boards using 5chan Board Manager. Each board owner runs their own P2P node that users connect to peer-to-peer, giving them complete control over their board's content, moderation, and rules.

Competitive Directory System

5chan maintains the familiar imageboard directory structure (Japanese Culture, Video Games, Interests, Creative, etc.), but introduces competition: multiple boards can compete for each directory slot. For example, there can be unlimited "Business & Finance" boards, but only the highest-voted one appears in the directory on the homepage.

Currently, directory assignments are temporarily handpicked by developers through GitHub pull requests. In the future, each directory will have its own voting page. 5chan Pass holders are expected to participate in directory voting, while final governance mechanics are still being designed to include BSO-holder alignment instead of pass-only final control.

How It Works

  • Current System: Developers manually curate directory assignments by reviewing pull requests to the 5chan directory files.

  • Future System: Each directory will have its own voting page listing the boards competing for that slot. 5chan Pass holders are expected to participate in directory voting, while final governance mechanics are still being designed to include BSO-holder alignment instead of pass-only final control.

  • Accessing Boards: Users can access any board at any time using its address, regardless of directory assignment. Boards can be accessed via the search bar, by subscribing to them (which adds them to the top bar), or by directly navigating to their address.

Future Roadmap

In-App Board Creation

Creating boards directly from the 5chan web app (5chan.app) is planned. This requires connecting via RPC to a bitsocial node—technically already possible, but there's no default connection configured. A default connection would require a public RPC service (similar to what Infura provides for crypto wallets, but for bitsocial nodes). This would allow all users to be connected to a P2P node by default using a free tier subscription in the background, potentially monetized via ads injected in the RPC service-owned boards.

Directory Voting

Directory voting pages are planned for each slot on 5chan. These pages will list the competing boards for that directory, and 5chan Pass holders are expected to participate in voting. Final governance mechanics are still being designed to include BSO-holder alignment instead of pass-only final control.

Downloads

Creating a Board

In the bitsocial protocol, a 5chan board is called a community. To deliver the expected 5chan imageboard UX, a board should run on a bitsocial node together with 5chan Board Manager. The board manager applies imageboard-style lifecycle rules that bitsocial communities do not enforce by themselves: thread limits, bump limits, archived-thread retention, and purging of author-deleted content.

To create and run a board:

  1. Follow the Docker Compose flow in the 5chan-board-manager README;
  2. Create your community and add it to 5chan Board Manager using the commands shown there;
  3. Keep the manager running so it can apply 5chan board behavior such as thread archiving, bump limits, and retention cleanup.

Once created, anyone can connect to your community using any bitsocial client (such as 5chan) by using the community address. The address is not stored in any central database—bitsocial is a pure peer-to-peer protocol.

Without 5chan Board Manager, a community can still be opened in 5chan, but it will not behave like a conventional imageboard board: old threads will not be archived when they fall past the last page, bump limits will not be enforced, archived threads will not be purged after the retention window, and author-deleted content will not be automatically purged.

Note: Creating boards directly from the 5chan web app is planned for the future (see Future Roadmap).

Submitting Your Board to a Directory

To have your board appear in a directory on the 5chan homepage:

  1. Ensure your board meets these requirements:

    • Active and well-moderated
    • Relevant to the directory category
    • 99% uptime (since a board acts like its own server—it's a P2P node)
  2. Open a pull request on GitHub by editing the relevant file in the 5chan-directories folder

  3. Add your board's entry with:

    • Title: in the format /directoryCode/ - Title, e.g. "/biz/ - Business & Finance";
    • Address: the bitsocial community address, whether IPNS key (12KooW...) or readable crypto address (mydomain.eth);
    • NSFW status: true or false, must match the standard classification for the directory code.
  4. The developers will review your PR and merge it if approved

Note: Even if your board isn't assigned to a directory, users can still access it at any time using its bitsocial community address. Directory assignment only affects visibility on the homepage.

Development

Prerequisites

  • Node.js 22.12.0, pinned in .nvmrc
  • Corepack enabled once per machine: corepack enable

Contributor Setup

  1. Run nvm install && nvm use
  2. Run corepack enable once
  3. Use plain yarn install, yarn build, and yarn test

Setup

  1. Clone the repository
  2. Install dependencies: yarn install
  3. Start the web client: yarn start

The dev server normally runs at https://5chan.localhost via Portless, which gives each Bitsocial project a stable, named URL instead of a random port. Portless 0.11 serves this URL through an HTTPS proxy on port 443, so the first yarn start after install or proxy reset may prompt for sudo; accept the prompt so the URL can stay portless. On non-master branches, or when another legacy process is already holding the canonical route, yarn start will automatically use a branch-scoped *.5chan.localhost URL instead of failing. To bypass Portless and use a plain Vite dev server, run PORTLESS=0 yarn start; it will start at http://localhost:3000 and automatically fall forward to the next free port if 3000 is already in use.

For device testing on a USB-connected Android phone (without relying on 5chan.localhost DNS from the device):

  • yarn start:android-usb starts Vite bound to 127.0.0.1 and runs adb reverse, so the phone can load the dev site at http://localhost:3000. When the server is up, it opens that URL in each connected device’s default browser via adb. Set ANDROID_USB_OPEN_BROWSER=0 to skip auto-open. Requires Android platform-tools (adb on your PATH), USB debugging enabled, and the device showing as device in adb devices.

Scripts

  • Web client: yarn start (https://5chan.localhost)
  • Web client (Android phone over USB): yarn start:android-usb (see above)
  • Electron client (must start web client first): yarn electron
  • Electron client (don't delete data): yarn electron:no-delete-data
  • Web client and electron client: yarn electron:start
  • Web client and electron client (don't delete data): yarn electron:start:no-delete-data

Challenge Types

Bitsocial communities can require users to solve one or more anti-spam challenges before a publication is accepted. 5chan already supports multiple challenge types, including url/iframe challenges so Mintpass communities can run their iframe flow directly inside a modal. The modal first shows a hostname confirmation (showing only the host for mintpass.org, full URL otherwise), then opens the HTTPS iframe with the current theme, replaces {userAddress} tokens with the signed-in address, and submits automatically when the user finishes.

Build

The Linux/Windows/macOS/Android build scripts are in .github/workflows/release.yml

License

5chan is open-source software (GPL-3.0-or-later) with no owner—anyone can host their own instance on any domain. The operator of any domain is merely hosting the web app and does not own, create, moderate, or control 5chan or any board content, which is stored peer-to-peer and generated by board owners and users.

Languages
TypeScript 83.9%
JavaScript 6.5%
CSS 5.8%
Java 2.5%
Shell 1.1%
Other 0.2%