···44 "errors"
55 "fmt"
66 "os"
77+ "path/filepath"
78 "runtime"
89 "strings"
910 "time"
···2627 if err != nil {
2728 return errors.New("somehow your user doesn't exist? fairly sure this should never happen; plz report this to @krn on slack or via email at me@dunkirk.sh")
2829 }
2929- hackatime_path := user_dir + "/.wakatime.cfg"
3030+ hackatime_path := filepath.Join(user_dir, ".wakatime.cfg")
30313131- switch os_name {
3232- case "linux":
3333- case "darwin":
3434- case "windows":
3535- default:
3232+ if os_name != "linux" && os_name != "darwin" && os_name != "windows" {
3633 return errors.New("hmm you don't seem to be running a recognized os? you are listed as running " + styles.Fancy.Render(os_name) + "; can you plz report this to @krn on slack or via email at me@dunkirk.sh?")
3734 }
3835···6259 return errors.New("hmm 🤔 looks like you don't have an api_url in your config file? are you sure you have followed the setup instructions at " + styles.Muted.Render("https://hackatime.hackclub.com/my/wakatime_setup") + " correctly?")
6360 }
64616565- if api_url != "https://hackatime.hackclub.com/api/hackatime/v1" {
6262+ correctApiUrl := "https://hackatime.hackclub.com/api/hackatime/v1"
6363+ if api_url != correctApiUrl {
6664 if api_url == "https://api.wakatime.com/api/v1" {
6765 client := wakatime.NewClient(api_key)
6866 _, err := client.GetStatusBar()
···7371 return errors.New("turns out your config is connected to the wrong api url and is trying to use wakatime.com to sync time but you don't have a working api key from them. Go to " + styles.Muted.Render("https://hackatime.hackclub.com/my/wakatime_setup") + " to run the setup script and fix your config file")
7472 }
7573 }
7676- c.Println("\nYour api url", styles.Muted.Render(api_url), "doesn't match the expected url of", styles.Muted.Render("https://hackatime.hackclub.com/api/hackatime/v1"), "however if you are using a custom forwarder or are sure you know what you are doing then you are probably fine")
7474+ c.Println("\nYour api url", styles.Muted.Render(api_url), "doesn't match the expected url of", styles.Muted.Render(correctApiUrl), "however if you are using a custom forwarder or are sure you know what you are doing then you are probably fine")
7775 }
78767977 client := wakatime.NewClientWithOptions(api_key, api_url)
7878+ c.Println("\nChecking your coding stats for today...")
8079 duration, err := client.GetStatusBar()
8180 if err != nil {
8281 if errors.Is(err, wakatime.ErrUnauthorized) {
···109108 Branch: "main",
110109 Category: "coding",
111110 CursorPos: 1,
112112- Entity: user_dir + "/akami.txt",
111111+ Entity: filepath.Join(user_dir, "akami.txt"),
113112 Type: "file",
114113 IsWrite: true,
115114 Language: "Go",
···128127 return nil
129128 },
130129 }
131131-132130}