kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
feat: improve nopecha key input
rodzic
814976c47f
commit
97f9c80403
|
@ -389,12 +389,6 @@ export async function initializeNopechaExtension(
|
||||||
await page.goto(`https://nopecha.com/setup#${nopechaKey}`)
|
await page.goto(`https://nopecha.com/setup#${nopechaKey}`)
|
||||||
await delay(1000)
|
await delay(1000)
|
||||||
try {
|
try {
|
||||||
const page3 = await browser.newPage()
|
|
||||||
if (minimize) {
|
|
||||||
await minimizePage(page3)
|
|
||||||
}
|
|
||||||
|
|
||||||
await page.close()
|
|
||||||
// find the nopecha extension ID
|
// find the nopecha extension ID
|
||||||
const targets = browser.targets()
|
const targets = browser.targets()
|
||||||
const extensionIds = (
|
const extensionIds = (
|
||||||
|
@ -417,19 +411,25 @@ export async function initializeNopechaExtension(
|
||||||
|
|
||||||
if (extensionId) {
|
if (extensionId) {
|
||||||
const extensionUrl = `chrome-extension://${extensionId}/popup.html`
|
const extensionUrl = `chrome-extension://${extensionId}/popup.html`
|
||||||
await page3.goto(extensionUrl, { waitUntil: 'networkidle2' })
|
await page.goto(extensionUrl, { waitUntil: 'networkidle2' })
|
||||||
const editKey = await page3.waitForSelector('#edit_key .clickable')
|
const editKey = await page.waitForSelector('#edit_key .clickable')
|
||||||
await editKey.click()
|
await editKey.click()
|
||||||
await delay(100)
|
|
||||||
|
|
||||||
for (let i = 0; i <= 30; i++) {
|
const settingsInput = await page.waitForSelector('input.settings_text')
|
||||||
await editKey.press('Backspace')
|
const value = await settingsInput.evaluate((el) => el.value)
|
||||||
|
|
||||||
|
if (value !== nopechaKey) {
|
||||||
|
for (let i = 0; i <= 30; i++) {
|
||||||
|
await settingsInput.press('Backspace')
|
||||||
|
}
|
||||||
|
|
||||||
|
await settingsInput.type(nopechaKey)
|
||||||
|
await settingsInput.press('Enter')
|
||||||
|
await delay(500)
|
||||||
|
await editKey.click()
|
||||||
|
await delay(2000)
|
||||||
}
|
}
|
||||||
|
|
||||||
await editKey.type(nopechaKey)
|
|
||||||
await delay(500)
|
|
||||||
await editKey.press('Enter')
|
|
||||||
await delay(2500)
|
|
||||||
console.log('initialized nopecha extension with key', nopechaKey)
|
console.log('initialized nopecha extension with key', nopechaKey)
|
||||||
} else {
|
} else {
|
||||||
console.error(
|
console.error(
|
||||||
|
|
File diff suppressed because one or more lines are too long
Ładowanie…
Reference in New Issue