Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Commit 9ec8c4e

Browse files
author
ZeroWolf233
committed
fix: 略加修改,并进行测试,结果没毛病
1 parent 96a6c8b commit 9ec8c4e

5 files changed

Lines changed: 6 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ OpenMCIM是对外开放的,所有需要 Minecraft Mod 资源的启动器均可
3131
| SKIP_SYNC || false | 强制跳过所有同步(不推荐) |
3232
| SKIP_GC || false | 跳过GC垃圾自动回收(由 **千时雨** 提供) |
3333
| THREADS || 由主控分配 | 同步线程(改太高会被banban) |
34+
| UA || openmcim-cluster/${version} | 获取token和同步的UA |
3435

3536
### 如果你在源码中发现了其他环境变量, 那么它们是为了方便开发而存在的, 可能会随时修改, 不要在生产环境中使用!
3637

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openmcim",
3-
"version": "1.1.3",
3+
"version": "1.1.4",
44
"description": "mcim@home",
55
"bin": "dist/openmcim.js",
66
"private": true,

src/cluster.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export class Cluster {
8181
this.host = config.clusterIp
8282
this._port = config.port
8383
this.publicPort = config.clusterPublicPort ?? config.port
84-
this.ua = `openmcim-cluster/${version}`
84+
this.ua = process.env.UA ?? `openmcim-cluster/${version}`
8585
whiteListDomain.push(this.prefixUrl)
8686
this.got = got.extend({
8787
prefixUrl: this.prefixUrl,
@@ -188,7 +188,7 @@ export class Cluster {
188188
})
189189
const totalBar = multibar.create(missingFiles.length, 0, {filename: '总文件数'})
190190
const parallel = Number(process.env.THREADS) ?? syncConfig.concurrency
191-
logger.info('您当前的下载线程:' + {parallel})
191+
logger.info(`您当前的下载线程: ${parallel} `)
192192
let hasError = false
193193
await pMap(
194194
missingFiles,

src/token.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class TokenManager {
1818
this.got = got.extend({
1919
prefixUrl: this.prefixUrl,
2020
headers: {
21-
'user-agent': `openmcim-cluster/${version}`,
21+
'user-agent': process.env.UA ?? 'openmcim-cluster/${version}',
2222
},
2323
timeout: {
2424
request: ms('5m'),

0 commit comments

Comments
 (0)