@ginhotaru282/reader 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -0
- package/.next/app-path-routes-manifest.json +15 -0
- package/.next/build-manifest.json +20 -0
- package/.next/package.json +1 -0
- package/.next/prerender-manifest.json +114 -0
- package/.next/required-server-files.json +334 -0
- package/.next/routes-manifest.json +149 -0
- package/.next/server/app/(reader)/[id]/page/app-paths-manifest.json +3 -0
- package/.next/server/app/(reader)/[id]/page/build-manifest.json +16 -0
- package/.next/server/app/(reader)/[id]/page/next-font-manifest.json +15 -0
- package/.next/server/app/(reader)/[id]/page/react-loadable-manifest.json +1 -0
- package/.next/server/app/(reader)/[id]/page/server-reference-manifest.json +4 -0
- package/.next/server/app/(reader)/[id]/page.js +16 -0
- package/.next/server/app/(reader)/[id]/page.js.map +5 -0
- package/.next/server/app/(reader)/[id]/page.js.nft.json +1 -0
- package/.next/server/app/(reader)/[id]/page_client-reference-manifest.js +3 -0
- package/.next/server/app/_global-error/page/app-paths-manifest.json +3 -0
- package/.next/server/app/_global-error/page/build-manifest.json +16 -0
- package/.next/server/app/_global-error/page/next-font-manifest.json +6 -0
- package/.next/server/app/_global-error/page/react-loadable-manifest.json +1 -0
- package/.next/server/app/_global-error/page/server-reference-manifest.json +4 -0
- package/.next/server/app/_global-error/page.js +9 -0
- package/.next/server/app/_global-error/page.js.map +5 -0
- package/.next/server/app/_global-error/page.js.nft.json +1 -0
- package/.next/server/app/_global-error/page_client-reference-manifest.js +3 -0
- package/.next/server/app/_global-error.html +1 -0
- package/.next/server/app/_global-error.meta +15 -0
- package/.next/server/app/_global-error.rsc +14 -0
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +5 -0
- package/.next/server/app/_global-error.segments/_full.segment.rsc +14 -0
- package/.next/server/app/_global-error.segments/_head.segment.rsc +5 -0
- package/.next/server/app/_global-error.segments/_index.segment.rsc +5 -0
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
- package/.next/server/app/_not-found/page/app-paths-manifest.json +3 -0
- package/.next/server/app/_not-found/page/build-manifest.json +16 -0
- package/.next/server/app/_not-found/page/next-font-manifest.json +11 -0
- package/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -0
- package/.next/server/app/_not-found/page/server-reference-manifest.json +4 -0
- package/.next/server/app/_not-found/page.js +13 -0
- package/.next/server/app/_not-found/page.js.map +5 -0
- package/.next/server/app/_not-found/page.js.nft.json +1 -0
- package/.next/server/app/_not-found/page_client-reference-manifest.js +3 -0
- package/.next/server/app/_not-found.html +1 -0
- package/.next/server/app/_not-found.meta +16 -0
- package/.next/server/app/_not-found.rsc +16 -0
- package/.next/server/app/_not-found.segments/_full.segment.rsc +16 -0
- package/.next/server/app/_not-found.segments/_head.segment.rsc +6 -0
- package/.next/server/app/_not-found.segments/_index.segment.rsc +5 -0
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -0
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +5 -0
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -0
- package/.next/server/app/api/bookmark/[id]/toggle/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/bookmark/[id]/toggle/route/build-manifest.json +9 -0
- package/.next/server/app/api/bookmark/[id]/toggle/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/bookmark/[id]/toggle/route.js +6 -0
- package/.next/server/app/api/bookmark/[id]/toggle/route.js.map +5 -0
- package/.next/server/app/api/bookmark/[id]/toggle/route.js.nft.json +1 -0
- package/.next/server/app/api/bookmark/[id]/toggle/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/chapter/[id]/audio/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/chapter/[id]/audio/route/build-manifest.json +9 -0
- package/.next/server/app/api/chapter/[id]/audio/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/chapter/[id]/audio/route.js +6 -0
- package/.next/server/app/api/chapter/[id]/audio/route.js.map +5 -0
- package/.next/server/app/api/chapter/[id]/audio/route.js.nft.json +1 -0
- package/.next/server/app/api/chapter/[id]/audio/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/chapter/[id]/audio-status/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/chapter/[id]/audio-status/route/build-manifest.json +9 -0
- package/.next/server/app/api/chapter/[id]/audio-status/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/chapter/[id]/audio-status/route.js +6 -0
- package/.next/server/app/api/chapter/[id]/audio-status/route.js.map +5 -0
- package/.next/server/app/api/chapter/[id]/audio-status/route.js.nft.json +1 -0
- package/.next/server/app/api/chapter/[id]/audio-status/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/chapter/[id]/unlock/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/chapter/[id]/unlock/route/build-manifest.json +9 -0
- package/.next/server/app/api/chapter/[id]/unlock/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/chapter/[id]/unlock/route.js +6 -0
- package/.next/server/app/api/chapter/[id]/unlock/route.js.map +5 -0
- package/.next/server/app/api/chapter/[id]/unlock/route.js.nft.json +1 -0
- package/.next/server/app/api/chapter/[id]/unlock/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/comment/story/[id]/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/comment/story/[id]/route/build-manifest.json +9 -0
- package/.next/server/app/api/comment/story/[id]/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/comment/story/[id]/route.js +6 -0
- package/.next/server/app/api/comment/story/[id]/route.js.map +5 -0
- package/.next/server/app/api/comment/story/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/comment/story/[id]/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/reading-progress/[storyId]/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/reading-progress/[storyId]/route/build-manifest.json +9 -0
- package/.next/server/app/api/reading-progress/[storyId]/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/reading-progress/[storyId]/route.js +6 -0
- package/.next/server/app/api/reading-progress/[storyId]/route.js.map +5 -0
- package/.next/server/app/api/reading-progress/[storyId]/route.js.nft.json +1 -0
- package/.next/server/app/api/reading-progress/[storyId]/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/reading-progress/sync/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/reading-progress/sync/route/build-manifest.json +9 -0
- package/.next/server/app/api/reading-progress/sync/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/reading-progress/sync/route.js +6 -0
- package/.next/server/app/api/reading-progress/sync/route.js.map +5 -0
- package/.next/server/app/api/reading-progress/sync/route.js.nft.json +1 -0
- package/.next/server/app/api/reading-progress/sync/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/story/[id]/combo-unlock/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/story/[id]/combo-unlock/route/build-manifest.json +9 -0
- package/.next/server/app/api/story/[id]/combo-unlock/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/story/[id]/combo-unlock/route.js +6 -0
- package/.next/server/app/api/story/[id]/combo-unlock/route.js.map +5 -0
- package/.next/server/app/api/story/[id]/combo-unlock/route.js.nft.json +1 -0
- package/.next/server/app/api/story/[id]/combo-unlock/route_client-reference-manifest.js +3 -0
- package/.next/server/app/icon.png/route/app-paths-manifest.json +3 -0
- package/.next/server/app/icon.png/route/build-manifest.json +9 -0
- package/.next/server/app/icon.png/route.js +7 -0
- package/.next/server/app/icon.png/route.js.map +5 -0
- package/.next/server/app/icon.png/route.js.nft.json +1 -0
- package/.next/server/app/icon.png.body +0 -0
- package/.next/server/app/icon.png.meta +1 -0
- package/.next/server/app/index.html +1 -0
- package/.next/server/app/index.meta +14 -0
- package/.next/server/app/index.rsc +16 -0
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +5 -0
- package/.next/server/app/index.segments/_full.segment.rsc +16 -0
- package/.next/server/app/index.segments/_head.segment.rsc +6 -0
- package/.next/server/app/index.segments/_index.segment.rsc +5 -0
- package/.next/server/app/index.segments/_tree.segment.rsc +4 -0
- package/.next/server/app/page/app-paths-manifest.json +3 -0
- package/.next/server/app/page/build-manifest.json +16 -0
- package/.next/server/app/page/next-font-manifest.json +11 -0
- package/.next/server/app/page/react-loadable-manifest.json +1 -0
- package/.next/server/app/page/server-reference-manifest.json +4 -0
- package/.next/server/app/page.js +14 -0
- package/.next/server/app/page.js.map +5 -0
- package/.next/server/app/page.js.nft.json +1 -0
- package/.next/server/app/page_client-reference-manifest.js +3 -0
- package/.next/server/app-paths-manifest.json +15 -0
- package/.next/server/chunks/[externals]_next_dist_0iuj5m_._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0ewmt7_._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0m1sn3r._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0rthafo._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0u0sxpl._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0xuaoik._.js +15 -0
- package/.next/server/chunks/[root-of-the-server]__0yuh9-6._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__10dmsr8._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1ohu1lu._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1ux8_la._.js +3 -0
- package/.next/server/chunks/[turbopack]_runtime.js +903 -0
- package/.next/server/chunks/_next-internal_server_app_api_bookmark_[id]_toggle_route_actions_0midgng.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_chapter_[id]_audio-status_route_actions_137h21m.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_chapter_[id]_audio_route_actions_1ursqip.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_chapter_[id]_unlock_route_actions_02wqhh1.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_comment_story_[id]_route_actions_0-k0u9j.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_reading-progress_[storyId]_route_actions_1wu6t2e.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_reading-progress_sync_route_actions_0bmsea-.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_story_[id]_combo-unlock_route_actions_1s8x_jq.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_icon_png_route_actions_1-lsc8h.js +3 -0
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_0nojrj_.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__01629yw._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__05n80pl._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0uw2vno._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0ybcdc2._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1-g8gmo._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__13bnu2t._.js +6 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1dky4g0._.js +33 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1gdndpr._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1gux7cw._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1t3wpve._.js +33 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1vfpvus._.js +21 -0
- package/.next/server/chunks/ssr/[turbopack]_runtime.js +903 -0
- package/.next/server/chunks/ssr/_1dkuh1k._.js +8 -0
- package/.next/server/chunks/ssr/_next-internal_server_app_(reader)_[id]_page_actions_1j9t8xe.js +3 -0
- package/.next/server/chunks/ssr/_next-internal_server_app__global-error_page_actions_0zi5s8-.js +3 -0
- package/.next/server/chunks/ssr/_next-internal_server_app__not-found_page_actions_0pt47yr.js +3 -0
- package/.next/server/chunks/ssr/_next-internal_server_app_page_actions_0hhsz1j.js +3 -0
- package/.next/server/chunks/ssr/node_modules_0h91jdk._.js +33 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_0bw_x_7._.js +3 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_0opsz1q._.js +6 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_client_components_0wpq8j3._.js +3 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_forbidden_0symwr9.js +3 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_0-o-goa.js +3 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_unauthorized_0l_sp0x.js +3 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_01b_3bz.js +4 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_05derss.js +4 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0p62q26.js +4 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_19--w_z.js +4 -0
- package/.next/server/functions-config-manifest.json +4 -0
- package/.next/server/middleware-build-manifest.js +20 -0
- package/.next/server/middleware-manifest.json +6 -0
- package/.next/server/next-font-manifest.js +1 -0
- package/.next/server/next-font-manifest.json +23 -0
- package/.next/server/pages/404.html +1 -0
- package/.next/server/pages/500.html +1 -0
- package/.next/server/pages-manifest.json +4 -0
- package/.next/server/prefetch-hints.json +1 -0
- package/.next/server/server-reference-manifest.js +1 -0
- package/.next/server/server-reference-manifest.json +5 -0
- package/.next/static/-r4Xo_1sB1eCBTgmD6W1a/_buildManifest.js +1 -0
- package/.next/static/-r4Xo_1sB1eCBTgmD6W1a/_clientMiddlewareManifest.js +1 -0
- package/.next/static/-r4Xo_1sB1eCBTgmD6W1a/_ssgManifest.js +1 -0
- package/.next/static/chunks/01dkdyukbdpqq.js +1 -0
- package/.next/static/chunks/05-c3ty_6dwfk.js +1 -0
- package/.next/static/chunks/0cz1d0mv5g_q7.js +1 -0
- package/.next/static/chunks/0w6_crw430jrp.css +3 -0
- package/.next/static/chunks/14mrh2-p_w84d.js +1 -0
- package/.next/static/chunks/1s4bwihthhw_5.css +4 -0
- package/.next/static/chunks/1tlb4p-7tvb4-.js +1 -0
- package/.next/static/chunks/25o46h8mdjlrg.js +1 -0
- package/.next/static/chunks/2wkjp1bvz-w78.js +5 -0
- package/.next/static/chunks/turbopack-1my_pp40jfqxc.js +1 -0
- package/.next/static/media/0b1dc8ddaa74ba49-s.0e__wj8580tc5.woff2 +0 -0
- package/.next/static/media/1a099d89ee94ee96-s.35a5cae5tspm2.woff2 +0 -0
- package/.next/static/media/4fa387ec64143e14-s.2tuy5pz7dlieh.woff2 +0 -0
- package/.next/static/media/507a47c1876d4ec2-s.2qdkzeru_ecot.woff2 +0 -0
- package/.next/static/media/53b9e256198e5412-s.390ncx5urfkfu.woff2 +0 -0
- package/.next/static/media/5ce348bf30bf5439-s.31988l_ccedte.woff2 +0 -0
- package/.next/static/media/6306c77e7c8268e4-s.2dbetqa9o8jxf.woff2 +0 -0
- package/.next/static/media/7178b3e590c64307-s.21jp631_3pja2.woff2 +0 -0
- package/.next/static/media/71fbf9c08529c2a5-s.2fpqrm51ez0iq.woff2 +0 -0
- package/.next/static/media/797e433ab948586e-s.p.0r6juujl39pe6.woff2 +0 -0
- package/.next/static/media/7d817b4c03b0c5f1-s.1uyisp29ctx0d.woff2 +0 -0
- package/.next/static/media/8a480f0b521d4e75-s.1qq4vpdcun5oj.woff2 +0 -0
- package/.next/static/media/8c2eb9ceedecfc8e-s.p.23aeddxv5enbo.woff2 +0 -0
- package/.next/static/media/ac34884600cd8d5d-s.2936i88_6qsfd.woff2 +0 -0
- package/.next/static/media/bbc41e54d2fcbd21-s.1rgnod-3esatf.woff2 +0 -0
- package/.next/static/media/caa3a2e1cccd8315-s.p.0wgildi0cnwt9.woff2 +0 -0
- package/.next/static/media/e1ccd2766b08c828-s.p.15gdzqknx46iu.woff2 +0 -0
- package/.next/static/media/e629b5bc06499d58-s.p.10u7vx61f1ie7.woff2 +0 -0
- package/.next/static/media/e7150917543fc9da-s.0mybutugvu-lq.woff2 +0 -0
- package/.next/static/media/e9457141811d41ae-s.02frcczqg7k-8.woff2 +0 -0
- package/.next/static/media/fba5a26ea33df6a3-s.p.18rizl4rsrl42.woff2 +0 -0
- package/.next/static/media/fef07dbb0973bf53-s.3p2_lha1f2xer.woff2 +0 -0
- package/.next/static/media/icon.189nugia0w7di.png +0 -0
- package/package.json +3 -1
- package/server.js +38 -0
- package/.dockerignore +0 -5
- package/.gitattributes +0 -2
- package/Dockerfile +0 -26
- package/README.md +0 -36
- package/eslint.config.mjs +0 -18
- package/next.config.ts +0 -8
- package/postcss.config.mjs +0 -7
- package/scripts/obfuscate-build.mjs +0 -77
- package/src/app/(reader)/[id]/page.tsx +0 -40
- package/src/app/(reader)/layout.tsx +0 -38
- package/src/app/api/bookmark/[id]/toggle/route.ts +0 -41
- package/src/app/api/chapter/[id]/audio/route.ts +0 -37
- package/src/app/api/chapter/[id]/audio-status/route.ts +0 -36
- package/src/app/api/chapter/[id]/unlock/route.ts +0 -49
- package/src/app/api/comment/story/[id]/route.ts +0 -48
- package/src/app/api/reading-progress/[storyId]/route.ts +0 -26
- package/src/app/api/reading-progress/sync/route.ts +0 -38
- package/src/app/api/story/[id]/combo-unlock/route.ts +0 -47
- package/src/app/globals.css +0 -26
- package/src/app/icon.png +0 -0
- package/src/app/layout.tsx +0 -35
- package/src/app/page.tsx +0 -3
- package/src/components/ssr/Skeleton/index.module.css +0 -22
- package/src/components/ssr/Skeleton/index.tsx +0 -38
- package/src/modules/reader/ReaderView.tsx +0 -48
- package/src/modules/reader/api/backend-data.ts +0 -231
- package/src/modules/reader/api/client-audio-api.ts +0 -33
- package/src/modules/reader/api/client-bookmark-api.ts +0 -21
- package/src/modules/reader/api/client-comment-api.ts +0 -31
- package/src/modules/reader/api/client-progress-api.ts +0 -36
- package/src/modules/reader/api/client-purchase-api.ts +0 -64
- package/src/modules/reader/api/get-reader-page-data.ts +0 -48
- package/src/modules/reader/api/types.ts +0 -47
- package/src/modules/reader/components/AudioPlayerBar.tsx +0 -299
- package/src/modules/reader/components/AutoScrollDrawer.tsx +0 -58
- package/src/modules/reader/components/ChapterBottomNav.tsx +0 -16
- package/src/modules/reader/components/ChapterContent.tsx +0 -43
- package/src/modules/reader/components/ChapterListDrawer.tsx +0 -84
- package/src/modules/reader/components/ChapterNav.tsx +0 -20
- package/src/modules/reader/components/ChapterSelect.tsx +0 -24
- package/src/modules/reader/components/ChapterWatermark.tsx +0 -53
- package/src/modules/reader/components/CommentSection.tsx +0 -156
- package/src/modules/reader/components/LockedChapterGate.tsx +0 -37
- package/src/modules/reader/components/MobileDock.tsx +0 -62
- package/src/modules/reader/components/NavButton.tsx +0 -22
- package/src/modules/reader/components/ReaderBreadcrumbs.tsx +0 -20
- package/src/modules/reader/components/ReaderChrome.tsx +0 -206
- package/src/modules/reader/components/ReaderToolbar.tsx +0 -52
- package/src/modules/reader/components/ReaderTopbar.tsx +0 -31
- package/src/modules/reader/components/SettingsPanel.tsx +0 -158
- package/src/modules/reader/components/Toast.tsx +0 -15
- package/src/modules/reader/constants/index.ts +0 -22
- package/src/modules/reader/hooks/useAudioPlayer.ts +0 -633
- package/src/modules/reader/hooks/useAutoScroll.ts +0 -31
- package/src/modules/reader/hooks/useBookmark.ts +0 -32
- package/src/modules/reader/hooks/useComments.ts +0 -86
- package/src/modules/reader/hooks/useContentProtection.ts +0 -81
- package/src/modules/reader/hooks/useDrawers.ts +0 -27
- package/src/modules/reader/hooks/useFullscreen.ts +0 -24
- package/src/modules/reader/hooks/usePrefs.ts +0 -66
- package/src/modules/reader/hooks/useReaderView.ts +0 -190
- package/src/modules/reader/hooks/useReadingProgress.ts +0 -95
- package/src/modules/reader/hooks/useScrollVisibility.ts +0 -44
- package/src/modules/reader/hooks/useToast.ts +0 -19
- package/src/modules/reader/hooks/useUnlock.ts +0 -59
- package/src/modules/reader/styles/reader.module.css +0 -1986
- package/src/modules/reader/types.ts +0 -145
- package/src/modules/reader/utils/affiliate.ts +0 -43
- package/src/modules/reader/utils/chapter-label.ts +0 -8
- package/src/modules/reader/utils/format-date.ts +0 -10
- package/src/modules/reader/utils/obfuscate-content.ts +0 -70
- package/src/modules/reader/utils/silent-wav.ts +0 -33
- package/src/modules/reader/utils/tiktok-tts.ts +0 -251
- package/src/modules/reader/utils/word-svg.ts +0 -132
- package/tsconfig.json +0 -34
package/src/app/globals.css
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
@import "tailwindcss";
|
|
2
|
-
|
|
3
|
-
:root {
|
|
4
|
-
--background: #ffffff;
|
|
5
|
-
--foreground: #171717;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
@theme inline {
|
|
9
|
-
--color-background: var(--background);
|
|
10
|
-
--color-foreground: var(--foreground);
|
|
11
|
-
--font-sans: var(--font-geist-sans);
|
|
12
|
-
--font-mono: var(--font-geist-mono);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
@media (prefers-color-scheme: dark) {
|
|
16
|
-
:root {
|
|
17
|
-
--background: #0a0a0a;
|
|
18
|
-
--foreground: #ededed;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
body {
|
|
23
|
-
background: var(--background);
|
|
24
|
-
color: var(--foreground);
|
|
25
|
-
font-family: Arial, Helvetica, sans-serif;
|
|
26
|
-
}
|
package/src/app/icon.png
DELETED
|
Binary file
|
package/src/app/layout.tsx
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { Metadata } from "next";
|
|
2
|
-
import { Geist, Geist_Mono } from "next/font/google";
|
|
3
|
-
import "./globals.css";
|
|
4
|
-
|
|
5
|
-
const geistSans = Geist({
|
|
6
|
-
variable: "--font-geist-sans",
|
|
7
|
-
subsets: ["latin"],
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
const geistMono = Geist_Mono({
|
|
11
|
-
variable: "--font-geist-mono",
|
|
12
|
-
subsets: ["latin"],
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export const metadata: Metadata = {
|
|
16
|
-
title: "Góc Nhỏ Nhà Tiêu – Đọc truyện online, tiểu thuyết hay nhất",
|
|
17
|
-
description:
|
|
18
|
-
"Góc Nhỏ Nhà Tiêu – Đọc truyện online, tiểu thuyết hay nhất. Hàng nghìn bộ truyện cập nhật mỗi ngày.",
|
|
19
|
-
robots: { index: false, follow: false },
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default function RootLayout({
|
|
23
|
-
children,
|
|
24
|
-
}: Readonly<{
|
|
25
|
-
children: React.ReactNode;
|
|
26
|
-
}>) {
|
|
27
|
-
return (
|
|
28
|
-
<html
|
|
29
|
-
lang="en"
|
|
30
|
-
className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
|
|
31
|
-
>
|
|
32
|
-
<body className="min-h-full flex flex-col">{children}</body>
|
|
33
|
-
</html>
|
|
34
|
-
);
|
|
35
|
-
}
|
package/src/app/page.tsx
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
.line {
|
|
2
|
-
height: 18px;
|
|
3
|
-
border-radius: 8px;
|
|
4
|
-
margin-bottom: 14px;
|
|
5
|
-
background: linear-gradient(
|
|
6
|
-
90deg,
|
|
7
|
-
var(--skeleton-base, rgba(118, 61, 251, 0.08)) 25%,
|
|
8
|
-
var(--skeleton-shine, rgba(118, 61, 251, 0.03)) 37%,
|
|
9
|
-
var(--skeleton-base, rgba(118, 61, 251, 0.08)) 63%
|
|
10
|
-
);
|
|
11
|
-
background-size: 800px 100%;
|
|
12
|
-
animation: shimmer 1.6s infinite linear;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
@keyframes shimmer {
|
|
16
|
-
0% {
|
|
17
|
-
background-position: -400px 0;
|
|
18
|
-
}
|
|
19
|
-
100% {
|
|
20
|
-
background-position: 400px 0;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties } from "react";
|
|
2
|
-
import readerStyles from "@/modules/reader/styles/reader.module.css";
|
|
3
|
-
import type { Theme } from "@/modules/reader/hooks/usePrefs";
|
|
4
|
-
import styles from "./index.module.css";
|
|
5
|
-
|
|
6
|
-
export function SkeletonSsr({ className, style }: { className?: string; style?: CSSProperties }) {
|
|
7
|
-
return <div className={`${styles.line} ${className ?? ""}`} style={style} />;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// Rendered instantly while page.tsx awaits the chapter API call, then
|
|
11
|
-
// swapped out automatically once that data resolves. `theme` comes from the
|
|
12
|
-
// reader_theme cookie (see loading.tsx) so this matches the user's saved
|
|
13
|
-
// preference on the very first paint instead of flashing the wrong colors.
|
|
14
|
-
export function ReaderLoadingSkeleton({ theme }: { theme: Theme }) {
|
|
15
|
-
return (
|
|
16
|
-
<div className={`${readerStyles.readerContainer} ${readerStyles[theme]}`}>
|
|
17
|
-
<header className={readerStyles.topbar}>
|
|
18
|
-
<div className={readerStyles.topbarLeft}>
|
|
19
|
-
<div className={readerStyles.iconBtn}>
|
|
20
|
-
<span className="material-icons-round">arrow_back</span>
|
|
21
|
-
</div>
|
|
22
|
-
<div className={readerStyles.storyInfo}>
|
|
23
|
-
<span className={readerStyles.storyTitle}>Đang tải chương...</span>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
</header>
|
|
27
|
-
|
|
28
|
-
<main className={readerStyles.main}>
|
|
29
|
-
<div className={readerStyles.wrap}>
|
|
30
|
-
<SkeletonSsr style={{ height: 28, width: "55%", marginBottom: 28 }} />
|
|
31
|
-
{Array.from({ length: 9 }).map((_, i) => (
|
|
32
|
-
<SkeletonSsr key={i} style={{ width: `${75 + ((i * 7) % 20)}%` }} />
|
|
33
|
-
))}
|
|
34
|
-
</div>
|
|
35
|
-
</main>
|
|
36
|
-
</div>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { getReaderPageProps } from "./api/get-reader-page-data";
|
|
2
|
-
import { ReaderBreadcrumbs } from "./components/ReaderBreadcrumbs";
|
|
3
|
-
import { ChapterNav } from "./components/ChapterNav";
|
|
4
|
-
import { ChapterBottomNav } from "./components/ChapterBottomNav";
|
|
5
|
-
import { Toast } from "./components/Toast";
|
|
6
|
-
import { ReaderChrome } from "./components/ReaderChrome";
|
|
7
|
-
|
|
8
|
-
export default async function ReaderView({ id }: { id: string }) {
|
|
9
|
-
let props;
|
|
10
|
-
try {
|
|
11
|
-
props = await getReaderPageProps(id);
|
|
12
|
-
} catch (err) {
|
|
13
|
-
console.error(err);
|
|
14
|
-
return <Toast toast={{ message: "Không thể tải chương. Vui lòng thử lại.", type: "error" }} />;
|
|
15
|
-
}
|
|
16
|
-
if (!props) {
|
|
17
|
-
return <Toast toast={{ message: "Không tìm thấy chương.", type: "error" }} />;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
chapter,
|
|
22
|
-
story,
|
|
23
|
-
allChapters,
|
|
24
|
-
renderedParagraphs,
|
|
25
|
-
paragraphs,
|
|
26
|
-
initialComments,
|
|
27
|
-
initialIsBookmarked,
|
|
28
|
-
loadWarnings,
|
|
29
|
-
viewer,
|
|
30
|
-
} = props;
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<ReaderChrome
|
|
34
|
-
chapter={chapter}
|
|
35
|
-
story={story}
|
|
36
|
-
allChapters={allChapters}
|
|
37
|
-
paragraphs={paragraphs}
|
|
38
|
-
initialComments={initialComments}
|
|
39
|
-
initialIsBookmarked={initialIsBookmarked}
|
|
40
|
-
loadWarnings={loadWarnings}
|
|
41
|
-
viewer={viewer}
|
|
42
|
-
renderedParagraphs={renderedParagraphs}
|
|
43
|
-
breadcrumbs={<ReaderBreadcrumbs story={story} chapter={chapter} />}
|
|
44
|
-
chapterNav={<ChapterNav chapter={chapter} allChapters={allChapters} />}
|
|
45
|
-
bottomNav={<ChapterBottomNav chapter={chapter} />}
|
|
46
|
-
/>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import { cookies, headers } from "next/headers";
|
|
2
|
-
import type { Chapter, Comment, Story } from "./types";
|
|
3
|
-
|
|
4
|
-
const API_BASE_URL = process.env.API_BASE_URL;
|
|
5
|
-
|
|
6
|
-
// Backend cần biết IP/User-Agent THẬT của người đọc (để rate-limit/audit đúng người) thay vì
|
|
7
|
-
// thấy chính server Next.js này, vì mọi lượt đọc chương đều đi qua fetch phía server chứ browser
|
|
8
|
-
// không gọi thẳng backend.
|
|
9
|
-
async function buildBackendHeaders(): Promise<Record<string, string>> {
|
|
10
|
-
const [cookieStore, incoming] = await Promise.all([cookies(), headers()]);
|
|
11
|
-
const jwt = cookieStore.get("jwt")?.value;
|
|
12
|
-
|
|
13
|
-
const userAgent = incoming.get("user-agent");
|
|
14
|
-
const cfIp = incoming.get("cf-connecting-ip") ?? undefined;
|
|
15
|
-
const forwardedFor = incoming.get("x-forwarded-for")?.split(",")[0]?.trim() ?? undefined;
|
|
16
|
-
const realIp = incoming.get("x-real-ip") ?? undefined;
|
|
17
|
-
const clientIp = cfIp ?? forwardedFor ?? realIp;
|
|
18
|
-
|
|
19
|
-
const result: Record<string, string> = {};
|
|
20
|
-
if (jwt) result.Cookie = `jwt=${jwt}`;
|
|
21
|
-
if (userAgent) result["User-Agent"] = userAgent;
|
|
22
|
-
// Tên riêng, KHÔNG dùng "CF-Connecting-IP" — .NET cũng đứng sau Cloudflare nên tên đó có thể bị
|
|
23
|
-
// Cloudflare ghi đè (nếu request đi qua CF) hoặc bị giả mạo (nếu gọi thẳng origin).
|
|
24
|
-
if (clientIp) result["X-Reader-Client-Ip"] = clientIp;
|
|
25
|
-
// Gửi kèm các nguồn IP thô để backend tự đối chiếu nếu cần, thay vì chỉ tin giá trị đã ưu tiên.
|
|
26
|
-
if (cfIp) result["X-Reader-Cf-Ip"] = cfIp;
|
|
27
|
-
if (forwardedFor ?? realIp) result["X-Reader-Remote-Ip"] = forwardedFor ?? realIp!;
|
|
28
|
-
|
|
29
|
-
return result;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
type ApiEnvelope<T> = { success: boolean; message?: string | null; data: T | null };
|
|
33
|
-
|
|
34
|
-
type PagedResult<T> = {
|
|
35
|
-
items: T[];
|
|
36
|
-
totalCount: number;
|
|
37
|
-
pageNumber: number;
|
|
38
|
-
pageSize: number;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
type BackendChapter = {
|
|
42
|
-
id: string;
|
|
43
|
-
storyId: string;
|
|
44
|
-
chapterNumber: number;
|
|
45
|
-
title: string | null;
|
|
46
|
-
contentRaw: string | null;
|
|
47
|
-
contentTranslated: string | null;
|
|
48
|
-
type: string;
|
|
49
|
-
priceGold: number;
|
|
50
|
-
isUnlocked: boolean;
|
|
51
|
-
nextChapterId: string | null;
|
|
52
|
-
prevChapterId: string | null;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
type BackendChapterListItem = {
|
|
56
|
-
id: string;
|
|
57
|
-
chapterNumber: number;
|
|
58
|
-
title: string | null;
|
|
59
|
-
type: string;
|
|
60
|
-
priceGold: number;
|
|
61
|
-
isUnlocked: boolean;
|
|
62
|
-
nextChapterId: string | null;
|
|
63
|
-
prevChapterId: string | null;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
type BackendStory = {
|
|
67
|
-
id: string;
|
|
68
|
-
title: string;
|
|
69
|
-
slug: string;
|
|
70
|
-
status: string;
|
|
71
|
-
comboPriceGold: number | null;
|
|
72
|
-
isComboUnlocked: boolean;
|
|
73
|
-
totalVipChaptersPrice: number;
|
|
74
|
-
description: string | null;
|
|
75
|
-
genres: string[];
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
type BackendComment = {
|
|
79
|
-
id: string;
|
|
80
|
-
displayName: string;
|
|
81
|
-
avatarUrl: string | null;
|
|
82
|
-
content: string;
|
|
83
|
-
createdAt: string;
|
|
84
|
-
replies: BackendComment[];
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
function toComment(c: BackendComment): Comment {
|
|
88
|
-
return {
|
|
89
|
-
id: c.id,
|
|
90
|
-
displayName: c.displayName,
|
|
91
|
-
avatarUrl: c.avatarUrl,
|
|
92
|
-
content: c.content,
|
|
93
|
-
createdAt: c.createdAt,
|
|
94
|
-
replies: (c.replies ?? []).map(toComment),
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
async function backendFetch<T>(path: string): Promise<T | null> {
|
|
99
|
-
if (!API_BASE_URL) {
|
|
100
|
-
throw new Error("API_BASE_URL is not configured.");
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const res = await fetch(`${API_BASE_URL}${path}`, {
|
|
104
|
-
headers: await buildBackendHeaders(),
|
|
105
|
-
cache: "no-store",
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
if (res.status === 404) return null;
|
|
109
|
-
if (!res.ok) {
|
|
110
|
-
throw new Error(`Backend request failed (${res.status}): ${path}`);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const body = (await res.json()) as ApiEnvelope<T>;
|
|
114
|
-
return body.data;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function toStoryStatus(status: string): Story["status"] {
|
|
118
|
-
return status === "completed" ? "completed" : "ongoing";
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
async function checkBookmark(storyId: string): Promise<boolean | null> {
|
|
122
|
-
if (!API_BASE_URL) return null;
|
|
123
|
-
const cookieStore = await cookies();
|
|
124
|
-
const jwt = cookieStore.get("jwt")?.value;
|
|
125
|
-
if (!jwt) return false;
|
|
126
|
-
|
|
127
|
-
try {
|
|
128
|
-
const res = await fetch(`${API_BASE_URL}/bookmark/${storyId}/check`, {
|
|
129
|
-
headers: await buildBackendHeaders(),
|
|
130
|
-
cache: "no-store",
|
|
131
|
-
});
|
|
132
|
-
if (!res.ok) return null;
|
|
133
|
-
const body = (await res.json()) as { success: boolean; isBookmarked: boolean };
|
|
134
|
-
return body.isBookmarked ?? false;
|
|
135
|
-
} catch {
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export type Viewer = { id: string; username: string };
|
|
141
|
-
|
|
142
|
-
type BackendUserProfile = { id: string; username: string };
|
|
143
|
-
|
|
144
|
-
// Chỉ dùng để dệt username vào lớp watermark chống OCR — không phải nguồn xác thực chính.
|
|
145
|
-
async function fetchViewer(): Promise<Viewer | null> {
|
|
146
|
-
if (!API_BASE_URL) return null;
|
|
147
|
-
const cookieStore = await cookies();
|
|
148
|
-
const jwt = cookieStore.get("jwt")?.value;
|
|
149
|
-
if (!jwt) return null;
|
|
150
|
-
|
|
151
|
-
try {
|
|
152
|
-
const res = await fetch(`${API_BASE_URL}/auth/me`, {
|
|
153
|
-
headers: await buildBackendHeaders(),
|
|
154
|
-
cache: "no-store",
|
|
155
|
-
});
|
|
156
|
-
if (!res.ok) return null;
|
|
157
|
-
const body = (await res.json()) as ApiEnvelope<BackendUserProfile>;
|
|
158
|
-
if (!body.data) return null;
|
|
159
|
-
return { id: body.data.id, username: body.data.username };
|
|
160
|
-
} catch {
|
|
161
|
-
return null;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export type ChapterPageData = {
|
|
166
|
-
chapter: Chapter;
|
|
167
|
-
story: Story;
|
|
168
|
-
allChapters: Chapter[];
|
|
169
|
-
comments: Comment[];
|
|
170
|
-
isBookmarked: boolean;
|
|
171
|
-
loadWarnings: string[];
|
|
172
|
-
viewer: Viewer | null;
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
export async function fetchChapterPageData(id: string): Promise<ChapterPageData | null> {
|
|
176
|
-
const chapter = await backendFetch<BackendChapter>(`/chapter/${id}`);
|
|
177
|
-
if (!chapter) return null;
|
|
178
|
-
|
|
179
|
-
const [story, chapterList, comments, isBookmarked, viewer] = await Promise.all([
|
|
180
|
-
backendFetch<BackendStory>(`/story/${chapter.storyId}`),
|
|
181
|
-
backendFetch<PagedResult<BackendChapterListItem>>(
|
|
182
|
-
`/chapter/story/${chapter.storyId}?page=1&pageSize=10000`
|
|
183
|
-
),
|
|
184
|
-
backendFetch<BackendComment[]>(`/comment/chapter/${id}`).catch(() => null),
|
|
185
|
-
checkBookmark(chapter.storyId).catch(() => null),
|
|
186
|
-
fetchViewer().catch(() => null),
|
|
187
|
-
]);
|
|
188
|
-
if (!story) return null;
|
|
189
|
-
|
|
190
|
-
const loadWarnings: string[] = [];
|
|
191
|
-
|
|
192
|
-
return {
|
|
193
|
-
chapter: {
|
|
194
|
-
id: chapter.id,
|
|
195
|
-
chapterNumber: chapter.chapterNumber,
|
|
196
|
-
title: chapter.title ?? `Chương ${chapter.chapterNumber}`,
|
|
197
|
-
content: chapter.contentTranslated || chapter.contentRaw || "",
|
|
198
|
-
type: chapter.type,
|
|
199
|
-
priceGold: chapter.priceGold,
|
|
200
|
-
isLocked: !chapter.isUnlocked,
|
|
201
|
-
prevChapterId: chapter.prevChapterId,
|
|
202
|
-
nextChapterId: chapter.nextChapterId,
|
|
203
|
-
},
|
|
204
|
-
story: {
|
|
205
|
-
id: story.id,
|
|
206
|
-
slug: story.slug,
|
|
207
|
-
title: story.title,
|
|
208
|
-
status: toStoryStatus(story.status),
|
|
209
|
-
comboPriceGold: story.comboPriceGold,
|
|
210
|
-
isComboUnlocked: story.isComboUnlocked,
|
|
211
|
-
totalVipChaptersPrice: story.totalVipChaptersPrice,
|
|
212
|
-
description: story.description,
|
|
213
|
-
genres: story.genres ?? [],
|
|
214
|
-
},
|
|
215
|
-
allChapters: (chapterList?.items ?? []).map((c) => ({
|
|
216
|
-
id: c.id,
|
|
217
|
-
chapterNumber: c.chapterNumber,
|
|
218
|
-
title: c.title ?? `Chương ${c.chapterNumber}`,
|
|
219
|
-
content: "",
|
|
220
|
-
type: c.type,
|
|
221
|
-
priceGold: c.priceGold,
|
|
222
|
-
isLocked: !c.isUnlocked,
|
|
223
|
-
prevChapterId: c.prevChapterId,
|
|
224
|
-
nextChapterId: c.nextChapterId,
|
|
225
|
-
})),
|
|
226
|
-
comments: (comments ?? []).map(toComment),
|
|
227
|
-
isBookmarked: isBookmarked ?? false,
|
|
228
|
-
loadWarnings,
|
|
229
|
-
viewer,
|
|
230
|
-
};
|
|
231
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { BASE_PATH } from "../constants";
|
|
4
|
-
|
|
5
|
-
// Browser-side calls for the "Studio" (server-generated) TTS voice. These hit
|
|
6
|
-
// same-origin Next.js route handlers (app/api/chapter/[id]/audio*), which in
|
|
7
|
-
// turn proxy to the real backend — the browser never learns API_BASE_URL.
|
|
8
|
-
|
|
9
|
-
export type AudioStatusData = {
|
|
10
|
-
status: "none" | "loading" | "generating" | "done" | "failed" | string;
|
|
11
|
-
audioUrl?: string | null;
|
|
12
|
-
error?: string | null;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type ApiEnvelope<T> = { success: boolean; message?: string | null; data: T | null };
|
|
16
|
-
|
|
17
|
-
async function parseEnvelope<T>(res: Response): Promise<ApiEnvelope<T>> {
|
|
18
|
-
const body = (await res.json().catch(() => null)) as ApiEnvelope<T> | null;
|
|
19
|
-
if (!body) {
|
|
20
|
-
return { success: false, message: `HTTP ${res.status}`, data: null };
|
|
21
|
-
}
|
|
22
|
-
return body;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export async function requestChapterAudio(chapterId: string): Promise<ApiEnvelope<AudioStatusData>> {
|
|
26
|
-
const res = await fetch(`${BASE_PATH}/api/chapter/${chapterId}/audio`, { method: "POST" });
|
|
27
|
-
return parseEnvelope<AudioStatusData>(res);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export async function getChapterAudioStatus(chapterId: string): Promise<ApiEnvelope<AudioStatusData>> {
|
|
31
|
-
const res = await fetch(`${BASE_PATH}/api/chapter/${chapterId}/audio-status`);
|
|
32
|
-
return parseEnvelope<AudioStatusData>(res);
|
|
33
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { BASE_PATH } from "../constants";
|
|
4
|
-
|
|
5
|
-
export type BookmarkEnvelope = { success: boolean; message?: string | null; isBookmarked: boolean };
|
|
6
|
-
|
|
7
|
-
export async function toggleBookmark(storyId: string): Promise<BookmarkEnvelope> {
|
|
8
|
-
try {
|
|
9
|
-
const res = await fetch(`${BASE_PATH}/api/bookmark/${storyId}/toggle`, { method: "POST" });
|
|
10
|
-
|
|
11
|
-
if (res.status === 401) {
|
|
12
|
-
return { success: false, message: "unauthorized", isBookmarked: false };
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const body = await res.json().catch(() => null);
|
|
16
|
-
if (!body) return { success: false, message: `HTTP ${res.status}`, isBookmarked: false };
|
|
17
|
-
return body as BookmarkEnvelope;
|
|
18
|
-
} catch {
|
|
19
|
-
return { success: false, message: "Không thể kết nối server", isBookmarked: false };
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import type { Comment } from "./types";
|
|
4
|
-
import { BASE_PATH } from "../constants";
|
|
5
|
-
|
|
6
|
-
export type CommentEnvelope = { success: boolean; message?: string | null; data: Comment | null };
|
|
7
|
-
|
|
8
|
-
export async function createComment(
|
|
9
|
-
storyId: string,
|
|
10
|
-
content: string,
|
|
11
|
-
chapterId?: string,
|
|
12
|
-
parentCommentId?: string
|
|
13
|
-
): Promise<CommentEnvelope> {
|
|
14
|
-
try {
|
|
15
|
-
const res = await fetch(`${BASE_PATH}/api/comment/story/${storyId}`, {
|
|
16
|
-
method: "POST",
|
|
17
|
-
headers: { "Content-Type": "application/json" },
|
|
18
|
-
body: JSON.stringify({ content, chapterId, parentCommentId }),
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
if (res.status === 401) {
|
|
22
|
-
return { success: false, message: "unauthorized", data: null };
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const body = await res.json().catch(() => null);
|
|
26
|
-
if (!body) return { success: false, message: `HTTP ${res.status}`, data: null };
|
|
27
|
-
return body as CommentEnvelope;
|
|
28
|
-
} catch {
|
|
29
|
-
return { success: false, message: "Không thể kết nối server", data: null };
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { BASE_PATH } from "../constants";
|
|
4
|
-
|
|
5
|
-
export type ProgressData = {
|
|
6
|
-
storyId: string;
|
|
7
|
-
chapterId: string;
|
|
8
|
-
scrollPosition: number;
|
|
9
|
-
updatedAt: number;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export function syncProgress(storyId: string, chapterId: string, scrollPosition: number, keepalive = false) {
|
|
13
|
-
return fetch(`${BASE_PATH}/api/reading-progress/sync`, {
|
|
14
|
-
method: "POST",
|
|
15
|
-
headers: { "Content-Type": "application/json" },
|
|
16
|
-
body: JSON.stringify({ storyId, chapterId, scrollPosition }),
|
|
17
|
-
keepalive,
|
|
18
|
-
}).catch(() => {});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export async function getProgress(storyId: string): Promise<ProgressData | null> {
|
|
22
|
-
try {
|
|
23
|
-
const res = await fetch(`${BASE_PATH}/api/reading-progress/${storyId}`);
|
|
24
|
-
if (!res.ok) return null;
|
|
25
|
-
const body = await res.json().catch(() => null);
|
|
26
|
-
if (!body) return null;
|
|
27
|
-
return {
|
|
28
|
-
storyId: body.storyId,
|
|
29
|
-
chapterId: body.chapterId,
|
|
30
|
-
scrollPosition: body.scrollPosition,
|
|
31
|
-
updatedAt: body.updatedAt ? new Date(body.updatedAt).getTime() : Date.now(),
|
|
32
|
-
};
|
|
33
|
-
} catch {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { BASE_PATH } from "../constants";
|
|
4
|
-
|
|
5
|
-
// Browser-side calls for chapter/combo unlock. These hit same-origin Next.js
|
|
6
|
-
// route handlers (app/api/chapter/[id]/unlock, app/api/story/[id]/combo-unlock),
|
|
7
|
-
// which in turn proxy to the real backend — mirrors client-audio-api.ts's
|
|
8
|
-
// pattern, so the browser never learns API_BASE_URL.
|
|
9
|
-
|
|
10
|
-
const TRK_KEY = "trk";
|
|
11
|
-
const ATTRIBUTION_TTL_MS = 30 * 24 * 60 * 60 * 1000;
|
|
12
|
-
|
|
13
|
-
// Ported from frontend/src/utils/trackingHelper.js's getStoryClickId — reads
|
|
14
|
-
// the same localStorage key, so affiliate-click attribution set while
|
|
15
|
-
// browsing the main site still gets credited when a purchase happens here.
|
|
16
|
-
export function getStoryClickId(storyId: string | null): string | null {
|
|
17
|
-
try {
|
|
18
|
-
const cutoff = Date.now() - ATTRIBUTION_TTL_MS;
|
|
19
|
-
const raw = localStorage.getItem(TRK_KEY);
|
|
20
|
-
const list = raw ? JSON.parse(raw) : [];
|
|
21
|
-
if (!Array.isArray(list)) return null;
|
|
22
|
-
|
|
23
|
-
type TrkEntry = { clickId?: string; ts: number; originStoryId?: string | null };
|
|
24
|
-
const eligible = (list as TrkEntry[])
|
|
25
|
-
.filter((item) => item?.clickId && item.ts >= cutoff)
|
|
26
|
-
.filter((item) => storyId == null || item.originStoryId == null || item.originStoryId === storyId)
|
|
27
|
-
.sort((a, b) => b.ts - a.ts);
|
|
28
|
-
|
|
29
|
-
return eligible[0]?.clickId || null;
|
|
30
|
-
} catch {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export type UnlockEnvelope = { success: boolean; message?: string | null };
|
|
36
|
-
|
|
37
|
-
async function postUnlock(path: string, storyId: string | null): Promise<UnlockEnvelope> {
|
|
38
|
-
const clickId = getStoryClickId(storyId);
|
|
39
|
-
|
|
40
|
-
try {
|
|
41
|
-
const res = await fetch(path, {
|
|
42
|
-
method: "POST",
|
|
43
|
-
headers: clickId ? { "X-Tracking-Click-Id": clickId } : undefined,
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
if (res.status === 401) {
|
|
47
|
-
return { success: false, message: "unauthorized" };
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const body = await res.json().catch(() => null);
|
|
51
|
-
if (!body) return { success: false, message: `HTTP ${res.status}` };
|
|
52
|
-
return body as UnlockEnvelope;
|
|
53
|
-
} catch {
|
|
54
|
-
return { success: false, message: "Không thể kết nối server" };
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function unlockChapter(chapterId: string, storyId: string | null) {
|
|
59
|
-
return postUnlock(`${BASE_PATH}/api/chapter/${chapterId}/unlock`, storyId);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export function unlockCombo(storyId: string) {
|
|
63
|
-
return postUnlock(`${BASE_PATH}/api/story/${storyId}/combo-unlock`, storyId);
|
|
64
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { cache } from "react";
|
|
2
|
-
import { fetchChapterPageData, type Viewer } from "./backend-data";
|
|
3
|
-
import { toChapterMeta, type ChapterMeta, type Comment, type Story } from "./types";
|
|
4
|
-
import { obfuscateChapterContent, type ContentSegment } from "../utils/obfuscate-content";
|
|
5
|
-
|
|
6
|
-
const getChapterPageData = cache((id: string) => fetchChapterPageData(id));
|
|
7
|
-
|
|
8
|
-
function getTimeBucket() {
|
|
9
|
-
return Math.floor(Date.now() / (60 * 60 * 1000));
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type ReaderPageProps = {
|
|
13
|
-
chapter: ChapterMeta;
|
|
14
|
-
story: Story;
|
|
15
|
-
allChapters: ChapterMeta[];
|
|
16
|
-
renderedParagraphs: ContentSegment[][];
|
|
17
|
-
paragraphs: string[];
|
|
18
|
-
initialComments: Comment[];
|
|
19
|
-
initialIsBookmarked: boolean;
|
|
20
|
-
loadWarnings: string[];
|
|
21
|
-
viewer: Viewer | null;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export async function getReaderPageProps(id: string): Promise<ReaderPageProps | null> {
|
|
25
|
-
const data = await getChapterPageData(id);
|
|
26
|
-
if (!data) return null;
|
|
27
|
-
|
|
28
|
-
const paragraphs = data.chapter.content
|
|
29
|
-
.replace(/\r\n/g, "\n")
|
|
30
|
-
.split("\n")
|
|
31
|
-
.map((p) => p.trim())
|
|
32
|
-
.filter(Boolean);
|
|
33
|
-
|
|
34
|
-
const timeBucket = getTimeBucket();
|
|
35
|
-
const renderedParagraphs = obfuscateChapterContent(paragraphs, data.chapter.id, timeBucket);
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
chapter: toChapterMeta(data.chapter),
|
|
39
|
-
story: data.story,
|
|
40
|
-
allChapters: data.allChapters.map(toChapterMeta),
|
|
41
|
-
renderedParagraphs,
|
|
42
|
-
paragraphs,
|
|
43
|
-
initialComments: data.comments,
|
|
44
|
-
initialIsBookmarked: data.isBookmarked,
|
|
45
|
-
loadWarnings: data.loadWarnings,
|
|
46
|
-
viewer: data.viewer,
|
|
47
|
-
};
|
|
48
|
-
}
|