Skip to content

Commit fc727a5

Browse files
Merge pull request #60 from southbridgeio/develop
Develop
2 parents 3d08b7f + f06be2b commit fc727a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+447
-1105
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 0.5.0
2+
3+
* Use supergroup chats
4+
* Refactor telegram commands
5+
* Support persistent commands
6+
* Update tdlib, remove proxy support
7+
18
# 0.4.1
29

310
* Fix tdlib proxy

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ gem 'sidekiq-rate-limiter', '0.1.3', require: 'sidekiq-rate-limiter/server'
55
gem 'telegram-bot-ruby', '>= 0.11', '< 1.0'
66
gem 'slack-ruby-bot'
77
gem 'celluloid-io'
8-
gem 'tdlib-ruby', '2.2.0'
8+
gem 'tdlib-ruby', '3.0.2'
9+
gem 'tdlib-schema', '~> 1.7.0'
910
gem 'jwt'
1011
gem 'filelock'
1112
gem 'patron'

README.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,6 @@ Telegram support includes:
2828
* Common client commands that utilize [tdlib-ruby](https://github.com/centosadmin/tdlib-ruby)
2929
* [Telegram Login](https://core.telegram.org/widgets/login) to connect Redmine and Telegram accounts
3030

31-
32-
### Proxy
33-
34-
You can set proxy pool on plugin settings page. Proxies are gonna be monitored for availability, and first working proxy will be taken for every request.
35-
36-
Proxy format is same to curl:
37-
38-
```bash
39-
http://user:password@127.0.0.1:3128
40-
socks5://user:password@127.0.0.1:9050
41-
```
42-
43-
Only SOCKS5 and HTTP proxies are supported.
44-
Note that tdlib supports only SOCKS5 proxies, so you should add at least one SOCKS5 proxy if you want tdlib to be proxied.
45-
4631
### Tdlib
4732
In order to use tdlib client you need compiled [TDLib](https://github.com/tdlib/td).
4833

app/controllers/redmine_telegram_setup_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ def bot_init
4141
bot = RedmineBots::Telegram.init_bot
4242
bot.api.setWebhook(url: web_hook_url)
4343

44-
redirect_to plugin_settings_path('redmine_bots'), notice: t('redmine_chat_telegram.bot.authorize.success')
44+
redirect_to plugin_settings_path('redmine_bots'), notice: t('redmine_2chat.bot.authorize.success')
4545
end
4646

4747
def bot_deinit
4848
token = Setting.plugin_redmine_bots['telegram_bot_token']
4949
bot = Telegram::Bot::Client.new(token)
5050
bot.api.setWebhook(url: '')
51-
redirect_to plugin_settings_path('redmine_bots'), notice: t('redmine_chat_telegram.bot.deauthorize.success')
51+
redirect_to plugin_settings_path('redmine_bots'), notice: t('redmine_2chat.bot.deauthorize.success')
5252
end
5353

5454
private

app/controllers/telegram_login_controller.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,6 @@ def check_auth
99
handle_auth_result(auth, user)
1010
end
1111

12-
def send_sign_in_link
13-
user = session[:otp_user_id] ? User.find(session[:otp_user_id]) : User.current
14-
message = RedmineBots::Telegram::Bot::SendSignInLink.(user, context: context, params: params.to_unsafe_h.slice(:autologin, :back_url))
15-
session[:sign_in_message_id] = message.dig('result', 'message_id') if message
16-
render plain: 'SUCCESS', status: :ok
17-
end
18-
19-
def check_jwt
20-
user = User.find_by_id(session[:otp_user_id]) || User.current
21-
auth = RedmineBots::Telegram::Bot::AuthenticateByToken.(user, params[:token],
22-
context: context,
23-
sign_in_message_id: session[:sign_in_message_id])
24-
25-
handle_auth_result(auth, user)
26-
end
27-
2812
private
2913

3014
def context

app/controllers/telegram_proxies_controller.rb

Lines changed: 0 additions & 53 deletions
This file was deleted.

app/views/settings/redmine_bots/_telegram.erb

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@
1919
<th><%= t 'redmine_bots.requirements.telegram.description' %></th>
2020
</tr>
2121
</thead>
22-
<tr>
23-
<td>TDlib</td>
24-
<td>
25-
<% if tdlib_path = (TD::Api::Dl.find_lib rescue nil) %>
26-
<%= t 'redmine_bots.requirements.yes' %>
27-
<% else %>
28-
<%= t 'redmine_bots.requirements.no' %>
29-
<% end %>
30-
</td>
31-
<td><%= tdlib_path || t('redmine_bots.requirements.telegram.tdlib_installation').html_safe %></td>
32-
</tr>
22+
<!-- <tr>-->
23+
<!-- <td>TDlib</td>-->
24+
<!-- <td>-->
25+
<%# if tdlib_path = (TD::Api::Dl.find_lib rescue nil) %>
26+
<%#= t 'redmine_bots.requirements.yes' %>
27+
<%# else %>
28+
<%#= t 'redmine_bots.requirements.no' %>
29+
<%# end %>
30+
<!-- </td>-->
31+
<!-- <td><%#= tdlib_path || t('redmine_bots.requirements.telegram.tdlib_installation').html_safe %></td>-->
32+
<!-- </tr>-->
3333
</table>
3434

3535
<p>
@@ -54,25 +54,6 @@
5454
<a target="_blank" href ="https://my.telegram.org/apps">API ID and API Hash can be obtained here</a>
5555
</p>
5656

57-
<hr>
58-
59-
<h3><%= t 'redmine_bots.settings.telegram.proxy_settings' %></h3>
60-
61-
<p>
62-
<label>
63-
<%= t 'redmine_bots.settings.telegram.tdlib_use_proxy' %>
64-
</label>
65-
<%= check_box_tag 'settings[tdlib_use_proxy]', '1', @settings['tdlib_use_proxy'] %>
66-
<p>
67-
<label>
68-
<%= t 'redmine_bots.settings.telegram.bot_use_proxy' %>
69-
</label>
70-
<%= check_box_tag 'settings[bot_use_proxy]', '1', @settings['bot_use_proxy'] %>
71-
</p>
72-
73-
<%= link_to t('redmine_bots.settings.telegram.proxy_list'), telegram_proxies_path, remote: true %>
74-
75-
7657
<hr>
7758

7859
<div style="display: flex; align-items: center;">
Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1 @@
11
<script async src="https://telegram.org/js/telegram-widget.js?4" data-telegram-login="<%= Setting.plugin_redmine_bots['telegram_bot_name'] %>" data-size="large" data-auth-url="<%= Setting.protocol %>://<%= Setting.host_name %>/telegram/check_auth?<%= params.to_unsafe_h.slice(:autologin, :back_url).merge(context: context).to_query %>" data-request-access="write"></script>
2-
<% current_user = @user || User.current %>
3-
<% telegram_account =
4-
case context
5-
when 'account_connection'
6-
current_user.telegram_account
7-
when '2fa_connection'
8-
current_user.telegram_connection
9-
end
10-
%>
11-
<br>
12-
13-
<% if current_user.logged? && telegram_account.present? %>
14-
<%= link_to send_telegram_sign_in_link_path(params.to_unsafe_h.slice(:autologin, :back_url)), method: :post, remote: true do %>
15-
<%= t('redmine_bots.telegram.bot.login.send_to_telegram') %>
16-
<% end %> (<%= t('redmine_bots.telegram.bot.login.widget_not_visible') %>)
17-
<% else %>
18-
<%= t('redmine_bots.telegram.bot.login.write_to_bot', bot: Setting.plugin_redmine_bots['telegram_bot_name']) %>
19-
<% end %>

app/views/telegram_proxies/_item.html.erb

Lines changed: 0 additions & 11 deletions
This file was deleted.

app/views/telegram_proxies/_modal.html.erb

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)