ishapi 0.1.8.130 → 0.1.8.135
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 +7 -0
- data/app/controllers/ishapi/application_controller.rb +74 -14
- data/app/controllers/ishapi/galleries_controller.rb +2 -1
- data/app/controllers/ishapi/gameui_controller.rb +2 -2
- data/app/controllers/ishapi/my/galleries_controller.rb +12 -0
- data/app/controllers/ishapi/my/my_controller.rb +13 -1
- data/app/controllers/ishapi/my/videos_controller.rb +14 -0
- data/app/controllers/ishapi/payments_controller.rb +74 -2
- data/app/controllers/ishapi/sites_controller.rb +3 -2
- data/app/controllers/ishapi/user_profiles_controller.rb +0 -5
- data/app/models/ishapi/ability.rb +17 -7
- data/app/views/ishapi/galleries/index.jbuilder +1 -1
- data/app/views/ishapi/galleries/show.jbuilder +1 -3
- data/app/views/ishapi/{user_profiles/my.jbuilder → my/my/account.jbuilder} +2 -0
- data/app/views/ishapi/my/videos/index.jbuilder +9 -0
- data/app/views/ishapi/newsitems/_index.jbuilder +4 -4
- data/app/views/ishapi/photos/_index.jbuilder +1 -0
- data/app/views/ishapi/sites/show.jbuilder +2 -2
- data/config/routes.rb +16 -12
- metadata +9 -7
- data/app/controllers/ishapi/api_controller.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d4ac76a945cecc499cbcd7702b5fa87065bbc551b68681871f8dd8e049d7434
|
4
|
+
data.tar.gz: 27faa2c48c19a47d7b46572c4ce3c7ff052737df6840e3ee22d930f65be37752
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 814a536e1e9f406bc707576da08b8265fcb6a72637b97b5ebd077c459943dec930f7172fbdf28469fb59f5d3057d3796f37ff3ad75db312fa9754b6628c5641b
|
7
|
+
data.tar.gz: da987ea35b0a763299fa30997546b3ebbee28229dfef11193f78ba668c1ab195e5742ad4de73fd06346c54a9cd1e698b9d1c1ad40a515c65ad8d669797eaa7fd
|
data/README.md
CHANGED
@@ -1,12 +1,19 @@
|
|
1
1
|
|
2
2
|
# Develop
|
3
3
|
|
4
|
+
-=----- 20201228
|
5
|
+
|
6
|
+
Expects params[:jwtToken]
|
7
|
+
no... expects params[:accessToken]
|
8
|
+
somehow expects params[:jwt_token] ?
|
9
|
+
|
4
10
|
# Test
|
5
11
|
|
6
12
|
cd test/dummy
|
7
13
|
be rspec spec
|
8
14
|
|
9
15
|
# Install
|
16
|
+
|
10
17
|
bundle
|
11
18
|
gem build ishapi.gemspec
|
12
19
|
|
@@ -6,8 +6,8 @@ module Ishapi
|
|
6
6
|
layout :false
|
7
7
|
|
8
8
|
# before_action :check_profile, except: [ :test ]
|
9
|
-
before_action :set_current_ability
|
10
|
-
|
9
|
+
# before_action :set_current_ability
|
10
|
+
|
11
11
|
check_authorization
|
12
12
|
skip_before_action :verify_authenticity_token
|
13
13
|
|
@@ -22,13 +22,32 @@ module Ishapi
|
|
22
22
|
|
23
23
|
params['domain'] = 'tgm.piousbox.com'
|
24
24
|
|
25
|
-
response = HTTParty.get "https://graph.facebook.com/v5.0/oauth/access_token?grant_type=fb_exchange_token&" +
|
25
|
+
response = ::HTTParty.get "https://graph.facebook.com/v5.0/oauth/access_token?grant_type=fb_exchange_token&" +
|
26
26
|
"client_id=#{FB[params['domain']][:app]}&client_secret=#{FB[params['domain']][:secret]}&" +
|
27
27
|
"fb_exchange_token=#{accessToken}"
|
28
28
|
j = JSON.parse response.body
|
29
|
-
@long_term_token
|
29
|
+
@long_term_token = j['access_token']
|
30
|
+
@graph = Koala::Facebook::API.new( accessToken )
|
31
|
+
@me = @graph.get_object( 'me', :fields => 'email' )
|
32
|
+
@current_user = User.where( :email => @me['email'] ).first
|
33
|
+
|
34
|
+
puts! @current_user, '#long_term_token @current_user'
|
30
35
|
|
31
|
-
|
36
|
+
# send the jwt to client
|
37
|
+
@jwt_token = encode(user_id: @current_user.id.to_s)
|
38
|
+
|
39
|
+
render json: {
|
40
|
+
email: @current_user.email,
|
41
|
+
jwt_token: @jwt_token,
|
42
|
+
long_term_token: @long_term_token,
|
43
|
+
n_unlocks: @current_user.profile.n_unlocks,
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
def home
|
48
|
+
authorize! :welcome_home, Ishapi
|
49
|
+
render :json => { :status => :ok, :message => 'Ishapi::ApiController.home',
|
50
|
+
:n_reports => Report.count, :n_cities => City.count }
|
32
51
|
end
|
33
52
|
|
34
53
|
#
|
@@ -37,6 +56,8 @@ module Ishapi
|
|
37
56
|
private
|
38
57
|
|
39
58
|
def append_long_term_token
|
59
|
+
puts! nil, 'append_long_term_token'
|
60
|
+
|
40
61
|
if @long_term_token
|
41
62
|
response.body = JSON.parse(response.body).merge({ long_term_token: @long_term_token }).to_json
|
42
63
|
end
|
@@ -60,10 +81,10 @@ module Ishapi
|
|
60
81
|
end
|
61
82
|
end
|
62
83
|
end
|
84
|
+
|
63
85
|
## Does not crap out if accessToken is missing
|
64
86
|
def soft_check_long_term_token
|
65
87
|
check_long_term_token soft=true
|
66
|
-
# puts! @profile, 'soft_check_long_term_token() profile'
|
67
88
|
end
|
68
89
|
|
69
90
|
def check_multiprofile provider = 'google'
|
@@ -75,9 +96,9 @@ module Ishapi
|
|
75
96
|
# puts! result, 'googleauth result'
|
76
97
|
|
77
98
|
decoded_token = JWT.decode params[:idToken], nil, false
|
78
|
-
|
99
|
+
|
79
100
|
@current_user = User.find_by email: decoded_token[0]['email']
|
80
|
-
|
101
|
+
|
81
102
|
elsif 'facebook' == provider
|
82
103
|
# accessToken ||= params[:fb_long_access_token]
|
83
104
|
|
@@ -101,7 +122,7 @@ module Ishapi
|
|
101
122
|
@current_user = User.where( :email => @me['email'] ).first
|
102
123
|
@current_user ||= User.create! email: @me['email'], password: SecureRandom.urlsafe_base64
|
103
124
|
|
104
|
-
@current_profile = @current_user.profile
|
125
|
+
@current_profile = @current_user.profile
|
105
126
|
if !@current_profile
|
106
127
|
begin
|
107
128
|
g = Gallery.find '5e1495e2d697f768ad0779eb'
|
@@ -120,25 +141,44 @@ module Ishapi
|
|
120
141
|
|
121
142
|
puts! @current_user, 'current_user'
|
122
143
|
puts! @current_profile, 'current_profile'
|
123
|
-
|
144
|
+
|
145
|
+
elsif 'jwt' == provider
|
146
|
+
decoded = decode(params[:jwt_token])
|
147
|
+
puts! decoded, 'decoded'
|
148
|
+
@current_user = User.find decoded['user_id']
|
124
149
|
else
|
125
150
|
puts! 'check_multiprofile(): no access token'
|
151
|
+
raise "ww1 - not implemented"
|
126
152
|
end
|
127
153
|
|
154
|
+
# @TODO: refactor [ref-5]
|
128
155
|
sign_in @current_user, scope: :user
|
129
156
|
set_current_ability
|
130
157
|
end
|
131
158
|
|
159
|
+
|
160
|
+
|
161
|
+
# same as check_profile but doesn't error out when jwt_token is missing
|
162
|
+
def check_profile_optionally
|
163
|
+
if !params[:jwt_token]
|
164
|
+
@current_user = User.new profile: Profile.new
|
165
|
+
else
|
166
|
+
check_profile
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
132
170
|
# this doesn't generate long-lived token, doesn't update user_profile
|
133
|
-
# this is only for facebook now
|
134
171
|
def check_profile
|
172
|
+
puts! params, 'params'
|
173
|
+
|
135
174
|
# return check_multiprofile 'google'
|
136
|
-
return check_multiprofile 'facebook'
|
175
|
+
# return check_multiprofile 'facebook'
|
176
|
+
return check_multiprofile 'jwt'
|
137
177
|
|
138
178
|
# puts! params, 'params'
|
139
179
|
# puts! current_user, 'current_user'
|
140
180
|
# puts! @current_user, '@current_user'
|
141
|
-
|
181
|
+
|
142
182
|
accessToken = request.headers[:accessToken]
|
143
183
|
accessToken ||= params[:fb_long_access_token]
|
144
184
|
accessToken ||= params[:accessToken]
|
@@ -201,7 +241,7 @@ module Ishapi
|
|
201
241
|
@current_order = @current_profile.current_order
|
202
242
|
# orders.where( :submitted_at => nil ).first || ::CoTailors::Order.new( :profile_id => @current_profile.id )
|
203
243
|
end
|
204
|
-
|
244
|
+
|
205
245
|
def get_long_token accessToken
|
206
246
|
url = "https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&" +
|
207
247
|
"client_id=#{FB[params['domain']][:app]}&client_secret=#{FB[params['domain']][:secret]}&fb_exchange_token=#{accessToken}"
|
@@ -221,5 +261,25 @@ module Ishapi
|
|
221
261
|
puts a.inspect
|
222
262
|
end
|
223
263
|
|
264
|
+
# jwt
|
265
|
+
def check_jwt
|
266
|
+
decoded = decode(params[:jwt_token])
|
267
|
+
puts! decoded, 'decoded'
|
268
|
+
@current_user = User.find decoded['user_id']
|
269
|
+
set_current_ability
|
270
|
+
end
|
271
|
+
|
272
|
+
# jwt
|
273
|
+
def encode(payload, exp = 2.hours.from_now)
|
274
|
+
payload[:exp] = exp.to_i
|
275
|
+
JWT.encode(payload, Rails.application.secrets.secret_key_base.to_s)
|
276
|
+
end
|
277
|
+
|
278
|
+
# jwt
|
279
|
+
def decode(token)
|
280
|
+
decoded = JWT.decode(token, Rails.application.secrets.secret_key_base.to_s)[0]
|
281
|
+
HashWithIndifferentAccess.new decoded
|
282
|
+
end
|
283
|
+
|
224
284
|
end
|
225
285
|
end
|
@@ -3,7 +3,8 @@ require_dependency "ishapi/application_controller"
|
|
3
3
|
module Ishapi
|
4
4
|
class GalleriesController < ApplicationController
|
5
5
|
|
6
|
-
before_action :soft_check_long_term_token, only: [ :show ]
|
6
|
+
# before_action :soft_check_long_term_token, only: [ :show ]
|
7
|
+
before_action :check_jwt
|
7
8
|
|
8
9
|
def index
|
9
10
|
@galleries = Gallery.all
|
@@ -21,7 +21,7 @@ module Ishapi
|
|
21
21
|
:amount => params[:amount],
|
22
22
|
:currency => 'usd',
|
23
23
|
:source => params[:stripeToken],
|
24
|
-
:destination => {
|
24
|
+
:destination => {
|
25
25
|
:account => acct,
|
26
26
|
}
|
27
27
|
)
|
@@ -46,7 +46,7 @@ module Ishapi
|
|
46
46
|
def do_purchase
|
47
47
|
authorize! :do_purchase, ::Gameui
|
48
48
|
item = params[:className].constantize.find_by_slug( params[:slug] )
|
49
|
-
|
49
|
+
|
50
50
|
raise 'no such item' if !item
|
51
51
|
raise 'too little funds' if @profile.n_stars < item.premium_tier
|
52
52
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
|
2
|
+
class Ishapi::My::GalleriesController < Ishapi::My::MyController
|
3
|
+
|
4
|
+
## expects params[:jwt_token]
|
5
|
+
def index
|
6
|
+
authorize! :my_index, Gallery
|
7
|
+
@galleries = @current_user.profile.galleries.unscoped.where( is_trash: false ).order_by( created_at: :desc ).limit(20)
|
8
|
+
render 'ishapi/galleries/index'
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
@@ -3,10 +3,22 @@ module Ishapi
|
|
3
3
|
module My
|
4
4
|
class MyController < Ishapi::ApplicationController
|
5
5
|
|
6
|
-
before_action :set_profile
|
6
|
+
# before_action :set_profile # this is DoS on FB - disabled
|
7
|
+
# before_action :do_login
|
8
|
+
before_action :check_profile
|
9
|
+
|
10
|
+
def account
|
11
|
+
@profile = current_user.profile
|
12
|
+
authorize! :show, @profile
|
13
|
+
end
|
7
14
|
|
8
15
|
private
|
9
16
|
|
17
|
+
def do_login
|
18
|
+
token = decode(params[:jwtToken])
|
19
|
+
@current_user = User.find(token["user_id"])
|
20
|
+
end
|
21
|
+
|
10
22
|
def set_profile
|
11
23
|
begin
|
12
24
|
@graph = Koala::Facebook::API.new( params[:accessToken] )
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
module Ishapi
|
3
|
+
module My
|
4
|
+
class VideosController < Ishapi::My::MyController
|
5
|
+
|
6
|
+
def index
|
7
|
+
authorize! :my_index, Video
|
8
|
+
@videos = @current_user.profile.videos.unscoped.where( is_trash: false ).order_by( created_at: :desc ).limit(20)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
@@ -2,6 +2,12 @@ require_dependency "ishapi/application_controller"
|
|
2
2
|
module Ishapi
|
3
3
|
class PaymentsController < ApplicationController
|
4
4
|
|
5
|
+
before_action :check_profile, only: %i| create2 unlock |
|
6
|
+
|
7
|
+
##
|
8
|
+
## this is for invoices on wasya.co, isn't it?
|
9
|
+
## 20200712
|
10
|
+
##
|
5
11
|
def create
|
6
12
|
authorize! :open_permission, ::Ishapi
|
7
13
|
begin
|
@@ -18,11 +24,10 @@ module Ishapi
|
|
18
24
|
:amount => amount_cents,
|
19
25
|
:currency => 'usd',
|
20
26
|
:source => params[:token][:id],
|
21
|
-
:destination => {
|
27
|
+
:destination => {
|
22
28
|
:account => acct,
|
23
29
|
}
|
24
30
|
)
|
25
|
-
# puts! charge, 'charge'
|
26
31
|
|
27
32
|
payment.charge = JSON.parse( charge.to_json )
|
28
33
|
if payment.save
|
@@ -36,6 +41,73 @@ module Ishapi
|
|
36
41
|
end
|
37
42
|
end
|
38
43
|
|
44
|
+
## This is for guyd _vp_ 20200721
|
45
|
+
def create2
|
46
|
+
authorize! :create, ::Ish::Payment
|
47
|
+
|
48
|
+
begin
|
49
|
+
amount_cents = 503 # @TODO: change
|
50
|
+
|
51
|
+
::Stripe.api_key = STRIPE_SK
|
52
|
+
intent = Stripe::PaymentIntent.create({
|
53
|
+
amount: amount_cents,
|
54
|
+
currency: 'usd',
|
55
|
+
metadata: { integration_check: "accept_a_payment" },
|
56
|
+
})
|
57
|
+
|
58
|
+
payment = Ish::Payment.create!(
|
59
|
+
client_secret: intent.client_secret,
|
60
|
+
email: @current_user.email,
|
61
|
+
payment_intent_id: intent.id,
|
62
|
+
profile_id: @current_user.profile.id )
|
63
|
+
|
64
|
+
render json: { client_secret: intent.client_secret }
|
65
|
+
rescue Mongoid::Errors::DocumentNotFound => e
|
66
|
+
puts! e, 'e'
|
67
|
+
render :status => 404, :json => e
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
## webhook
|
72
|
+
def stripe_confirm
|
73
|
+
authorize! :open_permission, ::Ishapi
|
74
|
+
payload = request.body.read
|
75
|
+
event = nil
|
76
|
+
begin
|
77
|
+
event = Stripe::Event.construct_from(JSON.parse(payload, symbolize_names: true))
|
78
|
+
rescue StandardError => e
|
79
|
+
puts! e, 'e'
|
80
|
+
render status: 400, json: { status: :not_ok }
|
81
|
+
return
|
82
|
+
end
|
83
|
+
|
84
|
+
payment_intent = event.data.object
|
85
|
+
|
86
|
+
payment = Ish::Payment.where( payment_intent_id: payment_intent.id ).first
|
87
|
+
if payment && payment_intent['status'] == 'succeeded'
|
88
|
+
payment.update_attributes( status: :confirmed )
|
89
|
+
payment.profile.update_attributes!( n_unlocks: payment.profile.n_unlocks + 5 )
|
90
|
+
end
|
91
|
+
|
92
|
+
render status: 200, json: { status: :ok }
|
93
|
+
end
|
94
|
+
|
95
|
+
def unlock
|
96
|
+
authorize! :unlock, ::Ish::Payment
|
97
|
+
item = Object::const_get(params['kind']).find params['id']
|
98
|
+
|
99
|
+
existing = Purchase.where( user_profile: @current_user.profile, item: item ).first
|
100
|
+
if existing
|
101
|
+
render status: 200, json: { status: :ok, message: 'already purchased' }
|
102
|
+
return
|
103
|
+
end
|
104
|
+
|
105
|
+
@current_user.profile.update_attributes n_unlocks: @current_user.profile.n_unlocks - 1 # @TODO: the number is variable
|
106
|
+
purchase = ::Gameui::PremiumPurchase.create!( item: item, user_profile: @current_user.profile, )
|
107
|
+
|
108
|
+
render status: 200, json: { status: :ok }
|
109
|
+
end
|
110
|
+
|
39
111
|
end
|
40
112
|
end
|
41
113
|
|
@@ -3,6 +3,8 @@ require_dependency "ishapi/application_controller"
|
|
3
3
|
module Ishapi
|
4
4
|
class SitesController < ApplicationController
|
5
5
|
|
6
|
+
before_action :check_profile_optionally, only: %i| show |
|
7
|
+
|
6
8
|
def index
|
7
9
|
authorize! :index, ::Site
|
8
10
|
@sites = ::Site.all
|
@@ -14,10 +16,9 @@ module Ishapi
|
|
14
16
|
else
|
15
17
|
domain = params[:domain]
|
16
18
|
end
|
17
|
-
@site = ::Site.find_by
|
19
|
+
@site = ::Site.find_by(domain: domain, lang: :en)
|
18
20
|
authorize! :show, @site
|
19
21
|
|
20
|
-
|
21
22
|
if @site.is_private
|
22
23
|
if !params[:accessToken]
|
23
24
|
render :json => { :status => :unauthorized}, :status => :unauthorized
|
@@ -3,7 +3,6 @@ class Ishapi::Ability
|
|
3
3
|
include ::CanCan::Ability
|
4
4
|
|
5
5
|
def initialize user
|
6
|
-
|
7
6
|
#
|
8
7
|
# signed in user
|
9
8
|
#
|
@@ -13,15 +12,18 @@ class Ishapi::Ability
|
|
13
12
|
can :manage, :all
|
14
13
|
end
|
15
14
|
|
15
|
+
can [ :update ], ::CoTailors::Address do |address|
|
16
|
+
puts [ user.inspect, address.inspect ], '+++ user in cancancan'
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
can [ :my_index ], Gallery
|
16
21
|
can [ :show ], Gallery do |gallery|
|
17
22
|
gallery.user_profile == user.profile
|
18
23
|
end
|
19
24
|
can [ :do_purchase ], ::Gameui
|
20
25
|
|
21
|
-
can [ :
|
22
|
-
puts [ user.inspect, address.inspect ], '+++ user in cancancan'
|
23
|
-
true
|
24
|
-
end
|
26
|
+
can [ :create, :unlock ], ::Ish::Payment
|
25
27
|
|
26
28
|
can [ :buy_stars ], ::IshModels::UserProfile
|
27
29
|
|
@@ -42,6 +44,11 @@ class Ishapi::Ability
|
|
42
44
|
|
43
45
|
can [ :index, :show ], Event
|
44
46
|
|
47
|
+
#
|
48
|
+
# Ish::P
|
49
|
+
#
|
50
|
+
|
51
|
+
|
45
52
|
#
|
46
53
|
# G
|
47
54
|
#
|
@@ -56,7 +63,7 @@ class Ishapi::Ability
|
|
56
63
|
can [ :my_index, :show ], Report do |report|
|
57
64
|
report.is_public
|
58
65
|
end
|
59
|
-
|
66
|
+
|
60
67
|
can [ :fb_sign_in, :long_term_token, :open_permission, :welcome_home ], Ishapi
|
61
68
|
|
62
69
|
can [ :index, :show ], Site
|
@@ -66,11 +73,14 @@ class Ishapi::Ability
|
|
66
73
|
tag.is_public
|
67
74
|
end
|
68
75
|
|
76
|
+
#
|
77
|
+
# V
|
78
|
+
#
|
69
79
|
can [ :index ], Venue
|
70
80
|
can [ :show ], Venue do |venue|
|
71
81
|
venue.is_public
|
72
82
|
end
|
73
|
-
can [ :index ], Video
|
83
|
+
can [ :index, :my_index ], Video
|
74
84
|
can [ :show ], Video do |video|
|
75
85
|
video.is_public
|
76
86
|
end
|
@@ -11,7 +11,7 @@ json.array! @galleries do |gallery|
|
|
11
11
|
json.subhead gallery.subhead
|
12
12
|
json.username gallery.user_profile.name
|
13
13
|
json.cityname gallery.city.name if gallery.city
|
14
|
-
json.
|
14
|
+
json.tag_names gallery.tags.map &:name_seo
|
15
15
|
json.venuename gallery.venue.name if gallery.venue
|
16
16
|
json.partial! 'ishapi/photos/index', :photos => gallery.photos
|
17
17
|
end
|
@@ -5,10 +5,8 @@
|
|
5
5
|
this_key = [ @gallery, params.permit! ]
|
6
6
|
json.cache! this_key do
|
7
7
|
json.gallery do
|
8
|
-
json.partial! 'ishapi/galleries/show', gallery: @gallery
|
9
|
-
json.partial! 'ishapi/photos/index', :photos => @gallery.photos
|
10
|
-
|
11
8
|
json.partial! 'ishapi/application/meta', item: @gallery
|
9
|
+
json.partial! 'ishapi/galleries/show', gallery: @gallery
|
12
10
|
end
|
13
11
|
end
|
14
12
|
|
@@ -10,7 +10,7 @@ json.newsitems do
|
|
10
10
|
json.name item.name
|
11
11
|
json.created_at item.created_at
|
12
12
|
json.updated_at item.updated_at
|
13
|
-
|
13
|
+
|
14
14
|
if item.gallery
|
15
15
|
json.item_type 'gallery'
|
16
16
|
json.name item.gallery.name
|
@@ -39,7 +39,7 @@ json.newsitems do
|
|
39
39
|
json.username item.report.user_profile.name if item.report.user_profile
|
40
40
|
|
41
41
|
if item.report.photo
|
42
|
-
json.photo_s169_url item.report.photo.photo.url( :s169 )
|
42
|
+
json.photo_s169_url item.report.photo.photo.url( :s169 )
|
43
43
|
json.photo_thumb2_url item.report.photo.photo.url( :thumb2 )
|
44
44
|
end
|
45
45
|
|
@@ -51,7 +51,7 @@ json.newsitems do
|
|
51
51
|
json.is_purchased current_user.profile.has_premium_purchase( item.report )
|
52
52
|
end
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
if item.video_id
|
56
56
|
json.partial! 'ishapi/videos/show', :video => Video.unscoped.find( item.video_id )
|
57
57
|
end
|
@@ -60,6 +60,6 @@ json.newsitems do
|
|
60
60
|
json.item_type 'photo'
|
61
61
|
json.partial! 'ishapi/photos/index', :photos => [ item.photo ]
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
end
|
65
65
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
|
2
2
|
#
|
3
3
|
# ishapi / sites / show
|
4
4
|
#
|
@@ -22,7 +22,7 @@ json.cache! key do
|
|
22
22
|
json.partial! 'ishapi/newsitems/index', :newsitems => @newsitems, :resource => @site
|
23
23
|
json.partial! 'ishapi/reports/index', :reports => @reports, :resource => @site
|
24
24
|
json.partial! 'ishapi/videos/index', :videos => @site.videos
|
25
|
-
|
25
|
+
|
26
26
|
json.feature_tags do
|
27
27
|
json.array! @feature_tags do |feature_tag|
|
28
28
|
json.partial! 'ishapi/tags/widget', :tag => feature_tag
|
data/config/routes.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
Ishapi::Engine.routes.draw do
|
2
|
-
root :to => '
|
3
|
-
post 'home', :to => '
|
2
|
+
root :to => 'application#home'
|
3
|
+
post 'home', :to => 'application#home'
|
4
4
|
|
5
5
|
resources :addresses
|
6
6
|
|
7
7
|
get 'cities', :to => 'cities#index'
|
8
8
|
get 'cities/view/:cityname', :to => 'cities#show'
|
9
9
|
get 'cities/features', :to => 'cities#features'
|
10
|
-
|
10
|
+
|
11
11
|
post 'co_tailors/orders', :to => 'orders#create'
|
12
12
|
post 'co_tailors/order_items', :to => 'order_items#create'
|
13
13
|
post 'co_tailors/measurements', :to => 'measurements#update'
|
@@ -15,8 +15,6 @@ Ishapi::Engine.routes.draw do
|
|
15
15
|
namespace :co_tailors do
|
16
16
|
end
|
17
17
|
|
18
|
-
post 'do_purchase', to: 'gameui#do_purchase'
|
19
|
-
|
20
18
|
get 'events/view/:eventname', :to => 'events#show'
|
21
19
|
|
22
20
|
get 'galleries', :to => 'galleries#index'
|
@@ -29,15 +27,21 @@ Ishapi::Engine.routes.draw do
|
|
29
27
|
get 'maps', to: 'maps#index'
|
30
28
|
get 'maps/view/:slug', to: 'maps#show'
|
31
29
|
get 'markers/view/:slug', to: 'maps#show_marker'
|
32
|
-
|
33
|
-
get 'my/newsitems', to: 'newsitems#index'
|
34
|
-
get 'my/account', to: 'user_profiles#my'
|
30
|
+
get "/my/account", to: "my/my#account"
|
35
31
|
namespace :my do
|
36
|
-
|
37
|
-
get
|
32
|
+
get 'galleries', to: 'galleries#index'
|
33
|
+
get 'newsitems', to: 'newsitems#index'
|
34
|
+
get 'reports', to: 'reports#index'
|
35
|
+
get 'videos', to: 'videos#index'
|
36
|
+
post 'videos', to: 'videos#index'
|
38
37
|
end
|
39
|
-
|
38
|
+
|
39
|
+
post 'do_purchase', to: 'gameui#do_purchase' # @TODO: rename to just purchase, or destroy endpoint
|
40
40
|
post 'payments', :to => 'payments#create'
|
41
|
+
post 'payments2', :to => 'payments#create2' # @TODO: change
|
42
|
+
get 'payments2', to: 'payments#create2'
|
43
|
+
post 'payments/unlock', to: 'payments#unlock' # do_purchase
|
44
|
+
post 'stripe_confirm', to: 'payments#stripe_confirm' # @TODO: test-drive
|
41
45
|
|
42
46
|
get 'profiles/view/:username', :to => 'user_profiles#show'
|
43
47
|
|
@@ -64,7 +68,7 @@ Ishapi::Engine.routes.draw do
|
|
64
68
|
|
65
69
|
get 'venues', :to => 'venues#index'
|
66
70
|
get 'venues/view/:venuename', :to => 'venues#show'
|
67
|
-
|
71
|
+
|
68
72
|
resources :videos
|
69
73
|
|
70
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ishapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.8.
|
4
|
+
version: 0.1.8.135
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -195,7 +195,6 @@ files:
|
|
195
195
|
- app/assets/stylesheets/ishapi/articles.css
|
196
196
|
- app/assets/stylesheets/scaffold.css
|
197
197
|
- app/controllers/ishapi/addresses_controller.rb
|
198
|
-
- app/controllers/ishapi/api_controller.rb
|
199
198
|
- app/controllers/ishapi/application_controller.rb
|
200
199
|
- app/controllers/ishapi/articles_controller.rb
|
201
200
|
- app/controllers/ishapi/cities_controller.rb
|
@@ -205,8 +204,10 @@ files:
|
|
205
204
|
- app/controllers/ishapi/invoices_controller.rb
|
206
205
|
- app/controllers/ishapi/maps_controller.rb
|
207
206
|
- app/controllers/ishapi/measurements_controller.rb
|
207
|
+
- app/controllers/ishapi/my/galleries_controller.rb
|
208
208
|
- app/controllers/ishapi/my/my_controller.rb
|
209
209
|
- app/controllers/ishapi/my/reports_controller.rb
|
210
|
+
- app/controllers/ishapi/my/videos_controller.rb
|
210
211
|
- app/controllers/ishapi/newsitems_controller.rb
|
211
212
|
- app/controllers/ishapi/order_items_controller.rb
|
212
213
|
- app/controllers/ishapi/orders_controller.rb
|
@@ -248,6 +249,8 @@ files:
|
|
248
249
|
- app/views/ishapi/maps/index.jbuilder
|
249
250
|
- app/views/ishapi/maps/show.jbuilder
|
250
251
|
- app/views/ishapi/measurements/_show.jbuilder
|
252
|
+
- app/views/ishapi/my/my/account.jbuilder
|
253
|
+
- app/views/ishapi/my/videos/index.jbuilder
|
251
254
|
- app/views/ishapi/newsitems/_index.jbuilder
|
252
255
|
- app/views/ishapi/newsitems/index.jbuilder
|
253
256
|
- app/views/ishapi/orders/_item.jbuilder
|
@@ -263,7 +266,6 @@ files:
|
|
263
266
|
- app/views/ishapi/tags/_widget.jbuilder
|
264
267
|
- app/views/ishapi/tags/index.jbuilder
|
265
268
|
- app/views/ishapi/tags/show.jbuilder
|
266
|
-
- app/views/ishapi/user_profiles/my.jbuilder
|
267
269
|
- app/views/ishapi/user_profiles/show.jbuilder
|
268
270
|
- app/views/ishapi/users/_index.jbuilder
|
269
271
|
- app/views/ishapi/users/show.jbuilder
|
@@ -282,7 +284,7 @@ homepage: http://wasya.co
|
|
282
284
|
licenses:
|
283
285
|
- MIT
|
284
286
|
metadata: {}
|
285
|
-
post_install_message:
|
287
|
+
post_install_message:
|
286
288
|
rdoc_options: []
|
287
289
|
require_paths:
|
288
290
|
- lib
|
@@ -298,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
298
300
|
version: '0'
|
299
301
|
requirements: []
|
300
302
|
rubygems_version: 3.0.6
|
301
|
-
signing_key:
|
303
|
+
signing_key:
|
302
304
|
specification_version: 4
|
303
305
|
summary: Summary of Ishapi.
|
304
306
|
test_files: []
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require_dependency "ishapi/application_controller"
|
2
|
-
|
3
|
-
module Ishapi
|
4
|
-
class ApiController < UnrestrictedController
|
5
|
-
|
6
|
-
def home
|
7
|
-
authorize! :welcome_home, Ishapi
|
8
|
-
render :json => { :status => :ok, :message => 'Ishapi::ApiController.home',
|
9
|
-
:n_reports => Report.count, :n_cities => City.count }
|
10
|
-
end
|
11
|
-
|
12
|
-
end
|
13
|
-
end
|