24 lines
712 B
JavaScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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(path.resolve(tmpPath, 'anonymous_token'))) {
fs.writeFileSync(path.resolve(tmpPath, 'anonymous_token'), '', 'utf-8')
}
// 启动时更新anonymous_tokenVercel 构建环境下跳过网络请求喵~
if (!process.env.VERCEL_ENV) {
const generateConfig = require('./generateConfig')
await generateConfig()
}
require('./server').serveNcmApi({
checkVersion: true,
})
}
start().catch((err) => {
console.error('[FATAL] 启动失败:', err)
process.exit(1)
})