[PR #273] [MERGED] feat(bot-browser): token-only Pygmalion, Janny robustness, DataCat provider #4538

Closed
opened 2026-10-22 04:08:32 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/273
Author: @LukaTheHero
Created: 4/28/2026
Status: ✅ Merged
Merged: 4/28/2026
Merged by: @LukaTheHero

Base: main ← Head: feat/botbrowser-upgrade


📝 Commits (6)

  • c520238 feat(bot-browser): token-only Pygmalion, Janny robustness, DataCat provider
  • 220856a fix(bot-browser): address CodeRabbit review on PR #273
  • 10061dc fix(bot-browser): revert credentials:"include" on JannyAI search
  • d7d82a1 fix(bot-browser): expire JannyAI fallback token cache after 60s
  • 8e68d4f fix(bot-browser): DataCat fresh totalCount + disable phantom search
  • 48f41a4 fix(bot-browser): JannyAI token TTL + force-refresh, kill-switch through body

📊 Changes

5 files changed (+1054 additions, -190 deletions)

View changed files

📝 packages/client/src/components/bot-browser/BotBrowserView.tsx (+550 -116)
➕ packages/server/src/routes/bot-browser-datacat.routes.ts (+238 -0)
📝 packages/server/src/routes/bot-browser-janny.routes.ts (+214 -25)
📝 packages/server/src/routes/bot-browser-pygmalion.routes.ts (+50 -49)
📝 packages/server/src/routes/index.ts (+2 -0)

📄 Description

Summary

Upgrade the bot browser across three providers and add a fourth.

Pygmalion — token-only login

  • Remove the username/password proxy login. The browser already exposes the
    auth token in Local Storage, so the user pastes that directly.
  • New POST /pygmalion/set-token accepts the pasted token (strips a leading
    Bearer prefix) and GET /pygmalion/validate confirms it via an
    authenticated CharacterSearch. Auto-clears the token on 401/403.
  • Help text in the login modal walks users to DevTools → Application →
    Local Storage → authn (~705-character string).

JannyAI — work around Cloudflare, recover lost data

  • The MeiliSearch POST is now made from the browser (matching how every
    working JannyAI client does it) so the user's cf_clearance cookie and
    real TLS fingerprint clear Cloudflare's bot challenge. The server still
    scrapes the public token and exposes it via GET /janny/token.
  • Token scraper now follows the SearchPage.<hash>.js chunk to find
    client-config.<hash>.js (the bundle layout changed). Page-scrape
    fallback through corsproxy.io for resilience when the local IP is blocked.
  • Cloudflare detection: added challenge-platform marker + a min-length
    sanity check on the character page scrape. Tag IDs / creator IDs missing
    from the page scrape are now back-filled from MeiliSearch.
  • Custom include tags (free-form names not in JannyAI's known tag map) are
    applied client-side against each hit's resolved tag names, instead of
    being silently dropped.
  • When client-side filters (excludeTags / custom includeTags) thin a page,
    auto-fetch up to 3 additional pages and concat to keep the grid full.

DataCat — new provider

  • Anonymous session bootstrap via POST /api/liberator/identify
    (random deviceToken); session token cached in memory and replayed in
    X-Session-Token on every call. Auto re-mints once on 401.
  • Two sort options: 🔍 Relevance (default, calls /recent-public,
    supports tag filtering) and 🔥 Fresh (/fresh 24h trending).
  • Tag panel uses DataCat's faceted tag list. The endpoint returns ~28k
    tags; the panel renders only the top 150 by character count to keep the
    UI snappy. The full id↔name map is still cached so card-level tags and
    long-tail typed-in tag names still resolve.
  • DataCat is NSFW-only upstream — every character is tagged NSFW. The NSFW
    toggle is hidden, the filter is force-on, and a confirmation modal warns
    before the first switch (Continue / Don't continue). Tooltip explains
    "DataCat is NSFW-only".
  • Avatar proxy routes through https://ella.janitorai.com/bot-avatars/
    (DataCat's CDN).

Misc

  • Wyvern-specific "Use 'Popular NSFW' sort for NSFW content" hint and
    toast are scoped to sourceId === "wyvern" so other providers without
    an NSFW toggle don't inherit the message.

Test plan

  • Pygmalion: paste auth token from pygmalion.chat Local Storage
    (authn); confirm "Token active — NSFW content enabled" appears,
    NSFW results load. Logout clears the token. Bad token surfaces a
    validation error.
  • JannyAI: search returns results in the browser (server-side route
    stays a fallback). Custom typed tag like "vampire" filters as
    expected. Excluded tag thinning still fills a page via auto-fetch.
  • JannyAI character detail: opens via corsproxy.io fallback when the
    direct fetch is Cloudflare-blocked.
  • DataCat: switch to DataCat shows the NSFW warning modal once;
    "Continue" loads the provider, "Don't continue" closes the modal
    and stays on the previous source. Relevance + Fresh both load.
    Tag filtering by top tags works. Tag panel doesn't lag the browser.
  • Wyvern unchanged: "Popular NSFW" hint and toggle behavior identical.

Summary by CodeRabbit

  • New Features

    • DataCat provider added: top-tag preload, tag-driven searching, NSFW gating warning, and enforced NSFW mode
    • Pygmalion switched to token-based setup with token entry and validation in the login UI
    • Provider-specific page sizes and smarter multi-source searching with automatic extra-page fetches
    • UI stat icon support expanded to include hash imagery
  • Bug Fixes

    • More reliable detail fetching and clearer error handling with improved fallback behavior

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/273 **Author:** [@LukaTheHero](https://github.com/LukaTheHero) **Created:** 4/28/2026 **Status:** ✅ Merged **Merged:** 4/28/2026 **Merged by:** [@LukaTheHero](https://github.com/LukaTheHero) **Base:** `main` ← **Head:** `feat/botbrowser-upgrade` --- ### 📝 Commits (6) - [`c520238`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c5202389f074b76e196b7f6f3545f63bb08e4fd2) feat(bot-browser): token-only Pygmalion, Janny robustness, DataCat provider - [`220856a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/220856a8e8bc8e3da32957c67edeba6a499cca42) fix(bot-browser): address CodeRabbit review on PR #273 - [`10061dc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/10061dc4502efa8b3c1a146bf71c4635d04662b6) fix(bot-browser): revert credentials:"include" on JannyAI search - [`d7d82a1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d7d82a1dd1161e00daa5764547ea4ff267657219) fix(bot-browser): expire JannyAI fallback token cache after 60s - [`8e68d4f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8e68d4fba1fbed2f247f2da590b9c5a317ee48b9) fix(bot-browser): DataCat fresh totalCount + disable phantom search - [`48f41a4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/48f41a412163de363062e88e9db2562e050ff5e1) fix(bot-browser): JannyAI token TTL + force-refresh, kill-switch through body ### 📊 Changes **5 files changed** (+1054 additions, -190 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/bot-browser/BotBrowserView.tsx` (+550 -116) ➕ `packages/server/src/routes/bot-browser-datacat.routes.ts` (+238 -0) 📝 `packages/server/src/routes/bot-browser-janny.routes.ts` (+214 -25) 📝 `packages/server/src/routes/bot-browser-pygmalion.routes.ts` (+50 -49) 📝 `packages/server/src/routes/index.ts` (+2 -0) </details> ### 📄 Description ## Summary Upgrade the bot browser across three providers and add a fourth. ### Pygmalion — token-only login - Remove the username/password proxy login. The browser already exposes the auth token in Local Storage, so the user pastes that directly. - New `POST /pygmalion/set-token` accepts the pasted token (strips a leading `Bearer ` prefix) and `GET /pygmalion/validate` confirms it via an authenticated `CharacterSearch`. Auto-clears the token on 401/403. - Help text in the login modal walks users to DevTools → Application → Local Storage → `authn` (~705-character string). ### JannyAI — work around Cloudflare, recover lost data - The MeiliSearch POST is now made from the browser (matching how every working JannyAI client does it) so the user's `cf_clearance` cookie and real TLS fingerprint clear Cloudflare's bot challenge. The server still scrapes the public token and exposes it via `GET /janny/token`. - Token scraper now follows the `SearchPage.<hash>.js` chunk to find `client-config.<hash>.js` (the bundle layout changed). Page-scrape fallback through corsproxy.io for resilience when the local IP is blocked. - Cloudflare detection: added `challenge-platform` marker + a min-length sanity check on the character page scrape. Tag IDs / creator IDs missing from the page scrape are now back-filled from MeiliSearch. - Custom include tags (free-form names not in JannyAI's known tag map) are applied client-side against each hit's resolved tag names, instead of being silently dropped. - When client-side filters (excludeTags / custom includeTags) thin a page, auto-fetch up to 3 additional pages and concat to keep the grid full. ### DataCat — new provider - Anonymous session bootstrap via `POST /api/liberator/identify` (random `deviceToken`); session token cached in memory and replayed in `X-Session-Token` on every call. Auto re-mints once on 401. - Two sort options: **🔍 Relevance** (default, calls `/recent-public`, supports tag filtering) and **🔥 Fresh** (`/fresh` 24h trending). - Tag panel uses DataCat's faceted tag list. The endpoint returns ~28k tags; the panel renders only the top 150 by character count to keep the UI snappy. The full id↔name map is still cached so card-level tags and long-tail typed-in tag names still resolve. - DataCat is NSFW-only upstream — every character is tagged NSFW. The NSFW toggle is hidden, the filter is force-on, and a confirmation modal warns before the first switch (Continue / Don't continue). Tooltip explains "DataCat is NSFW-only". - Avatar proxy routes through `https://ella.janitorai.com/bot-avatars/` (DataCat's CDN). ### Misc - Wyvern-specific "Use 'Popular NSFW' sort for NSFW content" hint and toast are scoped to `sourceId === "wyvern"` so other providers without an NSFW toggle don't inherit the message. ## Test plan - [x] Pygmalion: paste auth token from `pygmalion.chat` Local Storage (`authn`); confirm "Token active — NSFW content enabled" appears, NSFW results load. Logout clears the token. Bad token surfaces a validation error. - [x] JannyAI: search returns results in the browser (server-side route stays a fallback). Custom typed tag like "vampire" filters as expected. Excluded tag thinning still fills a page via auto-fetch. - [x] JannyAI character detail: opens via corsproxy.io fallback when the direct fetch is Cloudflare-blocked. - [x] DataCat: switch to DataCat shows the NSFW warning modal once; "Continue" loads the provider, "Don't continue" closes the modal and stays on the previous source. Relevance + Fresh both load. Tag filtering by top tags works. Tag panel doesn't lag the browser. - [x] Wyvern unchanged: "Popular NSFW" hint and toggle behavior identical. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * DataCat provider added: top-tag preload, tag-driven searching, NSFW gating warning, and enforced NSFW mode * Pygmalion switched to token-based setup with token entry and validation in the login UI * Provider-specific page sizes and smarter multi-source searching with automatic extra-page fetches * UI stat icon support expanded to include hash imagery * **Bug Fixes** * More reliable detail fetching and clearer error handling with improved fallback behavior <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:08:32 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4538
No description provided.