feat: 支持GitHub Actions和一堆其他更新

This commit is contained in:
qier222 2022-04-02 19:29:43 +08:00
parent f5ab5ea754
commit e748155032
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
28 changed files with 185 additions and 36 deletions

View file

@ -14,6 +14,7 @@ import path from 'path'
logger.info('[server] starting http server')
const isDev = process.env.NODE_ENV === 'development'
const isProd = process.env.NODE_ENV === 'production'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const neteaseApi = require('NeteaseCloudMusicApi') as (params: any) => any[]
@ -87,14 +88,14 @@ app.post('/yesplaymusic/audio/:id', async (req: Request, res: Response) => {
}
})
if (!isDev) {
app.use(express.static(path.join(__dirname, '../renderer')))
if (isProd) {
app.use('/', express.static(path.join(__dirname, '../renderer/')))
}
const port = Number(
isDev
? process.env.ELECTRON_DEV_NETEASE_API_PORT ?? 3000
: process.env.ELECTRON_WEB_SERVER_PORT ?? 42710
isProd
? process.env.ELECTRON_WEB_SERVER_PORT ?? 42710
: process.env.ELECTRON_DEV_NETEASE_API_PORT ?? 3000
)
app.listen(port, () => {
logger.info(`[server] API server listening on port ${port}`)