ishapi 0.1.8.153 → 0.1.8.157

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: 754fefba120e1ee7f87e94a2b3da3a450e07c86e7bd135055cb2240d7ccb5ef7
4
- data.tar.gz: ff7748716f5c58c458f6635386a77164c943d30b792f1c854a4d8b6977744e9d
3
+ metadata.gz: 2ef82397f73230341a9eb9b0b5775568c25c102e9a1f86863022bb9b08bb2006
4
+ data.tar.gz: 3b341765539250121ca07733bb337f3b74e2fa7dbda45e22268136e1e942664f
5
5
  SHA512:
6
- metadata.gz: b44159ee3983c79213b8e2ab0d98c1aaec009268b1d701d276e99475bde50235c233d03a249c03f80158d0507565f06c50aeb9cd4dcb4ac431274d07d0772abe
7
- data.tar.gz: 92ff67762868d928066fc0fb4d15602f0166da0f7ba74b552c46fd5261bc0a9d26f134768067f1c42ec87872418ff5c983561dc90e975c1e15d5c9db9f3c3f71
6
+ metadata.gz: a16446d1cdb7e5782319f3f3a0e657538fcb7984c017cb0f6b6f1d59ea1d72617b611ae37adaba4c446eefec2890becd12092c979ea334f7f6589c9825d3cf8c
7
+ data.tar.gz: 6887ee7845f45f8d379389fa8ce018b60759b6bbfbad5c2483200cefebb0fb8ff88d484c21d06abed4cfca3daa091b92853ba992394bdc75ebc8eafa1ed9e3df
@@ -9,7 +9,7 @@ module Ishapi
9
9
  params['domain'] = 'tgm.piousbox.com'
10
10
 
11
11
  response = ::HTTParty.get "https://graph.facebook.com/v5.0/oauth/access_token?grant_type=fb_exchange_token&" +
12
- "client_id=#{FB[params['domain']][:app]}&client_secret=#{FB[params['domain']][:secret]}&" +
12
+ "client_id=#{::FB[params['domain']][:app]}&client_secret=#{::FB[params['domain']][:secret]}&" +
13
13
  "fb_exchange_token=#{accessToken}"
14
14
  j = JSON.parse response.body
15
15
  @long_term_token = j['access_token']
@@ -35,7 +35,6 @@ module Ishapi
35
35
  decoded = decode(params[:jwt_token])
36
36
  @current_user = User.find decoded['user_id']
37
37
  rescue JWT::ExpiredSignature, JWT::DecodeError => e
38
- puts! e, 'ee1'
39
38
  flash[:notice] = 'You arent logged in, or you have been logged out.'
40
39
  # @current_user = User.new
41
40
  end
@@ -61,7 +60,7 @@ module Ishapi
61
60
  end
62
61
 
63
62
  # jwt
64
- def encode(payload, exp = 2.hours.from_now)
63
+ def encode(payload, exp = 48.hours.from_now) # @TODO: definitely change, right now I expire once in 2 days.
65
64
  payload[:exp] = exp.to_i
66
65
  JWT.encode(payload, Rails.application.secrets.secret_key_base.to_s)
67
66
  end
@@ -21,7 +21,7 @@ module Ishapi
21
21
  end
22
22
 
23
23
  def show
24
- @gallery = ::Gallery.unscoped.find_by :galleryname => params[:galleryname]
24
+ @gallery = ::Gallery.unscoped.find_by :slug => params[:slug]
25
25
  authorize! :show, @gallery
26
26
  if @gallery.premium?
27
27
  if current_user&.profile&.has_premium_purchase( @gallery )
@@ -1,16 +1,8 @@
1
1
  require_dependency "ishapi/application_controller"
2
2
  module Ishapi
3
3
  class MapsController < ApplicationController
4
-
5
4
  before_action :check_profile, only: [ :show ]
6
5
 
7
- =begin
8
- def index
9
- authorize! :index, ::Gameui::Map
10
- @maps = ::Gameui::Map.all
11
- end
12
- =end
13
-
14
6
  def show
15
7
  @map = ::Gameui::Map.find_by slug: params[:slug]
16
8
  @markers = @map.markers.where( is_active: true )
@@ -23,16 +15,14 @@ module Ishapi
23
15
  @markers = @markers.order_by( ordering: :asc )
24
16
  end
25
17
 
26
- # @TODO: move to models
18
+ ## @TODO: figure this out eventually
27
19
  if city = City.where( cityname: @map.slug ).first
28
- @newsitems = city.newsitems
20
+ # @newsitems = city.newsitems
29
21
  @galleries = city.galleries
30
22
  @reports = city.reports
31
23
  @videos = city.videos
32
24
  end
33
25
 
34
- puts! @map, 'prod map'
35
-
36
26
  authorize! :show, @map
37
27
  end
38
28
 
@@ -3,7 +3,7 @@ module Ishapi
3
3
  class ReportsController < ApplicationController
4
4
 
5
5
  def show
6
- @report = Report.unscoped.find_by :name_seo => params[:name_seo]
6
+ @report = Report.unscoped.find_by :slug => params[:slug]
7
7
  authorize! :show, @report
8
8
  end
9
9
 
@@ -13,9 +13,9 @@ module Ishapi
13
13
 
14
14
  def show
15
15
  begin
16
- @tag = Tag.find_by( :name_seo => params[:tagname] )
16
+ @tag = Tag.find_by( slug: params[:slug] )
17
17
  rescue Mongoid::Errors::DocumentNotFound
18
- @tag = Tag.find params[:tagname]
18
+ @tag = Tag.find params[:slug]
19
19
  end
20
20
  authorize! :show, @tag
21
21
  end
@@ -12,7 +12,7 @@ module Ishapi
12
12
  end
13
13
 
14
14
  def show
15
- @venue = Venue.find_by :name_seo => params[:venuename]
15
+ @venue = Venue.find_by :slug => params[:venuename]
16
16
  authorize! :show, @venue
17
17
  end
18
18
 
@@ -3,7 +3,7 @@ module Ishapi
3
3
  class VideosController < ApplicationController
4
4
 
5
5
  def show
6
- @video = Video.unscoped.find_by :name_seo => params[:name_seo]
6
+ @video = Video.unscoped.find_by :slug => params[:slug]
7
7
  authorize! :show, @video
8
8
  end
9
9
 
@@ -17,4 +17,4 @@ if item.city
17
17
  json.cityname item.city.cityname
18
18
  end
19
19
  json.subhead item.subhead
20
- json.description item.descr
20
+ json.description item.descr
@@ -21,7 +21,7 @@ json.features do
21
21
  r = feature.report
22
22
  json.name r.name
23
23
  json.subhead r.subhead
24
- json.reportname r.name_seo
24
+ json.reportname r.slug
25
25
  if r.photo
26
26
  json.photo_url r.photo.photo.url( :thumb )
27
27
  end
@@ -31,7 +31,7 @@ json.features do
31
31
  r = feature.gallery
32
32
  json.name r.name
33
33
  json.subhead r.subhead
34
- json.galleryname r.galleryname
34
+ json.slug r.slug
35
35
  if r.photos[0]
36
36
  json.photo_url r.photos[0].photo.url( :thumb )
37
37
  end
@@ -7,11 +7,11 @@
7
7
  json.id gallery.id.to_s
8
8
  json.item_type gallery.class.name
9
9
  json.name gallery.name
10
- json.galleryname gallery.galleryname
10
+ json.slug gallery.slug
11
11
  json.description gallery.description
12
12
  json.username gallery.username || 'piousbox'
13
13
  json.n_photos gallery.photos.length
14
- json.slug gallery.galleryname
14
+ json.slug gallery.slug
15
15
  json.subhead gallery.subhead
16
16
  json.partial! 'ishapi/application/meta', :item => gallery
17
17
  if gallery.is_premium
@@ -21,4 +21,4 @@ if gallery.is_premium
21
21
  json.partial! 'ishapi/photos/index', :photos => [ gallery.photos[0] ]
22
22
  else
23
23
  json.partial! 'ishapi/photos/index', :photos => gallery.photos
24
- end
24
+ end
@@ -6,12 +6,12 @@
6
6
  json.array! @galleries do |gallery|
7
7
  json.id gallery.id.to_s
8
8
  json.name gallery.name
9
- json.galleryname gallery.galleryname
10
- json.slug gallery.galleryname
9
+ json.slug gallery.slug
10
+ json.slug gallery.slug
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.tag_names gallery.tags.map &:name_seo
14
+ json.tag_names gallery.tags.map &:slug
15
15
  json.venuename gallery.venue.name if gallery.venue
16
16
  json.partial! 'ishapi/photos/index', :photos => gallery.photos
17
17
  end
@@ -2,6 +2,8 @@
2
2
  # ishapi / maps / _show
3
3
  #
4
4
 
5
+ ## @TODO: make sure that _show.jbuilder and show.jbuilder are reasonably deduped
6
+
5
7
  this_key = [ map, params.permit! ]
6
8
  json.cache! this_key do
7
9
  json.map do
@@ -16,6 +18,16 @@ json.cache! this_key do
16
18
 
17
19
  json.partial! 'ishapi/markers/index', map: map
18
20
 
21
+ ## I removed json parsing from here! _vp_ 2021-10-14
22
+ ## I added json parsing here! _vo_ 2021-10-19
23
+ if map.parent_slug.present?
24
+ json.config JSON.parse @map.parent.config
25
+ json.labels JSON.parse @map.parent.labels
26
+ else
27
+ json.config JSON.parse @map.config
28
+ json.labels JSON.parse @map.labels
29
+ end
30
+
19
31
  end
20
32
  end
21
33
 
@@ -26,6 +26,16 @@ json.cache! this_key do
26
26
  end
27
27
  end
28
28
 
29
+ ## I removed json parsing from here! _vp_ 2021-10-14
30
+ ## I added json parsing here! _vo_ 2021-10-19
31
+ if @map.parent_slug.present?
32
+ json.config JSON.parse @map.parent.config
33
+ json.labels JSON.parse @map.parent.labels
34
+ else
35
+ json.config JSON.parse @map.config
36
+ json.labels JSON.parse @map.labels
37
+ end
38
+
29
39
  json.partial! 'ishapi/markers/index', map: @map
30
40
 
31
41
  if @newsitems
@@ -2,6 +2,8 @@
2
2
  # ishapi / newsitems / _index
3
3
  #
4
4
 
5
+ puts! newsitems, 'newsitems idx'
6
+
5
7
  json.n_newsitems newsitems.count
6
8
  json.newsitems do
7
9
  json.array! newsitems do |item|
@@ -9,14 +11,16 @@ json.newsitems do
9
11
  json.created_at item.created_at
10
12
  json.updated_at item.updated_at
11
13
 
14
+ json.description item.description
15
+
12
16
  if item.gallery
13
17
  json.id item.gallery_id.to_s
14
18
  json.item_type item.gallery.class.name
15
19
  json.name item.gallery.name
16
- json.galleryname item.gallery.galleryname
20
+ json.slug item.gallery.slug
17
21
  json.username item.username || item.gallery.username || 'donor-default'
18
22
  json.n_photos item.gallery.photos.length
19
- json.slug item.gallery.galleryname
23
+ json.slug item.gallery.slug
20
24
  json.subhead item.gallery.subhead
21
25
  json.partial! 'ishapi/application/meta', :item => item.gallery
22
26
  if item.gallery.is_premium
@@ -30,24 +34,29 @@ json.newsitems do
30
34
  end
31
35
 
32
36
  if item.report
33
- json.id item.report_id.to_s
34
- json.item_type item.report.class.name
35
- json.name item.report.name
36
- json.reportname item.report.name_seo
37
- json.subhead item.report.subhead
38
- json.username item.report.user_profile.name if item.report.user_profile
37
+ if item.report.item_type == 'longscroll' # this allows you to have a wall of scrollable text instead of clickable items
38
+ json.description item.report.descr
39
39
 
40
- if item.report.photo
41
- json.photo_s169_url item.report.photo.photo.url( :s169 )
42
- json.photo_thumb2_url item.report.photo.photo.url( :thumb2 )
43
- end
40
+ else
41
+ json.id item.report_id.to_s
42
+ json.item_type item.report.class.name
43
+ json.name item.report.name
44
+ json.reportname item.report.slug
45
+ json.subhead item.report.subhead
46
+ json.username item.report.user_profile.name if item.report.user_profile
47
+
48
+ if item.report.photo
49
+ json.photo_s169_url item.report.photo.photo.url( :s169 )
50
+ json.photo_thumb2_url item.report.photo.photo.url( :thumb2 )
51
+ end
44
52
 
45
- json.partial! 'ishapi/application/meta', :item => item.report
53
+ json.partial! 'ishapi/application/meta', :item => item.report
46
54
 
47
- if item.report.is_premium
48
- json.premium_tier item.report.premium_tier
49
- json.is_premium item.report.premium_tier > 0
50
- json.is_purchased current_user&.profile&.has_premium_purchase( item.report )
55
+ if item.report.is_premium
56
+ json.premium_tier item.report.premium_tier
57
+ json.is_premium item.report.premium_tier > 0
58
+ json.is_purchased current_user&.profile&.has_premium_purchase( item.report )
59
+ end
51
60
  end
52
61
  end
53
62
 
@@ -9,7 +9,7 @@ json.reports do
9
9
  # json.id report.id.to_s
10
10
  json.created_at report.created_at
11
11
  json.name report.name
12
- json.slug report.name_seo
12
+ json.slug report.slug
13
13
  json.description report.descr
14
14
 
15
15
  if report.photo
@@ -9,7 +9,7 @@ json.cache! key do
9
9
  json.report do
10
10
  json.id @report.id.to_s
11
11
  json.name @report.name
12
- json.reportname @report.name_seo
12
+ json.reportname @report.slug
13
13
  if @report.photo
14
14
  json.photo_url @report.photo.photo.url( :small )
15
15
  json.thumb_url @report.photo.photo.url( :thumb )
@@ -6,7 +6,7 @@
6
6
  json.tags do
7
7
  json.array! tags do |tag|
8
8
  json.name tag.name
9
- json.slug tag.name_seo
9
+ json.slug tag.slug
10
10
  end
11
11
  end
12
12
 
@@ -6,6 +6,6 @@
6
6
 
7
7
  json.id tag.id.to_s
8
8
  json.name tag.name
9
- json.tagname tag.tagname
9
+ json.slug tag.slug
10
10
 
11
11
  json.partial! 'ishapi/newsitems/index', :newsitems => tag.newsitems.limit(1)
@@ -5,6 +5,6 @@
5
5
 
6
6
  json.array! @tags do |tag|
7
7
  json.name tag.name
8
- json.slug tag.name_seo
8
+ json.slug tag.slug
9
9
  end
10
10
 
@@ -5,8 +5,9 @@
5
5
  #
6
6
 
7
7
  json.name @tag.name
8
- json.slug @tag.tagname
8
+ json.slug @tag.slug
9
9
 
10
+ json.partial! 'ishapi/features/index', :features => @tag.features, :resource => @tag
10
11
  json.partial! 'ishapi/newsitems/index', :newsitems => @tag.newsitems.page( params[:newsitems_page] ).per( params[:newsitems_per] || 25 )
11
12
  json.partial! 'ishapi/reports/index', :reports => @tag.reports.page( params[:reports_page] ).per( params[:reports_per] || 25 )
12
13
  json.partial! 'ishapi/galleries/index', :galleries => @tag.galleries.page( params[:galleries_page] ).per( params[:galleries_per] || 25 )
@@ -1,15 +1,15 @@
1
1
 
2
2
 
3
- json.name @profile.name
4
- # json.username @profile.username
5
- json.email @profile.email
3
+ json.name @profile.name
4
+ json.username @profile.username
5
+ json.email @profile.email
6
+ json.profile_photo_url @profile.profile_photo.photo.url( :thumb ) if @profile.profile_photo
6
7
 
7
8
  json.n_reports @profile.reports.count
8
9
  json.n_galleries @profile.galleries.count
9
10
  json.n_videos @profile.videos.count
10
- json.n_stars @profile.n_stars
11
-
12
- json.n_unlocks @profile.n_unlocks
11
+ json.n_stars @profile.n_stars # @TODO: which one is deprecated?
12
+ json.n_unlocks @profile.n_unlocks # @TODO: which one is deprecated?
13
13
 
14
14
  if @profile.current_city
15
15
  json.current_city @profile.current_city
@@ -7,13 +7,15 @@ json.n_venues venues.count
7
7
  json.venues do
8
8
  json.array! venues do |venue|
9
9
  json.id venue.id.to_s
10
+
11
+ json.address venue.address if venue.address.present?
10
12
  json.name venue.name
11
- json.name_seo venue.name_seo
13
+ json.slug venue.slug
12
14
  json.subhead venue.subhead
13
15
  json.description venue.descr
14
16
  json.x venue.x
15
17
  json.y venue.y
16
- json.photo venue.profile_photo.photo.url( :thumb ) if venue.profile_photo
18
+ json.photo venue.profile_photo ? venue.profile_photo.photo.url( :thumb ) : image_url('missing.png')
17
19
  json.partial! 'ishapi/tags/index', :tags => venue.tags
18
20
  end
19
21
  end
@@ -7,7 +7,7 @@ key = [ @venue, params.permit! ]
7
7
  json.cache! key do
8
8
  json.venue do
9
9
  json.name @venue.name
10
- json.venuename @venue.name_seo
10
+ json.venuename @venue.slug
11
11
  json.description @venue.descr
12
12
  end
13
13
  end
data/config/routes.rb CHANGED
@@ -19,8 +19,8 @@ Ishapi::Engine.routes.draw do
19
19
 
20
20
  get 'galleries', :to => 'galleries#index'
21
21
  post 'galleries', :to => 'galleries#index'
22
- get 'galleries/view/:galleryname', :to => 'galleries#show'
23
- post 'galleries/view/:galleryname', :to => 'galleries#show'
22
+ get 'galleries/view/:slug', :to => 'galleries#show'
23
+ post 'galleries/view/:slug', :to => 'galleries#show'
24
24
 
25
25
  post 'invoices/search', :to => 'invoices#search'
26
26
 
@@ -47,7 +47,7 @@ Ishapi::Engine.routes.draw do
47
47
  get 'profiles/view/:username', :to => 'user_profiles#show'
48
48
 
49
49
  get 'reports', :to => 'reports#index'
50
- get 'reports/view/:name_seo', :to => 'reports#show'
50
+ get 'reports/view/:slug', :to => 'reports#show'
51
51
 
52
52
  get 'sites/view/:domain', :to => 'sites#show', :constraints => { :domain => /[^\/]+/ }
53
53
  post 'sites/view/:domain', :to => 'sites#show', :constraints => { :domain => /[^\/]+/ }
@@ -58,7 +58,7 @@ Ishapi::Engine.routes.draw do
58
58
 
59
59
  post 'stars/buy', to: 'gameui#buy_stars'
60
60
 
61
- get 'tags/view/:tagname', :to => 'tags#show'
61
+ get 'tags/view/:slug', :to => 'tags#show'
62
62
  get 'test', to: 'application#test'
63
63
 
64
64
  post 'users/fb_sign_in', :to => 'users#fb_sign_in'
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.153
4
+ version: 0.1.8.157
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-28 00:00:00.000000000 Z
11
+ date: 2021-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails