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 <shinyoukai@laidback.moe>
This commit is contained in:
2026-01-22 12:26:57 -03:00
parent 29cb126ed7
commit 3def8e4eee
7 changed files with 8 additions and 18 deletions

View File

@@ -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{

3
go.mod
View File

@@ -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

6
go.sum
View File

@@ -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=

View File

@@ -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)

View File

@@ -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()

View File

@@ -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 {

View File

@@ -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 {