From cadc507fad2fee59b23d1d8e73c472c077f468fc Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Sat, 18 Nov 2023 04:38:31 +0100 Subject: Add AiChatOnline, ChatgptDemoAi, ChatgptNext Providers Add OnlineGpt and TalkAi Provider Add get_random_string and get_random_hex helper Remove funcaptcha package --- .../@fastify/busboy/lib/utils/Decoder.js | 54 -------------- .../@fastify/busboy/lib/utils/basename.js | 14 ---- .../@fastify/busboy/lib/utils/decodeText.js | 26 ------- .../@fastify/busboy/lib/utils/getLimit.js | 16 ---- .../@fastify/busboy/lib/utils/parseParams.js | 87 ---------------------- 5 files changed, 197 deletions(-) delete mode 100644 g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/Decoder.js delete mode 100644 g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/basename.js delete mode 100644 g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/decodeText.js delete mode 100644 g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/getLimit.js delete mode 100644 g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/parseParams.js (limited to 'g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils') diff --git a/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/Decoder.js b/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/Decoder.js deleted file mode 100644 index 7917678c..00000000 --- a/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/Decoder.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict' - -const RE_PLUS = /\+/g - -const HEX = [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -] - -function Decoder () { - this.buffer = undefined -} -Decoder.prototype.write = function (str) { - // Replace '+' with ' ' before decoding - str = str.replace(RE_PLUS, ' ') - let res = '' - let i = 0; let p = 0; const len = str.length - for (; i < len; ++i) { - if (this.buffer !== undefined) { - if (!HEX[str.charCodeAt(i)]) { - res += '%' + this.buffer - this.buffer = undefined - --i // retry character - } else { - this.buffer += str[i] - ++p - if (this.buffer.length === 2) { - res += String.fromCharCode(parseInt(this.buffer, 16)) - this.buffer = undefined - } - } - } else if (str[i] === '%') { - if (i > p) { - res += str.substring(p, i) - p = i - } - this.buffer = '' - ++p - } - } - if (p < len && this.buffer === undefined) { res += str.substring(p) } - return res -} -Decoder.prototype.reset = function () { - this.buffer = undefined -} - -module.exports = Decoder diff --git a/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/basename.js b/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/basename.js deleted file mode 100644 index db588199..00000000 --- a/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/basename.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict' - -module.exports = function basename (path) { - if (typeof path !== 'string') { return '' } - for (var i = path.length - 1; i >= 0; --i) { // eslint-disable-line no-var - switch (path.charCodeAt(i)) { - case 0x2F: // '/' - case 0x5C: // '\' - path = path.slice(i + 1) - return (path === '..' || path === '.' ? '' : path) - } - } - return (path === '..' || path === '.' ? '' : path) -} diff --git a/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/decodeText.js b/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/decodeText.js deleted file mode 100644 index ee376062..00000000 --- a/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/decodeText.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict' - -// Node has always utf-8 -const utf8Decoder = new TextDecoder('utf-8') -const textDecoders = new Map([ - ['utf-8', utf8Decoder], - ['utf8', utf8Decoder] -]) - -function decodeText (text, textEncoding, destEncoding) { - if (text) { - if (textDecoders.has(destEncoding)) { - try { - return textDecoders.get(destEncoding).decode(Buffer.from(text, textEncoding)) - } catch (e) { } - } else { - try { - textDecoders.set(destEncoding, new TextDecoder(destEncoding)) - return textDecoders.get(destEncoding).decode(Buffer.from(text, textEncoding)) - } catch (e) { } - } - } - return text -} - -module.exports = decodeText diff --git a/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/getLimit.js b/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/getLimit.js deleted file mode 100644 index cb64fd67..00000000 --- a/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/getLimit.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict' - -module.exports = function getLimit (limits, name, defaultLimit) { - if ( - !limits || - limits[name] === undefined || - limits[name] === null - ) { return defaultLimit } - - if ( - typeof limits[name] !== 'number' || - isNaN(limits[name]) - ) { throw new TypeError('Limit ' + name + ' is not a valid number') } - - return limits[name] -} diff --git a/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/parseParams.js b/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/parseParams.js deleted file mode 100644 index f9214180..00000000 --- a/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/parseParams.js +++ /dev/null @@ -1,87 +0,0 @@ -'use strict' - -const decodeText = require('./decodeText') - -const RE_ENCODED = /%([a-fA-F0-9]{2})/g - -function encodedReplacer (match, byte) { - return String.fromCharCode(parseInt(byte, 16)) -} - -function parseParams (str) { - const res = [] - let state = 'key' - let charset = '' - let inquote = false - let escaping = false - let p = 0 - let tmp = '' - - for (var i = 0, len = str.length; i < len; ++i) { // eslint-disable-line no-var - const char = str[i] - if (char === '\\' && inquote) { - if (escaping) { escaping = false } else { - escaping = true - continue - } - } else if (char === '"') { - if (!escaping) { - if (inquote) { - inquote = false - state = 'key' - } else { inquote = true } - continue - } else { escaping = false } - } else { - if (escaping && inquote) { tmp += '\\' } - escaping = false - if ((state === 'charset' || state === 'lang') && char === "'") { - if (state === 'charset') { - state = 'lang' - charset = tmp.substring(1) - } else { state = 'value' } - tmp = '' - continue - } else if (state === 'key' && - (char === '*' || char === '=') && - res.length) { - if (char === '*') { state = 'charset' } else { state = 'value' } - res[p] = [tmp, undefined] - tmp = '' - continue - } else if (!inquote && char === ';') { - state = 'key' - if (charset) { - if (tmp.length) { - tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer), - 'binary', - charset) - } - charset = '' - } else if (tmp.length) { - tmp = decodeText(tmp, 'binary', 'utf8') - } - if (res[p] === undefined) { res[p] = tmp } else { res[p][1] = tmp } - tmp = '' - ++p - continue - } else if (!inquote && (char === ' ' || char === '\t')) { continue } - } - tmp += char - } - if (charset && tmp.length) { - tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer), - 'binary', - charset) - } else if (tmp) { - tmp = decodeText(tmp, 'binary', 'utf8') - } - - if (res[p] === undefined) { - if (tmp) { res[p] = tmp } - } else { res[p][1] = tmp } - - return res -} - -module.exports = parseParams -- cgit v1.2.3