Skip to content

Commit

Permalink
feat: 🎸 Update createConversation's bundleVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
haozi committed Oct 18, 2023
1 parent 65b285f commit 1b73212
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.5
20.6
6 changes: 3 additions & 3 deletions dist/chromium/app/assets/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/chromium/background.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/chromium/content_script.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/chromium/inject.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/chromium/manifest.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new-bing-anywhere",
"version": "2.4.6",
"version": "2.4.8",
"private": true,
"description": "New Bing isn't just for Edge anymore. Anywhere you want",
"homepage": "https://github.com/ha0z1/New-Bing-Anywhere",
Expand Down Expand Up @@ -57,8 +57,8 @@
"vite-node": "^0.34.3"
},
"engines": {
"node": "^20.3.0",
"pnpm": "^8.6.3"
"node": "^20.6.1",
"pnpm": "^8.8.0"
},
"extension-i18n": {
"en": {
Expand Down
2 changes: 1 addition & 1 deletion src/app/src/apis/_bing/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ let id = 0
const uid = () => ++id

export const bingChatCreateSession = async (): Promise<Bing.Session> => {
const API = 'https://www.bing.com/turing/conversation/create?bundleVersion=1.864.15'
const API = 'https://www.bing.com/turing/conversation/create?bundleVersion=1.1055.9'
try {
const xhr = await fetch(API, {
headers: {
Expand Down
2 changes: 1 addition & 1 deletion src/app/src/pages/Popup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default () => {
<hr className={s.hr} />
<footer className={s.footer}>
<a
href="#"
href="#/options"
onClick={(e) => {
e.preventDefault()
window.open(`${AIPLUS}?invite_code=b90e84b5`)
Expand Down
29 changes: 28 additions & 1 deletion src/background/listeners/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getURL, version } from '@@/utils'
import { getURL, isBrave, version } from '@@/utils'
import { bingChatCloseWebSocket, bingChatPing /*, getFromConversation as bingGetFromConversation */ } from './_bing'
import { getNotification, hideNotification } from './_notification'

Expand Down Expand Up @@ -57,6 +57,33 @@ export default {
getNotification,
hideNotification,

// runtimeReload: () => {
// chrome.runtime.reload()
// },
// ...(() => {
// const KEY = '@NBA://braveReload'

// return {
// getBraveReloadTmp: async () => {
// const val: boolean = (await chrome.storage.session.get(KEY))[KEY] ?? false
// return val
// },

// setBraveReloadTmp: async (val: boolean) => {
// await chrome.storage.session.set({ [KEY]: val })
// },

// getBraveReload: async () => {
// const val: boolean = (await chrome.storage.local.get(KEY))[KEY] ?? false
// return val
// },

// setBraveReload: async (val: boolean) => {
// await chrome.storage.local.set({ [KEY]: val })
// }
// }
// })(),

// 'bing.getFromConversation': bingGetFromConversation,
'bing.bingChatPing': bingChatPing,
'bing.bingChatCloseWebSocket': bingChatCloseWebSocket
Expand Down
43 changes: 41 additions & 2 deletions src/content_script/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { callBackground, checkIsGoogle, getConfig, getURL, isChinese } from '@@/utils'
import { callBackground, checkIsGoogle, getConfig, getURL, isBrave, isChinese } from '@@/utils'
import $ from 'jquery'
import { extensionName } from '../../package.json'
import bingHandler from './bing-handler'
Expand Down Expand Up @@ -29,6 +29,45 @@ import googleHandler from './google-handler'
googleHandler()
}

// if (isBrave) {
// const val = await callBackground('getBraveReload')
// const tmpVal = await callBackground('getBraveReloadTmp')

// console.log(111111, val, tmpVal)
// if (val) {
// callBackground('setBraveReloadTmp', [true])
// }
// console.log(2222222, await callBackground('getBraveReload'), await callBackground('getBraveReloadTmp'))
// if (!tmpVal) {
// callBackground('setBraveReload', [false])
// }

// if (val === 2) {
// await callBackground('setBraveReload', [true])
// await callBackground('setBraveReloadTmp', [true])
// }

// console.log(3333333, await callBackground('getBraveReload'), await callBackground('getBraveReloadTmp'))
// if (!val && !tmpVal) {
// console.log(44444444, val, tmpVal)
// callBackground('setBraveReload', [2])
// await callBackground('runtimeReload')
// }

// console.log(5555555, await callBackground('getBraveReload'), await callBackground('getBraveReloadTmp'))
// if (!tmpVal) {
// callBackground('setBraveReload', [false])
// }

// if (!val) {
// callBackground('setBraveReloadTmp', [false])
// }

// if (!val && !tmpVal) {
// await callBackground('setBraveReload', [true])
// }
// }

if (isChinese) {
if (location.hostname.endsWith('aiplus.lol')) {
$(document).on('click', 'a', (e) => {
Expand All @@ -37,7 +76,7 @@ import googleHandler from './google-handler'
const url = getURL(href)
const { hostname, pathname, searchParams } = url

if (hostname === 'aiplus.lol' && pathname === '/') {
if (hostname === 'ai.aiplus.lol' && pathname === '/') {
searchParams.set('inVitecode', 'WPYDMSUVIP')
url.search = searchParams.toString()
const newUrl = url.toString()
Expand Down

0 comments on commit 1b73212

Please sign in to comment.