wakatime / jetbrains-wakatime

IntelliJ IDEA, PyCharm, RubyMine, PhpStorm, AppCode, AndroidStudio, Goland, Rider, & WebStorm plugin for quantifying your coding.
https://wakatime.com/intellij-idea
BSD 3-Clause "New" or "Revised" License
1.12k stars 162 forks source link

SOCKS5 proxy server error #273

Closed KamikotoTkach closed 5 months ago

KamikotoTkach commented 6 months ago

When using a SOCKS5 proxy:

proxy = socks5://127.0.0.1:2080

When I run the IDEA with a missing wakatime-internal.cfg file, everything works, but the next run after that (when this file is already created) gives an error:

java.lang.Throwable: Proxy string must follow https://user:pass@host:port format: socks5://127.0.0.1:2080
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
    at com.wakatime.intellij.plugin.Dependencies.setupProxy(Dependencies.java:428)
    at com.wakatime.intellij.plugin.Dependencies.getUrlAsString(Dependencies.java:331)
    at com.wakatime.intellij.plugin.Dependencies.latestCliVersion(Dependencies.java:145)
    at com.wakatime.intellij.plugin.Dependencies.isCLIOld(Dependencies.java:134)
    at com.wakatime.intellij.plugin.WakaTime$1.run(WakaTime.java:110)
    at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:249)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    at java.base/java.lang.Thread.run(Thread.java:840)

The plugin, despite the error, seems to be working correctly:

{"caller":"cmd/run.go:99","func":"cmd.Run","level":"debug","message":"command: version","now":"2024-01-10T22:22:16+03:00","os/arch":"windows/amd64","version":"v1.88.1"}
{"caller":"cmd/run.go:117","func":"cmd.Run","level":"debug","message":"command: today","now":"2024-01-10T22:22:59+03:00","os/arch":"windows/amd64","version":"v1.88.1"}
{"caller":"cmd/today/today.go:30","func":"today.Run","level":"debug","message":"successfully fetched today for status bar","now":"2024-01-10T22:23:02+03:00","os/arch":"windows/amd64","version":"v1.88.1"}
alanhamlett commented 5 months ago

Fixed with fb9500ada7fbd7e1a8802f29423dee83755ba2f2 because Java.net.URL can only parse http urls, so needed to use Java.net.URI.