// ==UserScript== // @name ChatGPT禁用数据监管 // @namespace http://tampermonkey.net/ // @version 1.1.1 // @description 目前功能:1.关闭数据监管;2.会话导入导出;3.存档管理器。 // @author bigemon // @match https://chat.openai.com/chat // @match https://chat.openai.com/chat/* // @license GPL-3.0 // @run-at document-idle // @grant GM_info // @grant GM_getValue // @grant GM_setValue // @downloadURL none // ==/UserScript== function dispose(noalert) { var _alert = noalert ? ()=>{} : alert; window.enableFakeMod = 'false' != localStorage.getItem('enable_fakemod'); var style = document.createElement('style'); style.innerHTML = '.switch{position:relative;display:inline-block;width:60px;height:34px;}.switch input{opacity:0;width:0;height:0;}.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:.4s;transition:.4s;}.slider:before{position:absolute;content:"";height:26px;width:26px;left:4px;bottom:4px;background-color:white;-webkit-transition:.4s;transition:.4s;}input:checked + .slider{background-color:#2196F3;}input:focus + .slider{box-shadow:0 0 1px #2196F3;}input:checked + .slider:before{-webkit-transform:translateX(26px);-ms-transform:translateX(26px);transform:translateX(26px);}.slider.round{border-radius:34px;}.slider.round:before{border-radius:50%;}', document.head.appendChild(style), window.switchEnableFakeMod = function () { var a = document.querySelector('input#cswitch'), b = !!a && a.checked; b ? (window.enableFakeMod = !0, localStorage.setItem('enable_fakemod', !0)) : (window.enableFakeMod = !1, localStorage.setItem('enable_fakemod', !1)) }, window.clearAllBoxItem = function () { for (var c, a = document.querySelectorAll('nav'), b = 0; b < a.length; b++) { c = a[b].querySelectorAll('div.toolbox-item'); for (var d = 0; d < c.length; d++) c[d].remove() } }, window.exportSaveData = function () { var a = window.conversation_id_last || '', b = window.parent_message_id_last || '', c = window.authorization_last; if ('' == a || '' == b || 'undefined' == a || 'undefined' == b) return void _alert('\u8BF7\u81F3\u5C11\u8BF4\u4E24\u53E5\u8BDD\u518D\u4F7F\u7528\u8FD9\u4E2A\u529F\u80FD!'); var e = JSON.stringify( { conversation_id: a, parent_message_id: b, authorization: c }), f = window.btoa(e); return f }, window.importSaveData = function (a) { var b = window.atob(a), c = JSON.parse(b); if (void 0 === c.conversation_id || void 0 === c.parent_message_id) return void _alert('\u5B58\u6863\u5DF2\u635F\u574F, \u8BF7\u786E\u4FDD\u5B8C\u6574\u590D\u5236!'); var d = window.getAuthTimestamp(c.authorization) || 0; return d && Math.floor(Date.now() / 1e3) > d ? void _alert('\u8FD9\u4E2A\u5B58\u6863\u7684Token\u5DF2\u8FC7\u671F\u3002') : void (_alert('\u8FD9\u4E2A\u4F1A\u8BDD\u5B58\u6863\u7684\u6709\u6548\u671F\u6700\u957F\u81F3\uFF1A\r\n' + new Date(1e3 * d).toLocaleString('en-US') + '\r\n\r\n\u8BF7\u6CE8\u610F:\u5BFC\u5165\u7684\u4F1A\u8BDD\u65E0\u6CD5\u88AB\u518D\u6B21\u5BFC\u51FA\uFF0C\u4E5F\u65E0\u6CD5\u4FDD\u5B58'), window.next_conversation_id = c.conversation_id, window.next_parent_message_id = c.parent_message_id, window.import_authorization = c.authorization, _alert('\u5BFC\u5165\u6210\u529F,\u5F53\u524D\u4F1A\u8BDD\u72B6\u6001\u5DF2\u300C\u6682\u65F6\u300D\u9644\u52A0\u5230\u5BFC\u5165\u7684\u5B58\u6863\u3002\u8FD9\u5C06\u5BF9\u60A8\u7684\u4E0B\u4E00\u53E5\u8BDD\u751F\u6548\u3002\r\n\u5982\u679C\u8BE5\u5B58\u6863\u7684\u5BBF\u4E3B\u5DF2\u9000\u51FA\u767B\u5F55\u6216\u91CA\u653E\u8BE5\u4F1A\u8BDD\uFF0C\u5219\u5B58\u6863\u4E5F\u4F1A\u4E00\u8D77\u5931\u6548\r\n\u6B64\u65F6\u60A8\u53EF\u80FD\u4F1A\u88AB\u63D0\u793A\u767B\u5F55\u8FC7\u671F\u3002\r\n\r\n\u82E5\u8981\u4E2D\u9014\u89E3\u9664\u9644\u52A0\u72B6\u6001\u3002\u8BF7\u5237\u65B0\u6D4F\u89C8\u5668\u3001\u70B9\u51FB\u300C +New chat \u300D\u65B0\u5EFA\u4F1A\u8BDD\u6216\u5207\u6362\u5230\u5176\u5B83\u7684\u4F1A\u8BDD\u3002')) }, window.boxInit = function () { window.clearAllBoxItem(); for (var a = document.querySelectorAll('nav'), b = 0; b < a.length; b++) { var d = a[b], e = document.createElement('div'), f = d.querySelectorAll('a'); d.childNodes[0].onclick = function () { setTimeout(window.onresize, 1e3), confirm('\u5373\u5C06\u521B\u5EFA\u4E00\u4E2A\u65B0\u7684\u4F1A\u8BDD, \u4F7F\u7528\u5BFC\u5165\u529F\u80FD\u5BFC\u5165\u7684\u4F1A\u8BDD\u5C06\u5931\u6548\u3002') && (delete window.import_authorization, delete window.next_parent_message_id, delete window.next_conversation_id, delete window.parent_message_id_last, delete window.conversation_id_last, delete window.authorization_last) }, e.setAttribute('class', 'toolbox-item flex py-3 px-3 items-center gap-3 rounded-md hover:bg-gray-500/10 transition-colors duration-200 text-white cursor-pointer text-sm flex-shrink-0 border border-white/20'), e.innerHTML = '\u7981\u7528\u6570\u636E\u76D1\u7BA1', d.insertBefore(e, d.childNodes[1]); for (var c = 0; c < f.length; c++) 0 <= f[c].innerHTML.indexOf('FAQ') && (f[c].removeAttribute('href'), f[c].innerHTML = '\u5BFC\u51FA\u4F1A\u8BDD', f[c].onclick = function () { var g = document.querySelector('textarea'), h = window.exportSaveData(); h && prompt('\u2193\u8BF7\u590D\u5236\u60A8\u7684\u4F1A\u8BDD\u5B58\u6863\u2193', h) }), 0 <= f[c].innerHTML.indexOf('OpenAI Discord') && (f[c].removeAttribute('href'), f[c].innerHTML = '\u5BFC\u5165\u4F1A\u8BDD', f[c].onclick = function () { var g = prompt('\u8BF7\u5728\u6B64\u7C98\u8D34\u4F1A\u8BDD\u5B58\u6863'); window.importSaveData(g) }) } }, window.getAuthTimestamp = function (a) { var b = a.split('.'); if (2 > b.length) return 0; var c = window.atob(b[1]), d = JSON.parse(c); return d && d.exp ? d.exp : 0 }, window.boxInit(); var oldFetch = window.fetch; window.fetch = function () { for (var a = arguments.length, b = Array(a), c = 0; c < a; c++) b[c] = arguments[c]; if (b[0].includes('moderations') && window.enableFakeMod) return new Response('{}', { status: 200, statusText: 'ok' }); if (b[0].includes('/conversation/') || b[0].includes('/conversations') || b[0].includes('/chat.json')) setTimeout(window.onresize, 1e3), delete window.import_authorization, delete window.next_parent_message_id, delete window.next_conversation_id, delete window.parent_message_id_last, delete window.conversation_id_last, delete window.authorization_last; else if (b[0].includes('conversation') && b[1].body && 'POST' === b[1].method) { var d = new Headers(b[1].headers), e = d.get('authorization'); window.authorization_last = e; var f = window.import_authorization ? window.import_authorization : e, g; if (d.set('authorization', f), b[1].headers = d, window.next_conversation_id && window.next_parent_message_id) { g = JSON.parse(b[1].body); g.conversation_id = window.next_conversation_id ? window.next_conversation_id : g.conversation_id, g.parent_message_id = window.next_parent_message_id ? window.next_parent_message_id : g.parent_message_id, b[1].body = JSON.stringify(g), delete window.next_parent_message_id, delete window.next_conversation_id } else { g = JSON.parse(b[1].body); window.conversation_id_last = g.conversation_id, window.parent_message_id_last = g.parent_message_id } } return oldFetch.apply(void 0, b) }; var resizeTimer = null; window.onresize = function () { resizeTimer && clearTimeout(resizeTimer), resizeTimer = setTimeout(function () { window.boxInit(); for (var c, a = document.getElementsByTagName('button'), b = 0; b < a.length; b++) c = a[b], -1 !== c.innerHTML.indexOf('sidebar') && c.addEventListener('click', function () { window.setTimeout(function () { window.boxInit() }, 300) }) }, 200) }, window.onresize(), _alert('\u8D5B\u535A\u5DE5\u5177\u5A18v1.1.8\u811A\u672C\u5DF2\u542F\u7528\u3002\u672C\u5DE5\u5177\u7531ChatGPT\u5728\u6307\u5BFC\u4E0B\u751F\u6210~\r\n\r\n\u66F4\u65B0:\r\n1. \u5B98\u65B9\u4F1A\u8BDD\u7BA1\u7406\u5DF2\u6B63\u5F0F\u63A8\u9001\uFF0C\u79FB\u9664\u7B2C\u4E09\u65B9\u5B58\u6863\u652F\u6301\r\n2. \u300C\u5BFC\u5165\u4F1A\u8BDD\u300D\u300C\u5BFC\u51FA\u4F1A\u8BDD\u300D\u73B0\u5728\u53EF\u4EE5\u5728\u65B0\u7248\u672C\u6B63\u5E38\u4F7F\u7528.\r\n3. \u5BFC\u51FA\u7684\u4F1A\u8BDD\u73B0\u5728\u53EF\u4EE5\u5206\u4EAB\u7ED9\u5176\u5B83\u4EBA ( \u5B58\u6D3B\u65F6\u95F4\u53D6\u51B3\u4E8E\u5206\u4EAB\u8005Token )'); } (function () { if(GM_getValue('savedVersion', '-1') < GM_info.version) { dispose(0); GM_setValue('savedVersion', GM_info.version); } else dispose(1); })();