Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #135 from arrow2nd/develop
Browse files Browse the repository at this point in the history
v2.2.3
  • Loading branch information
arrow2nd authored Feb 15, 2023
2 parents 48df419 + f490920 commit 9f5028b
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 7 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [Unreleased]

## [v2.2.3] - 2023-02-15

### Added

- API キーが使えなくなった場合のメッセージを追加

## [v2.2.2] - 2023-02-01

### Fixed
Expand Down Expand Up @@ -208,7 +214,8 @@

- リリースしました! 😸

[unreleased]: https://github.com/arrow2nd/nekome/compare/v2.2.2...HEAD
[unreleased]: https://github.com/arrow2nd/nekome/compare/v2.2.3...HEAD
[v2.2.3]: https://github.com/arrow2nd/nekome/compare/v2.2.2...v2.2.3
[v2.2.2]: https://github.com/arrow2nd/nekome/compare/v2.2.1...v2.2.2
[v2.2.1]: https://github.com/arrow2nd/nekome/compare/v2.2.0...v2.2.1
[v2.2.0]: https://github.com/arrow2nd/nekome/compare/v2.1.0...v2.2.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
>
> [Twitter API の無料プラン廃止](https://twitter.com/TwitterDev/status/1621026986784337922)にともない、nekome の開発は 2023/02/09 をもって終了しました。
>
> 組込みの API トークンは既に失効していますが、ご自身で API トークンを用意し、設定していただくことで引き続きご利用いただくことが可能です。
> 組込みの API トークンは既に失効している可能性があります。その場合はご自身で API トークンを用意し、設定していただくことで引き続きご利用いただくことが可能です。
> 設定個所については、[こちら](https://github.com/arrow2nd/nekome/blob/v2/docs/ja/config.md#credtoml) をご参照ください。
![nekome](https://user-images.githubusercontent.com/44780846/210126086-2be3feab-3ad9-41f5-9510-d28b947256f4.gif)
Expand Down
2 changes: 1 addition & 1 deletion README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
>
> Due to the [Discontinuation of the free Twitter API plan](https://twitter.com/TwitterDev/status/1621026986784337922), the development of nekome will end on 2023/02/09.
>
> The built-in API token has already expired, but you can continue to use it by preparing and setting up your own API token.
> The built-in API token may have already expired. In that case, you can continue to use the API by preparing and setting up your own API token.
> Please refer to [this page](https://github.com/arrow2nd/nekome/blob/v2/docs/en/config.md#credtoml) for the setting locations.
![nekome](https://user-images.githubusercontent.com/44780846/210126086-2be3feab-3ad9-41f5-9510-d28b947256f4.gif)
Expand Down
9 changes: 8 additions & 1 deletion api/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,20 @@ func checkError(err error) error {
return err
}

errText := fmt.Sprintf("%d %s | %s", tErr.StatusCode, tErr.Title, tErr.Detail)

// 認証
if tErr.StatusCode == 401 || tErr.StatusCode == 402 || tErr.StatusCode == 403 {
return fmt.Errorf("client error: %s (API key may no longer be available)", errText)
}

// レート制限
if tErr.StatusCode == 429 {
t := tErr.RateLimit.Reset.Time().Local().Format("15:04:05")
return fmt.Errorf("Rate limit exceeded (Reset time: %s)", t)
}

return fmt.Errorf("server error: %d %s | %s", tErr.StatusCode, tErr.Title, tErr.Detail)
return fmt.Errorf("server error: %s", errText)
}

// checkPartialError : 部分エラーが無いかチェック
Expand Down
18 changes: 16 additions & 2 deletions app/account.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
package app

import "github.com/arrow2nd/nekome/v2/api"
import (
"fmt"
"os"

"github.com/arrow2nd/nekome/v2/api"
)

// printConsumerKeyWarn : コンシューマーキーに関する警告
func printConsumerKeyWarn() {
fmt.Fprintln(
os.Stderr,
`WARN: The built-in API key may have expired due to the Twitter API no longer being provided free of charge.
See https://github.com/arrow2nd/nekome for details.`,
)
}

// addAccount : アカウントを追加
func addAccount(setMain bool) error {
authUser, err := shared.api.Auth(&shared.conf.Cred.Consumer)
if err != nil {
printConsumerKeyWarn()
return err
}

Expand Down Expand Up @@ -42,6 +57,5 @@ func loginAccount(u string) error {
}

shared.api = api

return nil
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ require (
require (
github.com/gdamore/tcell/v2 v2.5.4
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
github.com/rivo/tview v0.0.0-20230130130022-4a1b7a76c01c
github.com/rivo/tview v0.0.0-20230208211350-7dfff1ce7854
github.com/stretchr/testify v1.8.1
golang.org/x/crypto v0.6.0
golang.org/x/sync v0.1.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/tview v0.0.0-20230130130022-4a1b7a76c01c h1:zIYU4PjQJ4BnYryMmpyizt1Un13V0ToCMXvC05DK8xc=
github.com/rivo/tview v0.0.0-20230130130022-4a1b7a76c01c/go.mod h1:lBUy/T5kyMudFzWUH/C2moN+NlU5qF505vzOyINXuUQ=
github.com/rivo/tview v0.0.0-20230208211350-7dfff1ce7854 h1:/IIOjnKLbuO5YtZUZaJVw9fc062ChPlaGWEBmJ6jyGY=
github.com/rivo/tview v0.0.0-20230208211350-7dfff1ce7854/go.mod h1:lBUy/T5kyMudFzWUH/C2moN+NlU5qF505vzOyINXuUQ=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw=
Expand Down

0 comments on commit 9f5028b

Please sign in to comment.