ishapi 0.1.8.147 → 0.1.8.151

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: 37a74ed060c1c14807a40188d3cb99e1a7b67910a88dfc8ab4a97ad01f4eb11c
4
- data.tar.gz: 5c3529a4f9b79117cb4d5c45e92a0d24f4194717f64fe8c2c2f71e3e13543ebb
3
+ metadata.gz: 48a60ea3b0572e7a03c6367c503ade90a23d0c9c668f7126328cf69fb6edd6f0
4
+ data.tar.gz: '059b472d0856d0984b540d92207035c0c7e5593a050ae0693d4e309351427f02'
5
5
  SHA512:
6
- metadata.gz: 19ecdf1027c55c91fdc1526fcc7f0fb1d80e47c60d802b01733ab6ba9cd7de0a9eb8f4a31b5dc857758a0f7abf531cebc190c6c8556ae31d20c91e9ad65b5c17
7
- data.tar.gz: 040f38f5013b4ee85b9385b746a4ce01464613e1c1c2ea315099fc69b7b2fb4d6380dc343e5cf0ad14dc07ca854a000a792182280c3bcaea30fc1c5cf4091bbb
6
+ metadata.gz: 9730c397b9c7468348771f3f25d26a20d3544ab22930ad58363f7b0b79ee1bc9a61b625e7d6c7f1a92c76e12eee9dc875f7b857fe597c9f839e179a29e982978
7
+ data.tar.gz: 53770e986e3fb7f2f84ff09ac672444961d8eeb79dbafc285fc1961017866a4ca6ef85732b805064b5fc70df61a93f5977a30eec1ab51f8e9135503a89190701
@@ -4,10 +4,12 @@ module Ishapi
4
4
 
5
5
  before_action :check_profile, only: [ :show ]
6
6
 
7
+ =begin
7
8
  def index
8
9
  authorize! :index, ::Gameui::Map
9
10
  @maps = ::Gameui::Map.all
10
11
  end
12
+ =end
11
13
 
12
14
  def show
13
15
  @map = ::Gameui::Map.find_by slug: params[:slug]
@@ -21,12 +23,16 @@ module Ishapi
21
23
  @markers = @markers.order_by( ordering: :asc )
22
24
  end
23
25
 
26
+ # @TODO: move to models
24
27
  if city = City.where( cityname: @map.slug ).first
25
28
  @newsitems = city.newsitems
26
29
  @galleries = city.galleries
27
30
  @reports = city.reports
28
31
  @videos = city.videos
29
32
  end
33
+
34
+ puts! @map, 'prod map'
35
+
30
36
  authorize! :show, @map
31
37
  end
32
38
 
@@ -1,7 +1,6 @@
1
1
 
2
- class Ishapi::My::GalleriesController < Ishapi::My::MyController
2
+ class Ishapi::My::GalleriesController < Ishapi::ApplicationController
3
3
 
4
- ## expects params[:jwt_token]
5
4
  def index
6
5
  authorize! :my_index, Gallery
7
6
  @galleries = @current_user.profile.galleries.unscoped.where( is_trash: false ).order_by( created_at: :desc ).limit(20)
@@ -3,19 +3,20 @@ module Ishapi
3
3
  module My
4
4
  class MyController < Ishapi::ApplicationController
5
5
 
6
- # before_action :set_profile # this is DoS on FB - disabled
7
- # before_action :do_login
8
6
  before_action :check_profile
9
7
 
8
+ # @TODO: move to users_controller
10
9
  def account
11
10
  @profile = current_user&.profile
12
11
  authorize! :show, @profile
12
+ render 'ishapi/users/account'
13
13
  rescue CanCan::AccessDenied
14
14
  render json: {
15
15
  status: :not_ok,
16
16
  }, status: 401
17
17
  end
18
18
 
19
+ =begin
19
20
  private
20
21
 
21
22
  def do_login
@@ -33,6 +34,7 @@ module Ishapi
33
34
  return
34
35
  end
35
36
  end
37
+ =end
36
38
 
37
39
  end
38
40
  end
@@ -1,14 +1,11 @@
1
1
 
2
- module Ishapi
3
- module My
4
- class ReportsController < Ishapi::My::MyController
5
2
 
6
- def index
7
- authorize! :my_index, Report
8
- @reports = @profile.reports
9
- end
3
+ class Ishapi::My::ReportsController < Ishapi::ApplicationController
10
4
 
11
- end
5
+ def index
6
+ authorize! :my_index, Report
7
+ @reports = @profile.reports
12
8
  end
9
+
13
10
  end
14
11
 
@@ -1,14 +1,10 @@
1
1
 
2
- module Ishapi
3
- module My
4
- class VideosController < Ishapi::My::MyController
2
+ class Ishapi::My::VideosController < Ishapi::ApplicationController
5
3
 
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
4
+ def index
5
+ authorize! :my_index, Video
6
+ @videos = @current_user.profile.videos.unscoped.where( is_trash: false ).order_by( created_at: :desc ).limit(20)
12
7
  end
8
+
13
9
  end
14
10
 
@@ -2,9 +2,20 @@ require_dependency "ishapi/application_controller"
2
2
 
3
3
  module Ishapi
4
4
  class UsersController < ApplicationController
5
- before_action :set_profile, :only => [ :fb_sign_in, :show ]
6
5
 
7
- skip_authorization_check only: %i| login |
6
+ skip_authorization_check only: %i| fb_sign_in login |
7
+
8
+ before_action :check_profile, only: %i| account |
9
+
10
+ def account
11
+ @profile = current_user&.profile
12
+ authorize! :show, @profile
13
+ render 'ishapi/users/account'
14
+ rescue CanCan::AccessDenied
15
+ render json: {
16
+ status: :not_ok,
17
+ }, status: 401
18
+ end
8
19
 
9
20
  def fb_sign_in
10
21
  authorize! :fb_sign_in, Ishapi
@@ -12,10 +23,6 @@ module Ishapi
12
23
  render :action => 'show'
13
24
  end
14
25
 
15
- def show
16
- authorize! :fb_sign_in, Ishapi
17
- end
18
-
19
26
  def login
20
27
  @current_user = User.where( email: params[:email] ).first
21
28
  if !@current_user
@@ -27,12 +34,16 @@ module Ishapi
27
34
 
28
35
  # send the jwt to client
29
36
  @jwt_token = encode(user_id: @current_user.id.to_s)
37
+ @profile = @current_user.profile
38
+
39
+ =begin
30
40
  render json: {
31
41
  email: @current_user.email,
32
42
  jwt_token: @jwt_token,
33
- long_term_token: @long_term_token,
34
43
  n_unlocks: @current_user.profile.n_unlocks,
35
44
  }
45
+ =end
46
+
36
47
  end
37
48
  end
38
49
 
@@ -0,0 +1,22 @@
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.image.image.url(:original)
15
+ json.updated_at map.updated_at
16
+
17
+ json.partial! 'ishapi/markers/index', map: map
18
+
19
+ end
20
+ end
21
+
22
+
@@ -11,9 +11,13 @@ json.cache! this_key do
11
11
  json.description @map.description
12
12
  json.w @map.w
13
13
  json.h @map.h
14
- json.img_path @map.img_path
14
+ json.img_path @map.image.image.url(:original)
15
15
  json.updated_at @map.updated_at
16
16
 
17
+ if @map.map
18
+ json.partial! 'ishapi/maps/show', map: @map.map
19
+ end
20
+
17
21
  json.breadcrumbs do
18
22
  json.array! @map.breadcrumbs do |b|
19
23
  json.name b[:name]
@@ -22,19 +26,7 @@ json.cache! this_key do
22
26
  end
23
27
  end
24
28
 
25
- json.markers do
26
- json.array! @markers do |marker|
27
- json.name marker.name
28
- json.slug marker.slug
29
- json.x marker.x
30
- json.y marker.y
31
- json.w marker.w
32
- json.h marker.h
33
- json.img_path marker.img_path
34
- json.title_img_path marker.title_img_path
35
- json.item_type marker.item_type
36
- end
37
- end
29
+ json.partial! 'ishapi/markers/index', map: @map
38
30
 
39
31
  if @newsitems
40
32
  json.partial! 'ishapi/newsitems/index', :newsitems => @newsitems
@@ -0,0 +1,20 @@
1
+ #
2
+ # ishapi / markers / _index
3
+ #
4
+
5
+ json.markers do
6
+ json.array! map.markers do |marker|
7
+ json.name marker.name
8
+ json.slug marker.slug
9
+ json.x marker.x
10
+ json.y marker.y
11
+ json.w marker.w
12
+ json.h marker.h
13
+ json.centerOffsetX marker.centerOffsetX
14
+ json.centerOffsetY marker.centerOffsetY
15
+ json.img_path marker.image.image.url(:original)
16
+ json.title_img_path marker.title_image.image.url(:thumb)
17
+ json.item_type marker.item_type
18
+ json.url marker.url
19
+ end
20
+ end
@@ -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.profile.has_premium_purchase( item.gallery )
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.profile.has_premium_purchase( item.report )
51
+ json.is_purchased current_user&.profile&.has_premium_purchase( item.report )
52
52
  end
53
53
  end
54
54
 
@@ -1,6 +1,7 @@
1
1
 
2
+
2
3
  json.name @profile.name
3
- json.username @profile.username
4
+ # json.username @profile.username
4
5
  json.email @profile.email
5
6
 
6
7
  json.n_reports @profile.reports.count
@@ -14,3 +15,8 @@ if @profile.current_city
14
15
  json.current_city @profile.current_city
15
16
  end
16
17
 
18
+ json.bookmarks @profile.bookmarks do |b|
19
+ json.name b.name
20
+ json.slug b.slug
21
+ end
22
+
@@ -0,0 +1,2 @@
1
+
2
+ json.partial! 'account'
@@ -0,0 +1,5 @@
1
+
2
+ json.email @profile.email
3
+ json.n_unlocks @profile.n_unlocks
4
+ json.jwt_token @jwt_token
5
+ json.partial! 'account'
data/config/routes.rb CHANGED
@@ -27,8 +27,8 @@ Ishapi::Engine.routes.draw do
27
27
  get 'maps', to: 'maps#index'
28
28
  get 'maps/view/:slug', to: 'maps#show'
29
29
  get 'markers/view/:slug', to: 'maps#show_marker'
30
- get "/my/account", to: "my/my#account"
31
- post "/my/account", to: "my/my#account"
30
+ get "/my/account", to: "users#account"
31
+ post "/my/account", to: "users#account"
32
32
  namespace :my do
33
33
  get 'galleries', to: 'galleries#index'
34
34
  get 'newsitems', to: 'newsitems#index'
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.147
4
+ version: 0.1.8.151
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-17 00:00:00.000000000 Z
11
+ date: 2021-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -206,7 +206,7 @@ files:
206
206
  - app/controllers/ishapi/maps_controller.rb
207
207
  - app/controllers/ishapi/measurements_controller.rb
208
208
  - app/controllers/ishapi/my/galleries_controller.rb
209
- - app/controllers/ishapi/my/my_controller.rb
209
+ - app/controllers/ishapi/my/my_controller.rb-trash
210
210
  - app/controllers/ishapi/my/reports_controller.rb
211
211
  - app/controllers/ishapi/my/videos_controller.rb
212
212
  - app/controllers/ishapi/newsitems_controller.rb
@@ -247,10 +247,11 @@ 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
253
+ - app/views/ishapi/markers/_index.jbuilder
252
254
  - app/views/ishapi/measurements/_show.jbuilder
253
- - app/views/ishapi/my/my/account.jbuilder
254
255
  - app/views/ishapi/my/videos/index.jbuilder
255
256
  - app/views/ishapi/newsitems/_index.jbuilder
256
257
  - app/views/ishapi/newsitems/index.jbuilder
@@ -268,7 +269,10 @@ files:
268
269
  - app/views/ishapi/tags/index.jbuilder
269
270
  - app/views/ishapi/tags/show.jbuilder
270
271
  - app/views/ishapi/user_profiles/show.jbuilder
272
+ - app/views/ishapi/users/_account.jbuilder
271
273
  - app/views/ishapi/users/_index.jbuilder
274
+ - app/views/ishapi/users/account.jbuilder
275
+ - app/views/ishapi/users/login.jbuilder
272
276
  - app/views/ishapi/users/show.jbuilder
273
277
  - app/views/ishapi/venues/_index.jbuilder
274
278
  - app/views/ishapi/venues/index.jbuilder