Fix token retrieval

Signed-off-by: Shin'ya Minazuki <shinyoukai@laidback.moe>
This commit is contained in:
2025-12-30 00:37:25 -03:00
parent cf64d9038f
commit 57a2914fe3

View File

@@ -3,6 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"os" "os"
"strings"
"syscall" "syscall"
"golang.org/x/term" "golang.org/x/term"
@@ -16,12 +17,12 @@ var (
) )
func init() { func init() {
xdg_config_home, err := os.UserConfigDir() config, err := os.UserConfigDir()
if err != nil { if err != nil {
fmt.Println("Unable to obtain user's configuration directory") fmt.Println("Unable to obtain user's configuration directory")
os.Exit(1) os.Exit(1)
} }
configPath := xdg_config_home + "/mikuru.ini" configPath := config + "/mikuru.ini"
mikuru.Parse(configPath) mikuru.Parse(configPath)
} }
@@ -59,9 +60,11 @@ func signin(cli *client.Client) {
os.Exit(1) os.Exit(1)
} }
token := strings.Trim(fmt.Sprintf(res.Token), "{}")
fmt.Println("Login successful") fmt.Println("Login successful")
fmt.Println("Place this token in your configuration file for later use") fmt.Println("Place this token in your configuration file for later use")
fmt.Println("Do not share it with anyone, it's classified information") fmt.Println("Do not share it with anyone, it's classified information")
fmt.Println("Trim surrounding braces before usage") fmt.Printf("token = %v\n", token)
fmt.Printf("token = %v\n", res)
} }