您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
获取 ChatGPT Token,并实时显示 PoW 算力值
当前为
// ==UserScript== // @name ChatGPT Token & PoW 监控 // @namespace http://tampermonkey.net/ // @version 2.5 // @description 获取 ChatGPT Token,并实时显示 PoW 算力值 // @author ChatGPT指导员 // @match https://chatgpt.com/* // @grant none // @license V:ChatGPT4V // ==/UserScript== (function() { 'use strict'; let powDifficulty = "N/A"; // 存储当前算力值 // 监听 PoW 算力 API const originalFetch = window.fetch; window.fetch = async function(resource, options) { const response = await originalFetch(resource, options); const url = typeof resource === "string" ? resource : resource?.url; if (url && url.includes("/sentinel/chat-requirements") && options?.method === "POST") { try { const clonedResponse = response.clone(); clonedResponse.json().then(data => { powDifficulty = data?.proofofwork?.difficulty || "N/A"; updatePowButton(); // 更新按钮显示的算力值 }); } catch (error) { console.error("获取 PoW 失败:", error); } } return response; }; // 检查当前网址是否是 chatgpt.com if (window.location.hostname === 'chatgpt.com') { fetch('https://chatgpt.com/api/auth/session') .then(res => res.json()) .then((data) => { const { accessToken } = data; // 如果 accessToken 为 undefined,则不执行后续操作 if (typeof accessToken === 'undefined' || accessToken === null) { console.warn('AccessToken 未定义或未找到,未执行复制操作。'); return; } // 创建弹窗容器 const modal = document.createElement('div'); modal.style.position = 'fixed'; modal.style.top = '50%'; modal.style.left = '50%'; modal.style.transform = 'translate(-50%, -50%)'; modal.style.backgroundColor = '#FFFFFF'; modal.style.padding = '15px'; modal.style.borderRadius = '10px'; modal.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.1)'; modal.style.textAlign = 'center'; modal.style.zIndex = 1001; modal.style.fontFamily = 'Arial, sans-serif'; modal.style.color = '#333'; modal.style.display = 'inline-block'; modal.style.maxWidth = '90%'; modal.style.boxSizing = 'border-box'; modal.style.border = '1px solid #ccc'; // 创建提示文本 const promptText = document.createElement('p'); promptText.textContent = 'Token 已获取,点击按钮复制'; promptText.style.marginBottom = '12px'; promptText.style.fontSize = '16px'; modal.appendChild(promptText); // 创建一个包含按钮的容器,使用 flexbox 布局 const buttonContainer = document.createElement('div'); buttonContainer.style.display = 'flex'; buttonContainer.style.justifyContent = 'center'; buttonContainer.style.gap = '10px'; modal.appendChild(buttonContainer); // 创建复制Token按钮 const copyTokenBtn = document.createElement('button'); copyTokenBtn.textContent = '单Token'; copyTokenBtn.style.backgroundColor = 'rgb(254, 94, 8)'; copyTokenBtn.style.color = 'white'; copyTokenBtn.style.border = 'none'; copyTokenBtn.style.borderRadius = '5px'; copyTokenBtn.style.padding = '10px 20px'; copyTokenBtn.style.cursor = 'pointer'; copyTokenBtn.style.fontSize = '16px'; copyTokenBtn.onclick = () => { navigator.clipboard.writeText(accessToken).then(() => { document.body.removeChild(modal); // 创建自动消失的提示框 const toast = document.createElement('div'); toast.textContent = 'Token 已复制到剪贴板'; toast.style.position = 'fixed'; toast.style.top = '50%'; toast.style.left = '50%'; toast.style.transform = 'translate(-50%, -50%) translateY(-50%)'; toast.style.backgroundColor = 'rgba(0, 0, 0, 0.8)'; toast.style.color = 'white'; toast.style.padding = '10px 20px'; toast.style.borderRadius = '5px'; toast.style.zIndex = 1000; toast.style.fontSize = '16px'; toast.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.2)'; document.body.appendChild(toast); // 1.5秒后自动移除提示框 setTimeout(() => { document.body.removeChild(toast); }, 1500); }).catch(err => { console.error('复制失败', err); }); }; copyTokenBtn.onmouseover = () => { copyTokenBtn.style.backgroundColor = 'rgb(230, 80, 5)'; }; copyTokenBtn.onmouseout = () => { copyTokenBtn.style.backgroundColor = 'rgb(254, 94, 8)'; }; buttonContainer.appendChild(copyTokenBtn); // 创建显示算力值的按钮(替换原来的“全部数据”按钮) const powButton = document.createElement('button'); powButton.id = "pow-button"; // 方便更新 powButton.textContent = `算力:${powDifficulty}`; powButton.style.backgroundColor = '#f44336'; powButton.style.color = 'white'; powButton.style.border = 'none'; powButton.style.borderRadius = '5px'; powButton.style.padding = '10px 20px'; powButton.style.cursor = 'pointer'; powButton.style.fontSize = '16px'; powButton.onclick = () => { document.body.removeChild(modal); }; powButton.onmouseover = () => { powButton.style.backgroundColor = '#e53935'; }; powButton.onmouseout = () => { powButton.style.backgroundColor = '#f44336'; }; buttonContainer.appendChild(powButton); // 添加提示文字 const tipText = document.createElement('p'); tipText.textContent = '点击页面任意空白处关闭弹窗'; tipText.style.fontSize = '12px'; tipText.style.color = 'rgba(0, 0, 0, 0.6)'; tipText.style.marginTop = '8px'; tipText.style.marginBottom = '0'; modal.appendChild(tipText); // 添加弹窗到页面 document.body.appendChild(modal); // 监听点击事件,检测点击是否在弹窗外部 setTimeout(() => { document.addEventListener('click', function handleOutsideClick(event) { if (!modal.contains(event.target)) { document.body.removeChild(modal); document.removeEventListener('click', handleOutsideClick); } }); }, 0); }) .catch(console.error); } // 更新算力按钮的显示值 function updatePowButton() { const powButton = document.getElementById("pow-button"); if (powButton) { powButton.textContent = `算力值:${powDifficulty}`; } } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址