mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-18 06:07:48 +00:00
feat: updates
This commit is contained in:
parent
c6c59b2cd9
commit
7ce516877e
63 changed files with 6591 additions and 1107 deletions
|
|
@ -14,6 +14,7 @@ import { appName, isProd } from './env'
|
|||
import { APIs } from '@/shared/CacheAPIs'
|
||||
import history from 'connect-history-api-fallback'
|
||||
import { db, Tables } from './db'
|
||||
import axios from 'axios'
|
||||
|
||||
class Server {
|
||||
port = Number(
|
||||
|
|
@ -30,12 +31,32 @@ class Server {
|
|||
this.app.use(cookieParser())
|
||||
this.app.use(fileUpload())
|
||||
this.getAudioUrlHandler()
|
||||
this.r3playApiHandler()
|
||||
this.neteaseHandler()
|
||||
this.cacheAudioHandler()
|
||||
this.serveStaticForProduction()
|
||||
this.listen()
|
||||
}
|
||||
|
||||
r3playApiHandler() {
|
||||
this.app.get(`/r3play/apple-music/:endpoint`, async (req: Request, res: Response) => {
|
||||
log.debug(`[server] Handling request: ${req.path}`)
|
||||
const { endpoint } = req.params
|
||||
const { query } = req
|
||||
axios
|
||||
.get(`https://r3play.app/r3play/apple-music/${endpoint}`, {
|
||||
params: query,
|
||||
})
|
||||
.then(response => {
|
||||
console.log(response.data)
|
||||
res.send(response.data)
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
neteaseHandler() {
|
||||
Object.entries(this.netease).forEach(([name, handler]: [string, any]) => {
|
||||
// 例外处理
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue