Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

32 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

4CHMG2 Mascot

4CHMG2

4chan Media Gallery 2.0 โ€” a cross-imageboard media aggregator and gallery viewer.
Search one keyword. Get every matching image and video from every board, merged into one fast gallery.

Version Next.js 16 License: MIT

React 19 TypeScript Tailwind CSS v4 Self-hosted

4CHMG2 homepage

The redesigned "deep space utility" homepage โ€” live source-status panel, neon accents, and a single search box.


Note

v1.4.0. New this release: auto-refresh with a "new posts" divider that merges in smoothly, download-complete toasts, a locate-on-exit highlight that returns you to your place after closing the lightbox, fixed webp downloads, always-clockwise rotation, and pulsing live status dots. K-pop-oriented by default, general-purpose by design.

๐Ÿ“– Table of contents

โœจ Why 4CHMG2

Imageboards scatter the same media across a dozen boards and archives. Finding everything on a topic means opening tab after tab, scrolling thread after thread, and re-running the same search by hand. 4CHMG2 collapses that into one query.

Principle What it means
๐Ÿ”Ž Search once, see everything One keyword fans out across 4chan, 2ch.org, Mokachan, and Desuarchive in parallel.
๐Ÿ–ผ๏ธ One unified gallery All hits merge into a single grid, sorted newest-first by post timestamp.
โšก Fast by default A self-hosted proxy with aggressive thumbnail caching keeps scrolling smooth โ€” no skeleton flashes.
๐ŸŽ›๏ธ Yours to configure Add, hide, or remove boards right in the browser โ€” no source edits required.

๐Ÿš€ What's new in 1.4.0

  • ๐Ÿ”„ Auto-refresh โ€” toggle live polling of your open threads for new posts, with a 1m / 5m interval (default 5m). Fresh media lands below a full-width "new posts" divider; successive batches stack below it and merge into the grid only when you scroll to the bottom โ€” with a smooth slide-in animation instead of a layout jump.
  • ๐ŸŽฏ Locate-on-exit โ€” closing the lightbox smooth-scrolls the tile you were viewing back to centre and highlights it (a cyan pulse plus a full-bleed band across its row, fading out) so you never lose your place.
  • โœ… Download-complete toasts โ€” green-check "filename saved" notifications slide in, stack, and fade out on both the search and lightbox views, tucked out of the way of the thumbnail strip.
  • ๐Ÿ’พ Fixed webp downloads โ€” webp now saves like every other format instead of opening in a new tab.
  • ๐Ÿ” Always-clockwise rotation โ€” rotate reads clockwise even after a horizontal flip, and flipping no longer "rewinds" your rotation.
  • ๐ŸŸข Live status dots โ€” the home-page source-status dots pulse to signal live data.
  • ๐Ÿงญ More orienting controls โ€” a scroll-to-bottom button, mouse-wheel scrolling on the lightbox thumbnail strip, centred-then-cursor-following zoom, and Ctrl+F to filter by filename.

๐Ÿงฐ Features

Feature checklist
  • Multi-board search โ€” query 4chan, 2ch.org, Mokachan, and Desuarchive simultaneously
  • Unified gallery grid โ€” all results merged and sorted by timestamp
  • Batch ZIP downloads โ€” select gallery results and export them as a single archive
  • Quick save โ€” hover a result and press S to download it in place
  • Full-featured lightbox โ€” keyboard nav, zoom/pan, slideshow, flip, rotate, download, hotkeys
  • OR search โ€” separate keywords with | for multi-term matching
  • Auto-refresh โ€” toggleable live polling with a "new posts" divider that merges in smoothly when you reach the bottom
  • Download toasts โ€” slide-in "saved" confirmations that stack and fade
  • Locate-on-exit โ€” smooth-scroll + highlight returns you to your place after closing the lightbox
  • Touch-friendly โ€” drag-to-pan, pinch-to-zoom, double-tap reset
  • Fast self-hosted proxy โ€” aggressive thumbnail caching for smooth, flash-free scrolling
  • In-browser Board Configurator โ€” add / hide / delete boards, persisted per-browser
  • Relative-time scrollbar โ€” scrub a result set by post time
  • Dock-style lightbox thumbnails โ€” cursor-following magnification

๐Ÿ–ผ๏ธ Showcase

Search results gallery
Unified search gallery โ€” every board's hits in one timeline-sorted grid.
Lightbox viewer
Lightbox viewer โ€” zoom, pan, slideshow, and a magnifying dock.
๐ŸŽ›๏ธ In-browser Board Configurator

Board Configurator
Add your own boards by id + label, hide ones you don't use, or delete them โ€” all without editing source code.

๐ŸŒ Supported boards

Source Board(s) Cloudflare Format
4chan /mu/, /trash/, /gif/ No 4chan API
2ch.org (Dvach) /kpop/ No Dvach / Vichan
Mokachan /kr/ No Meguca
Desuarchive /mu/, /trash/ No Foolfuuka
Easychan (defunct) /kr/ Yes Meguca

Tip

Users can add their own boards on the supported sites via the in-app Board Configurator โ€” no source edits needed. Adding a new built-in default is still a single entry in src/lib/boards.ts.

A note on Cloudflare

Cloudflare-bypass support (FlareSolverr) is retained in code for future Cloudflare-fronted boards, but is not deployed in production โ€” the only board that ever needed it, Easychan, is defunct. It is dormant, not a headline feature.

๐ŸŽฎ Lightbox hotkeys

Key Action
โ† / โ†’ Navigate between media
Space Toggle slideshow
F Toggle fullscreen
H Flip image horizontally
R Rotate
S Download current media
T Toggle thumbnail strip
M Mute / unmute video
Esc Close lightbox

๐Ÿš€ Quick start

Local development

Run the app directly without pm2 โ€” ideal for development or quick testing:

git clone https://github.com/kpg-anon/4chmg2.git
cd 4chmg2
cp .env.example .env
nano .env                    # set your port, etc.
npm install
npm run build
npm start

Persistent server (pm2 + gulp)

Use pm2 for process management with automatic restarts and zero-downtime reloads:

git clone https://github.com/kpg-anon/4chmg2.git
cd 4chmg2
cp .env.example .env
nano .env                    # set your domain, port, etc.
npm install
npx gulp reset               # install, build, and start under pm2

VPS deployment (Debian 12)

For a full production setup with nginx, SSL (certbot), and pm2 autostart:

sudo ./install.sh

See docs/INSTALLATION.md for the complete walkthrough.

๐Ÿง‘โ€๐Ÿ’ป Usage

After making changes to the code:

npx gulp                     # build + reload (everyday command)
Command Description
npx gulp Build and reload the server
npx gulp build Build only
npx gulp restart Reload pm2 only
npx gulp reset Full setup from scratch (install + build + start)
npx gulp logs View application logs
npx gulp status Check pm2 process status

๐Ÿ› ๏ธ Tech stack

Layer Technology
Framework Next.js 16 (App Router)
Runtime React 19
Language TypeScript
Styling Tailwind CSS v4
Process manager pm2
Build runner gulp
Reverse proxy nginx + certbot

Cloudflare-bypass (FlareSolverr) support is retained in code for future Cloudflare-fronted boards, but is dormant and not deployed in production.

๐Ÿ“ฆ Deployment

4CHMG2 is designed to be self-hosted. Instance-specific configuration (domain, ports, etc.) lives in .env, which is gitignored. For full VPS deployment details, see docs/INSTALLATION.md.

๐Ÿ—บ๏ธ Roadmap

  • Additional imageboard sources
  • Media deduplication via perceptual hash
  • Gallery sharing via URL
  • Expanded settings (grid density, accent color)

๐Ÿ“œ License

MIT


Built with Next.js, React, and Tailwind CSS.

Releases

Packages

Contributors

Languages