mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-18 06:17:06 +00:00
后台适配trss,更新web
This commit is contained in:
parent
adc2931351
commit
f3fb9aa0ee
31 changed files with 133 additions and 73 deletions
|
|
@ -50,6 +50,21 @@ async function routes(fastify, options) {
|
|||
reply.type('text/html').send(stream)
|
||||
return reply
|
||||
})
|
||||
fastify.get('/prompt/*', async (request, reply) => {
|
||||
const { raw } = request
|
||||
const newPath = raw.url.replace(/^\/prompt/, '')
|
||||
const response = await fetch(`https://chatgpt.roki.best${newPath}`,
|
||||
{
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'FROM-CHATGPT': 'ikechan8370'
|
||||
}
|
||||
})
|
||||
if (response.ok) {
|
||||
const data = await response.json()
|
||||
reply.send(data)
|
||||
} else reply.code(500).send(new Error('Api Server Error'))
|
||||
})
|
||||
fastify.setNotFoundHandler((request, reply) => {
|
||||
if (request.method == 'GET') {
|
||||
const stream = fs.createReadStream('plugins/chatgpt-plugin/server/static/index.html')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue