From 3def8e4eee5fa11c8b9869c24c35d2697a4dc074 Mon Sep 17 00:00:00 2001 From: Shin'ya Minazuki Date: Thu, 22 Jan 2026 12:26:57 -0300 Subject: [PATCH] Update go-writefreely to v1.4.0 As it was a breaking change, all the code using it has been modified accordingly. That also means less lines of code for doing the same thing, too. Signed-off-by: Shin'ya Minazuki --- delete.go | 4 +--- go.mod | 3 +-- go.sum | 6 ++---- login.go | 3 +-- logout.go | 4 +--- post.go | 3 +-- update.go | 3 +-- 7 files changed, 8 insertions(+), 18 deletions(-) diff --git a/delete.go b/delete.go index 2f55ea8..e312f3d 100644 --- a/delete.go +++ b/delete.go @@ -28,9 +28,7 @@ func init() { } func DoDelete(id string, args []string) { - writefreely.InstanceURL = Config.Host - - c := writefreely.NewClient() + c := writefreely.NewClient(Config.Host) c.SetToken(Config.Token) err := c.DeletePost(&writefreely.PostParams{ diff --git a/go.mod b/go.mod index a23835f..8e6e483 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module code.laidback.moe/yuki go 1.25.2 require ( - code.laidback.moe/go-writefreely v1.3.2 + code.laidback.moe/go-writefreely v1.4.0 github.com/spf13/cobra v1.10.2 github.com/tj/go-editor v1.0.0 golang.org/x/term v0.39.0 @@ -11,7 +11,6 @@ require ( ) require ( - code.as/core/socks v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/pkg/errors v0.8.1 // indirect github.com/spf13/pflag v1.0.9 // indirect diff --git a/go.sum b/go.sum index de7d56a..a8e2781 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,5 @@ -code.as/core/socks v1.0.0 h1:SPQXNp4SbEwjOAP9VzUahLHak8SDqy5n+9cm9tpjZOs= -code.as/core/socks v1.0.0/go.mod h1:BAXBy5O9s2gmw6UxLqNJcVbWY7C/UPs+801CcSsfWOY= -code.laidback.moe/go-writefreely v1.3.2 h1:NXB81Vfs6Iklc659p6iwPNJD6kdRpCHUgxCTNF4T1B0= -code.laidback.moe/go-writefreely v1.3.2/go.mod h1:wt1ofi/PFoZ/rFFY08wfGRf8WROEpFxc1ueMgzMlrL8= +code.laidback.moe/go-writefreely v1.4.0 h1:4CAdwtwJwThx4Twd0AFL9whhiaeBZ1CJyjaJna7o9Vk= +code.laidback.moe/go-writefreely v1.4.0/go.mod h1:bUe8yGQYpUIR8cMAthkTQSRCDIILTuNUhUxcOxbV1zs= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/login.go b/login.go index c89eba8..30edcf5 100644 --- a/login.go +++ b/login.go @@ -30,9 +30,8 @@ func init() { // and authenticates to the instance. func DoLogin(args []string) { var user, pass string - writefreely.InstanceURL = Config.Host - c := writefreely.NewClient() + c := writefreely.NewClient(Config.Host) reader := bufio.NewReader(os.Stdin) diff --git a/logout.go b/logout.go index 62b1a74..0f526b8 100644 --- a/logout.go +++ b/logout.go @@ -21,9 +21,7 @@ func init() { } func DoLogout(args []string) { - writefreely.InstanceURL = Config.Host - - c := writefreely.NewClient() + c := writefreely.NewClient(Config.Host) c.SetToken(Config.Token) err := c.Logout() diff --git a/post.go b/post.go index 9e53bf5..34c63f8 100644 --- a/post.go +++ b/post.go @@ -50,7 +50,6 @@ func init() { } func DoPost(collection, font, lang string, rtl bool, title string, args []string) { - writefreely.InstanceURL = Config.Host var err error var w *writefreely.Post @@ -66,7 +65,7 @@ func DoPost(collection, font, lang string, rtl bool, title string, args []string post := string(data) - c := writefreely.NewClient() + c := writefreely.NewClient(Config.Host) c.SetToken(Config.Token) if len(collection) == 0 { diff --git a/update.go b/update.go index 709c7d1..2539d52 100644 --- a/update.go +++ b/update.go @@ -54,7 +54,6 @@ func init() { } func DoUpdate(id, collection, font, lang string, rtl bool, title string, args []string) { - writefreely.InstanceURL = Config.Host var err error var w *writefreely.Post @@ -70,7 +69,7 @@ func DoUpdate(id, collection, font, lang string, rtl bool, title string, args [] post := string(data) - c := writefreely.NewClient() + c := writefreely.NewClient(Config.Host) c.SetToken(Config.Token) if len(collection) == 0 {