Skip to content

Commit 98c08fb

Browse files
anupammeclaude
andcommitted
fix: preserve optional login behavior for V-001
Replace throw-on-missing credential pattern with direct env var reads so undefined cleanly represents "not configured" instead of crashing the app at startup when muserId/mtoken are absent. Update downstream guards in androidURL.js and updateData.js to truthy checks that handle both undefined and empty string. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
1 parent 703e64f commit 98c08fb

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// 用户id
2-
const userId = process.env.muserId || (() => { throw new Error("Environment variable muserId is required") })()
2+
const userId = process.env.muserId
33
// 用户token 可以使用网页登录获取
4-
const token = process.env.mtoken || (() => { throw new Error("Environment variable mtoken is required") })()
4+
const token = process.env.mtoken
55
// 本地运行端口号
66
const port = process.env.mport || 1234
77
// 公网/自定义访问地址

utils/androidURL.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async function getAndroidURL(userId, token, pid, rateType) {
5555
headers["appCode"] = "miguvideo_default_android"
5656
}
5757

58-
if (rateType != 2 && userId != "" && token != "") {
58+
if (rateType != 2 && userId && token) {
5959
headers.UserId = userId
6060
headers.UserToken = token
6161
}

utils/updateData.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ async function update(hours) {
217217

218218
if (!(hours % 720)) {
219219
// 每720小时(一个月)刷新token
220-
if (userId != "" && token != "") {
220+
if (userId && token) {
221221
if (mrefreshToken) {
222222
await refreshToken(userId, token) ? printGreen("token刷新成功") : printRed("token刷新失败")
223223
} else {

0 commit comments

Comments
 (0)