Skip to content

Commit

Permalink
Added OrangeMonkey + OrangeMonkey Pro support
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlui committed Jun 28, 2024
1 parent 9385cef commit e2a89ae
Show file tree
Hide file tree
Showing 30 changed files with 178 additions and 100 deletions.
3 changes: 2 additions & 1 deletion autoclear-chatgpt-history/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
1. Install a userscript manager:
- ScriptCat for [Chrome](https://chromewebstore.google.com/detail/scriptcat/ndcooeababalnlpkfedmmbbbgkljhpjf), [Firefox](https://addons.mozilla.org/firefox/addon/scriptcat/) or [Edge](https://microsoftedge.microsoft.com/addons/detail/scriptcat/liilgpjgabokdklappibcjfablkpcekh)
- Violentmonkey for [Chrome](https://chromewebstore.google.com/detail/violentmonkey/jinjaccalgkegednnccohejagnlnfdag), [Firefox](https://addons.mozilla.org/firefox/addon/violentmonkey/) or [Edge](https://microsoftedge.microsoft.com/addons/detail/eeagobfjdenkkddmbclomhiblgggliao)
- [OrangeMonkey](https://chromewebstore.google.com/detail/orangemonkey/ekmeppjgajofkpiofbebgcbohbmfldaf) or [OrangeMonkey Pro](https://chromewebstore.google.com/detail/orangemonkey-pro/ggdmdoodcfamjggeigifpjfnnjfbland) for Chrome
- or Tampermonkey for [Chrome](https://chromewebstore.google.com/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo), [Firefox](https://addons.mozilla.org/firefox/addon/tampermonkey/), [Edge](https://microsoftedge.microsoft.com/addons/detail/tampermonkey/iikmkjmpaadaobahmlepeloendndfphd) or [Opera](https://addons.opera.com/extensions/details/tampermonkey-beta/)

2. Install [Autoclear ChatGPT History](https://greasyfork.autoclearchatgpt.com) (will load in userscript manager installed above)
Expand Down Expand Up @@ -68,7 +69,7 @@ Autoclear ChatGPT History relies on code from the powerful <a href="https://gith

## 🌐 Compatibility

Autoclear ChatGPT History is compatible w/ the following browsers using [ScriptCat](https://docs.scriptcat.org), [Violentmonkey](https://violentmonkey.github.io) or [Tampermonkey](https://www.tampermonkey.net):
Autoclear ChatGPT History is compatible w/ the following browsers using [ScriptCat](https://docs.scriptcat.org), [Violentmonkey](https://violentmonkey.github.io), [OrangeMonkey](https://chromewebstore.google.com/detail/orangemonkey/ekmeppjgajofkpiofbebgcbohbmfldaf), [OrangeMonkey Pro](https://chromewebstore.google.com/detail/orangemonkey-pro/ggdmdoodcfamjggeigifpjfnnjfbland) or [Tampermonkey](https://www.tampermonkey.net):

- [Google Chrome](https://www.chrome.com)
- [Mozilla Firefox](https://www.firefox.com)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
// @description:zu Ziba itshala lokucabanga okuzoshintshwa ngokuzenzakalelayo uma ukubuka chatgpt.com
// @author Adam Lui
// @namespace https://github.com/adamlui
// @version 2024.6.27.1
// @version 2024.6.27.2
// @license MIT
// @icon https://media.autoclearchatgpt.com/images/icons/openai/black/icon48.png?a8868ef
// @icon64 https://media.autoclearchatgpt.com/images/icons/openai/black/icon64.png?a8868ef
Expand All @@ -248,6 +248,7 @@
// @grant GM_registerMenuCommand
// @grant GM_unregisterMenuCommand
// @grant GM_openInTab
// @grant GM_xmlhttpRequest
// @grant GM.xmlHttpRequest
// @noframes
// @downloadURL https://update.greasyfork.org/scripts/460805/autoclear-chatgpt-history.user.js
Expand Down Expand Up @@ -276,13 +277,16 @@
config.userLanguage = chatgpt.getUserLanguage()
loadSetting('autoclear', 'buttonHidden', 'notifDisabled', 'toggleHidden')

// Init FETCHER
const xhr = getUserscriptManager() == 'OrangeMonkey' ? GM_xmlhttpRequest : GM.xmlHttpRequest

// Define MESSAGES
let msgs = {};
let msgs = {}
const msgsLoaded = new Promise(resolve => {
const msgHostDir = config.assetHostURL + 'greasemonkey/_locales/',
msgLocaleDir = ( config.userLanguage ? config.userLanguage.replace('-', '_') : 'en' ) + '/'
let msgHref = msgHostDir + msgLocaleDir + 'messages.json', msgXHRtries = 0
GM.xmlHttpRequest({ method: 'GET', url: msgHref, onload: onLoad })
xhr({ method: 'GET', url: msgHref, onload: onLoad })
function onLoad(resp) {
try { // to return localized messages.json
const msgs = JSON.parse(resp.responseText), flatMsgs = {}
Expand All @@ -295,10 +299,10 @@
msgHref = config.userLanguage.includes('-') && msgXHRtries == 1 ? // if regional lang on 1st try...
msgHref.replace(/([^_]+_[^_]+)_[^/]*(\/.*)/, '$1$2') // ...strip region before retrying
: ( msgHostDir + 'en/messages.json' ) // else use default English messages
GM.xmlHttpRequest({ method: 'GET', url: msgHref, onload: onLoad })
xhr({ method: 'GET', url: msgHref, onload: onLoad })
}
}
}) ; if (!config.userLanguage.startsWith('en')) try { msgs = await msgsLoaded; } catch (err) {}
}) ; if (!config.userLanguage.startsWith('en')) try { msgs = await msgsLoaded } catch (err) {}

// Init MENU objs
const menuIDs = [] // to store registered cmds for removal while preserving order
Expand Down Expand Up @@ -424,7 +428,10 @@
menuIDs.push(GM_registerMenuCommand(amLabel, launchAboutModal))
}

function refreshMenu() { for (const id of menuIDs) { GM_unregisterMenuCommand(id) } registerMenu() }
function refreshMenu() {
if (getUserscriptManager() == 'OrangeMonkey') return
for (const id of menuIDs) { GM_unregisterMenuCommand(id) } registerMenu()
}

function launchAboutModal() {

Expand Down Expand Up @@ -478,7 +485,7 @@

// Fetch latest meta
const currentVer = GM_info.script.version
GM.xmlHttpRequest({
xhr({
method: 'GET', url: config.updateURL + '?t=' + Date.now(),
headers: { 'Cache-Control': 'no-cache' },
onload: response => { const updateAlertWidth = 377
Expand Down
3 changes: 2 additions & 1 deletion autoclear-chatgpt-history/greasemonkey/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
1. Install a userscript manager:
- ScriptCat for [Chrome](https://chromewebstore.google.com/detail/scriptcat/ndcooeababalnlpkfedmmbbbgkljhpjf), [Firefox](https://addons.mozilla.org/firefox/addon/scriptcat/) or [Edge](https://microsoftedge.microsoft.com/addons/detail/scriptcat/liilgpjgabokdklappibcjfablkpcekh)
- Violentmonkey for [Chrome](https://chromewebstore.google.com/detail/violentmonkey/jinjaccalgkegednnccohejagnlnfdag), [Firefox](https://addons.mozilla.org/firefox/addon/violentmonkey/) or [Edge](https://microsoftedge.microsoft.com/addons/detail/eeagobfjdenkkddmbclomhiblgggliao)
- [OrangeMonkey](https://chromewebstore.google.com/detail/orangemonkey/ekmeppjgajofkpiofbebgcbohbmfldaf) or [OrangeMonkey Pro](https://chromewebstore.google.com/detail/orangemonkey-pro/ggdmdoodcfamjggeigifpjfnnjfbland) for Chrome
- or Tampermonkey for [Chrome](https://chromewebstore.google.com/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo), [Firefox](https://addons.mozilla.org/firefox/addon/tampermonkey/), [Edge](https://microsoftedge.microsoft.com/addons/detail/tampermonkey/iikmkjmpaadaobahmlepeloendndfphd) or [Opera](https://addons.opera.com/extensions/details/tampermonkey-beta/)

2. Install [Autoclear ChatGPT History](https://greasyfork.autoclearchatgpt.com) (will load in userscript manager installed above)
Expand Down Expand Up @@ -68,7 +69,7 @@ Autoclear ChatGPT History relies on code from the powerful <a href="https://gith

## 🌐 Compatibility

Autoclear ChatGPT History is compatible w/ the following browsers using [ScriptCat](https://docs.scriptcat.org), [Violentmonkey](https://violentmonkey.github.io) or [Tampermonkey](https://www.tampermonkey.net):
Autoclear ChatGPT History is compatible w/ the following browsers using [ScriptCat](https://docs.scriptcat.org), [Violentmonkey](https://violentmonkey.github.io), [OrangeMonkey](https://chromewebstore.google.com/detail/orangemonkey/ekmeppjgajofkpiofbebgcbohbmfldaf), [OrangeMonkey Pro](https://chromewebstore.google.com/detail/orangemonkey-pro/ggdmdoodcfamjggeigifpjfnnjfbland) or [Tampermonkey](https://www.tampermonkey.net):

- [Google Chrome](https://www.chrome.com)
- [Mozilla Firefox](https://www.firefox.com)
Expand Down
9 changes: 5 additions & 4 deletions bravegpt/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@
1. Install a userscript manager:
- ScriptCat for [Chrome](https://chromewebstore.google.com/detail/scriptcat/ndcooeababalnlpkfedmmbbbgkljhpjf), [Firefox](https://addons.mozilla.org/firefox/addon/scriptcat/) or [Edge](https://microsoftedge.microsoft.com/addons/detail/scriptcat/liilgpjgabokdklappibcjfablkpcekh)
- Tampermonkey for [Chrome](https://chromewebstore.google.com/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo), [Firefox](https://addons.mozilla.org/firefox/addon/tampermonkey/), [Edge](https://microsoftedge.microsoft.com/addons/detail/tampermonkey/iikmkjmpaadaobahmlepeloendndfphd) or [Opera](https://addons.opera.com/extensions/details/tampermonkey-beta/)
- or Violentmonkey* for [Chrome](https://chromewebstore.google.com/detail/violentmonkey/jinjaccalgkegednnccohejagnlnfdag), [Firefox](https://addons.mozilla.org/firefox/addon/violentmonkey/) or [Edge](https://microsoftedge.microsoft.com/addons/detail/eeagobfjdenkkddmbclomhiblgggliao)
- Violentmonkey* for [Chrome](https://chromewebstore.google.com/detail/violentmonkey/jinjaccalgkegednnccohejagnlnfdag), [Firefox](https://addons.mozilla.org/firefox/addon/violentmonkey/) or [Edge](https://microsoftedge.microsoft.com/addons/detail/eeagobfjdenkkddmbclomhiblgggliao)
- [OrangeMonkey](https://chromewebstore.google.com/detail/orangemonkey/ekmeppjgajofkpiofbebgcbohbmfldaf)* or [OrangeMonkey Pro](https://chromewebstore.google.com/detail/orangemonkey-pro/ggdmdoodcfamjggeigifpjfnnjfbland)* for Chrome

2. Install [BraveGPT](https://greasyfork.org/scripts/462440-bravegpt) (will load in userscript manager installed above)

3. Visit [search.brave.com](https://search.brave.com), type your search, engage bot!

##### _*Violentmonkey does not support Streaming Mode, so is not recommended_
##### _*Violentmonkey, OrangeMonkey & OrangeMonkey Pro do not support Streaming Mode, so are not recommended_

<div align="center">

Expand All @@ -67,7 +68,7 @@ To do so, visit [chrome://extensions](chrome://extensions) > activate **Develope

## 🌐 Compatibility

**BraveGPT** is compatible w/ the following browsers using [ScriptCat](https://docs.scriptcat.org), [Tampermonkey](https://www.tampermonkey.net) or [Violentmonkey](https://violentmonkey.github.io)*.
**BraveGPT** is compatible w/ the following browsers using [ScriptCat](https://docs.scriptcat.org), [Tampermonkey](https://www.tampermonkey.net), [Violentmonkey](https://violentmonkey.github.io)\*, [OrangeMonkey](https://chromewebstore.google.com/detail/orangemonkey/ekmeppjgajofkpiofbebgcbohbmfldaf)* or [OrangeMonkey Pro](https://chromewebstore.google.com/detail/orangemonkey-pro/ggdmdoodcfamjggeigifpjfnnjfbland)*.

### 🖥️ Desktop

Expand All @@ -89,7 +90,7 @@ To do so, visit [chrome://extensions](chrome://extensions) > activate **Develope
- [Waterfox](https://play.google.com/store/apps/details?id=net.waterfox.android.release) (using [Tampermonkey](https://addons.mozilla.org/firefox/addon/tampermonkey/) or [Violentmonkey](https://addons.mozilla.org/en-US/firefox/addon/violentmonkey/)* for Firefox)
- [Mask Browser](https://play.google.com/store/apps/details?id=net.maskbrowser.browser) (using [Tampermonkey](https://microsoftedge.microsoft.com/addons/detail/tampermonkey/iikmkjmpaadaobahmlepeloendndfphd) for Edge ; ScriptCat for [Edge](https://microsoftedge.microsoft.com/addons/detail/scriptcat/liilgpjgabokdklappibcjfablkpcekh) or [Chrome](https://chromewebstore.google.com/detail/scriptcat/ndcooeababalnlpkfedmmbbbgkljhpjf) ; or Violentmonkey* for [Edge](https://microsoftedge.microsoft.com/addons/detail/eeagobfjdenkkddmbclomhiblgggliao) or [Chrome](https://chromewebstore.google.com/detail/violentmonkey/jinjaccalgkegednnccohejagnlnfdag))

##### _*Violentmonkey does not support Streaming Mode, so is not recommended_
##### _*Violentmonkey, OrangeMonkey & OrangeMonkey Pro do not support Streaming Mode, so are not recommended_

<br>

Expand Down
29 changes: 18 additions & 11 deletions bravegpt/greasemonkey/bravegpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
// @description:zu Yengeza izimpendulo ze-AI ku-Brave Search (inikwa amandla yi-GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2024.6.27.19
// @version 2024.6.27.20
// @license MIT
// @icon https://media.bravegpt.com/images/icons/bravegpt/icon48.png?0a9e287
// @icon64 https://media.bravegpt.com/images/icons/bravegpt/icon64.png?0a9e287
Expand Down Expand Up @@ -191,6 +191,7 @@
// @grant GM_registerMenuCommand
// @grant GM_unregisterMenuCommand
// @grant GM_getResourceText
// @grant GM_xmlhttpRequest
// @grant GM.xmlHttpRequest
// @noframes
// @downloadURL https://update.greasyfork.org/scripts/462440/bravegpt.user.js
Expand Down Expand Up @@ -242,6 +243,9 @@ setTimeout(async () => {
|| getUserscriptManager() == 'Tampermonkey' && (isChrome || isEdge || isBrave) // TM in browser that triggers STATUS_ACCESS_VIOLATION
) saveSetting('streamingDisabled', true)

// Init FETCHER
const xhr = getUserscriptManager() == 'OrangeMonkey' ? GM_xmlhttpRequest : GM.xmlHttpRequest

// Init API props
const openAIendpoints = { auth: 'https://auth0.openai.com', session: 'https://chatgpt.com/api/auth/session' }
const apis = {
Expand Down Expand Up @@ -270,7 +274,7 @@ setTimeout(async () => {
const msgHostDir = config.assetHostURL + 'greasemonkey/_locales/',
msgLocaleDir = ( config.userLanguage ? config.userLanguage.replace('-', '_') : 'en' ) + '/'
let msgHref = msgHostDir + msgLocaleDir + 'messages.json', msgXHRtries = 0
GM.xmlHttpRequest({ method: 'GET', url: msgHref, onload: onLoad })
xhr({ method: 'GET', url: msgHref, onload: onLoad })
function onLoad(resp) {
try { // to return localized messages.json
const msgs = JSON.parse(resp.responseText), flatMsgs = {}
Expand All @@ -283,10 +287,10 @@ setTimeout(async () => {
msgHref = config.userLanguage.includes('-') && msgXHRtries == 1 ? // if regional lang on 1st try...
msgHref.replace(/([^_]+_[^_]+)_[^/]*(\/.*)/, '$1$2') // ...strip region before retrying
: ( msgHostDir + 'en/messages.json' ) // else use default English messages
GM.xmlHttpRequest({ method: 'GET', url: msgHref, onload: onLoad })
xhr({ method: 'GET', url: msgHref, onload: onLoad })
}
}
}) ; if (!config.userLanguage.startsWith('en')) try { msgs = await msgsLoaded; } catch (err) {}
}) ; if (!config.userLanguage.startsWith('en')) try { msgs = await msgsLoaded } catch (err) {}

// Init SETTINGS props
const settingsProps = {
Expand Down Expand Up @@ -366,13 +370,16 @@ setTimeout(async () => {
break
}}}

function refreshMenu() { for (const id of menuIDs) { GM_unregisterMenuCommand(id) } registerMenu() }
function refreshMenu() {
if (getUserscriptManager() == 'OrangeMonkey') return
for (const id of menuIDs) { GM_unregisterMenuCommand(id) } registerMenu()
}

function updateCheck() {

// Fetch latest meta
const currentVer = GM_info.script.version
GM.xmlHttpRequest({
xhr({
method: 'GET', url: config.updateURL + '?t=' + Date.now(),
headers: { 'Cache-Control': 'no-cache' },
onload: resp => { const updateAlertWidth = 489
Expand Down Expand Up @@ -1556,7 +1563,7 @@ setTimeout(async () => {
const accessToken = GM_getValue(config.keyPrefix + '_openAItoken')
consoleInfo('OpenAI access token: ' + accessToken)
if (!accessToken) {
GM.xmlHttpRequest({ url: openAIendpoints.session, onload: resp => {
xhr({ url: openAIendpoints.session, onload: resp => {
if (isBlockedbyCloudflare(resp.responseText)) {
appAlert('checkCloudflare') ; return }
try {
Expand Down Expand Up @@ -1687,7 +1694,7 @@ setTimeout(async () => {
api.tryNew(get.reply, 'timeout') }, config.streamingDisabled ? 9000 : 6000)

// Get/show answer from ChatGPT
GM.xmlHttpRequest({
xhr({
method: apis[get.reply.api].method, url: apis[get.reply.api].endpoint,
responseType: config.streamingDisabled || !config.proxyAPIenabled ? 'text' : 'stream',
headers: api.createHeaders(get.reply.api), data: api.createPayload(get.reply.api, msgChain),
Expand All @@ -1711,7 +1718,7 @@ setTimeout(async () => {
},

json(url, callback) { // for dynamic footer
GM.xmlHttpRequest({ method: 'GET', url: url, onload: resp => {
xhr({ method: 'GET', url: url, onload: resp => {
if (resp.status >= 200 && resp.status < 300) {
try { const data = JSON.parse(resp.responseText) ; callback(null, data) }
catch (err) { callback(err, null) }
Expand Down Expand Up @@ -1749,7 +1756,7 @@ setTimeout(async () => {
+ ' But the key is variety. Do not be repetitive.'
+ ' You must entice user to want to ask one of your related queries.'
+ ` Reply in ${config.replyLanguage}`
GM.xmlHttpRequest({
xhr({
method: apis[get.related.api].method, url: apis[get.related.api].endpoint,
responseType: 'text', headers: api.createHeaders(get.related.api),
data: api.createPayload(get.related.api, [{ role: 'user', content: rqPrompt }]),
Expand Down Expand Up @@ -1999,7 +2006,7 @@ setTimeout(async () => {
iv = CryptoJS.enc.Utf8.parse(atob('AAAAAAAAAAAAAAAAAAAAAA==') || '76350b1840ff9832eb6244ac6d444366')
const securePayload = CryptoJS.AES.encrypt(JSON.stringify(payload), key, {
iv: iv, mode: CryptoJS.mode.CBC, pad: CryptoJS.pad.Pkcs7 }).toString()
GM.xmlHttpRequest({ // audio from Sogou TTS
xhr({ // audio from Sogou TTS
url: 'https://fanyi.sogou.com/openapi/external/getWebTTS?S-AppId=102356845&S-Param='
+ encodeURIComponent(securePayload),
method: 'GET', responseType: 'arraybuffer',
Expand Down
Loading

0 comments on commit e2a89ae

Please sign in to comment.