Commit graph

180 commits

Author SHA1 Message Date
Waffle Maybe
b7eac69d66
remove version from changelog until it's released 2022-06-20 01:53:05 +04:00
Crax97
021372bd1b Update CHANGELOG.md to reflect latest bugfix 2022-06-19 23:35:41 +02:00
Maybe Waffle
0da3eec6de bump version 2022-06-16 23:06:09 +04:00
Maybe Waffle
987f594f95 Fix changelog format 2022-06-16 23:04:30 +04:00
Waffle Maybe
6f6e7a6678
Merge pull request #223 from teloxide/msg_url_impr
Improve url-to-message creation
2022-06-16 23:00:53 +04:00
Maybe Waffle
5053d419c3 Add functions to Message for creating urls 2022-06-16 22:55:11 +04:00
Maybe Waffle
3e6b39c48f Remove trailing / from Message::url 2022-06-16 22:53:03 +04:00
Maybe Waffle
ddaf78d891 Fix ChatPrivate serialization 2022-06-16 13:05:02 +04:00
Waffle Maybe
5e5b8e46a3
Merge pull request #217 from teloxide/message_entity_ref
Implement message entity parsing
2022-06-14 20:43:53 +04:00
Maybe Waffle
f91fcc0a2a Update changelog 2022-06-14 15:46:40 +04:00
Shihpin Tseng
71b0ae0487 add CHANGELOG for pr 225 2022-06-14 15:54:58 +08:00
Kezi
bcd24d2d53 Fix is_channel assert 2022-06-03 21:12:07 +02:00
Maybe Waffle
46cb2e7f41 Release teloxide-core v0.6.1 2022-06-02 21:15:44 +04:00
Waffle Maybe
5de6529b60
Merge pull request #220 from teloxide/fix_file_deserialization
Fix deserialization of `File`
2022-06-02 21:03:00 +04:00
Maybe Waffle
b03d9d864b Correct deserialization of NotFound and UserDeactivated errors 2022-06-02 20:49:58 +04:00
Maybe Waffle
851722e46c Fix deserialization of File when file_path or file_size are missing 2022-06-02 20:47:25 +04:00
Maybe Waffle
8b281ae50b Add is_* methods to ChatMemberStatus 2022-05-24 12:20:03 +04:00
Maybe Waffle
bc638efc98 Add ChatId and UserId to the prelude 2022-05-05 16:03:28 +04:00
Maybe Waffle
9dd296659b Dump version 2022-04-25 14:30:23 +04:00
Maybe Waffle
cb978b226e Fixup changelog 2022-04-25 14:25:35 +04:00
Sprite
6107d8bbdf Update changelog 2022-04-25 17:13:32 +08:00
Waffle Maybe
95f519073b
Merge pull request #208 from SpriteOvO/user-mention-shortcut
Add method `MessageEntity::user_mention`
2022-04-24 20:51:49 +04:00
Sprite
f5f1fa974f Update changelog 2022-04-24 08:20:26 +08:00
Hirrolot
1a12dd2388
Merge branch 'master' into tune-markups 2022-04-24 01:10:08 +06:00
Hirrolot
daa43e4dbf Revert "Fix indentation in CHANGELOG.md"
This reverts commit 1229d783e3.
2022-04-24 00:45:57 +06:00
Hirrolot
1229d783e3
Fix indentation in CHANGELOG.md 2022-04-24 00:44:21 +06:00
Hirrolot
9440609a3c Accept Into<String> in InlineKeyboardButton's methods 2022-04-24 00:02:28 +06:00
Hirrolot
012fb94044 Accept IntoIterator in KeyboardMarkup::append_row 2022-04-23 23:57:42 +06:00
Maybe Waffle
852feaeda4 Update changelog and stuff 2022-04-21 20:15:31 +04:00
Maybe Waffle
f98472d798 Release v0.5.1 2022-04-18 14:03:50 +04:00
Hirrolot
9ee3b90988 Update the changelog 2022-04-18 15:52:22 +06:00
Maybe Waffle
22c6330ba8 Prepare 0.5.0 release 2022-04-13 14:58:38 +04:00
Waffle Maybe
b294631121
Merge pull request #198 from teloxide/bare_id
Expose bare chat id
2022-04-13 14:00:57 +04:00
Waffle Maybe
4e35f6de31
Merge pull request #130 from teloxide/chrottle_retries_and_freeze
`Throttle` retries and freeze
2022-04-13 13:58:59 +04:00
Maybe Waffle
6318a7e730 Apply changes from the review
Make `BareChatId` internal.
2022-04-13 13:57:26 +04:00
Maybe Waffle
57a3731e6b Fix Message::url 2022-04-13 13:56:48 +04:00
Maybe Waffle
6ebdeb7f01 Expose bare chat id 2022-04-13 13:56:46 +04:00
Maybe Waffle
edb84691a2 Fix changelog formatting 2022-04-10 19:28:15 +04:00
Maybe Waffle
2477a0f945 Fix infinite loop in read_from_rx 2022-04-10 19:04:30 +04:00
Maybe Waffle
af0dd99ef4 Use Duration instead of u32 as the RetryAfter field 2022-04-10 18:48:00 +04:00
Maybe Waffle
43802a5c41 Improve Throttling adoptor
- Freeze when getting `RetryAfter(_)` error
- Retry requests that previously returned `RetryAfter(_)` error
2022-04-10 17:24:57 +04:00
Maybe Waffle
6a91c44836 make errors module pub and add errors::AsResponseParameters trait 2022-04-10 17:23:33 +04:00
Maybe Waffle
51d6800a32 Make RequestError::RetryAfter::0 u32, instead of i32
(you can't really wait a negative amount of time, can you?)
2022-04-10 17:22:20 +04:00
Maybe Waffle
213db7b64c Add AllowedUpdate::ChatJoinRequest 2022-04-08 15:57:16 +04:00
Waffle Maybe
ac08117216
Merge pull request #197 from teloxide/convenience_user_and_me_methods
Add some convenience methods to `User` and `Me`
2022-04-04 03:35:07 +04:00
Waffle Maybe
d1cf0e4f52
Merge branch 'master' into hide_token_in_errors 2022-04-03 16:14:34 +04:00
Maybe Waffle
daec5ee13e Hide bot token in errors
This fixes a potential[^1] security vulnerability -- if bot shows errors
from teloxide to the user & for some reason network error happened[^2]
the url of the request would be included in the error. Since TBA
includes bot token in the error this may lead to token leakage.

This commit fixes that issue by removing the token from the urls of
`reqwest::Error`, we try to only replace the token, but if we fail we
remove the whole url.

This can be tested by using a very low timeout value for the http
reqwest client:
```rust
let client = reqwest::Client::builder()
    .timeout(std::time::Duration::from_millis(1))
    .build()
    .unwrap();

let bot = Bot::from_env_with_client(client).auto_send();

// see if the token is redacted when network error (timeout) happens
// while sending common requests
let _ = dbg!(bot.get_me().await);

// see if the token is redacted when network error (timeout) happens
// while downloading files ("path" is unimportant as the timeout is so
// low the request probably won't even be sent)
let _ = dbg!(bot.download_file_stream("path").next().await);
```

For me this gives the following result:
```text
[t.rs:26] bot.get_me().await = Err(
    Network(
        reqwest::Error {
            kind: Request,
            url: Url {
                scheme: "https",
                cannot_be_a_base: false,
                username: "",
                password: None,
                host: Some(
                    Domain(
                        "api.telegram.org",
                    ),
                ),
                port: None,
                path: "/token:redacted/GetMe",
                query: None,
                fragment: None,
            },
            source: TimedOut,
        },
    ),
)
[t.rs:31] bot.download_file_stream("path").next().await = Some(
    Err(
        reqwest::Error {
            kind: Request,
            url: Url {
                scheme: "https",
                cannot_be_a_base: false,
                username: "",
                password: None,
                host: Some(
                    Domain(
                        "api.telegram.org",
                    ),
                ),
                port: None,
                path: "/file/token:redacted/path",
                query: None,
                fragment: None,
            },
            source: TimedOut,
        },
    ),
)
```

Note that this commits parent is `d0be260` and not the current master
the master branch currently contains breaking changes (we'll need to
make a release from this brach directly).

[^1]: Note that there are recorded cases where the token got exposed.
[^2]: Note that this can be theoretically be controlled by the user when
      sending/downloading bigger files.
2022-04-03 13:34:17 +04:00
Maybe Waffle
b3c0d00b7d "override" mention and tme_url on Me
That's not **really** an override, but by adding an inherent methods
we "hide" methods from `Deref<Target = User>`, that allows us to return
non-option types from `me.mention()` and `me.tme_url()` -- bots must
always have usernames.
2022-04-02 22:56:32 +04:00
Maybe Waffle
df9ffe8918 Add Me::username and Deref<Target = User> impl for Me 2022-04-02 22:43:55 +04:00
Maybe Waffle
55f753a201 Add User::{tme_url, preferably_tme_url} functions 2022-04-02 21:09:34 +04:00