mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 13:57:10 +00:00
feat: add support for Claude and Poe(WIP)
This commit is contained in:
parent
a3a16bc5ff
commit
7ef6051da8
38 changed files with 882 additions and 19 deletions
40
utils/poe/credential.js
Normal file
40
utils/poe/credential.js
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import fetch from 'node-fetch'
|
||||
import { readFileSync, writeFile } from 'fs'
|
||||
|
||||
const scrape = async (pbCookie) => {
|
||||
const _setting = await fetch(
|
||||
'https://poe.com/api/settings',
|
||||
{ headers: { cookie: `${pbCookie}` } }
|
||||
)
|
||||
if (_setting.status !== 200) throw new Error('Failed to fetch token')
|
||||
const appSettings = await _setting.json()
|
||||
console.log(appSettings)
|
||||
const { tchannelData: { channel: channelName } } = appSettings
|
||||
return {
|
||||
channelName,
|
||||
appSettings,
|
||||
formKey: appSettings.formKey
|
||||
}
|
||||
}
|
||||
|
||||
const getUpdatedSettings = async (channelName, pbCookie) => {
|
||||
const _setting = await fetch(
|
||||
`https://poe.com/api/settings?channel=${channelName}`,
|
||||
{ headers: { cookie: `${pbCookie}` } }
|
||||
)
|
||||
if (_setting.status !== 200) throw new Error('Failed to fetch token')
|
||||
const appSettings = await _setting.json()
|
||||
const { tchannelData: { minSeq } } = appSettings
|
||||
const credentials = JSON.parse(readFileSync('config.json', 'utf8'))
|
||||
credentials.app_settings.tchannelData.minSeq = minSeq
|
||||
writeFile('config.json', JSON.stringify(credentials, null, 4), function (err) {
|
||||
if (err) {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
return {
|
||||
minSeq
|
||||
}
|
||||
}
|
||||
|
||||
export { scrape, getUpdatedSettings }
|
||||
Loading…
Add table
Add a link
Reference in a new issue