mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-05-23 22:37:41 +08:00
fix: 修复vercel无文件创建权限问题 #1796
This commit is contained in:
parent
52c6021d89
commit
8c52f4de1b
@ -1,4 +1,7 @@
|
||||
# 更新日志
|
||||
### 4.11.2 | 2023.09.09
|
||||
- 修复`vercel`无文件创建权限问题
|
||||
|
||||
### 4.11.1 | 2023.09.08
|
||||
- `anonymous_token` 配置抽离
|
||||
|
||||
|
5
app.js
5
app.js
@ -1,11 +1,12 @@
|
||||
#!/usr/bin/env node
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const tmpPath = require('os').tmpdir()
|
||||
|
||||
async function start() {
|
||||
// 检测是否存在 anonymous_token 文件,没有则生成
|
||||
if (!fs.existsSync('./anonymous_token')) {
|
||||
fs.writeFileSync(path.resolve(__dirname, 'anonymous_token'), '', 'utf-8')
|
||||
if (!fs.existsSync(path.resolve(tmpPath, 'anonymous_token'))) {
|
||||
fs.writeFileSync(path.resolve(tmpPath, 'anonymous_token'), '', 'utf-8')
|
||||
}
|
||||
const generateConfig = require('./generateConfig')
|
||||
await generateConfig()
|
||||
|
@ -1,7 +1,9 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const { register_anonimous } = require('./main')
|
||||
const { cookieToJson } = require('./util/index')
|
||||
const path = require('path')
|
||||
|
||||
const tmpPath = require('os').tmpdir()
|
||||
async function generateConfig() {
|
||||
try {
|
||||
const res = await register_anonimous()
|
||||
@ -9,7 +11,7 @@ async function generateConfig() {
|
||||
if (cookie) {
|
||||
const cookieObj = cookieToJson(cookie)
|
||||
fs.writeFileSync(
|
||||
path.resolve(__dirname, 'anonymous_token'),
|
||||
path.resolve(tmpPath, 'anonymous_token'),
|
||||
cookieObj.MUSIC_A,
|
||||
'utf-8',
|
||||
)
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "NeteaseCloudMusicApi",
|
||||
"version": "4.11.1",
|
||||
"version": "4.11.2",
|
||||
"description": "网易云音乐 NodeJS 版 API",
|
||||
"scripts": {
|
||||
"start": "node app.js",
|
||||
|
@ -6,7 +6,12 @@ const http = require('http')
|
||||
const https = require('https')
|
||||
const tunnel = require('tunnel')
|
||||
const fs = require('fs')
|
||||
const anonymous_token = fs.readFileSync('./anonymous_token', 'utf-8')
|
||||
const path = require('path')
|
||||
const tmpPath = require('os').tmpdir()
|
||||
const anonymous_token = fs.readFileSync(
|
||||
path.resolve(tmpPath, './anonymous_token'),
|
||||
'utf-8',
|
||||
)
|
||||
console.log(anonymous_token)
|
||||
const { URLSearchParams, URL } = require('url')
|
||||
// request.debug = true // 开启可看到更详细信息
|
||||
|
Loading…
x
Reference in New Issue
Block a user