├── .github
└── workflows
│ └── builRelease.yml
├── api.d.ts
├── myapi.d.ts
├── package.json
├── readme-en.md
├── readme.md
└── src
├── SimpleTranslate.js
├── UrlQRcodeGenerator.js
├── aigcfun.com无限key_油猴.js
├── autoOpenInQQ.js
├── chat网页增强.js
├── consoleMobile.js
├── kogoujx.js
├── search-plus.js
├── shushubuyue.js
├── test.js
├── testScript.js
├── videoPlayRate.js
├── 微博暗黑模式.js
├── 文心一言去水印.js
└── 百度题库.js
/.github/workflows/builRelease.yml:
--------------------------------------------------------------------------------
1 | name: Create Archive
2 | on:
3 | push:
4 | tags: [ 'v*']
5 |
6 | jobs:
7 | build:
8 | runs-on: ubuntu-latest
9 | steps:
10 | - uses: actions/checkout@master
11 | - name: Archive Release
12 | uses: thedoctor0/zip-release@0.7.1
13 | with:
14 | type: 'zip'
15 | filename: 'release.zip'
16 | exclusions: '*.git* test.js'
17 | - name: Create Release With Asset
18 | uses: Hs1r1us/Release-AIO@v2.0.0
19 | env:
20 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 | with:
22 | tag_name: ${{ github.ref }}
23 | asset_files: './release.zip'
24 | - name: Duplicate Release With Asset to public_Repo
25 | uses: Hs1r1us/Release-AIO@v2.0.0
26 | env:
27 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # You need a new token to access the target Repository
28 | with:
29 | tag_name: 'inherit' # Must use 'inherit' to get the latest release
30 | body: 'release zip' # Will be added in the new release
31 | repo: 'yang10560/tampermonkey-userscript' # The format is like owner/repo
32 | asset_files: './release.zip' # Will be added in the new release
--------------------------------------------------------------------------------
/api.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * 访问window对象,使用油猴API时window对象是沙盒内的window对象,只能通过unsafeWindow访问页面window对象
3 | */
4 | const unsafeWindow: Window;
5 |
6 | /**
7 | * 添加样式到页面中
8 | * @param style 样式
9 | * @returns 添加后的style元素
10 | */
11 | function GM_addStyle(style: string): HTMLElement;
12 |
13 | /**
14 | * 添加元素到head中
15 | * @param tag_name 标签名称
16 | * @param attributes 属性
17 | * @returns 添加的元素
18 | */
19 | function GM_addElement(tag_name: string, attributes?: object): HTMLElement;
20 | /**
21 | * 添加元素到指定元素中
22 | * @param parent_node 父元素
23 | * @param tag_name 标签名称
24 | * @param attributes 属性
25 | * @returns 添加的元素
26 | */
27 | function GM_addElement(parent_node: HTMLElement, tag_name: string, attributes?: object): HTMLElement;
28 |
29 | /**
30 | * 设置值
31 | * @param name 键
32 | * @param value 值
33 | */
34 | function GM_setValue(name: string, value: any): void;
35 | /**
36 | * 获取值
37 | * @param name 键
38 | * @param defaultValue 默认值
39 | * @returns 值
40 | */
41 | function GM_getValue(name: string, defaultValue?: any): any;
42 | /**
43 | * 删除值
44 | * @param name 键
45 | */
46 | function GM_deleteValue(name: string): void;
47 | /**
48 | * 获取键列表
49 | * @returns 键数组
50 | */
51 | function GM_listValues(): string[];
52 | /**
53 | * 添加值变化监听器
54 | * @param name 键
55 | * @param callback 回调函数
56 | * @returns 监听器ID
57 | */
58 | function GM_addValueChangeListener(name: string,
59 | callback: (
60 | /** 键 */
61 | name: string,
62 | /** 旧值 */
63 | old_value: any,
64 | /** 新值 */
65 | new_value: any,
66 | /** 该值是否是被其它选项卡中的脚本实例修改 */
67 | remote: boolean
68 | ) => void
69 | ): number;
70 | /**
71 | * 移除值变化监听器
72 | * @param listener_id 监听器ID
73 | */
74 | function GM_removeValueChangeListener(listener_id: number): void;
75 |
76 | /**
77 | * 打印内容
78 | * @param message 内容
79 | */
80 | function GM_log(message: string): void;
81 |
82 | /**
83 | * 获取资源的文本内容
84 | * @param name 资源名称
85 | * @returns 文本内容
86 | */
87 | function GM_getResourceText(name: string): string | null;
88 | /**
89 | * 获取资源的内容base64编码后的结果
90 | * @param name 资源名称
91 | * @returns data:type;base64,值
92 | */
93 | function GM_getResourceURL(name: string): string | null;
94 |
95 | /**
96 | * 注册一个菜单,在运行此脚本页面的tampermonkey菜单中显示。
97 | * 前提是插件的run-at要设置为 context-menu,否则不会出现菜单
98 | * @param name 菜单显示名称
99 | * @param fn 单击菜单的事件
100 | * @param accessKey 访问键(好像没用)
101 | * @returns 菜单ID
102 | */
103 | function GM_registerMenuCommand(name: string, fn: Function, accessKey: string): number;
104 | /**
105 | * 取消注册一个菜单
106 | * @param menuCmdId 菜单ID
107 | */
108 | function GM_unregisterMenuCommand(menuCmdId: number): void;
109 |
110 | /**
111 | * 获取当前选项卡的tab对象,只要选项卡没有被关闭,那么这个对象就是持久的
112 | * @param 回调,参数是tab对象,默认是空对象
113 | */
114 | function GM_getTab(callback: (tab: object) => void): void;
115 |
116 | /**
117 | * 保存选项卡对象,以便在页面关闭后重新打开时加载(就随便填一个普通对象,或者自己的tab对象都可以)
118 | * getTab获取的是saveTab后的内容
119 | * @param tab
120 | */
121 | function GM_saveTab(tab: object): void
122 | /**
123 | * 获取所有选项卡对象,以便与其它脚本实例进行通信
124 | * @param callback 回调,参数是普通对象,每个属性是一个实例(只会获取到存活的选项卡tab对象)
125 | */
126 | function GM_getTabs(callback: (tabs: object) => void): void;
127 |
128 | type GMOepnInTabOptions = {
129 | /** 聚焦,切换到该选项卡 */
130 | active?: boolean,
131 | /** 在当前选项卡之后插入新选项卡,而不是添加到所有选项卡末尾 */
132 | insert?: boolean,
133 | /** 使浏览器将当前选项卡重新聚焦在关闭和关闭位置 */
134 | setParent?: boolean,
135 | /** 在隐匿模式下打开该标签页 */
136 | incognito?: boolean
137 | }
138 | type GMOpenInTabResult = {
139 | /** 关闭选项卡 */
140 | close: () => void;
141 | /** 选项卡是否已关闭 */
142 | closed: boolean,
143 | /** 选项卡名称 */
144 | name: string | undefined | null,
145 | /** 选项卡关闭时触发 */
146 | onclose: Function | null
147 | }
148 |
149 | /**
150 | * 打开新的选项卡
151 | * @param url 地址
152 | * @param options 属性
153 | */
154 | function GM_openInTab(url: string, options: GMOepnInTabOptions): GMOpenInTabResult;
155 | /**
156 | * 打开新的选项卡
157 | * @param url 地址
158 | * @param loadInBackground 与options的active相反,是否不聚焦
159 | */
160 | function GM_openInTab(url: string, loadInBackground: boolean): GMOpenInTabResult;
161 |
162 |
163 | /**
164 | * 将数据复制到剪贴板
165 | * @param data 数据
166 | * @param info 信息,可以是 {type: 内容类型, mimetype: 内容mime类型} 或者 内容类型
167 | */
168 | function GM_setClipboard(data: any, info: { type?: string, mimetype?: string } | string): void;
169 |
170 |
171 | type GMNotificationOptions = {
172 | /** 通知的文本,除非设置了highlight,否则为必填项 */
173 | text?: string,
174 | /** 标题 */
175 | title?: string,
176 | /** 图像 */
177 | image?: unknown,
178 | /** 是否突出显示发送通知的选项卡,除非设置了text,否则为必填项 */
179 | highlight?: boolean,
180 | /** 静音 */
181 | slient?: boolean,
182 | /** 超时被隐藏时间,0=禁用 */
183 | timeout?: number,
184 | /** 通知关闭时调用,无论是超时、单击触发、关闭选项卡 */
185 | ondone?: Function,
186 | /** 单击通知时调用 */
187 | onclick?: Function
188 | }
189 | /**
190 | * 显示桌面通知
191 | * @param details 详细信息
192 | * @param ondone 通知关闭时调用,无论是超时、单击触发、关闭选项卡
193 | */
194 | function GM_notification(details: GMNotificationOptions, ondone: Function): void;
195 | /**
196 | * 显示桌面通知
197 | * @param text 通知的文本
198 | * @param title 标题
199 | * @param image 图像
200 | * @param onclick 单击通知时调用
201 | */
202 | function GM_notification(text: string, title: string, image: unknown, onclick: Function): void;
203 |
204 | /**
205 | * 脚本信息
206 | */
207 | const GM_info: {
208 | downloadMode: string,
209 | isFirstPartyIsolation: unknown,
210 | isIncognito: boolean,
211 | script: {
212 | antifeatures: object,
213 | author: string | null,
214 | blockers: unknown[],
215 | copyright: string | null,
216 | description: string | null,
217 | description_i18n: object,
218 | downloadURL: string | null,
219 | evilness: number,
220 | excludes: string[],
221 | grant: string[],
222 | header: string,
223 | homepage: string | null,
224 | icon: string | null,
225 | icon64: string | null,
226 | includes: string[],
227 | lastModified: number,
228 | matches: string[],
229 | name: string | null,
230 | name_i18n: object,
231 | namespace: string | null,
232 | options: {
233 | check_for_updates: boolean,
234 | comment: unknown | null,
235 | compat_foreach: boolean,
236 | compat_metadata: boolean,
237 | compat_prototypes: boolean,
238 | compat_wrappedjsobject: boolean,
239 | compatopts_for_requires: boolean,
240 | noframes: unknown | null,
241 | override: {
242 | merge_connects: boolean,
243 | merge_excludes: boolean,
244 | merge_includes: boolean,
245 | merge_matches: boolean,
246 | orig_connects: string[],
247 | orig_excludes: string[],
248 | orig_includes: string[],
249 | orig_matches: string[],
250 | orig_noframes: unknown | null,
251 | orig_run_at: 'document-start' | 'document-body' | 'document-end' | 'document-idle',
252 | use_blockers: unknown[],
253 | use_connects: unknown[],
254 | use_excludes: unknown[],
255 | use_includes: unknown[],
256 | use_matches: unknown[],
257 | },
258 | run_at: 'document-start' | 'document-body' | 'document-end' | 'document-idle' | 'context-menu',
259 | },
260 | position: number,
261 | resources: unknown[],
262 | 'run-at': 'document-start' | 'document-body' | 'document-end' | 'document-idle' | 'context-menu',
263 | supportURL: unknown | null,
264 | sync: {
265 | imported: boolean
266 | },
267 | unwrap: boolean,
268 | updateURL: string | null,
269 | uuid: string | null,
270 | version: string | null,
271 | webRequest: unknown[]
272 | },
273 | scriptHandler: string | null,
274 | scriptMetaStr: string | null,
275 | scriptSource: string | null,
276 | scriptUpdateURL: string | undefined | null,
277 | scriptWillUpdate: boolean,
278 | toString: () => string,
279 | version: string | null
280 | }
281 |
282 | // [T] 标记:类型可能不准确
283 |
284 | type GMXMLHttpRequestOptionsOnloadArg0 = {
285 | /** 从加载数据的所有重定向后的最终 URL */
286 | finalUrl: string,
287 | /** 就绪状态 */
288 | readyState: number,
289 | /** 请求状态 */
290 | status: number,
291 | /** 请求状态文本 */
292 | statusText: string,
293 | /** 请求响应标头 */
294 | responseHeaders: object,
295 | /** 如果设置了responseType,那么此处的类型则为预先设置的类型 */
296 | response: any,
297 | /** 作为 XML 文档的响应数据 */
298 | responseXML: any,
299 | /** 纯字符串形式的响应数据 */
300 | responseText: string
301 | }
302 |
303 | type GMXMLHttpRequestOptions = {
304 | method: 'GET' | 'HEAD' | 'POST',
305 | url: string,
306 | headers?: object,
307 | /** 通过POST请求发送的字符串 */
308 | data?: string,
309 | /** 携带的cookie */
310 | cookie?: object,
311 | /** 以二进制模式发送data字符串 [T] */
312 | binary?: boolean,
313 | /** 不缓存资源 */
314 | nocache?: boolean,
315 | /** 重新验证可能缓存的内容 [T] */
316 | revalidate?: boolean,
317 | /** 超时时间(毫秒) */
318 | timeout?: number
319 | /** 添加到响应对象的属性 */
320 | context?: any,
321 | /** 指定响应数据的类型 */
322 | responseType?: 'arraybuffer' | 'blob' | 'json' | 'stream',
323 | /** 请求的MIME类型 */
324 | overrideMimeType?: string,
325 | /** 不跟随请求发送cookie */
326 | anonymous?: boolean,
327 | /** 使用fetch而不是xhr请求(beta),请查阅官方说明:https://www.tampermonkey.net/documentation.php#GM_xmlhttpRequest */
328 | fetch?: boolean,
329 | /** 用于身份验证的用户名 */
330 | user?: string,
331 | /** 用于身份验证的密码 */
332 | password?: string,
333 | /** 请求终止回调 */
334 | onabort: Function,
335 | /** 如果请求出现错误,要执行的回调 */
336 | onerror: Function,
337 | /** 在加载开始时执行的回调,如果 responseType 设置为"stream",则提供对流对象的访问 */
338 | onloadstart: Function,
339 | /** 如果请求取得了一些进展,则要执行的回调 */
340 | onprogress: Function,
341 | /** 在请求的就绪状态发生更改时要执行的回调 */
342 | onreadystatechange: Function,
343 | /** 如果请求由于超时而失败,则要执行的回调 */
344 | ontimeout: Function,
345 | /** 如果加载了请求,则要执行的回调 */
346 | onload: (e: GMXMLHttpRequestOptionsOnloadArg0) => void
347 | }
348 |
349 | /**
350 | * 通过XMLHttpRequest发送一个请求
351 | * @param details 详细信息
352 | * @returns 该函数终止此次请求
353 | */
354 | function GM_xmlhttpRequest(details: GMXMLHttpRequestOptions): () => void;
--------------------------------------------------------------------------------
/myapi.d.ts:
--------------------------------------------------------------------------------
1 | const Obj = {
2 | toString: (text: any): string => {
3 | }
4 | }
5 | /**
6 | * CryptoJS
7 | */
8 | const CryptoJS = {
9 | SHA256: (text): Obj => {
10 | },
11 | enc: {
12 | Hex: 'hex'
13 | }
14 | }
15 | /**
16 | * katex
17 | */
18 | const katex = {
19 | renderToString: (text: string, options: any): string => {
20 | }
21 | }
22 | /**
23 | * hljs
24 | */
25 | const hljs = {
26 | highlightElement:(el: HTMLElement): void => {},
27 | configure:(el: any): void => {},
28 | }
29 |
30 |
31 | /**
32 | * jquery
33 | */
34 | function $(selector: string): HTMLElement;
35 |
36 | /**
37 | * 发送人信息
38 | * @param type 类型
39 | * @returns
40 | */
41 | function handleUserInput(type: int): () => void;
42 |
43 | /**
44 | * 机器人信息
45 | * @param str 信息
46 | * @returns
47 | */
48 | function simulateBotResponse(str: string): () => void;
49 |
50 |
51 | /**
52 | * 填充机器人信息,先@simulateBotResponse创建
53 | * @param str 信息
54 | * @returns
55 | */
56 | function fillBotResponse(str: string): () => void;
57 |
58 | /**
59 | * 保存问题答案
60 | * @param question 问题
61 | * @param answer 答案
62 | * @returns
63 | */
64 | function saveHistory(question: string, answer: string): () => void;
65 |
66 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tampermonkeyscript",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "crypto-js": "^4.1.1",
14 | "element-plus": "^2.3.6",
15 | "tsc": "^2.0.4"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/readme-en.md:
--------------------------------------------------------------------------------
1 | ## Tampermonkey Plugins
2 |
3 | Mainly including
4 | * Chatgpt Search tool
5 | * Chat webpage addition
6 | * Weibo dark mode
7 | * Baidu question bank
8 | * Web page debugging and loading
9 | * Other
10 | ## Instructions for use
11 | ### Local installation
12 | 1. Install Tampermonkey to tamper with Monkey Browser extensions
13 | reference resources: https://greasyfork.org/zh-CN
14 | 2. Create a new script
15 | 3. Ready to use
16 | ### Online installation
17 | [ https://greasyfork.org/zh-CN/scripts/459997 ]( https://greasyfork.org/zh-CN/scripts/459997 )
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | ## 油猴插件仓库
2 | 主要包括
3 | * chatgpt搜索引擎右侧菜单
4 | * 网页中英双显互译
5 | * chat网页增加
6 | * 微博暗黑模式
7 | * 百度题库
8 | * 网页调试加载
9 | * 其他
10 |
11 | ## 使用说明
12 | ### 本地安装
13 | 1.安装tampermonkey篡改猴浏览器拓展
14 |
15 | 参考:https://greasyfork.org/zh-CN
16 |
17 | 2.新建脚本
18 |
19 | 3.即可使用
20 |
21 | ### 在线安装
22 |
23 | [https://greasyfork.org/zh-CN/scripts/459997](https://greasyfork.org/zh-CN/scripts/459997)
24 |
25 |
--------------------------------------------------------------------------------
/src/UrlQRcodeGenerator.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name 网页URL二维码生成
3 | // @namespace http://yeyu1024.xyz
4 | // @version 1.8
5 | // @description 生成当前网页的地址(url)的二维码,方便手机扫描.支持二维码图片解析
6 | // @description:en Generate the QR code of the address of the current webpage (URL), which is convenient for mobile phone scanning
7 | // @author 夜雨
8 | // @match *://*/*
9 | // @icon https://www.google.com/s2/favicons?sz=64&domain=https://www.the-qrcode-generator.com
10 | // @require https://cdn.bootcdn.net/ajax/libs/qrcodejs/1.0.0/qrcode.min.js
11 | // @require https://cdn.staticfile.org/jquery/3.4.0/jquery.min.js
12 | // @grant GM_registerMenuCommand
13 | // @homepageURL https://greasyfork.org/zh-CN/scripts/480612
14 | // @supportURL https://greasyfork.org/zh-CN/scripts/480612
15 | // @license MIT
16 | // ==/UserScript==
17 |
18 | (function() {
19 | 'use strict';
20 |
21 | function addjs() {
22 | // require https://cdn.jsdelivr.net/npm/jsqr/dist/jsQR.js
23 | //spark-js
24 | if(!document.getElementById("jsQRjs")){
25 | $("head").append($(
26 | ''
27 | ));
28 | }
29 |
30 | }
31 | setTimeout(addjs)
32 | setInterval(addjs,3000)
33 |
34 |
35 | function isURL(str) {
36 | // 使用正则表达式检查是否符合网址格式
37 | var pattern = new RegExp('^(https?:\\/\\/)?' + // 协议部分,可选
38 | '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // 域名部分
39 | '((\\d{1,3}\\.){3}\\d{1,3}))' + // 或者IP地址形式
40 | '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // 端口号和路径部分
41 | '(\\?[;&a-z\\d%_.~+=-]*)?' + // 查询字符串
42 | '(\\#[-a-z\\d_]*)?$', 'i'); // 锚点部分
43 |
44 | return pattern.test(str);
45 | }
46 |
47 | function urlQRCode(){
48 | $("body").append(`
49 |
50 |
51 |
52 |
53 | ×
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
`);
62 |
63 | let qrcodeDiv = document.getElementById("qrcodeDiv")
64 | let QRContainer = document.getElementById("QRContainer")
65 | let qrcode = new QRCode(qrcodeDiv, {
66 | text: location.href,
67 | width: 256,
68 | height: 256,
69 | colorDark : "#000000",
70 | colorLight : "#ffffff",
71 | correctLevel : QRCode.CorrectLevel.H
72 | });
73 | const closeQRCodebtn = document.getElementById("closeQRCodebtn");
74 | closeQRCodebtn.addEventListener("click",()=>{
75 | QRContainer.remove();
76 | })
77 |
78 | const reQRCodebtn = document.getElementById("reQRCodebtn");
79 | reQRCodebtn.addEventListener("click",()=>{
80 | qrcode.clear(); // clear the code.
81 | qrcode.makeCode(location.href);
82 | })
83 | }
84 |
85 | function decodeImgQRcode(img){
86 | const canvas = document.createElement('canvas');
87 | const ctx = canvas.getContext('2d');
88 | canvas.width = img.width;
89 | canvas.height = img.height;
90 | ctx.drawImage(img, 0, 0, img.width, img.height);
91 |
92 | const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
93 | const code = jsQR(imageData.data, imageData.width, imageData.height);
94 |
95 | if (code) {
96 | console.log("解析结果",'二维码内容:' + code.data)
97 | $("body").append(`
98 |
99 |
100 |
101 |
102 | ×
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 | `);
118 |
119 | let decodeResult = document.getElementById("decodeResult")
120 | let QRContainer = document.getElementById("QRContainer")
121 | decodeResult.innerHTML = code.data
122 |
123 | if(isURL(code.data)){
124 | let openURL = document.getElementById("openURL");
125 | openURL.removeAttribute("style")
126 | openURL.setAttribute("href",code.data)
127 | }
128 | const closeQRresultbtn = document.getElementById("closeQRresultbtn");
129 | closeQRresultbtn.addEventListener("click",()=>{
130 | QRContainer.remove();
131 | })
132 |
133 | //copy result
134 | const copyResultbtn = document.getElementById("copyResultbtn");
135 | copyResultbtn.addEventListener("click",()=>{
136 | decodeResult.select()
137 | document.execCommand("copy");
138 | })
139 |
140 |
141 | } else {
142 | alert('未找到二维码')
143 | }
144 | }
145 |
146 | GM_registerMenuCommand("生成二维码", function (event) {
147 | let QRContainer = document.getElementById("QRContainer")
148 | if(QRContainer){
149 | QRContainer.remove()
150 | }
151 | urlQRCode()
152 | }, "qrcodeGenerate");
153 |
154 | GM_registerMenuCommand("解析二维码", function (event) {
155 | alert("请点击要解析含有二维码的图片.")
156 | let contextMenuHandler = function(ev) {
157 | ev.preventDefault();
158 | if (ev.button === 0) {
159 | console.log('解析二维码...');
160 |
161 | // 获取所有的 img 元素
162 | const images = document.querySelectorAll('img');
163 |
164 | // 为每个 img 元素删除事件监听器
165 | images.forEach(function(img) {
166 | img.removeEventListener('click', contextMenuHandler);
167 | setTimeout(()=>{
168 | img.removeAttribute("crossorigin") //还原
169 | },3000)
170 | });
171 |
172 | console.log('二维码解析---结束');
173 | console.warn(ev.target)
174 | decodeImgQRcode(ev.target)
175 | }
176 |
177 | };
178 | console.log('二维码解析---启动');
179 | // document.addEventListener('click', contextMenuHandler);
180 |
181 | // 获取所有的 img 元素
182 | const images = document.querySelectorAll('img');
183 |
184 | // 为每个 img 元素添加点击事件监听器
185 | images.forEach(function(img) {
186 | img.setAttribute("crossorigin","anonymous") //crossorigin="anonymous"
187 | img.addEventListener('click', contextMenuHandler);
188 | });
189 |
190 |
191 | }, "decodeQRImg");
192 |
193 |
194 | })();
--------------------------------------------------------------------------------
/src/aigcfun.com无限key_油猴.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name aigcfun无限key
3 | // @namespace http://tampermonkey.net/
4 | // @version 0.2
5 | // @description AI无限用key
6 | // @author 夜雨
7 | // @match https://aigcfun.com/*
8 | // @icon https://www.google.com/s2/favicons?sz=64&domain=baidu.com
9 | // @grant GM_addStyle
10 | // @run-at document-end
11 | // ==/UserScript==
12 |
13 | (function () {
14 | 'use strict';
15 |
16 | GM_addStyle(`.floating-btn {
17 | position: fixed;
18 | bottom: 20px;
19 | right: 20px;
20 | z-index: 9999;
21 | }
22 |
23 | .floating-btn button {
24 | background-color: blue;
25 | color: white;
26 | border: none;
27 | padding: 10px 20px;
28 | border-radius: 50px;
29 | }`)
30 |
31 |
32 | setTimeout(() => {
33 | var mydiv = document.createElement("div")
34 | mydiv.setAttribute("class", "floating-btn")
35 | var mybtn = document.createElement("button")
36 | mybtn.innerText = "重置key"
37 | mybtn.addEventListener("click", () => {
38 | console.log("clear")
39 | localStorage.clear()
40 | location.reload()
41 | })
42 | mydiv.append(mybtn)
43 | document.body.append(mydiv)
44 | }, 2000)
45 |
46 |
47 | // Your code here...
48 | })();
--------------------------------------------------------------------------------
/src/autoOpenInQQ.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name QQ链接自动打开
3 | // @namespace http://yeyu1024.xyz
4 | // @version 2.4
5 | // @description PC上使用QQ、QQ邮箱,微云文档点开链接,浏览器提示非QQ官方链接页面时自动打开对应的链接。另外支持CSDN,简书,贴吧,微博,酷安,知乎,nodeseek
6 | // @author 夜雨
7 | // @match *://c.pc.qq.com/*
8 | // @match *://weixin110.qq.com/cgi-bin/*
9 | // @match *://link.zhihu.com/*
10 | // @match *://mail.qq.com/cgi-bin/*
11 | // @match *://*.bdimg.com/safecheck/*
12 | // @match *://t.cn/*
13 | // @match *://*.coolapk.com/*
14 | // @match *://*.jianshu.com/go-wild*
15 | // @match *://link.csdn.net/*
16 | // @match *://google.urlshare.cn/umirror_url_check*
17 | // @match *://www.nodeseek.com/jump?to=*
18 | // @icon https://mat1.gtimg.com/www/icon/favicon2.ico
19 | // @grant none
20 | // @license MIT
21 | // ==/UserScript==
22 |
23 | (function() {
24 | 'use strict';
25 |
26 | function getParams(name){
27 | let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
28 | let r = window.location.search.substr(1).match(reg);
29 | if (r != null) return decodeURIComponent(r[2]);
30 | return '';
31 | }
32 |
33 |
34 | let linkUrl = ""
35 |
36 | if(location.href.includes('c.pc.qq.com')){
37 | linkUrl = getParams('pfurl') || getParams('url');
38 | //debugger;
39 | if(!linkUrl){
40 | linkUrl = document.querySelector("div.safety-url").innerText;
41 | }
42 | }
43 |
44 | if(location.href.includes('bdimg.com')){
45 | document.querySelector("a.btn.btn-next").click()
46 | }
47 |
48 | if(location.href.includes('t.cn')){
49 | document.querySelector(".open-url a").click()
50 | }
51 |
52 | //酷安 https://www.coolapk.com/link?url=https%3A%2F%2Fwwu.lanzoub.com%2Fb0387ekmf
53 | if(location.href.includes('coolapk.com\/link')){
54 | linkUrl = getParams('url');
55 |
56 | }
57 |
58 | //知乎
59 | if(location.href.includes('zhihu.com')){
60 | linkUrl = getParams('target');
61 | }
62 |
63 | //简书
64 | if(location.href.includes('jianshu.com')){
65 | linkUrl = getParams('url');
66 | }
67 |
68 | //csdn
69 | if(location.href.includes('link.csdn.net')){
70 | linkUrl = getParams('target');
71 | }
72 |
73 | //微云文档
74 | if(location.href.includes('google.urlshare.cn')){
75 | linkUrl = getParams('url');
76 | }
77 |
78 | //nodeseek
79 | if(location.href.includes('nodeseek.com\/jump')){
80 | linkUrl = getParams('to');
81 | }
82 |
83 | //weixin
84 | if(location.href.includes('weixin110')){
85 | linkUrl = document.querySelector(".weui-msg__desc").innerText
86 | }
87 |
88 | if(location.href.includes('mail.qq.com')){
89 |
90 | try{
91 | goUrl(1);
92 | console.log("goUrl: ")
93 | return;
94 | }catch (e) {
95 | console.log("exception:", e)
96 | linkUrl = document.querySelector("div.safety-url").innerText;
97 | }
98 |
99 | }
100 |
101 | linkUrl && (window.location.href = linkUrl.startsWith("http")? linkUrl:`http://${linkUrl}`) ;
102 |
103 |
104 | })();
--------------------------------------------------------------------------------
/src/chat网页增强.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name Chat网页增强
3 | // @namespace http://blog.yeyusmile.top/
4 | // @version 4.98
5 | // @description 网页增强,使你在网页中可以用GPT, 网址 https://yeyu2048.xyz/gpt.html
6 | // @author 夜雨
7 | // @match *://yeyu1024.xyz/gpt.html*
8 | // @match *://yeyu1024.xyz/gptlight.html*
9 | // @match *://yeyu2048.xyz/gpt.html*
10 | // @match *://yeyu2048.xyz/gptlight.html*
11 | // @grant GM_xmlhttpRequest
12 | // @grant GM_getResourceText
13 | // @grant GM_openInTab
14 | // @grant GM_registerMenuCommand
15 | // @icon64 data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAZlBMVEUAAAD///+hoaFoaGhsbGy7u7vd3d2+vr76+vra2tr29va2trYrKyvg4ODs7OxXV1dgYGCtra0xMTGXl5fExMQ6OjqOjo7R0dEVFRWnp6dSUlIiIiIcHBwLCwt4eHhycnKEhIRHR0f14+hfAAADN0lEQVRYhe1WyZajMAyEsMQshgABEwIJ+f+fbC02W0yHnjnNvNYFDFbZKpUlO86v/e/Wpve/8M4TFckwSvI/cx8z11g2/tw9vZKrEIKe159GUkvwipPxVb4eQQzvYV12XX3Y/x6BT5LqUZkgWixEHF/9/hAAeozz0I8nOtzoccDfg8CbaZQrYkOGYUaEFO2RDUTT4MZefjkMpVcQo5/Wr2DSi9/bhlYPhukvZqf41l3hiiFv8xJR2CslIT+XXfc+YapojY60kG1ZA0rknj+lL4YtnGCQ4lbESSczf5R6Ugc5ee4AoL9KAwbwYXDWXJTXhaDhf2L3R44rxzkbgFgHn55Y0JJjzyeONpYLDn4CCPn7A46VaggjwIB6eEltAOConCUAcZVDXBKIHHgbp9IZ4KW0AZj8LAHaQEzaY0lmHk60AXiQ8XYFEDoVrRpXOmSfdQFfbMe7MuTOJMLU6IJqkh7PuTMVrhosAJCp2xrApA6Lk+p4VllMQjsAcNNkpzeQlKkPHhQb0VkAEgO8TSMaVqhMH/EyW57W2R7moNoBCjwDPg1QzM07QAk7o+wUrIcNwAVZ1ktAROE7gBMaEq4kaW8NgHlQOsrULiUoHjGT40PIqngHOIGYzRK22ggJz3TpbrCt7AMU9gPZwc4y5slJC7FO4woAxmcLgMMi0dF1ymSOtnMEYFDczxqtdJRM6HlAbhSvARIqHG+G5BJGqONoK2opooIMLQFaYMvWs0EJruNRV1b8vy+wqDtbEj2caAcQg5NWdIQL6IJPjIGg1gDKhLINARyxed4DpgLFq+vvKoRiEszGWmlCy0OmcyrqSxKr/eaUzFvDGnDWCX2d5zQmNdJsO4xoz8XeyqcpIdRexZ0BBOYl2r2wyHfwB2WFO0zBjS/Zv2Vc8Pey3l3kor0iR65Q+61Vr6GmttNSOtxRf+jgvfnW3eFa4CZ+3fb1k1q1uC0D3GmKC2s5zkxKvieqWbKQPvFpfbRnNF+pYn/+3ny6m0zW+9eYDIMxlQsbvKuO3zfrV5fWKMc4GLu6G+m2KY/fNNnu6/vu2drTv7fFjVuOP3dHy5MolJEqrKfvoPXp57vpr/3r9gUxwiW4OiuC3wAAAABJRU5ErkJggg==
16 | // @connect chatai.to
17 | // @connect luntianxia.uk
18 | // @connect pp2pdf.com
19 | // @connect tdchat0.com
20 | // @connect zw7.lol
21 | // @connect xeasy.me
22 | // @connect api.aigcfun.com
23 | // @connect ai5.wuguokai.top
24 | // @connect chat.aidutu.cn
25 | // @connect xjai.pro
26 | // @connect wobcw.com
27 | // @connect aifree.site
28 | // @connect promplate.dev
29 | // @connect t-chat.cn
30 | // @connect ai.ls
31 | // @connect chat.ohtoai.com
32 | // @connect extkj.cn
33 | // @connect free.anzz.top
34 | // @connect supremes.pro
35 | // @connect onrender.com
36 | // @connect free-chat.asia
37 | // @connect chat7.aifks001.online
38 | // @connect sunls.me
39 | // @connect theb.ai
40 | // @connect www.ftcl.store
41 | // @connect chatgpt.qdymys.cn
42 | // @connect chat.bushiai.com
43 | // @connect www.pizzagpt.it
44 | // @connect easyai.one
45 | // @connect chat2.wuguokai.cn
46 | // @connect a0.chat
47 | // @connect gpt.esojourn.org
48 | // @connect free-api.cveoy.top
49 | // @connect chatcleand.xyz
50 | // @connect 154.40.59.105
51 | // @connect gptplus.one
52 | // @connect xcbl.cc
53 | // @connect hz-it-dev.com
54 | // @connect toyaml.com
55 | // @connect 38.47.97.76
56 | // @connect api.aichatos.cloud
57 | // @connect binjie.fun
58 | // @connect gamejx.cn
59 | // @connect ai001.live
60 | // @connect ai003.live
61 | // @connect promptboom.com
62 | // @connect caipacity.com
63 | // @connect anfans.cn
64 | // @connect 6bbs.cn
65 | // @connect ai-yuxin.space
66 | // @connect yuxin-ai.com
67 | // @connect cytsee.com
68 | // @connect yeyu1024.xyz
69 | // @connect yeyu2048.xyz
70 | // @connect gptgo.ai
71 | // @connect mixerbox.com
72 | // @connect muspimerol.site
73 | // @connect frechat.xyz
74 | // @compatible Chrome
75 | // @compatible Firefox
76 | // @license MIT
77 | // @require https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js
78 | // @website https://yeyu1024.xyz/gpt.html
79 | // @run-at document-end
80 |
81 | // ==/UserScript==
82 |
83 | (function () {
84 | 'use strict';
85 | console.log("======AI增强=====")
86 |
87 | const JSVer = "v4.98"
88 | //ai差不多停止更新 请移步 https://greasyfork.org/scripts/459997
89 | //将于2024.2月初更新域名,请到:https://yeyu2048.xyz/gpt.html中使用
90 |
91 | try {
92 | GM_registerMenuCommand("更新脚本", function (event) {
93 | GM_openInTab("https://greasyfork.org/zh-CN/scripts/463138")
94 | }, "updateScript");
95 | }catch (e) { }
96 |
97 | function GM_simulateBotResponse(str) {
98 | simulateBotResponse(str)
99 | }
100 | function GM_fillBotResponse(str) {
101 | fillBotResponse(str)
102 | }
103 | function GM_saveHistory(your_qus, ans) {
104 | saveHistory(your_qus,ans)
105 | }
106 | function GM_simulateBotResponseAndSave(your_qus, ans) {
107 | simulateBotResponse(ans)
108 | saveHistory(your_qus,ans)
109 | }
110 |
111 | function GM_fillBotResponseAndSave(your_qus, ans) {
112 | fillBotResponse(ans)
113 | saveHistory(your_qus,ans)
114 | }
115 |
116 | function GM_handleUserInput(InputType){
117 | handleUserInput(InputType)
118 | }
119 |
120 | //toastr 封装 ----start----
121 | const Toast = {
122 |
123 | warn: function(msg, title, options) {
124 | try {
125 | toastr.warning(msg, title, options)
126 | }catch (e) {}
127 | },
128 | info: function(msg, title, options) {
129 | try {
130 | toastr.info(msg, title, options)
131 | }catch (e) {}
132 | },
133 | success: function(msg, title, options) {
134 | try {
135 | toastr.success(msg, title, options)
136 | }catch (e) {}
137 | },
138 | error: function(msg, title, options) {
139 | try {
140 | toastr.error(msg, title, options)
141 | }catch (e) {}
142 | },
143 | };
144 | //toastr 封装 ----end----
145 |
146 |
147 |
148 | //封装GM_xmlhttpRequest ---start---
149 | async function GM_fetch(details) {
150 | return new Promise((resolve, reject) =>{
151 | switch (details.responseType){
152 | case "stream":
153 | details.onloadstart = (res)=>{
154 | resolve(res)
155 | };
156 | break;
157 | default:
158 | details.onload = (res)=>{
159 | resolve(res)
160 | };
161 | }
162 |
163 | details.onerror = (res)=>{
164 | reject(res)
165 | };
166 | details.ontimeout = (res)=>{
167 | reject(res)
168 | };
169 | details.onabort = (res)=>{
170 | reject(res)
171 | };
172 | GM_xmlhttpRequest(details)
173 | });
174 | }
175 |
176 |
177 | function GM_httpRequest(details, callBack, errorCallback, timeoutCallback, abortCallback){
178 | if(callBack){
179 | switch (details.responseType){
180 | case "stream":
181 | details.onloadstart = callBack;
182 | break;
183 | default:
184 | details.onload = callBack
185 | }
186 | }
187 | if(errorCallback){
188 | details.onerror = errorCallback;
189 | }
190 | if(timeoutCallback){
191 | details.ontimeout = timeoutCallback;
192 | }
193 | if(abortCallback){
194 | details.onabort = abortCallback;
195 | }
196 | console.log(details)
197 | GM_xmlhttpRequest(details);
198 | }
199 |
200 | //封装GM_xmlhttpRequest ---end---
201 |
202 |
203 |
204 | //enc-start
205 | async function digestMessage(r) {
206 | const hash = CryptoJS.SHA256(r);
207 | return hash.toString(CryptoJS.enc.Hex);
208 | }
209 |
210 | const generateSignatureWithPkey = async r => {
211 | const {
212 | t: e,
213 | m: t,
214 | pkey: n
215 | } = r;
216 | console.log("CURRENT KEY:" + n)
217 |
218 | const a = `${e}:${t}:${n}`;
219 | return await digestMessage(a);
220 | };
221 |
222 | let aesKey = "hj6cdzrhj72x8ht1";
223 | const AES_CBC = {
224 |
225 | encrypt: function(e, t) {
226 | return CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(e), CryptoJS.enc.Utf8.parse(t), {
227 | iv: CryptoJS.enc.Utf8.parse(aesKey),
228 | mode: CryptoJS.mode.CBC
229 | }).toString()
230 | },
231 | decrypt: function(e, t) {
232 | return CryptoJS.AES.decrypt(e, CryptoJS.enc.Utf8.parse(t), {
233 | iv: CryptoJS.enc.Utf8.parse(aesKey),
234 | mode: CryptoJS.mode.CBC
235 | }).toString(CryptoJS.enc.Utf8)
236 | }
237 | };
238 | //enc-end
239 |
240 | var messageChain2 = []//ails
241 |
242 |
243 |
244 | function uuidv4() {
245 | let d = new Date().getTime(); // get current timestamp in ms (to ensure UUID uniqueness)
246 | let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
247 | let r = (d + Math.random() * 16) % 16 | 0 // generate random nibble
248 | d = Math.floor(d / 16) // correspond each UUID digit to unique 4-bit chunks of timestamp
249 | return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16) // generate random hexadecimal digit
250 | })
251 | return uuid
252 | }
253 |
254 | function addMessageChain(messageChain, element) {
255 | if (messageChain.length >= 5) {
256 | messageChain.shift();
257 | }
258 | messageChain.push(element);
259 | console.log(messageChain)
260 | }
261 |
262 | var formatTime = () => {
263 | let padZero = (num) => {
264 | // 如果数字小于 10,前面补一个 0
265 | return num < 10 ? `0${num}` : num;
266 | }
267 | const now = new Date(); // 获取当前时间
268 | const hours = now.getHours(); // 获取小时
269 | const minutes = now.getMinutes(); // 获取分钟
270 | const seconds = now.getSeconds(); // 获取秒数
271 | // 格式化为 HH:MM:SS 的形式
272 | return `${padZero(hours)}:${padZero(minutes)}:${padZero(seconds)}`;
273 | }
274 |
275 |
276 |
277 |
278 | let pizzaSecret;
279 |
280 |
281 | function PIZZA(question) {
282 | let your_qus = question;//你的问题
283 | GM_handleUserInput(null)
284 | GM_xmlhttpRequest({
285 | method: "POST",
286 | url: "https://www.pizzagpt.it/api/chatx-completion",
287 | headers: {
288 | "content-type": "application/json",
289 | "Referer": `https://www.pizzagpt.it/`,
290 | "origin": `https://www.pizzagpt.it`,
291 | "x-secret": pizzaSecret
292 | },
293 | data: JSON.stringify({
294 | question: your_qus
295 | }),
296 | onload: function (res) {
297 | if (res.status === 200) {
298 | console.log('成功....')
299 | console.log(res)
300 | let rest = res.responseText
301 | //console.log(rest.choices[0].text.replaceAll("\n",""))
302 |
303 | try {
304 | GM_simulateBotResponseAndSave(your_qus, JSON.parse(rest).answer.content)
305 |
306 | } catch (e) {
307 | console.log(e)
308 |
309 | }
310 |
311 | } else {
312 | console.log('失败')
313 | console.log(res)
314 |
315 | }
316 | },
317 |
318 | responseType: "application/json;charset=UTF-8",
319 | onerror: function (err) {
320 | Toast.error(`some err happends,errinfo : ${err.messages}`)
321 | }
322 | });
323 | }
324 |
325 | function formattedDate() {
326 | const now = new Date();
327 | const year = now.getFullYear();
328 | const month = now.getMonth() + 1;
329 | const day = now.getDate();
330 |
331 | const formattedMonth = month < 10 ? `0${month}` : month;
332 | const formattedDay = day < 10 ? `0${day}` : day;
333 |
334 | return `${year}-${formattedMonth}-${formattedDay}`;
335 | }
336 |
337 | let ails_clientv;
338 | let ails_signKey = 'WI,2rU#_r:r~aF4aJ36[.Z(/8Rv93Rf';
339 | function AILS(question) {
340 | let your_qus = question;//你的问题
341 | GM_handleUserInput(null)
342 | let vtime = function converTimestamp(t) {
343 | const e = parseInt(t)
344 | , n = e % 10
345 | , r = n % 2 === 0 ? n + 1 : n;
346 | return (e - n + r).toString()
347 | }
348 |
349 | let now = vtime(new Date().getTime());
350 | const pk = `${ails_signKey}:${your_qus.length}`;//查看js的generateSignature函数中的key
351 | let Baseurl = "https://api.caipacity.com/"
352 | generateSignatureWithPkey({
353 | t: now,
354 | m: your_qus || "",
355 | pkey: pk
356 | }).then(sign => {
357 | addMessageChain(messageChain2, {role: "user", content: your_qus})//连续话
358 | console.log(sign)
359 | GM_fetch({
360 | method: "POST",
361 | url: Baseurl + "v1/chat/completions?full=false",
362 | headers: {
363 | "Content-Type": "application/json",
364 | "authorization": "Bearer free",
365 | "client-id": uuidv4(),
366 | "client-v": ails_clientv,
367 | "Referer": Baseurl,
368 | "from-url": "https://ai.ls/?chat=1",
369 | "origin": "https://ai.ls",
370 | "X-Forwarded-For": generateRandomIP(),
371 | "accept": "application/json"
372 | },
373 | data: JSON.stringify({
374 | model: "gpt-3.5-turbo",
375 | messages: messageChain2,
376 | stream: true,
377 | t: `${now}`,
378 | d: formattedDate(),
379 | s: sign,
380 | temperature:0.6
381 | }),
382 | responseType: "stream"
383 | }).then((stream) => {
384 | let result = [];
385 | let finalResult;
386 | GM_simulateBotResponse("...")
387 | const reader = stream.response.getReader();
388 | reader.read().then(function processText({done, value}) {
389 | if (done) {
390 | finalResult = result.join("")
391 | try {
392 | console.log(finalResult)
393 | addMessageChain(messageChain2, {
394 | role: "assistant",
395 | content: finalResult
396 | })
397 | GM_fillBotResponseAndSave(your_qus,finalResult)
398 | } catch (e) {
399 | console.log(e)
400 | }
401 | return;
402 | }
403 | try {
404 | let d = new TextDecoder("utf8").decode(new Uint8Array(value));
405 | /*d.split("\n").forEach(item=>{
406 | try {
407 | let chunk = JSON.parse(item.replace(/data:/,"").trim())
408 | .choices[0].delta.content;
409 | result.push(chunk)
410 | }catch (ex){}
411 | })*/
412 | result.push(d)
413 | GM_fillBotResponse(result.join(""))
414 | } catch (e) {
415 | console.log(e)
416 | }
417 |
418 | return reader.read().then(processText);
419 | });
420 | },(reason)=>{
421 | console.log(reason)
422 | }).catch((ex)=>{
423 | console.log(ex)
424 | });
425 |
426 | });
427 | }
428 |
429 |
430 |
431 | function TDCHAT(question) {
432 | let your_qus = question;//你的问题
433 | GM_handleUserInput(3)
434 | GM_xmlhttpRequest({
435 | method: "POST",
436 | //http://5p2ag.tdchat0.com/
437 | url: "http://7shi.zw7.lol/chat.php",
438 | headers: {
439 | "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
440 | // "Authorization": "Bearer null",
441 | "Referer": "http://7shi.zw7.lol/",
442 | //"Host":"www.aiai.zone",
443 | "accept": "application/json, text/plain, */*"
444 | },
445 | data: `id=3.5&key=&role=&title=&text=${encodeURIComponent(question).replace(/%/g, '‰')}&length=${question.length}&stream=1`,
446 | onloadstart: (stream) => {
447 | let result = [];
448 | GM_simulateBotResponse("...")
449 | const reader = stream.response.getReader();
450 | reader.read().then(function processText({done, value}) {
451 | if (done) {
452 | let finalResult = result.join("")
453 | try {
454 | console.log(finalResult)
455 | GM_saveHistory(your_qus, finalResult);
456 | } catch (e) {
457 | console.error(e)
458 | } finally {
459 | GM_fillBotResponse(result.join(""))
460 | }
461 |
462 |
463 | return;
464 | }
465 |
466 | try {
467 | let d = new TextDecoder("utf8").decode(new Uint8Array(value));
468 | console.log("raw:",d)
469 | let dd = d.replace(/data: /g, "").split("\n\n")
470 | console.log("dd:",dd)
471 | dd.forEach(item=>{
472 | try {
473 | let delta = JSON.parse(item).choices[0].delta.content
474 | result.push(delta)
475 | GM_fillBotResponse(result.join(""))
476 | }catch (e) {
477 |
478 | }
479 | })
480 | } catch (e) {
481 | console.log(e)
482 | }
483 |
484 | return reader.read().then(processText);
485 | });
486 | },
487 | responseType: "stream",
488 | onprogress: function (msg) {
489 | //console.log(msg) //Todo
490 | },
491 | onerror: function (err) {
492 | console.log(err)
493 | },
494 | ontimeout: function (err) {
495 | console.log(err)
496 | }
497 | })
498 |
499 | }
500 |
501 |
502 |
503 | function generateRandomString(length) {
504 | var result = '';
505 | var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
506 | var charactersLength = characters.length;
507 | for (var i = 0; i < length; i++) {
508 | result += characters.charAt(Math.floor(Math.random() * charactersLength));
509 | }
510 | return result;
511 | }
512 |
513 | var parentID_aidutu;
514 | function AIDUTU(question){
515 | let your_qus = question;//你的问题
516 | console.log(parentID_aidutu)
517 | GM_handleUserInput(null)
518 | let _iam = generateRandomString(8)
519 | let ops = {};
520 | if(parentID_aidutu){
521 | ops = {parentMessageId: parentID_aidutu};
522 | }
523 | console.log(ops)
524 | GM_xmlhttpRequest({
525 | url: "https://chat.aidutu.cn/api/cg/chatgpt/user/info?v=1.5",
526 | headers: {
527 | "accept": "*/*",
528 | "referrer": "https://chat.aidutu.cn/",
529 | "x-iam": _iam,
530 | "Cookie": `_UHAO={"uid":"160941","school":"","time":1681704243,"ts":"2","name":"chat_q2Ac","head":"\/res\/head\/2ciyuan\/24.jpg","term":"201801","sign":"714653d141dac0e7709f31003b8df858"}; _UIP=0e98d94e599ef74c29fb40cb35971810`,
531 | "content-type": "application/json"
532 | },
533 | data: JSON.stringify({
534 | q: your_qus,
535 | iam: _iam
536 | }),
537 | method: "POST",
538 | onload: (resp) => {
539 | let rs = resp.responseText;
540 | console.log(rs)
541 | let xtoken = JSON.parse(rs).data.token;
542 | console.log(xtoken)
543 | GM_xmlhttpRequest({
544 | method: "POST",
545 | url: "https://chat.aidutu.cn/api/chat-process",
546 | headers: {
547 | "Content-Type": "application/json",
548 | "Referer": "https://chat.aidutu.cn/",
549 | "Cookie": `_UHAO={"uid":"160941","school":"","time":1681704243,"ts":"2","name":"chat_q2Ac","head":"\/res\/head\/2ciyuan\/24.jpg","term":"201801","sign":"714653d141dac0e7709f31003b8df858"}; _UIP=0e98d94e599ef74c29fb40cb35971810`,
550 | "accept": "application/json, text/plain, */*",
551 | "x-token": xtoken
552 | },
553 | data: JSON.stringify({
554 | prompt: your_qus,
555 | temperature: 0.8,
556 | top_p: 1,
557 | options: ops,
558 | systemMessage: "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown."
559 | }),
560 | onloadstart: (stream) => {
561 | let result = "";
562 | GM_simulateBotResponse("请稍后...")
563 | const reader = stream.response.getReader();
564 | // console.log(reader.read)
565 | let finalResult = "";
566 | reader.read().then(function processText({done, value}) {
567 | if (done) {
568 | GM_saveHistory(your_qus, finalResult);
569 | return;
570 | }
571 | const chunk = value;
572 | result += chunk;
573 | try {
574 | let byteArray = new Uint8Array(chunk);
575 | let decoder = new TextDecoder('utf-8');
576 | let nowResult = JSON.parse(decoder.decode(byteArray))
577 | console.log(nowResult)
578 | if (nowResult.text) {
579 | console.log(nowResult)
580 | finalResult = nowResult.text
581 | GM_fillBotResponse(finalResult)
582 | }
583 | if(nowResult.id){
584 | parentID_aidutu = nowResult.id;
585 | }
586 |
587 | } catch (e) {
588 | console.log(e)
589 | }
590 |
591 | return reader.read().then(processText);
592 | });
593 | },
594 | responseType: "stream",
595 | onerror: function (err) {
596 | console.log(err)
597 | }
598 | })
599 |
600 | }//end onload
601 |
602 | })
603 | }
604 |
605 |
606 | function TOYAML(question) {
607 | let your_qus = question;//你的问题
608 | GM_handleUserInput(null)
609 | GM_fetch({
610 | method: "GET",
611 | url: "https://toyaml.com/stream?q="+encodeURI(your_qus),
612 | headers: {
613 | "Content-Type": "application/json",
614 | "Referer": "https://toyaml.com/",
615 | "accept": "*/*"
616 | },
617 | responseType: "stream"
618 | }).then((stream) => {
619 | let finalResult = [];
620 | GM_simulateBotResponse("=====")
621 | const reader = stream.response.getReader();
622 | reader.read().then(function processText({done, value}) {
623 | if (done) {
624 | return;
625 | }
626 | try {
627 | // console.log(normalArray)
628 | let byteArray = new Uint8Array(value);
629 | let decoder = new TextDecoder('utf-8');
630 | let nowResult = decoder.decode(byteArray)
631 | console.log(nowResult)
632 | if(!nowResult.match(/答案来自/)){
633 | finalResult.push(nowResult)
634 | }
635 | GM_fillBotResponse(finalResult.join(""))
636 |
637 | } catch (ex) {
638 | console.log(ex)
639 | }
640 |
641 | return reader.read().then(processText);
642 | });
643 | }).catch((ex)=>{
644 | console.log(ex)
645 | })
646 |
647 |
648 |
649 |
650 | }
651 |
652 |
653 |
654 |
655 | var generateRandomIP = () => {
656 | const ip = [];
657 | for (let i = 0; i < 4; i++) {
658 | ip.push(Math.floor(Math.random() * 256));
659 | }
660 | console.log(ip.join('.'))
661 | return ip.join('.');
662 | }
663 |
664 | function getAIgcKey() {
665 | Toast.info("此功能是普通接口的key")
666 |
667 |
668 | GM_xmlhttpRequest({
669 | method: "GET",
670 | url: "https://api.aigcfun.com/fc/key",
671 | headers: {
672 | "Content-Type": "application/json",
673 | "Referer": `https://aigcfun.com/`,
674 | "X-Forwarded-For": generateRandomIP()
675 | },
676 | onload: function (response) {
677 | let resp = response.responseText;
678 | let gckey = JSON.parse(resp).data;
679 | if (!gckey) {
680 | Toast.error("更新失败")
681 | localStorage.removeItem("useKeyTime")
682 | return
683 | }
684 | console.log("gckey:" + gckey);
685 | localStorage.setItem("useKeyTime", 0)
686 | localStorage.setItem("aigcfunkey", gckey)
687 | Toast.success("更新成功:" + gckey)
688 | }
689 | });
690 | }
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 | let messageChain9 = []
699 | function FRECHAT(question) {
700 | let your_qus = question;//你的问题
701 | GM_handleUserInput(null)
702 | let now = Date.now();
703 | generateSignatureWithPkey({
704 | t: now,
705 | m: your_qus || "",
706 | pkey: ""
707 | }).then(sign => {
708 | addMessageChain(messageChain9, {role: "user", content: your_qus})//连续话
709 | console.log(sign)
710 | GM_fetch({
711 | method: "PUT",
712 | url: "https://demo-9elp.onrender.com/single/chat_messages",
713 | headers: {
714 | "Content-Type": "application/json",
715 | "Referer": "https://e10.frechat.xyz",
716 | "accept": "*/*"
717 | },
718 | data: JSON.stringify({
719 | "messages": messageChain9,
720 | "model": "THUDM/glm-4-9b-chat"
721 | }),
722 | responseType: "stream"
723 | }).then((stream) => {
724 | let result = [];
725 | GM_simulateBotResponse("...")
726 | const reader = stream.response.getReader();
727 | reader.read().then(function processText({done, value}) {
728 | if (done) {
729 | let finalResult = result.join("")
730 | try {
731 | console.log(finalResult)
732 | addMessageChain(messageChain9, {
733 | role: "assistant",
734 | content: finalResult
735 | })
736 | GM_fillBotResponseAndSave(your_qus,finalResult)
737 | } catch (e) {
738 | console.log(e)
739 | }
740 | return;
741 | }
742 | try {
743 | let d = new TextDecoder("utf8").decode(new Uint8Array(value));
744 | result.push(d)
745 | GM_fillBotResponse(result.join("")
746 | .replace(/muspimerol/gi,""))
747 | } catch (e) {
748 | console.log(e)
749 | }
750 |
751 | return reader.read().then(processText);
752 | });
753 | },function (reason) {
754 | console.log(reason)
755 | Toast.error("未知错误!")
756 | }).catch((ex)=>{
757 | console.log(ex)
758 | Toast.error("未知错误!")
759 | });
760 |
761 | });
762 | }
763 |
764 |
765 | //https://chat7.aifks001.online/v1/chat/gpt/
766 | var aifskList = [];
767 | var aifsid = generateRandomString(21);
768 |
769 | //失效
770 | function AIFKS(question) {
771 | let your_qus = question;//你的问题
772 | GM_handleUserInput(null)
773 | let Baseurl = "https://chat7.aifks001.online/";
774 | let padZero = (num) => {
775 | // 如果数字小于 10,前面补一个 0
776 | return num < 10 ? `0${num}` : num;
777 | }
778 | let formatTime = () => {
779 | const now = new Date(); // 获取当前时间
780 | const hours = now.getHours(); // 获取小时
781 | const minutes = now.getMinutes(); // 获取分钟
782 | const seconds = now.getSeconds(); // 获取秒数
783 | // 格式化为 HH:MM:SS 的形式
784 | return `${padZero(hours)}:${padZero(minutes)}:${padZero(seconds)}`;
785 | }
786 | console.log(formatTime())
787 | aifskList.push({"content": your_qus, "role": "user", "nickname": "", "time": formatTime(), "isMe": true})
788 | aifskList.push({"content":"正在思考中...","role":"assistant","nickname":"AI","time": formatTime(),"isMe":false})
789 | if (aifskList.length > 10){
790 | aifskList = aifskList.shift();
791 | }
792 | GM_xmlhttpRequest({
793 | method: "POST",
794 | url: Baseurl + "v1/chat/gpt/",
795 | headers: {
796 | "Content-Type": "application/json",
797 | // "Authorization": "Bearer null",
798 | "Referer": Baseurl,
799 | "accept": "application/json, text/plain, */*"
800 | },
801 | data: JSON.stringify({
802 | "list": aifskList,
803 | "id": aifsid,
804 | "title": your_qus,
805 | "prompt": "",
806 | "temperature": 0.5,
807 | "models": "0",
808 | "continuous": true
809 | }),
810 | onloadstart: (stream) => {
811 | let result = [];
812 | GM_simulateBotResponse("请稍后...")
813 | const reader = stream.response.getReader();
814 | reader.read().then(function processText({done, value}) {
815 | if (done) {
816 | let finalResult = result.join("")
817 | try {
818 | console.log(finalResult)
819 | aifskList[aifskList.length - 1] = {
820 | "content": finalResult,
821 | "role": "assistant",
822 | "nickname": "AI",
823 | "time": formatTime(),
824 | "isMe": false
825 | };
826 | GM_fillBotResponseAndSave(your_qus, finalResult);
827 | } catch (e) {
828 | console.log(e)
829 | }
830 | return;
831 | }
832 | try {
833 | let d = new TextDecoder("utf8").decode(new Uint8Array(value));
834 | console.log(d)
835 | result.push(d)
836 | GM_fillBotResponse(result.join(""))
837 | } catch (e) {
838 | console.log(e)
839 | }
840 | return reader.read().then(processText);
841 | });
842 | },
843 | responseType: "stream",
844 | onerror: function (err) {
845 | console.log(err)
846 | }
847 | });
848 |
849 | }
850 |
851 |
852 |
853 |
854 |
855 |
856 |
857 | //var promptboom_did = generateRandomString(32)
858 | let promptboom_did = 'dd633043916550bea93f56e1af08debd'
859 | let promptboom_token = ''
860 | let promptboom_url = ''
861 | let promptboom_version = '1.0'
862 | let messageChain10 = []
863 | async function PRTBOOM(question) {
864 | let your_qus = question;//你的问题
865 | GM_handleUserInput(null)
866 | addMessageChain(messageChain10, {role: "user", content: your_qus})//连续话
867 |
868 | const t = Date.now()
869 | const r = t + ":" + "question:" + promptboom_token
870 | const sign = CryptoJS.SHA256(r).toString();
871 | console.log(sign)
872 | let request_json = {
873 | 'did': promptboom_did ? promptboom_did : 'dd633043916550bea93f56e1af08debd',
874 | 'chatList': messageChain10,
875 | 'special': {
876 | 'time': t,
877 | 'sign': sign,
878 | 'referer':'https://www.promptboom.com/',
879 | 'path':'https://www.promptboom.com/'
880 | }
881 | };
882 | let raw_requst_json = {
883 | 'data': btoa(unescape(encodeURIComponent(JSON.stringify(request_json))))
884 | };
885 |
886 | console.log(raw_requst_json)
887 |
888 | GM_fetch({
889 | method: "POST",
890 | url: promptboom_url ? promptboom_url : 'https://api2.promptboom.com/cfdoctetstream',
891 | headers: {
892 | "Content-Type": "application/json",
893 | "version": promptboom_version,
894 | "origin": "https://www.promptboom.com",
895 | "Referer": "https://www.promptboom.com/",
896 | "accept": "*/*"
897 | },
898 | data: JSON.stringify(raw_requst_json),
899 | responseType: "stream"
900 | }).then((stream) => {
901 | GM_simulateBotResponse("请稍后...")
902 | let result = [];
903 | const reader = stream.response.getReader();
904 | reader.read().then(function processText({done, value}) {
905 | if (done) {
906 | let finalResult = result.join("")
907 | try {
908 | console.log(finalResult)
909 | addMessageChain(messageChain10, {
910 | role: "assistant",
911 | content: finalResult
912 | })
913 | GM_fillBotResponseAndSave(your_qus, finalResult)
914 | } catch (e) {
915 | console.log(e)
916 | }
917 | return;
918 | }
919 | try {
920 | let d = new TextDecoder("utf8").decode(new Uint8Array(value));
921 | result.push(d.replace(//gi,''))
922 | GM_fillBotResponse(result.join(""))
923 | } catch (e) {
924 | console.log(e)
925 | }
926 |
927 | return reader.read().then(processText);
928 | });
929 | },(reason)=>{
930 | console.log(reason)
931 | }).catch((ex)=>{
932 | console.log(ex)
933 | });
934 |
935 | /*let rootDomain = "promptboom.com";
936 |
937 | let apiList = [`https://api2.${rootDomain}/cfdoctetstream`, `https://api2.${rootDomain}/cfdoctetstream2`, `https://api2.${rootDomain}/cfdoctetstream3`]
938 | apiList.sort(() => Math.random() - 0.5);
939 | let apiListBackup = [`https://api2.${rootDomain}/cfdoctetstream4`, `https://api2.${rootDomain}/cfdoctetstream5`, `https://api2.${rootDomain}/cfdoctetstream6`]
940 |
941 | let finalApiList = apiList.concat(apiListBackup)
942 |
943 |
944 | for (let cfdoctetstream_url of finalApiList) {
945 | console.log(cfdoctetstream_url)
946 |
947 | break;
948 | }*/
949 |
950 |
951 |
952 | }
953 |
954 |
955 | async function ChatGO(question) {
956 | let your_qus = question;//你的问题
957 | GM_handleUserInput(null)
958 | let response = await GM_fetch({
959 | method: "GET",
960 | url: `https://gptgo.ai/action_get_token.php?q=${encodeURIComponent(your_qus)}&hlgpt=default`,
961 | headers: {
962 | "Referer": "https://gptgo.ai/?hl=zh",
963 | "origin": "https://gptgo.ai/",
964 | }
965 | });
966 | let resp = response.responseText;
967 | if(!resp){
968 | return ;
969 | }
970 | let tk = JSON.parse(resp).token;
971 | console.log("tk:",tk)
972 | GM_fetch({
973 | method: "GET",
974 | url: `https://gptgo.ai/action_ai_gpt.php?token=${tk}`,
975 | headers: {
976 | "Referer": "https://gptgo.ai/?hl=zh",
977 | "origin": "https://gptgo.ai/",
978 | "accept": "text/event-stream"
979 | },
980 | responseType:"stream"
981 | }).then((stream)=>{
982 | let result = []
983 | GM_simulateBotResponse("...")
984 | const reader = stream.response.getReader();
985 | reader.read().then(function processText({done, value}) {
986 | if (done) {
987 | GM_saveHistory(your_qus,result.join(""))
988 | return;
989 | }
990 | try {
991 | let d = new TextDecoder("utf8").decode(new Uint8Array(value));
992 | console.warn(d)
993 | d.split("\n").forEach(item=>{
994 | try {
995 | let chunk = JSON.parse(item.replace(/data:/,"").trim())
996 | .choices[0].delta.content;
997 | result.push(chunk)
998 | }catch (ex){
999 |
1000 | }
1001 | })
1002 | GM_fillBotResponse(result.join(""))
1003 |
1004 | } catch (e) {
1005 | console.log(e)
1006 | }
1007 |
1008 | return reader.read().then(processText);
1009 | });
1010 | },reason => {
1011 | console.log(reason)
1012 | }).catch((ex)=>{
1013 | console.log(ex)
1014 | })
1015 |
1016 |
1017 | }
1018 |
1019 |
1020 | async function MixerBox(question) {
1021 | let your_qus = question;//你的问题
1022 | GM_handleUserInput(null)
1023 | GM_fetch({
1024 | method: "POST",
1025 | url: `https://chatai.mixerbox.com/api/chat/stream`,
1026 | headers: {
1027 | "Referer": "https://chatai.mixerbox.com/chat",
1028 | "origin": "https://chatai.mixerbox.com",
1029 | "accept": "*/*",
1030 | "content-type": "application/json",
1031 | "user-agent": "Mozilla/5.0 (Android 12; Mobile; rv:107.0) Gecko/107.0 Firefox/107.0"
1032 | },
1033 | data:JSON.stringify({
1034 | "prompt": [
1035 | {
1036 | "role": "user",
1037 | "content": your_qus
1038 | }
1039 | ],
1040 | "lang": "zh",
1041 | "model": "gpt-3.5-turbo",
1042 | "plugins": [],
1043 | "pluginSets": [],
1044 | "getRecommendQuestions": true,
1045 | "isSummarize": false,
1046 | "webVersion": "1.4.5",
1047 | "userAgent": "Mozilla/5.0 (Android 12; Mobile; rv:107.0) Gecko/107.0 Firefox/107.0",
1048 | "isExtension": false
1049 | }),
1050 | responseType:"stream"
1051 | }).then((stream)=>{
1052 | let result = []
1053 | GM_simulateBotResponse("...")
1054 | const reader = stream.response.getReader();
1055 | reader.read().then(function processText({done, value}) {
1056 | if (done) {
1057 | GM_saveHistory(your_qus,result.join("").
1058 | replace(/\[space\]/gi," ").replace(/\[NEWLINE\]/gi,"\n"))
1059 | return;
1060 | }
1061 | try {
1062 | let d = new TextDecoder("utf8").decode(new Uint8Array(value));
1063 | console.warn(d)
1064 | d.split("\n").forEach(item=>{
1065 | try {
1066 | if(item.startsWith("data")){
1067 | result.push(item.replace(/data:/gi,""))
1068 | }
1069 | }catch (ex){
1070 |
1071 | }
1072 | })
1073 | GM_fillBotResponse(result.join("").
1074 | replace(/\[space\]/gi," ").replace(/\[NEWLINE\]/gi,"\n"))
1075 |
1076 | } catch (e) {
1077 | console.log(e)
1078 | }
1079 |
1080 | return reader.read().then(processText);
1081 | });
1082 | },reason => {
1083 | console.log(reason)
1084 | }).catch((ex)=>{
1085 | console.log(ex)
1086 | })
1087 |
1088 |
1089 | }
1090 |
1091 |
1092 | let parentID_thebai;
1093 |
1094 | function XJAI(question) {
1095 | let your_qus = question;//你的问题
1096 | GM_handleUserInput(null)
1097 | let ops = {};
1098 | if (parentID_thebai) {
1099 | ops = {parentMessageId: parentID_thebai};
1100 | }
1101 | console.log(ops)
1102 | GM_xmlhttpRequest({
1103 | method: "POST",
1104 | url: "https://p1api.xjai.pro/freeapi/chat-process",
1105 | headers: {
1106 | "Content-Type": "application/json",
1107 | "Referer": "https://f2.cnote.top/",
1108 | "accept": "application/json, text/plain, */*"
1109 | },
1110 | data: JSON.stringify({
1111 | "prompt": your_qus,
1112 | "options": ops,
1113 | "systemMessage": "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.",
1114 | "temperature": 0.8,
1115 | "top_p": 1
1116 | }),
1117 | onloadstart: (stream) => {
1118 | GM_simulateBotResponse("...")
1119 | const reader = stream.response.getReader();
1120 | let result = []
1121 | reader.read().then(function processText({done, value}) {
1122 | if (done) {
1123 | GM_fillBotResponse(result.join("").replace(/x-code.fun/gi,"")
1124 | .replace(/bilibili/gi,"").replace(/xjai/gi,"")
1125 | .replace(/ymiai/gi,"").replace(/aiflarepro/gi,"")
1126 | .split(/\.*?\&/gi)[2]
1127 | )
1128 |
1129 | GM_saveHistory(your_qus, result.join("").replace(/x-code.fun/gi,"")
1130 | .replace(/bilibili/gi,"").replace(/xjai/gi,"")
1131 | .replace(/ymiai/gi,"").replace(/aiflarepro/gi,"")
1132 | .split(/\.*?\&/gi)[2]
1133 | )
1134 | return;
1135 | }
1136 | try {
1137 | let byteArray = new Uint8Array(value);
1138 | let decoder = new TextDecoder('utf-8');
1139 | let d = decoder.decode(byteArray);
1140 | try {
1141 | let jsonObj = JSON.parse(d.trim())
1142 | if (jsonObj.id) {
1143 | parentID_thebai = jsonObj.id;
1144 | }
1145 | }catch (e) { }
1146 | console.log(d)
1147 | result.push(d)
1148 | GM_fillBotResponse(result.join("").replace(/x-code.fun/gi,"")
1149 | .replace(/bilibili/gi,"").replace(/xjai/gi,""))
1150 |
1151 |
1152 | } catch (e) {
1153 | console.error(e)
1154 | }
1155 |
1156 | return reader.read().then(processText);
1157 | });
1158 | },
1159 | responseType: "stream",
1160 | onerror: function (err) {
1161 | console.log(err)
1162 | Toast.error("未知错误!")
1163 | }
1164 | })
1165 | }
1166 |
1167 |
1168 | //https://s.aifree.site/
1169 | let messageChain_aifree = []
1170 | function AIFREE(question) {
1171 | let your_qus = question;//你的问题
1172 | GM_handleUserInput(null)
1173 | let now = Date.now();
1174 | let Baseurl = `https://am.aifree.site/`
1175 | generateSignatureWithPkey({
1176 | t:now,
1177 | m: your_qus || "",
1178 | pkey: {}.PUBLIC_SECRET_KEY || ""
1179 | }).then(sign => {
1180 | addMessageChain(messageChain_aifree, {role: "user", content: your_qus})//连续话
1181 | console.log(sign)
1182 | GM_fetch({
1183 | method: "POST",
1184 | url: Baseurl + "api/generate",
1185 | headers: {
1186 | "Content-Type": "text/plain;charset=UTF-8",
1187 | "Referer": Baseurl,
1188 | "X-Forwarded-For": generateRandomIP(),
1189 | "accept": "application/json, text/plain, */*"
1190 | },
1191 | data: JSON.stringify({
1192 | messages: messageChain_aifree,
1193 | time: now,
1194 | pass: null,
1195 | sign: sign
1196 | }),
1197 | responseType: "stream"
1198 | }).then((stream) => {
1199 | let result = [];
1200 | GM_simulateBotResponse("...")
1201 | const reader = stream.response.getReader();
1202 | reader.read().then(function processText({done, value}) {
1203 | if (done) {
1204 | let finalResult = result.join("")
1205 | try {
1206 | console.log(finalResult)
1207 | addMessageChain(messageChain_aifree, {
1208 | role: "assistant",
1209 | content: finalResult
1210 | })
1211 | GM_fillBotResponseAndSave(your_qus,finalResult)
1212 |
1213 | } catch (e) {
1214 | console.log(e)
1215 | }
1216 | return;
1217 | }
1218 | try {
1219 | let d = new TextDecoder("utf8").decode(new Uint8Array(value));
1220 | result.push(d)
1221 | GM_fillBotResponse(result.join(""))
1222 | } catch (e) {
1223 | console.log(e)
1224 | }
1225 |
1226 | return reader.read().then(processText);
1227 | });
1228 | },function (reason) {
1229 | console.log(reason)
1230 | Toast.error("未知错误!" + reason.message)
1231 |
1232 | }).catch((ex)=>{
1233 | console.log(ex)
1234 | Toast.error("未知错误!" + ex.message)
1235 | });
1236 |
1237 | });
1238 | }
1239 |
1240 |
1241 |
1242 |
1243 | //https://ai1.chagpt.fun/
1244 | function CVEOY(question) {
1245 | let your_qus = question;//你的问题
1246 | GM_handleUserInput(null)
1247 | let baseURL = "https://free-api.cveoy.top/";
1248 | GM_xmlhttpRequest({
1249 | method: "POST",
1250 | url: baseURL + "v3/completions",
1251 | headers: {
1252 | "Content-Type": "application/json",
1253 | "origin": "https://ai1.chagpt.fun",
1254 | "Referer": baseURL
1255 | },
1256 | data: JSON.stringify({
1257 | prompt: your_qus
1258 | }),
1259 | onloadstart: (stream) => {
1260 | let result = [];
1261 | GM_simulateBotResponse("请稍后...")
1262 | const reader = stream.response.getReader();
1263 | reader.read().then(function processText({done, value}) {
1264 | if (done) {
1265 |
1266 | try {
1267 | let finalResult = result.join("")
1268 | console.log(finalResult)
1269 | GM_fillBotResponseAndSave(your_qus, finalResult);
1270 | } catch (e) {
1271 | console.log(e)
1272 | }
1273 | return;
1274 | }
1275 | try {
1276 | let d = new TextDecoder("utf8").decode(new Uint8Array(value));
1277 | if(d.match(/wxgpt@qq.com/gi)){
1278 | d = d.replace(/wxgpt@qq.com/gi,"")
1279 | }
1280 | result.push(d);
1281 | console.log(d)
1282 | GM_fillBotResponse(result.join(""))
1283 | } catch (e) {
1284 | console.log(e)
1285 | }
1286 |
1287 | return reader.read().then(processText);
1288 | });
1289 | },
1290 | responseType: "stream",
1291 | onerror: function (err) {
1292 | console.log(err)
1293 | }
1294 | });
1295 |
1296 | }
1297 |
1298 |
1299 | async function delay(ms) {
1300 | return new Promise(resolve => setTimeout(resolve, ms));
1301 | }
1302 |
1303 |
1304 |
1305 |
1306 |
1307 |
1308 | var userId_yqcloud = "#/chat/" + Date.now();
1309 |
1310 | function YQCLOUD(question) {
1311 | let your_qus = question;//你的问题
1312 | GM_handleUserInput(null)
1313 | console.log(userId_yqcloud)
1314 | GM_fetch({
1315 | method: "POST",
1316 | url: "https://api.binjie.fun/api/generateStream",
1317 | headers: {
1318 | "Content-Type": "application/json",
1319 | "Referer": "https://chat18.aichatos8.com",
1320 | "origin": "https://chat18.aichatos8.com",
1321 | "X-Forwarded-For": generateRandomIP(),
1322 | "X-Real-IP": generateRandomIP(),
1323 | "accept": "application/json, text/plain, */*"
1324 | },
1325 | data: JSON.stringify({
1326 | prompt: your_qus,
1327 | apikey: "",
1328 | system: "",
1329 | withoutContext: false,
1330 | userId: userId_yqcloud,
1331 | network: true
1332 | }),
1333 | responseType: "stream"
1334 | }).then((stream) => {
1335 | let result = [];
1336 | GM_simulateBotResponse("...")
1337 | const reader = stream.response.getReader();
1338 | reader.read().then(function processText({done, value}) {
1339 | if (done) {
1340 | let finalResult = result.join("").replaceAll(/gptxyy/gi,"")
1341 | .replace(/aichatos/gi,"").replace(/https?:\/\/[^\s]+/g,"")
1342 | GM_fillBotResponseAndSave(your_qus, finalResult);
1343 | return;
1344 | }
1345 | let d = new TextDecoder("utf8").decode(new Uint8Array(value));
1346 | result.push(d)
1347 | try {
1348 | console.log(result.join(""))
1349 | GM_fillBotResponse(result.join("").
1350 | replaceAll(/gptxyy/gi,"")
1351 | .replace(/aichatos/gi,"")
1352 | .replace(/https?:\/\/[^\s]+/g,""))
1353 | } catch (e) {
1354 | console.log(e)
1355 | }
1356 | return reader.read().then(processText);
1357 | })
1358 | }, (reason)=> {
1359 | console.log(reason)
1360 | GM_fillBotResponse("error:", reason);
1361 | }
1362 | ).catch((ex)=>{
1363 | console.log(ex)
1364 | })
1365 |
1366 | }
1367 |
1368 |
1369 |
1370 | //狐猴内置 2023年5月12日
1371 | function LEMURCHAT(question) {
1372 | let your_qus = question;
1373 | GM_handleUserInput(null)
1374 | let baseURL = "http://lemurchat.anfans.cn/";
1375 | GM_fetch({
1376 | method: "POST",
1377 | url: baseURL + "api/chat/conversation-trial",
1378 | headers: {
1379 | "Content-Type": "application/json",
1380 | "User-Agent": "Mozilla/5.0 (Linux; Android 9; Redmi 4 Prime) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Mobile Safari/537.36"
1381 | },
1382 | data: `{"messages":"[{\\"content\\":\\"\\",\\"id\\":\\"LEMUR_AI_SYSTEM_SETTING\\",\\"isSensitive\\":false,\\"needCheck\\":false,\\"role\\":\\"system\\"},{\\"content\\":\\"${your_qus}\\",\\"isSensitive\\":false,\\"needCheck\\":true,\\"role\\":\\"user\\"}]"}`,
1383 | //data: `{"messages":"[{\\"content\\":\\"\\",\\"id\\":\\"LEMUR_AI_SYSTEM_SETTING\\",\\"isSensitive\\":false,\\"needCheck\\":false,\\"role\\":\\"system\\"},{\\"content\\":\\"你好\\",\\"isSensitive\\":false,\\"needCheck\\":true,\\"role\\":\\"user\\"}]"}`,
1384 | responseType: "stream"
1385 | }).then((stream)=>{
1386 | const reader = stream.response.getReader();
1387 | let result = [];
1388 | GM_simulateBotResponse("...")
1389 | reader.read().then(function processText({done, value}) {
1390 | if (done) {
1391 | GM_fillBotResponseAndSave(your_qus,result.join(""))
1392 | return;
1393 | }
1394 | try {
1395 | let d = new TextDecoder("utf8").decode(new Uint8Array(value));
1396 | console.log("raw:",d)
1397 | let dd = d.replace(/data: /g, "").split("\n\n")
1398 | console.log("dd:",dd)
1399 | dd.forEach(item=>{
1400 | try {
1401 | let delta = /content\\":\\"(.*?)\\"/gi.exec(item)[1]
1402 | result.push(delta.replace(/\\\\n/g,"\n"))
1403 | GM_fillBotResponse(result.join(""))
1404 | }catch (e) {
1405 |
1406 | }
1407 | })
1408 |
1409 | } catch (e) {
1410 | console.log(e)
1411 | }
1412 |
1413 | return reader.read().then(processText);
1414 | });
1415 | },function (err) {
1416 | console.log(err)
1417 | }).catch((ex)=>{
1418 | console.log(ex)
1419 | });
1420 |
1421 | }
1422 |
1423 |
1424 |
1425 |
1426 |
1427 | setTimeout(async () => {
1428 | let rr = await GM_fetch({
1429 | method: "GET",
1430 | url: `https://yeyu2048.xyz/chat/haohula.json?r=${Math.random()}`
1431 | });
1432 | if (rr.status === 200) {
1433 | console.log(rr)
1434 | let result = JSON.parse(rr.responseText);
1435 |
1436 | //AILS
1437 | ails_clientv = result.ails.clientv
1438 | ails_signKey = result.ails.signKey
1439 | console.log("ails_clientv:",ails_clientv)
1440 | console.log("ails_signKey:",ails_signKey)
1441 |
1442 |
1443 | //ptrboom
1444 | promptboom_did = result.ptrboom.did
1445 | promptboom_token = result.ptrboom.token
1446 | promptboom_url = result.ptrboom.url
1447 | promptboom_version = result.ptrboom.version
1448 | console.log("promptboom_did:",promptboom_did)
1449 | console.log("promptboom_url:",promptboom_url)
1450 | console.log("promptboom_version:",promptboom_version)
1451 |
1452 |
1453 | //pizaa
1454 | pizzaSecret = result.pizza.secret
1455 | console.log("pizzaSecret:",pizzaSecret)
1456 |
1457 |
1458 | } else {
1459 | console.error(rr)
1460 | }
1461 |
1462 | })
1463 |
1464 | function isTokenExpired(token) {
1465 | if(!token) return true
1466 | try {
1467 | const tokenData = JSON.parse(atob(token.split('.')[1]));
1468 |
1469 | if (!tokenData.exp) {
1470 | return false;
1471 | }
1472 |
1473 | const expirationTime = tokenData.exp * 1000; // Convert expiration time to milliseconds
1474 | const currentTime = new Date().getTime();
1475 |
1476 | if (currentTime > expirationTime) {
1477 | return true;
1478 | } else {
1479 | return false;
1480 | }
1481 | }catch (e) {
1482 | return false
1483 | }
1484 |
1485 | return true;
1486 | }
1487 |
1488 |
1489 |
1490 |
1491 |
1492 | //初始化
1493 | setTimeout(() => {
1494 |
1495 | // let aigckeybtn = document.createElement("button");
1496 | // aigckeybtn.innerText = "更新key"
1497 | // aigckeybtn.setAttribute("id", "aigckey")
1498 | // aigckeybtn.addEventListener("click", () => {
1499 | // getAIgcKey();
1500 | // });
1501 |
1502 | let aiJKbtn = document.createElement("button");
1503 | aiJKbtn.innerText = "插件接口"
1504 | aiJKbtn.setAttribute("id", "aiJKbtn")
1505 | aiJKbtn.addEventListener("click", () => {
1506 | // 获取