mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 13:57:10 +00:00
fix: poe添加proxy支持
This commit is contained in:
parent
63f8629037
commit
1a94d92943
3 changed files with 43 additions and 33 deletions
|
|
@ -1,10 +1,14 @@
|
|||
import fetch from 'node-fetch'
|
||||
import { readFileSync, writeFile } from 'fs'
|
||||
|
||||
const scrape = async (pbCookie) => {
|
||||
const scrape = async (pbCookie, proxy) => {
|
||||
let option = { headers: { cookie: `${pbCookie}` } }
|
||||
if (proxy) {
|
||||
option.proxy = proxy
|
||||
}
|
||||
const _setting = await fetch(
|
||||
'https://poe.com/api/settings',
|
||||
{ headers: { cookie: `${pbCookie}` } }
|
||||
option
|
||||
)
|
||||
if (_setting.status !== 200) throw new Error('Failed to fetch token')
|
||||
const appSettings = await _setting.json()
|
||||
|
|
@ -17,10 +21,14 @@ const scrape = async (pbCookie) => {
|
|||
}
|
||||
}
|
||||
|
||||
const getUpdatedSettings = async (channelName, pbCookie) => {
|
||||
const getUpdatedSettings = async (channelName, pbCookie, proxy) => {
|
||||
let option = { headers: { cookie: `${pbCookie}` } }
|
||||
if (proxy) {
|
||||
option.proxy = proxy
|
||||
}
|
||||
const _setting = await fetch(
|
||||
`https://poe.com/api/settings?channel=${channelName}`,
|
||||
{ headers: { cookie: `${pbCookie}` } }
|
||||
option
|
||||
)
|
||||
if (_setting.status !== 200) throw new Error('Failed to fetch token')
|
||||
const appSettings = await _setting.json()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue