You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
701 B
25 lines
701 B
const fs = require('fs')
|
|
const { register_anonimous } = require('./main')
|
|
const { cookieToJson } = require('./util/index')
|
|
const config = require('./util/config.json')
|
|
const path = require('path')
|
|
async function generateConfig() {
|
|
try {
|
|
const res = await register_anonimous()
|
|
const cookie = res.body.cookie
|
|
if (cookie) {
|
|
const cookieObj = cookieToJson(cookie)
|
|
let newConfig = { ...config }
|
|
newConfig.anonymous_token = cookieObj.MUSIC_A
|
|
fs.writeFileSync(
|
|
path.resolve(__dirname, 'util/config.json'),
|
|
JSON.stringify(newConfig, null, 2),
|
|
'utf-8',
|
|
)
|
|
}
|
|
} catch (error) {
|
|
console.log(error)
|
|
}
|
|
}
|
|
module.exports = generateConfig
|