ishapi 0.1.8.145 → 0.1.8.149
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/app/controllers/ishapi/application_controller.rb +1 -1
- data/app/controllers/ishapi/my/my_controller.rb +5 -1
- data/app/controllers/ishapi/users_controller.rb +22 -0
- data/app/views/ishapi/maps/_show.jbuilder +34 -0
- data/app/views/ishapi/maps/show.jbuilder +4 -0
- data/app/views/ishapi/newsitems/_index.jbuilder +2 -2
- data/app/views/ishapi/sites/show.jbuilder +0 -2
- data/config/routes.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cd7a53ae8d95d217a973a346a43735501330d08ff96705fe24ebf42014a10ba
|
4
|
+
data.tar.gz: 1d85e34875c2f3c3b026e92eda83e21d4a4409aada61d57cbd9bf3c547c08c02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 629a76c8e71f990c024cc5968ab41572216d852c73ababc8101327e74dceb998a28a3a480c8a9d657aa4c8cbe531400b8859830e0d8a5ca853fa2510cd36ee9b
|
7
|
+
data.tar.gz: 89da2fef64a91d1560b6a76da8403573ad43978fe22da94a4385c014e74ed5aa36da38a58380f0a00397d97ace7062756eee3473611a8eef1e0aa915943510c6
|
@@ -8,8 +8,12 @@ module Ishapi
|
|
8
8
|
before_action :check_profile
|
9
9
|
|
10
10
|
def account
|
11
|
-
@profile = current_user
|
11
|
+
@profile = current_user&.profile
|
12
12
|
authorize! :show, @profile
|
13
|
+
rescue CanCan::AccessDenied
|
14
|
+
render json: {
|
15
|
+
status: :not_ok,
|
16
|
+
}, status: 401
|
13
17
|
end
|
14
18
|
|
15
19
|
private
|
@@ -4,6 +4,8 @@ module Ishapi
|
|
4
4
|
class UsersController < ApplicationController
|
5
5
|
before_action :set_profile, :only => [ :fb_sign_in, :show ]
|
6
6
|
|
7
|
+
skip_authorization_check only: %i| login |
|
8
|
+
|
7
9
|
def fb_sign_in
|
8
10
|
authorize! :fb_sign_in, Ishapi
|
9
11
|
# render :json => { :status => :ok }
|
@@ -14,5 +16,25 @@ module Ishapi
|
|
14
16
|
authorize! :fb_sign_in, Ishapi
|
15
17
|
end
|
16
18
|
|
19
|
+
def login
|
20
|
+
@current_user = User.where( email: params[:email] ).first
|
21
|
+
if !@current_user
|
22
|
+
render json: { status: :not_ok }, status: 401
|
23
|
+
return
|
24
|
+
end
|
25
|
+
if @current_user.valid_password?(params[:password])
|
26
|
+
# from: application_controller#long_term_token
|
27
|
+
|
28
|
+
# send the jwt to client
|
29
|
+
@jwt_token = encode(user_id: @current_user.id.to_s)
|
30
|
+
render json: {
|
31
|
+
email: @current_user.email,
|
32
|
+
jwt_token: @jwt_token,
|
33
|
+
long_term_token: @long_term_token,
|
34
|
+
n_unlocks: @current_user.profile.n_unlocks,
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
17
39
|
end
|
18
40
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#
|
2
|
+
# ishapi / maps / _show
|
3
|
+
#
|
4
|
+
|
5
|
+
this_key = [ map, params.permit! ]
|
6
|
+
json.cache! this_key do
|
7
|
+
json.map do
|
8
|
+
json.id map.id.to_s
|
9
|
+
json.slug map.slug
|
10
|
+
json.parent_slug map.parent_slug
|
11
|
+
json.description map.description
|
12
|
+
json.w map.w
|
13
|
+
json.h map.h
|
14
|
+
json.img_path map.img_path
|
15
|
+
json.updated_at map.updated_at
|
16
|
+
|
17
|
+
json.markers do
|
18
|
+
json.array! map.markers do |marker|
|
19
|
+
json.name marker.name
|
20
|
+
json.slug marker.slug
|
21
|
+
json.x marker.x
|
22
|
+
json.y marker.y
|
23
|
+
json.w marker.w
|
24
|
+
json.h marker.h
|
25
|
+
json.img_path marker.img_path
|
26
|
+
json.title_img_path marker.title_img_path
|
27
|
+
json.item_type marker.item_type
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
@@ -23,7 +23,7 @@ json.newsitems do
|
|
23
23
|
if item.gallery.is_premium
|
24
24
|
json.premium_tier item.gallery.premium_tier
|
25
25
|
json.is_premium item.gallery.premium_tier > 0
|
26
|
-
json.is_purchased current_user
|
26
|
+
json.is_purchased current_user&.profile&.has_premium_purchase( item.gallery )
|
27
27
|
json.partial! 'ishapi/photos/index', :photos => [ item.gallery.photos[0] ]
|
28
28
|
else
|
29
29
|
json.partial! 'ishapi/photos/index', :photos => item.gallery.photos
|
@@ -48,7 +48,7 @@ json.newsitems do
|
|
48
48
|
if item.report.is_premium
|
49
49
|
json.premium_tier item.report.premium_tier
|
50
50
|
json.is_premium item.report.premium_tier > 0
|
51
|
-
json.is_purchased current_user
|
51
|
+
json.is_purchased current_user&.profile&.has_premium_purchase( item.report )
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -13,8 +13,6 @@ json.cache! key do
|
|
13
13
|
json.subhead @site.subhead
|
14
14
|
json.description @site.description
|
15
15
|
|
16
|
-
json.email @current_user.email
|
17
|
-
|
18
16
|
json.is_ads_enabled @site.is_ads_enabled
|
19
17
|
json.play_videos_in_preview @site.play_videos_in_preview
|
20
18
|
json.newsitems_per_page @site.newsitems_per_page
|
data/config/routes.rb
CHANGED
@@ -66,6 +66,7 @@ Ishapi::Engine.routes.draw do
|
|
66
66
|
post 'users/profile/update', :to => 'users#update'
|
67
67
|
get 'users/profile', :to => 'users#show' # @TODO: only for testing! accessToken must be hidden
|
68
68
|
match 'users/long_term_token', to: 'application#long_term_token', via: [ :get, :post ]
|
69
|
+
post 'users/login', to: 'users#login'
|
69
70
|
|
70
71
|
get 'venues', :to => 'venues#index'
|
71
72
|
get 'venues/view/:venuename', :to => 'venues#show'
|
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.149
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -247,6 +247,7 @@ files:
|
|
247
247
|
- app/views/ishapi/galleries/show.jbuilder
|
248
248
|
- app/views/ishapi/galleries/show_premium_locked.jbuilder
|
249
249
|
- app/views/ishapi/galleries/show_premium_unlocked.jbuilder
|
250
|
+
- app/views/ishapi/maps/_show.jbuilder
|
250
251
|
- app/views/ishapi/maps/index.jbuilder
|
251
252
|
- app/views/ishapi/maps/show.jbuilder
|
252
253
|
- app/views/ishapi/measurements/_show.jbuilder
|