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

Commit 9f5028b

Browse files
authored
Merge pull request #135 from arrow2nd/develop
v2.2.3
2 parents 48df419 + f490920 commit 9f5028b

File tree

7 files changed

+37
-7
lines changed

7 files changed

+37
-7
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## [Unreleased]
44

5+
## [v2.2.3] - 2023-02-15
6+
7+
### Added
8+
9+
- API キーが使えなくなった場合のメッセージを追加
10+
511
## [v2.2.2] - 2023-02-01
612

713
### Fixed
@@ -208,7 +214,8 @@
208214

209215
- リリースしました! 😸
210216

211-
[unreleased]: https://github.com/arrow2nd/nekome/compare/v2.2.2...HEAD
217+
[unreleased]: https://github.com/arrow2nd/nekome/compare/v2.2.3...HEAD
218+
[v2.2.3]: https://github.com/arrow2nd/nekome/compare/v2.2.2...v2.2.3
212219
[v2.2.2]: https://github.com/arrow2nd/nekome/compare/v2.2.1...v2.2.2
213220
[v2.2.1]: https://github.com/arrow2nd/nekome/compare/v2.2.0...v2.2.1
214221
[v2.2.0]: https://github.com/arrow2nd/nekome/compare/v2.1.0...v2.2.0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
>
1515
> [Twitter API の無料プラン廃止](https://twitter.com/TwitterDev/status/1621026986784337922)にともない、nekome の開発は 2023/02/09 をもって終了しました。
1616
>
17-
> 組込みの API トークンは既に失効していますが、ご自身で API トークンを用意し、設定していただくことで引き続きご利用いただくことが可能です。
17+
> 組込みの API トークンは既に失効している可能性があります。その場合はご自身で API トークンを用意し、設定していただくことで引き続きご利用いただくことが可能です。
1818
> 設定個所については、[こちら](https://github.com/arrow2nd/nekome/blob/v2/docs/ja/config.md#credtoml) をご参照ください。
1919
2020
![nekome](https://user-images.githubusercontent.com/44780846/210126086-2be3feab-3ad9-41f5-9510-d28b947256f4.gif)

README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
>
1515
> 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.
1616
>
17-
> The built-in API token has already expired, but you can continue to use it by preparing and setting up your own API token.
17+
> 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.
1818
> Please refer to [this page](https://github.com/arrow2nd/nekome/blob/v2/docs/en/config.md#credtoml) for the setting locations.
1919
2020
![nekome](https://user-images.githubusercontent.com/44780846/210126086-2be3feab-3ad9-41f5-9510-d28b947256f4.gif)

api/error.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,20 @@ func checkError(err error) error {
2121
return err
2222
}
2323

24+
errText := fmt.Sprintf("%d %s | %s", tErr.StatusCode, tErr.Title, tErr.Detail)
25+
26+
// 認証
27+
if tErr.StatusCode == 401 || tErr.StatusCode == 402 || tErr.StatusCode == 403 {
28+
return fmt.Errorf("client error: %s (API key may no longer be available)", errText)
29+
}
30+
2431
// レート制限
2532
if tErr.StatusCode == 429 {
2633
t := tErr.RateLimit.Reset.Time().Local().Format("15:04:05")
2734
return fmt.Errorf("Rate limit exceeded (Reset time: %s)", t)
2835
}
2936

30-
return fmt.Errorf("server error: %d %s | %s", tErr.StatusCode, tErr.Title, tErr.Detail)
37+
return fmt.Errorf("server error: %s", errText)
3138
}
3239

3340
// checkPartialError : 部分エラーが無いかチェック

app/account.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
package app
22

3-
import "github.com/arrow2nd/nekome/v2/api"
3+
import (
4+
"fmt"
5+
"os"
6+
7+
"github.com/arrow2nd/nekome/v2/api"
8+
)
9+
10+
// printConsumerKeyWarn : コンシューマーキーに関する警告
11+
func printConsumerKeyWarn() {
12+
fmt.Fprintln(
13+
os.Stderr,
14+
`WARN: The built-in API key may have expired due to the Twitter API no longer being provided free of charge.
15+
See https://github.com/arrow2nd/nekome for details.`,
16+
)
17+
}
418

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

@@ -42,6 +57,5 @@ func loginAccount(u string) error {
4257
}
4358

4459
shared.api = api
45-
4660
return nil
4761
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ require (
2929
require (
3030
github.com/gdamore/tcell/v2 v2.5.4
3131
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
32-
github.com/rivo/tview v0.0.0-20230130130022-4a1b7a76c01c
32+
github.com/rivo/tview v0.0.0-20230208211350-7dfff1ce7854
3333
github.com/stretchr/testify v1.8.1
3434
golang.org/x/crypto v0.6.0
3535
golang.org/x/sync v0.1.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
3939
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
4040
github.com/rivo/tview v0.0.0-20230130130022-4a1b7a76c01c h1:zIYU4PjQJ4BnYryMmpyizt1Un13V0ToCMXvC05DK8xc=
4141
github.com/rivo/tview v0.0.0-20230130130022-4a1b7a76c01c/go.mod h1:lBUy/T5kyMudFzWUH/C2moN+NlU5qF505vzOyINXuUQ=
42+
github.com/rivo/tview v0.0.0-20230208211350-7dfff1ce7854 h1:/IIOjnKLbuO5YtZUZaJVw9fc062ChPlaGWEBmJ6jyGY=
43+
github.com/rivo/tview v0.0.0-20230208211350-7dfff1ce7854/go.mod h1:lBUy/T5kyMudFzWUH/C2moN+NlU5qF505vzOyINXuUQ=
4244
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
4345
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
4446
github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw=

0 commit comments

Comments
 (0)