kamigo 0.26.0 → 0.27.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -0
- data/lib/generators/rails/kamigo/templates/edit.liff.erb +1 -1
- data/lib/generators/rails/kamigo/templates/new.liff.erb +1 -1
- data/lib/generators/templates/kamigo.rb +2 -14
- data/lib/kamigo/event_processors/rails_router_processor.rb +2 -2
- data/lib/kamigo/version.rb +1 -1
- data/lib/kamigo.rb +4 -4
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a113303a0a5d45d56f938861944573df97e98ad6fd2ef1dc53a8a48d188aeade
|
4
|
+
data.tar.gz: 4bbe10ff5c3f8b91d82999cc83f52f415d6fca35c061c300b01b73d4f5c0b87a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fae826a9496cc069bd60e2ce4120b1378e951655870b7b7042251028fe0571c0b238cf0502a5c4e24a575397e20ec311efbc2cac87bde299f2f00cfa68046bd9
|
7
|
+
data.tar.gz: 9e00a82ffe3d2365d26edb6810cf26b45f8381ba99aa31c5c4e30af630ee7b94f255fc5fb3700e4eb4c7347f4b83049b8f328c6763cb08934ea256db04813cb8
|
data/README.md
CHANGED
@@ -83,6 +83,25 @@ window.addEventListener("liff_submit", function(event){
|
|
83
83
|
});
|
84
84
|
```
|
85
85
|
|
86
|
+
若使用 Importmap(Rails 7),請使用 kamigo 0.27.0 以上的版本,並且在 `app/javascript/application.js` 當中
|
87
|
+
|
88
|
+
加入以下程式碼:
|
89
|
+
|
90
|
+
```
|
91
|
+
/* kamiliff default behavior */
|
92
|
+
window.addEventListener("liff_ready", function(event){
|
93
|
+
register_kamiliff_submit();
|
94
|
+
});
|
95
|
+
|
96
|
+
window.addEventListener("liff_submit", function(event){
|
97
|
+
var json = JSON.stringify(event.detail.data);
|
98
|
+
var url = event.detail.url;
|
99
|
+
var method = event.detail.method;
|
100
|
+
var request_text = method + " " + url + "\n" + json;
|
101
|
+
liff_send_text_message(request_text);
|
102
|
+
});
|
103
|
+
```
|
104
|
+
|
86
105
|
這會影響 LINE Bot 在 LIFF 送出表單時的行為。
|
87
106
|
|
88
107
|
# 設定聊天機器人 Webhook URL
|
@@ -98,6 +117,9 @@ https://你的網域/line
|
|
98
117
|
請在專案根目錄下新增一個 `.env` 檔並且填入以下內容:
|
99
118
|
|
100
119
|
```
|
120
|
+
LINE_LOGIN_CHANNEL_ID=這裡填入你的 LINE_LOGIN_CHANNEL_ID
|
121
|
+
LINE_LOGIN_CHANNEL_SECRET=這裡填入你的 LINE_LOGIN_CHANNEL_SECRET
|
122
|
+
|
101
123
|
LINE_CHANNEL_SECRET=這裡填入你的 LINE_CHANNEL_SECRET
|
102
124
|
LINE_CHANNEL_TOKEN=這裡填入你的 LINE_CHANNEL_ACCESS_TOKEN
|
103
125
|
LIFF_COMPACT=這裡填入你的 COMPACT_LIFF_URL
|
@@ -105,6 +127,8 @@ LIFF_TALL=這裡填入你的 TALL_LIFF_URL
|
|
105
127
|
LIFF_FULL=這裡填入你的 FULL_LIFF_URL
|
106
128
|
```
|
107
129
|
|
130
|
+
- `LINE_LOGIN_CHANNEL_ID` 可以在 LINE LOGIN 後台的 Basic settings 分頁中找到。
|
131
|
+
- `LINE_LOGIN_CHANNEL_SECRET` 可以在 LINE LOGIN 後台的 Basic settings 分頁中找到。
|
108
132
|
- `LINE_CHANNEL_SECRET` 可以在 Messaging API 後台的 Basic settings 分頁中找到。
|
109
133
|
- `LINE_CHANNEL_ACCESS_TOKEN` 可以在 Messaging API 後台的 Messaging API 分頁中找到。
|
110
134
|
- `COMPACT_LIFF_URL`、`TALL_LIFF_URL` 和 `FULL_LIFF_URL` 需要到 LINE 後台的 LIFF 分頁新增後,即可獲得一組 LIFF URL。
|
@@ -1,2 +1,2 @@
|
|
1
1
|
<%% content_for :title, "Edit <%= singular_table_name.titleize %>" %>
|
2
|
-
<%%= render "<%= route_url %>/form
|
2
|
+
<%%= render partial: "<%= route_url %>/form", formats: [:html], locals: {<%= singular_table_name %>: @<%= singular_table_name %>} %>
|
@@ -1,2 +1,2 @@
|
|
1
1
|
<%% content_for :title, "New <%= singular_table_name.titleize %>" %>
|
2
|
-
<%%= render "<%= route_url %>/form
|
2
|
+
<%%= render partial: "<%= route_url %>/form", formats: [:html], locals: {<%= singular_table_name %>: @<%= singular_table_name %>} %>
|
@@ -12,18 +12,6 @@ Kamigo.setup do |config|
|
|
12
12
|
# When line_default_message is nil, then Kamigo don't reply message.
|
13
13
|
# config.line_default_message = nil
|
14
14
|
|
15
|
-
#
|
16
|
-
# config.
|
17
|
-
# config.line_login_channel_secret = ENV["LINE_LOGIN_CHANNEL_SECRET"]
|
18
|
-
# config.line_login_redirect_uri = ENV["LINE_LOGIN_REDIRECT_URI"]
|
19
|
-
|
20
|
-
# Integrate with liff
|
21
|
-
# config.liff_url_compact = ENV["LIFF_COMPACT"]
|
22
|
-
# config.liff_url_tall = ENV["LIFF_TALL"]
|
23
|
-
# config.liff_url_full = ENV["LIFF_FULL"]
|
24
|
-
|
25
|
-
# Integrate with line messaging api
|
26
|
-
# config.line_message_api_channel_id = ENV["LINE_CHANNEL_ID"]
|
27
|
-
# config.line_message_api_channel_secret = ENV["LINE_CHANNEL_SECRET"]
|
28
|
-
# config.line_message_api_channel_token = ENV["LINE_CHANNEL_TOKEN"]
|
15
|
+
# When Kamigo receive a request, then Kamigo will process the request with the following processors.
|
16
|
+
# config.line_event_processors = [Kamigo::EventProcessors::RailsRouterProcessor.new]
|
29
17
|
end
|
@@ -10,13 +10,13 @@ module Kamigo
|
|
10
10
|
def process(event)
|
11
11
|
http_method, path, request_params = kamiform_context(event)
|
12
12
|
http_method, path, request_params = language_understanding(event.message) if http_method.nil?
|
13
|
-
encoded_path = URI.
|
13
|
+
encoded_path = URI::Parser.new.escape(path)
|
14
14
|
request_params = event.platform_params.merge(request_params)
|
15
15
|
output = reserve_route(encoded_path, http_method: http_method, request_params: request_params, format: :line)
|
16
16
|
return output if output.present?
|
17
17
|
|
18
18
|
return nil if Kamigo.default_path.nil?
|
19
|
-
reserve_route(URI.
|
19
|
+
reserve_route(URI::Parser.new.escape(Kamigo.default_path), http_method: Kamigo.default_http_method, request_params: request_params, format: :line)
|
20
20
|
end
|
21
21
|
|
22
22
|
private
|
data/lib/kamigo/version.rb
CHANGED
data/lib/kamigo.rb
CHANGED
@@ -29,17 +29,17 @@ module Kamigo
|
|
29
29
|
# env
|
30
30
|
mattr_writer :line_messaging_api_channel_id
|
31
31
|
mattr_writer :line_messaging_api_channel_secret
|
32
|
-
mattr_writer :
|
32
|
+
mattr_writer :line_messaging_api_channel_token
|
33
33
|
|
34
|
-
def self.
|
34
|
+
def self.line_messaging_api_channel_id
|
35
35
|
@@line_message_api_channel_id = ENV["LINE_CHANNEL_ID"]
|
36
36
|
end
|
37
37
|
|
38
|
-
def self.
|
38
|
+
def self.line_messaging_api_channel_secret
|
39
39
|
@@line_message_api_channel_secret = ENV["LINE_CHANNEL_SECRET"]
|
40
40
|
end
|
41
41
|
|
42
|
-
def self.
|
42
|
+
def self.line_messaging_api_channel_token
|
43
43
|
@@line_message_api_channel_token = ENV["LINE_CHANNEL_TOKEN"]
|
44
44
|
end
|
45
45
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kamigo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.27.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- etrex
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,20 +30,20 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.36'
|
34
34
|
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: 0.
|
36
|
+
version: 0.36.0
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - "~>"
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '0.
|
43
|
+
version: '0.36'
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.
|
46
|
+
version: 0.36.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: kamiflex
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|