Skip to content

Commit 6d30b06

Browse files
Use the config for Dashboard URL
Previously, the "Dashboard" button will always send users to https://wakatime.com, regardless of the `api_url` that they use. This can cause problems, especially when and if you're using a 3rd party Wakatime server, such as Hakatime.
1 parent fdad357 commit 6d30b06

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

WakaTime/AppDelegate.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, StatusBarDelegate, UNUserNot
107107
}
108108

109109
@objc func dashboardClicked(_ sender: AnyObject) {
110-
if let url = URL(string: "https://wakatime.com/") {
110+
guard let urlString = ConfigFile.getSetting(section: "settings", key: "api_url") else {
111+
Logging.default.log("No `api_url` was set in the config!")
112+
return
113+
}
114+
115+
if let url = URL(string: urlString) {
116+
// When you go to the `api_url`, it redirects to the dashboard.
111117
NSWorkspace.shared.open(url)
112118
}
113119
}

0 commit comments

Comments
 (0)