fir-cli 2.0.11 → 2.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/fir-cli.gemspec +1 -0
- data/lib/fir/cli.rb +2 -1
- data/lib/fir/util/dingtalk_helper.rb +67 -0
- data/lib/fir/util/publish.rb +6 -32
- data/lib/fir/version.rb +1 -1
- metadata +18 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 954e969109ed3d6d61b3ca1a736f3078607fc56bfb079e225042d8badd061902
|
4
|
+
data.tar.gz: 9a07109ea940a55fac9a95794261536c622e068d53ea26f6fa99d493ba2acea8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78807f3b119d7386fdd67b3073983edfb61b68cfb77b7b0efd2746cc32b37eb27b8f99d4b736b7b541d3d7b75154551d701b0b6a3449a4a1dfd05d5ed7d6ddad
|
7
|
+
data.tar.gz: 3acc0e40268677755254abf3e9232eedc3765b34f26983fc8a34d4eed089dee22fe4f8e742039f6802395c0670d9010ccd2d6ce23608ed0ad8b5ea8277b5f8fc
|
data/README.md
CHANGED
@@ -17,6 +17,7 @@ fir.im-cli 可以通过指令查看, 上传, iOS/Android 应用.
|
|
17
17
|
|
18
18
|
|
19
19
|
# 最近更新
|
20
|
+
- (2.0.12) 修复因为钉钉机器人不再支持base64导致无法显示二维码,另外开始支持钉钉加签方式的鉴权, 参数为 --dingtalk_secret
|
20
21
|
- (2.0.11) 兼容了 ruby 3.0
|
21
22
|
- (2.0.10) 飞书支持了 V2 版本的机器人推送
|
22
23
|
- (2.0.9) publish 支持了 企业微信通知 可以使用 --wxwork_access_token 或 --wxwork_webhook, 增加了回调超时时间至20秒
|
data/fir-cli.gemspec
CHANGED
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
/_/ /___/_/ |_| \____/_____/___/
|
28
28
|
|
29
29
|
## 更新记录
|
30
|
+
- (2.0.12) 修复因为钉钉机器人不再支持base64导致无法显示二维码,另外开始支持钉钉加签方式的鉴权, 参数为 --dingtalk_secret
|
30
31
|
- (2.0.11) 兼容了 ruby 3.0 版本, 增加了环境变量FEISHU_TIMEOUT,可以多给飞书一些超时时间
|
31
32
|
- (2.0.10) 飞书支持了 V2 版本的机器人推送
|
32
33
|
- (2.0.9) publish 支持了 企业微信通知 可以使用 --wxwork_access_token 或 --wxwork_webhook, 增加了回调超时时间至20秒
|
data/lib/fir/cli.rb
CHANGED
@@ -125,7 +125,8 @@ module FIR
|
|
125
125
|
method_option :dingtalk_access_token, type: :string, aliases: '-D', desc: 'Send msg to dingtalk, only need access_token, not whole url'
|
126
126
|
method_option :dingtalk_custom_message, type: :string, desc: 'add custom message to dingtalk'
|
127
127
|
method_option :dingtalk_at_phones, type: :string, desc: 'at some phones, split by , eg: 13111111111,13111111112'
|
128
|
-
method_option :dingtalk_at_all, type: :boolean,
|
128
|
+
method_option :dingtalk_at_all, type: :boolean, default: false
|
129
|
+
method_option :dingtalk_secret, type: :string, desc: 'dingtalk bot secret code (eg: SEC********)'
|
129
130
|
|
130
131
|
method_option :feishu_access_token, type: :string, desc: 'Send msg to feishu, need access_token, not whole url'
|
131
132
|
method_option :feishu_custom_message, type: :string, desc: 'add custom message to feishu'
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'openssl'
|
3
|
+
require 'base64'
|
4
|
+
require 'cgi'
|
5
|
+
# require 'byebug'
|
6
|
+
class DingtalkHelper
|
7
|
+
attr_accessor :app_info, :options, :access_token, :qrcode_path, :image_key, :download_url, :title
|
8
|
+
include FIR::Config
|
9
|
+
|
10
|
+
def initialize(app_info, options, qrcode_path, download_url)
|
11
|
+
@app_info = app_info
|
12
|
+
@options = options
|
13
|
+
@access_token = @options[:dingtalk_access_token]
|
14
|
+
@secret = @options[:dingtalk_secret]
|
15
|
+
@qrcode_path = qrcode_path
|
16
|
+
@download_url = download_url
|
17
|
+
end
|
18
|
+
|
19
|
+
def send_msg
|
20
|
+
return if options[:dingtalk_access_token].blank?
|
21
|
+
|
22
|
+
api_domain = @app_info[:api_url]
|
23
|
+
title = "#{@app_info[:name]}-#{@app_info[:version]}(Build #{@app_info[:build]})"
|
24
|
+
payload = {
|
25
|
+
"msgtype": 'markdown',
|
26
|
+
"markdown": {
|
27
|
+
"title": "#{title} uploaded",
|
28
|
+
"text": "#### #{title}\n\n>uploaded at #{Time.now}\n\nurl: #{download_url}\n\n#{options[:dingtalk_custom_message]}\n\n "
|
29
|
+
}
|
30
|
+
}
|
31
|
+
build_dingtalk_at_info(payload)
|
32
|
+
url = "https://oapi.dingtalk.com/robot/send?access_token=#{options[:dingtalk_access_token]}"
|
33
|
+
if options[:dingtalk_secret]
|
34
|
+
info = secret_cal(options[:dingtalk_secret])
|
35
|
+
url = "#{url}×tamp=#{info[:timestamp]}&sign=#{info[:sign]}"
|
36
|
+
end
|
37
|
+
|
38
|
+
x = DefaultRest.post(url, payload)
|
39
|
+
rescue StandardError => e
|
40
|
+
end
|
41
|
+
|
42
|
+
def build_dingtalk_at_info(payload)
|
43
|
+
answer = {}
|
44
|
+
answer[:isAtAll] = options[:dingtalk_at_all]
|
45
|
+
|
46
|
+
unless options[:dingtalk_at_phones].blank?
|
47
|
+
answer[:atMobiles] = options[:dingtalk_at_phones].split(',')
|
48
|
+
payload[:markdown][:text] += options[:dingtalk_at_phones].split(',').map { |x| "@#{x}" }.join(',')
|
49
|
+
end
|
50
|
+
|
51
|
+
payload[:at] = answer
|
52
|
+
end
|
53
|
+
|
54
|
+
def secret_cal(secret)
|
55
|
+
timestamp = Time.now.to_i * 1000
|
56
|
+
secret_enc = secret.encode('utf-8')
|
57
|
+
str = "#{timestamp}\n#{secret}"
|
58
|
+
string_to_sign_enc = str.encode('utf-8')
|
59
|
+
|
60
|
+
hmac = OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), secret_enc, string_to_sign_enc)
|
61
|
+
{
|
62
|
+
timestamp: timestamp,
|
63
|
+
sign: CGI.escape(Base64.encode64(hmac).strip)
|
64
|
+
}
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
data/lib/fir/util/publish.rb
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
require_relative './qiniu_uploader'
|
6
6
|
require_relative './ali_uploader'
|
7
7
|
require_relative '../util/feishu_helper'
|
8
|
+
require_relative '../util/dingtalk_helper'
|
8
9
|
|
9
10
|
module FIR
|
10
11
|
module Publish
|
@@ -16,6 +17,7 @@ module FIR
|
|
16
17
|
logger.info "fir-cli version #{FIR::VERSION} (#{RUBY_VERSION} @ #{RUBY_PLATFORM})"
|
17
18
|
received_app_info = upload_app
|
18
19
|
|
20
|
+
|
19
21
|
short = received_app_info[:short]
|
20
22
|
download_domain = received_app_info[:download_domain]
|
21
23
|
release_id = received_app_info[:release_id]
|
@@ -197,26 +199,7 @@ module FIR
|
|
197
199
|
end
|
198
200
|
|
199
201
|
def dingtalk_notifier(download_url, qrcode_path)
|
200
|
-
|
201
|
-
|
202
|
-
title = "#{@app_info[:name]}-#{@app_info[:version]}(Build #{@app_info[:build]})"
|
203
|
-
payload = {
|
204
|
-
"msgtype": 'markdown',
|
205
|
-
"markdown": {
|
206
|
-
"title": "#{title} uploaded",
|
207
|
-
"text": "#{title} uploaded at #{Time.now}\nurl: #{download_url}\n#{options[:dingtalk_custom_message]}\n))})"
|
208
|
-
# "text": "#{title} uploaded at #{Time.now}\nurl: #{download_url}\n#{options[:dingtalk_custom_message]}\n"
|
209
|
-
}
|
210
|
-
}
|
211
|
-
build_dingtalk_at_info(payload)
|
212
|
-
url = "https://oapi.dingtalk.com/robot/send?access_token=#{options[:dingtalk_access_token]}"
|
213
|
-
|
214
|
-
# 用完了二维码, 就删了
|
215
|
-
File.delete(qrcode_path) unless @export_qrcode
|
216
|
-
|
217
|
-
DefaultRest.post(url, payload)
|
218
|
-
rescue StandardError => e
|
219
|
-
logger.warn "Dingtalk send error #{e.message}"
|
202
|
+
DingtalkHelper.new(@app_info, options, qrcode_path, download_url).send_msg
|
220
203
|
end
|
221
204
|
|
222
205
|
def feishu_notifier(download_url, qrcode_path)
|
@@ -265,7 +248,10 @@ module FIR
|
|
265
248
|
@app_id = @uploading_info[:id]
|
266
249
|
|
267
250
|
@skip_update_icon = options[:skip_update_icon]
|
251
|
+
|
268
252
|
@force_pin_history = options[:force_pin_history]
|
253
|
+
|
254
|
+
@app_info[:api_url] = fir_api[:base_url]
|
269
255
|
unless options[:specify_icon_file].blank?
|
270
256
|
@specify_icon_file_path = File.absolute_path(options[:specify_icon_file])
|
271
257
|
end
|
@@ -278,17 +264,5 @@ module FIR
|
|
278
264
|
end
|
279
265
|
|
280
266
|
|
281
|
-
|
282
|
-
def build_dingtalk_at_info(payload)
|
283
|
-
answer = {}
|
284
|
-
answer[:isAtAll] = options[:dingtalk_at_all]
|
285
|
-
|
286
|
-
unless options[:dingtalk_at_phones].blank?
|
287
|
-
answer[:atMobiles] = options[:dingtalk_at_phones].split(',')
|
288
|
-
payload[:markdown][:text] += options[:dingtalk_at_phones].split(',').map { |x| "@#{x}" }.join(',')
|
289
|
-
end
|
290
|
-
|
291
|
-
payload[:at] = answer
|
292
|
-
end
|
293
267
|
end
|
294
268
|
end
|
data/lib/fir/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fir-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NaixSpirit
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-02-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -232,6 +232,7 @@ files:
|
|
232
232
|
- lib/fir/util/build_common.rb
|
233
233
|
- lib/fir/util/build_ipa.rb
|
234
234
|
- lib/fir/util/config.rb
|
235
|
+
- lib/fir/util/dingtalk_helper.rb
|
235
236
|
- lib/fir/util/feishu_helper.rb
|
236
237
|
- lib/fir/util/http.rb
|
237
238
|
- lib/fir/util/info.rb
|
@@ -269,19 +270,20 @@ metadata: {}
|
|
269
270
|
post_install_message: "\n ______________ ________ ____\n /
|
270
271
|
____/ _/ __ \\ / ____/ / / _/\n / /_ / // /_/ /_____/ / / / /
|
271
272
|
/\n / __/ _/ // _, _/_____/ /___/ /____/ /\n /_/ /___/_/ |_| \\____/_____/___/\n\n
|
272
|
-
\ ## 更新记录\n - (2.0.
|
273
|
-
(2.0.
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
273
|
+
\ ## 更新记录\n - (2.0.12) 修复因为钉钉机器人不再支持base64导致无法显示二维码,另外开始支持钉钉加签方式的鉴权, 参数为 --dingtalk_secret\n
|
274
|
+
\ - (2.0.11) 兼容了 ruby 3.0 版本, 增加了环境变量FEISHU_TIMEOUT,可以多给飞书一些超时时间\n - (2.0.10) 飞书支持了
|
275
|
+
V2 版本的机器人推送\n - (2.0.9) publish 支持了 企业微信通知 可以使用 --wxwork_access_token 或 --wxwork_webhook,
|
276
|
+
增加了回调超时时间至20秒\n - (2.0.8) publish 支持 飞书通知, 可使用 `feishu_access_token` 和 `feishu_custom_message`,
|
277
|
+
详情见 `fir publish --help`\n - (2.0.7) 修复了提示 token 有问题的错误\n - (2.0.6) 将校验文件是否存在提前\n
|
278
|
+
\ - (2.0.5) 更换了上传域名, 避免与 深信服的设备冲突\n - (2.0.4) 修复了 cdn 不支持 patch 方法透传, 导致在修改 app
|
279
|
+
信息的时候返回的 400 错误\n - (2.0.3) 增加 dingtalk_at_phones, 钉钉通知可 at 用户手机号, 以逗号,分割. 此命令需配合
|
280
|
+
`dingtalk_access_token` 使用\n - (2.0.3) 增加 dingtalk_at_all, 钉钉通知可 at 所有人, 此命令需配合
|
281
|
+
`dingtalk_access_token` 使用\n - (2.0.3) publish 增加海外加速参数 --oversea_turbo\n - (2.0.2)
|
282
|
+
有限支持 aab 文件上传, 强依赖`bundletool`工具, 具体请参见参数 `--bundletool_jar_path` 和 `auto_download_bundletool_jar`\n
|
283
|
+
\ - (2.0.1) publish 支持 新参数 `specify_app_display_name`, 指定 app 显示名称\n - (2.0.1)
|
284
|
+
publish 支持 新参数 `need_ansi_qrcode`, 在控制台直接打印二维码, jenkins 用户可能需要使用 `AnsiColor Plugin`
|
285
|
+
插件配合\n - (2.0.1) publish 支持 新参数 `dingtalk_custom_message`, 可以在钉钉通知里增加自定义消息, 此命令需配合
|
286
|
+
`dingtalk_access_token` 使用\n - (2.0.1) publish 支持 新参数 `skip_fir_cli_feedback`,
|
285
287
|
可禁止 fir-cli 发送统计信息\n - (2.0.0) publish 使用更快的存储商, 加速上传速度, 若感觉没以前可使用 switch_to_qiniu
|
286
288
|
恢复\n - [fir-cli](https://github.com/firhq/fir-cli) 已经开源\n - 欢迎 fork, issue 和 pull
|
287
289
|
request\n "
|
@@ -299,7 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
299
301
|
- !ruby/object:Gem::Version
|
300
302
|
version: '0'
|
301
303
|
requirements: []
|
302
|
-
rubygems_version: 3.
|
304
|
+
rubygems_version: 3.0.3
|
303
305
|
signing_key:
|
304
306
|
specification_version: 4
|
305
307
|
summary: fir.im command tool
|