Kutubee Reading Script

Intercepts the final reading completion request and sets the 'duration' to a high value (312 seconds) to bypass server-side time checks.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Kutubee Reading Script
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Intercepts the final reading completion request and sets the 'duration' to a high value (312 seconds) to bypass server-side time checks.
// @author       neonmodder123
// @match        https://read.kutubee.com/*
// @grant        none
// @run-at       document-start
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    console.log("Kutubee Script Working :)");
    const TARGET_DURATION = 312;
    const TARGET_API_PATH = '/api/user-activity';
    const originalFetch = window.fetch;

    window.fetch = async function(resource, options) {

        const url = resource.toString();
        const method = options?.method;
        const isPostOrPut = options && (method === 'POST' || method === 'PUT');

        const isTargetApi = url.includes(TARGET_API_PATH);

        if (isTargetApi && isPostOrPut && options.body) {

            let originalPayload;

            try {
                originalPayload = JSON.parse(options.body);
                if (originalPayload.tryingToComplete === true && originalPayload.activitySessionInfo) {

                    const sessionInfo = originalPayload.activitySessionInfo;

                    console.log(`[Kutubee Script] INTERCEPTED completion attempt for ${originalPayload.contentId}`);
                    console.log(`[Kutubee Script] Original Duration: ${sessionInfo.duration}s`);

                    sessionInfo.duration = TARGET_DURATION;

                    options.body = JSON.stringify(originalPayload);

                    console.log(`[Kutubee Script] New Duration Injected: ${sessionInfo.duration}s`);
                    console.log("[Kutubee Script] Sending modified request to server...");
                }
            } catch (e) {
                console.error("[Kutubee Script] Error during payload modification, request sent unedited:", e);
            }
        }
        return originalFetch(resource, options);
    };

})();