Diving-Fish / maimaidx-prober

舞萌 DX 查分器
https://www.diving-fish.com/maimaidx/prober
MIT License
681 stars 52 forks source link

Chore: update default config.json #99

Open Amia33 opened 12 months ago

Amia33 commented 12 months ago

TL;DR We should give some default value directly in the config.json generated for the first time to avoid problems

1 ERROR: Failed to parse response (but not fatal)

EDIT: This issue seems not persistent across platforms, so runtime reports are welcomed!

Multi-line json file will introduce error when running the software. (I use vscode's built-in feature for better reading experience.)

ERROR: Failed to parse response:
%!(EXTRA *json.UnmarshalTypeError=json: cannot unmarshal object into Go value of type []main.Tag)

However those scores can still be updated, so this is a low-priority issue.

2 Default value for addr seems not fine Resolved in v1.3.3

Following config works: ```json5 { "username": "some_username", "password": "some_password", "slice": true, "timeout": 120, "mai_diffs": [ "exp", "mas", "rem" ], "addr": "127.0.0.1:8033" //EDIT: ":8033" also works } ``` ``` INFO: 代理设置已自动修改。 INFO: 代理已开启到 127.0.0.1:8033 ``` While this config doesn't: ```json { "username": "some_username", "password": "some_password", "slice": true, "timeout": 120, "mai_diffs": [ "exp", "mas", "rem" ] } ``` ``` WARN: 自动修改代理设置失败。请尝试手动修改代理。 INFO: 代理已开启到 ``` Seems that default value for `addr` is not exist.
Diving-Fish commented 12 months ago

Can you post full json (without username and password) of Q1? It's working fine on my machine. Q2 will be fixed soon.

Amia33 commented 12 months ago

Can you post full json (without username and password) of Q1? It's working fine on my machine. Q2 will be fixed soon.

Same as the examples below. And I checked that shrinking the json into one single line works fine. However it still works and uploads score, so this is not really a problem.

Diving-Fish commented 12 months ago

On my machine, the program works normally with indented json.

%!(EXTRA *json.UnmarshalTypeError=json: cannot unmarshal object into Go value of type []main.Tag) This problem maybe occured because key of json is not paired with struct config. (or some encoding problem?)

Amia33 commented 12 months ago

Can you post full json (without username and password) of Q1? It's working fine on my machine. Q2 will be fixed soon.

Same as the examples below. And I checked that shrinking the json into one single line works fine. However it still works and uploads score, so this is not really a problem.

Update: This issue is NOT persistent across tests on my machine: To reproduce:

Diving-Fish commented 12 months ago

Can you post full json (without username and password) of Q1? It's working fine on my machine. Q2 will be fixed soon.

Same as the examples below. And I checked that shrinking the json into one single line works fine. However it still works and uploads score, so this is not really a problem.

Update: This issue is NOT persistent across tests on my machine: To reproduce:

  • Use fresh folder, write config with multi-line json and save it.
  • Open for the first time by double click // This triggers the issue
  • Close and repoen by double click // This test works fine
  • Close and reopen Using administrator mode // This triggers the issue again
  • Close and reopen Using administrator mode // This test works fine again

All tests are fine on my machine.

Amia33 commented 12 months ago

Can you post full json (without username and password) of Q1? It's working fine on my machine. Q2 will be fixed soon.

Same as the examples below. And I checked that shrinking the json into one single line works fine. However it still works and uploads score, so this is not really a problem.

Update: This issue is NOT persistent across tests on my machine: To reproduce:

  • Use fresh folder, write config with multi-line json and save it.
  • Open for the first time by double click // This triggers the issue
  • Close and repoen by double click // This test works fine
  • Close and reopen Using administrator mode // This triggers the issue again
  • Close and reopen Using administrator mode // This test works fine again

All tests are fine on my machine.

🤔 For Q1 let's wait for someone else to report if it works... It can be reproduced every time on my machine... I really don't want to open VMs since my work deals with them A LOT

btw is there some plan to update template config.json?

Amia33 commented 12 months ago

I confirm that Q2 is resolved in v1.3.3

For Q1: I'm not familiar with Golang, but from StackOverflow it seems related to property declaration. I think this might help. Time to learn Golang first

https://github.com/Diving-Fish/maimaidx-prober/blob/0c0acd165c532efff19079a125d78588d9f83b10/proxy/cmd/maimaidx-prober-proxy/check_update.go#L14