weixin_rails_middleware 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 20636ef04ad9e490d71c59375819148285a067e3
4
- data.tar.gz: 3c9e8ef0d981074eaec67981c93c6965bc84ab28
2
+ SHA256:
3
+ metadata.gz: 93c071e9165390e9d9f396c1437bbe4273e2e34608a988f74ad7c011885620a9
4
+ data.tar.gz: 5bd7edf8b0fa48aadd37077b756e3d50dcc2dfcd31e0cb16012af36b17ef84b9
5
5
  SHA512:
6
- metadata.gz: adadd27ecb4ce7e0ae949500613fab251d066ef1eefe5bfa6f03be515766009a1319cdfbfa8346806110a8de352b23bd13a9db13c1c9778c11d0c0c80ad79c25
7
- data.tar.gz: 23c3a8e5b56525c52ce9a5e5e04090bdb90f4d3ab7ea2c265a1eaf55739a2eb0df4607195929637b16f6e365b426d71c4f807ea1ad01033fd0067454f9d43b66
6
+ metadata.gz: a5739cd1e7912b5e7a414eff1a17a7e462e93a61e15225b812c1aa34793af22f9cd18ef5337b1e73c246f013b2006d6bbfd377ea6003135caa6e99811eb78370
7
+ data.tar.gz: 6b2588a06fe7e778d1dd00e44238d136f118c716cbc194bea15ebfb549db67ccd2e611182f17c3a3b8c76a3372b41b4717d78042fb26449cd1457f0f60e53c4f
@@ -2,10 +2,12 @@ module WeixinRailsMiddleware
2
2
  class WeixinController < ActionController::Base
3
3
  include ReplyWeixinMessageHelper
4
4
 
5
- before_filter :check_is_encrypt, only: [:index, :reply]
6
- before_filter :initialize_adapter, :check_weixin_legality, only: [:index, :reply]
7
- before_filter :set_weixin_public_account, :set_weixin_message, only: :reply
8
- before_filter :set_keyword, only: :reply
5
+ skip_before_action :verify_authenticity_token
6
+
7
+ before_action :check_is_encrypt, only: [:index, :reply]
8
+ before_action :initialize_adapter, :check_weixin_legality, only: [:index, :reply]
9
+ before_action :set_weixin_public_account, :set_weixin_message, only: :reply
10
+ before_action :set_keyword, only: :reply
9
11
 
10
12
  def index
11
13
  end
@@ -2,10 +2,19 @@
2
2
  # 1, @weixin_message: 获取微信所有参数.
3
3
  # 2, @weixin_public_account: 如果配置了public_account_class选项,则会返回当前实例,否则返回nil.
4
4
  # 3, @keyword: 目前微信只有这三种情况存在关键字: 文本消息, 事件推送, 接收语音识别结果
5
+
6
+ # 兼容Rails6.0的目录加载机制
7
+ # https://github.com/fxn/zeitwerk
8
+ begin
9
+ class Controllers::WeixinRailsMiddleware::WeixinControllerDecorator;end
10
+ rescue
11
+ end
12
+
5
13
  WeixinRailsMiddleware::WeixinController.class_eval do
6
14
 
7
15
  def reply
8
- render xml: send("response_#{@weixin_message.MsgType}_message", {})
16
+ result = send("response_#{@weixin_message.MsgType}_message", {})
17
+ render result.is_a?(String) ? {xml: result} : {nothing: true}
9
18
  end
10
19
 
11
20
  private
@@ -1,3 +1,3 @@
1
1
  module WeixinRailsMiddleware
2
- VERSION = "1.3.2"
2
+ VERSION = "1.3.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weixin_rails_middleware
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - lanrion
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-03 00:00:00.000000000 Z
11
+ date: 2019-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  requirements: []
135
135
  rubyforge_project:
136
- rubygems_version: 2.4.5
136
+ rubygems_version: 2.7.6
137
137
  signing_key:
138
138
  specification_version: 4
139
139
  summary: weixin_rails_middleware for integration weixin