mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 13:48:02 +00:00
feat: updates
This commit is contained in:
parent
c6c59b2cd9
commit
7ce516877e
63 changed files with 6591 additions and 1107 deletions
31
packages/desktop/main/appServer/appServer.ts
Normal file
31
packages/desktop/main/appServer/appServer.ts
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import fastify from 'fastify'
|
||||
import fastifyStatic from '@fastify/static'
|
||||
import path from 'path'
|
||||
import fastifyCookie from '@fastify/cookie'
|
||||
import { isProd } from '../env'
|
||||
import log from '../log'
|
||||
import netease from './routes/netease'
|
||||
import appleMusic from './routes/r3play/appleMusic'
|
||||
|
||||
const server = fastify({
|
||||
ignoreTrailingSlash: true,
|
||||
})
|
||||
|
||||
server.register(fastifyCookie)
|
||||
if (isProd) {
|
||||
server.register(fastifyStatic, {
|
||||
root: path.join(__dirname, '../web'),
|
||||
})
|
||||
}
|
||||
|
||||
server.register(netease, { prefix: '/netease' })
|
||||
server.register(appleMusic)
|
||||
|
||||
const port = Number(
|
||||
isProd
|
||||
? process.env.ELECTRON_WEB_SERVER_PORT || 42710
|
||||
: process.env.ELECTRON_DEV_NETEASE_API_PORT || 30001
|
||||
)
|
||||
server.listen({ port })
|
||||
|
||||
log.info(`[appServer] http server listening on port ${port}`)
|
||||
Loading…
Add table
Add a link
Reference in a new issue