kamiliff 0.16.0 → 0.21.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d812733308fb2c84752e60e36240a89031899474b0e6ab2fa49e8ce4d0ebe0e2
|
4
|
+
data.tar.gz: 6843aa34d820b9d9f1f30099d7afd02afddec981c86c944ec46a914a4b027cc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '085dbadbcae74022d46f4d9544d59e5a61cb47e0b7e0c2c323fe4e224c418dfdd7e83f83dee728672ba2f66db124513276869d5f9334e9736760bb3406d96b64'
|
7
|
+
data.tar.gz: c736f723a51c9b743770ee1ed2a7204ceaed298032be0ac2a09854ada1850ba83372b7a128cc925a0748c92e93cdfa52c72ad57cb9ee5813d98cfb4832475b5a
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
class LiffController <
|
2
|
+
class LiffController < ActionController::Base
|
3
3
|
layout false, only: :route
|
4
4
|
|
5
5
|
def entry
|
@@ -32,9 +32,12 @@ class LiffController < ApplicationController
|
|
32
32
|
# env = {Rack::RACK_INPUT => StringIO.new}
|
33
33
|
|
34
34
|
res = Rails.application.routes.router.serve(request)
|
35
|
+
# res[0]: http state code
|
36
|
+
# res[1]: headers
|
37
|
+
# res[2]: response
|
35
38
|
res[2].body
|
36
|
-
rescue
|
37
|
-
res
|
39
|
+
rescue NoMethodError => e
|
40
|
+
res&.to_s || e.full_message
|
38
41
|
end
|
39
42
|
|
40
43
|
def source_info
|
@@ -45,11 +48,14 @@ class LiffController < ApplicationController
|
|
45
48
|
source_group_id = context["roomId"] || context["groupId"] || context["userId"]
|
46
49
|
source_user_id = context["userId"]
|
47
50
|
|
51
|
+
profile = params["profile"]
|
52
|
+
|
48
53
|
{
|
49
54
|
platform_type: 'line',
|
50
55
|
source_type: source_type,
|
51
56
|
source_group_id: source_group_id,
|
52
57
|
source_user_id: source_user_id,
|
58
|
+
profile: profile
|
53
59
|
}
|
54
60
|
end
|
55
61
|
end
|
data/app/helpers/liff_helper.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
module LiffHelper
|
2
2
|
def liff_path(params)
|
3
3
|
liff = LiffService.new(params)
|
4
|
-
"
|
4
|
+
if ENV["LIFF_MODE"]&.downcase == "replace"
|
5
|
+
return "#{liff.url}/liff_entry?#{params.to_query}"
|
6
|
+
end
|
7
|
+
# liff mode is Concatenate
|
8
|
+
"#{liff.url}?#{params.to_query}"
|
5
9
|
end
|
6
10
|
end
|
@@ -5,14 +5,28 @@
|
|
5
5
|
<%= csrf_meta_tags %>
|
6
6
|
<%= csp_meta_tag %>
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1" >
|
8
|
-
<script src="https://static.line-scdn.net/liff/edge/2.
|
9
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
|
8
|
+
<script src="https://static.line-scdn.net/liff/edge/versions/2.5.0/sdk.js"></script>
|
10
9
|
|
11
|
-
|
12
|
-
|
10
|
+
<% asset_application_js_path = Dir.glob("#{Rails.root}/app/assets/javascripts/application.*").first %>
|
11
|
+
<% if asset_application_js_path.present? %>
|
12
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<% webpacker_application_js_path = Dir.glob("#{Rails.root}/app/javascript/packs/application.*").first %>
|
16
|
+
<% if webpacker_application_js_path.present? %>
|
17
|
+
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<% has_jquery = [asset_application_js_path, webpacker_application_js_path].compact.map do |path|
|
21
|
+
(File.read(path) =~ /jquery/i).present?
|
22
|
+
end.any? %>
|
13
23
|
|
24
|
+
<% unless has_jquery %>
|
25
|
+
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
14
29
|
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
15
|
-
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
16
30
|
<script>
|
17
31
|
function liff_send_text_message(text){
|
18
32
|
liff.sendMessages(
|
@@ -50,12 +50,15 @@
|
|
50
50
|
if (!liff.isLoggedIn()) {
|
51
51
|
liff.login();
|
52
52
|
}else{
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
53
|
+
liff.getProfile().then(profile => {
|
54
|
+
const data = {};
|
55
|
+
data.context = liff.getContext();
|
56
|
+
data.profile = profile;
|
57
|
+
data.path = "<%= @liff.path %>";
|
58
|
+
<% if !@need_reload %>
|
59
|
+
route(data);
|
60
|
+
<% end %>
|
61
|
+
})
|
59
62
|
}
|
60
63
|
})
|
61
64
|
.catch((err) => {
|
@@ -20,7 +20,7 @@ class LiffService
|
|
20
20
|
self.size = size.to_s.upcase
|
21
21
|
raise "liff_size should be compact, tall or full." unless size.in? %w[COMPACT TALL FULL]
|
22
22
|
self.url = ENV["LIFF_#{size}"]
|
23
|
-
raise "LIFF_#{size} should be in the env variables" if url.
|
23
|
+
raise "LIFF_#{size} should be in the env variables" if url.blank?
|
24
24
|
self.id = url[(url.rindex('/')+1)..-1]
|
25
25
|
end
|
26
26
|
end
|
data/lib/kamiliff/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kamiliff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- etrex kuo
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -54,7 +54,7 @@ licenses:
|
|
54
54
|
- MIT
|
55
55
|
metadata:
|
56
56
|
allowed_push_host: https://rubygems.org
|
57
|
-
post_install_message:
|
57
|
+
post_install_message:
|
58
58
|
rdoc_options: []
|
59
59
|
require_paths:
|
60
60
|
- lib
|
@@ -69,8 +69,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
|
-
rubygems_version: 3.
|
73
|
-
signing_key:
|
72
|
+
rubygems_version: 3.1.4
|
73
|
+
signing_key:
|
74
74
|
specification_version: 4
|
75
75
|
summary: An easy way to use LINE Front-end Framework(LIFF) on rails.
|
76
76
|
test_files: []
|