ishapi 0.1.8.284 → 0.1.8.286
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 +3 -0
- data/app/controllers/ishapi/email_unsubscribes_controller.rb +29 -0
- data/app/controllers/ishapi/galleries_controller.rb +3 -3
- data/app/controllers/ishapi/lead_actions_controller.rb +23 -0
- data/app/controllers/ishapi/obfuscated_redirects_controller.rb +27 -0
- data/app/controllers/ishapi/videos_controller.rb +1 -1
- data/app/jobs/ishapi/email_message_intake_job.rb +22 -21
- data/app/models/ishapi/ability.rb +17 -7
- data/app/views/ishapi/application_mailer/forwarder_notify.html.erb +14 -1
- data/app/views/ishapi/email_unsubscribes/create.haml +2 -0
- data/app/views/ishapi/obfuscated_redirects/show.haml +4 -0
- data/config/routes.rb +14 -5
- data/lib/ishapi.rb +2 -2
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5c0832ec3c2109607e7d612d9daf38dbff6e2b710879710f71e358ed5304ea3
|
4
|
+
data.tar.gz: e2ad530fe9863aa53e532b1e37ab628a179b49da40a5edb31fd4c0abe080e721
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15b2df35cdc3dde6cece928bdf20427f4603b82de04e52cb9ca901ba1ebade45d338487d80de8013f87fc3a9225158d6ee46dafdf041bcfdd0f003cee23fc46d
|
7
|
+
data.tar.gz: 6cdaba9a607c484cff7a481e2edbe50071a3ec3ea3881392487f8406f85a0bebacfda86842a2bb83ed6297692d9a509a64dcad54f66cc2ec338076e83e5b36c1
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require_dependency "ishapi/application_controller"
|
2
|
+
|
3
|
+
module ::Ishapi
|
4
|
+
class EmailUnsubscribesController < ApplicationController
|
5
|
+
|
6
|
+
layout false
|
7
|
+
|
8
|
+
def create
|
9
|
+
authorize! :open_permission, ::Ishapi
|
10
|
+
@lead = Lead.find params[:lead_id]
|
11
|
+
|
12
|
+
if( !params[:token] ||
|
13
|
+
@lead.unsubscribe_token != params[:token] )
|
14
|
+
render code: 400, message: "We're sorry, but something went wrong. Please try again later."
|
15
|
+
return
|
16
|
+
end
|
17
|
+
|
18
|
+
@unsubscribe = ::Ish::EmailUnsubscribe.find_or_create_by({
|
19
|
+
lead_id: params[:lead_id],
|
20
|
+
template_id: params[:template_id],
|
21
|
+
campaign_id: params[:campaign_id],
|
22
|
+
})
|
23
|
+
@unsubscribe.update_attributes({
|
24
|
+
unsubscribed_at: Time.now,
|
25
|
+
})
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -7,7 +7,7 @@ module Ishapi
|
|
7
7
|
before_action :check_jwt
|
8
8
|
|
9
9
|
def index
|
10
|
-
@galleries = Gallery.all
|
10
|
+
@galleries = Gallery.all.published
|
11
11
|
authorize! :index, Gallery
|
12
12
|
if params[:domain]
|
13
13
|
@site = Site.find_by( :domain => params[:domain], :lang => 'en' )
|
@@ -17,8 +17,8 @@ module Ishapi
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def show
|
20
|
-
@gallery
|
21
|
-
@gallery ||= ::Gallery.unscoped.where( id: params[:slug]
|
20
|
+
@gallery = ::Gallery.unscoped.where( slug: params[:slug] ).first
|
21
|
+
@gallery ||= ::Gallery.unscoped.where( id: params[:slug] ).first
|
22
22
|
authorize! :show, @gallery
|
23
23
|
|
24
24
|
@photos = @gallery.photos.order_by( ordering: :asc )
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_dependency "ishapi/application_controller"
|
2
|
+
|
3
|
+
module Ishapi
|
4
|
+
class LeadActionsController < ApplicationController
|
5
|
+
|
6
|
+
def create
|
7
|
+
if !params[:lead_id]
|
8
|
+
render json: { status: :ok }
|
9
|
+
return
|
10
|
+
end
|
11
|
+
tmpl = Office::LeadActionTemplate.find( params[:tmpl_id] )
|
12
|
+
puts! tmpl, 'tmpl'
|
13
|
+
lead_action = Office::LeadAction.find_or_create_by({
|
14
|
+
lead_id: params[:lead_id],
|
15
|
+
tmpl_id: params[:tmpl_id],
|
16
|
+
})
|
17
|
+
lead_action.params = params.to_json
|
18
|
+
lead_action.save
|
19
|
+
render json: { status: :ok, message: 'saved' }
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_dependency "ishapi/application_controller"
|
2
|
+
|
3
|
+
module Ishapi
|
4
|
+
class ObfuscatedRedirectsController < ApplicationController
|
5
|
+
|
6
|
+
def show
|
7
|
+
@obf = Office::ObfuscatedRedirect.find params[:id]
|
8
|
+
puts! @obf, '@obf'
|
9
|
+
authorize! :show, @obf
|
10
|
+
|
11
|
+
visit_time = Time.now
|
12
|
+
@obf.update_attributes({
|
13
|
+
visited_at: visit_time,
|
14
|
+
visits: @obf.visits + [ visit_time ],
|
15
|
+
})
|
16
|
+
|
17
|
+
if Rails.application.config.debug
|
18
|
+
render and return
|
19
|
+
end
|
20
|
+
|
21
|
+
redirect_to @obf.to
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
@@ -1,15 +1,12 @@
|
|
1
1
|
|
2
2
|
##
|
3
3
|
## 2023-02-26 _vp_ Let's go
|
4
|
-
## 2023-03-02 _vp_ Continue
|
5
4
|
## 2023-03-07 _vp_ Continue
|
6
5
|
##
|
7
6
|
## class name: EIJ
|
8
7
|
##
|
9
8
|
class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
10
9
|
|
11
|
-
# include Sidekiq::Worker ## From: https://stackoverflow.com/questions/59114063/sidekiq-options-giving-sidekiqworker-cannot-be-included-in-an-activejob-for
|
12
|
-
|
13
10
|
queue_as :default
|
14
11
|
|
15
12
|
## For recursive parts of type `related`.
|
@@ -59,7 +56,8 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
59
56
|
client = Aws::S3::Client.new({
|
60
57
|
region: ::S3_CREDENTIALS[:region_ses],
|
61
58
|
access_key_id: ::S3_CREDENTIALS[:access_key_id_ses],
|
62
|
-
secret_access_key: ::S3_CREDENTIALS[:secret_access_key_ses]
|
59
|
+
secret_access_key: ::S3_CREDENTIALS[:secret_access_key_ses],
|
60
|
+
})
|
63
61
|
|
64
62
|
_mail = client.get_object( bucket: ::S3_CREDENTIALS[:bucket_ses], key: stub.object_key ).body.read
|
65
63
|
the_mail = Mail.new(_mail)
|
@@ -71,7 +69,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
71
69
|
the_mail.to = [ 'NO-RECIPIENT' ]
|
72
70
|
end
|
73
71
|
|
74
|
-
@message
|
72
|
+
@message = ::Office::EmailMessage.where( message_id: message_id ).first
|
75
73
|
@message ||= ::Office::EmailMessage.new
|
76
74
|
@message.assign_attributes({
|
77
75
|
raw: _mail,
|
@@ -101,21 +99,11 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
101
99
|
@message.epilogue = the_mail.body.epilogue
|
102
100
|
end
|
103
101
|
|
102
|
+
## Parts
|
104
103
|
the_mail.parts.each do |part|
|
105
104
|
churn_subpart( @message, part )
|
106
105
|
end
|
107
106
|
|
108
|
-
the_mail.attachments.each do |att|
|
109
|
-
photo = Photo.new({
|
110
|
-
content_type: att.content_type.split(';')[0],
|
111
|
-
original_filename: att.content_type_parameters[:name],
|
112
|
-
image_data: att.body.encoded,
|
113
|
-
email_message_id: @message.id,
|
114
|
-
})
|
115
|
-
photo.decode_base64_image
|
116
|
-
photo.save
|
117
|
-
end
|
118
|
-
|
119
107
|
if the_mail.parts.length == 0
|
120
108
|
body = the_mail.body.decoded.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
|
121
109
|
if the_mail.content_type.include?('text/html')
|
@@ -127,6 +115,18 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
127
115
|
end
|
128
116
|
end
|
129
117
|
|
118
|
+
## Attachments
|
119
|
+
the_mail.attachments.each do |att|
|
120
|
+
photo = Photo.new({
|
121
|
+
content_type: att.content_type.split(';')[0],
|
122
|
+
original_filename: att.content_type_parameters[:name],
|
123
|
+
image_data: att.body.encoded,
|
124
|
+
email_message_id: @message.id,
|
125
|
+
})
|
126
|
+
photo.decode_base64_image
|
127
|
+
photo.save
|
128
|
+
end
|
129
|
+
|
130
130
|
## Leadset, Lead
|
131
131
|
domain = @message.from.split('@')[1]
|
132
132
|
leadset = Leadset.find_or_create_by( company_url: domain )
|
@@ -154,9 +154,10 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
154
154
|
conv.update_attributes({
|
155
155
|
state: Conv::STATE_UNREAD,
|
156
156
|
latest_at: the_mail.date || Time.now.to_datetime,
|
157
|
-
lead_ids: conv.lead_ids.push( lead.id ).uniq,
|
158
|
-
wp_term_ids: ( [ email_inbox_tag_id ] + conv.wp_term_ids + stub.wp_term_ids ).uniq,
|
157
|
+
lead_ids: conv.lead_ids.push( lead.id ).uniq, ## @TODO: change, this is an association now
|
158
|
+
# wp_term_ids: ( [ email_inbox_tag_id ] + conv.wp_term_ids + stub.wp_term_ids ).uniq,
|
159
159
|
})
|
160
|
+
conv.add_tag( ::WpTag::INBOX )
|
160
161
|
|
161
162
|
## Actions & Filters
|
162
163
|
email_filters = Office::EmailFilter.active
|
@@ -169,15 +170,15 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
169
170
|
|
170
171
|
# || MiaTagger.analyze( @message.part_html, :is_spammy_recruite ).score > .5
|
171
172
|
|
172
|
-
|
173
|
+
conv.apply_filter( filter )
|
173
174
|
end
|
174
175
|
end
|
175
176
|
|
176
177
|
stub.update_attributes({ state: ::Office::EmailMessageStub::STATE_PROCESSED })
|
177
178
|
|
178
179
|
## Notification
|
179
|
-
conv.
|
180
|
-
if conv.
|
180
|
+
conv = Conv.find( conv.id )
|
181
|
+
if conv.in_emailtag? WpTag::INBOX
|
181
182
|
out = ::Ishapi::ApplicationMailer.forwarder_notify( @message.id.to_s )
|
182
183
|
Rails.env.production? ? out.deliver_later : out.deliver_now
|
183
184
|
end
|
@@ -7,7 +7,7 @@ class Ishapi::Ability
|
|
7
7
|
##
|
8
8
|
## super user
|
9
9
|
##
|
10
|
-
if %w| piousbox@gmail.com |.include?( user_profile
|
10
|
+
if %w| piousbox@gmail.com |.include?( user_profile&.email )
|
11
11
|
can [ :manage ], :all
|
12
12
|
end
|
13
13
|
|
@@ -18,9 +18,9 @@ class Ishapi::Ability
|
|
18
18
|
|
19
19
|
can [ :my_index ], Gallery
|
20
20
|
can [ :show ], Gallery do |gallery|
|
21
|
-
gallery.user_profile == user_profile || # my own
|
22
|
-
(!gallery.is_trash && gallery.is_public
|
23
|
-
(!gallery.is_trash && gallery.shared_profiles.include?( user_profile ) )
|
21
|
+
( gallery.user_profile == user_profile ) || # my own
|
22
|
+
(!gallery.is_trash && gallery.is_public ) || # public
|
23
|
+
(!gallery.is_trash && gallery.shared_profiles.include?( user_profile ) ) # shared with me
|
24
24
|
end
|
25
25
|
|
26
26
|
can [ :do_purchase ], ::Gameui
|
@@ -29,7 +29,7 @@ class Ishapi::Ability
|
|
29
29
|
end
|
30
30
|
|
31
31
|
can [ :destroy ], Newsitem do |n|
|
32
|
-
n.map.creator_profile.id == user_profile.id
|
32
|
+
n.map.creator_profile.id.to_s == user_profile.id.to_s
|
33
33
|
end
|
34
34
|
|
35
35
|
can [ :create, :unlock ], ::Ish::Payment
|
@@ -58,10 +58,16 @@ class Ishapi::Ability
|
|
58
58
|
p.user.id.to_s == user.id.to_s
|
59
59
|
end
|
60
60
|
|
61
|
+
|
62
|
+
##
|
63
|
+
## E
|
64
|
+
##
|
65
|
+
can [ :create ], Ish::EmailUnsubscribe
|
66
|
+
|
61
67
|
#
|
62
68
|
# G
|
63
69
|
#
|
64
|
-
can [ :index ], Gallery
|
70
|
+
# can [ :index ], Gallery
|
65
71
|
can [ :show ], Gallery do |gallery|
|
66
72
|
gallery.is_public && !gallery.is_trash
|
67
73
|
end
|
@@ -85,8 +91,12 @@ class Ishapi::Ability
|
|
85
91
|
#
|
86
92
|
# O
|
87
93
|
#
|
94
|
+
|
95
|
+
can [ :show ], ::Office::ObfuscatedRedirect
|
96
|
+
|
88
97
|
can [ :view_chain ], ::Iro::OptionPriceItem
|
89
98
|
|
99
|
+
|
90
100
|
#
|
91
101
|
# P
|
92
102
|
#
|
@@ -111,7 +121,7 @@ class Ishapi::Ability
|
|
111
121
|
#
|
112
122
|
# V
|
113
123
|
#
|
114
|
-
can [ :index, :my_index ], Video
|
124
|
+
# can [ :index, :my_index ], Video
|
115
125
|
can [ :show ], Video do |video|
|
116
126
|
video.is_public
|
117
127
|
end
|
@@ -1,2 +1,15 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
<ul>
|
3
|
+
<li><b>From:</b> <%= @msg.from %></li>
|
4
|
+
<li><b>To:</b> <%= @msg.to %></li>
|
5
|
+
<li><b>Subject:</b> <%= @msg.subject %></li>
|
6
|
+
<li><b>Date:</b> <%= @msg.date %></li>
|
7
|
+
<li><b>N Attachments:</b> <%= @msg.attachments.length %></li>
|
8
|
+
</ul>
|
9
|
+
|
10
|
+
<%= raw @msg.part_html %>
|
11
|
+
|
12
|
+
<hr />
|
13
|
+
|
14
|
+
<%= raw @msg.part_txt %>
|
15
|
+
|
data/config/routes.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
|
2
2
|
Ishapi::Engine.routes.draw do
|
3
3
|
|
4
|
-
root
|
5
|
-
post 'home', :
|
4
|
+
root to: 'application#home'
|
5
|
+
post 'home', to: 'application#home'
|
6
|
+
|
7
|
+
## E
|
6
8
|
|
7
|
-
# E
|
8
9
|
post 'email_messages', to: 'email_messages#receive'
|
9
10
|
get 'email_messages/:id', to: 'email_messages#show', as: :email_message
|
10
11
|
|
@@ -13,7 +14,10 @@ Ishapi::Engine.routes.draw do
|
|
13
14
|
delete 'email_conversations', to: 'email_conversations#delete'
|
14
15
|
post 'email_conversations/rmtag/:emailtag', to: 'email_conversations#rmtag'
|
15
16
|
|
16
|
-
#
|
17
|
+
get 'email_unsubscribes', to: 'email_unsubscribes#create'
|
18
|
+
|
19
|
+
## G
|
20
|
+
|
17
21
|
get 'galleries', :to => 'galleries#index'
|
18
22
|
post 'galleries', :to => 'galleries#index'
|
19
23
|
get 'galleries/view/:slug', :to => 'galleries#show'
|
@@ -28,9 +32,12 @@ Ishapi::Engine.routes.draw do
|
|
28
32
|
get 'leadsets', to: 'leadsets#index'
|
29
33
|
delete 'leadsets', to: 'leadsets#destroy'
|
30
34
|
|
35
|
+
get 'lead_actions', to: 'lead_actions#create', as: :lead_actions
|
31
36
|
get 'locations/show/:slug', to: 'locations#show'
|
32
37
|
resources :locations
|
33
38
|
|
39
|
+
## M
|
40
|
+
|
34
41
|
get 'maps', to: 'maps#index'
|
35
42
|
get 'maps/view/:slug', to: 'maps#show'
|
36
43
|
get 'markers/view/:slug', to: 'maps#show_marker'
|
@@ -47,6 +54,8 @@ Ishapi::Engine.routes.draw do
|
|
47
54
|
|
48
55
|
## O
|
49
56
|
|
57
|
+
get '/obf/:id', to: 'obfuscated_redirects#show', as: :obf
|
58
|
+
|
50
59
|
# resources :option_price_items
|
51
60
|
get 'option_price_items/view-by/symbol/:symbol', to: 'option_price_items#view_by_symbol', :constraints => { :symbol => /[^\/]+/ } ## the symbol is detailed eg 'GME_011924P30'
|
52
61
|
get 'option_price_items/index1', to: 'option_price_items#index', defaults: { kind: 'kind-1' }
|
@@ -74,7 +83,7 @@ Ishapi::Engine.routes.draw do
|
|
74
83
|
get 'exception', to: 'application#exception'
|
75
84
|
|
76
85
|
post 'users/fb_sign_in', to: 'users#fb_sign_in'
|
77
|
-
get 'users/me', to: 'users#account'
|
86
|
+
get 'users/me', to: 'users#account', as: :users_dashboard
|
78
87
|
post 'users/profile', to: 'users#show' ## @TODO: change, this makes no sense
|
79
88
|
post 'users/profile/update', to: 'user_profiles#update'
|
80
89
|
get 'users/profile', to: 'users#show' # @TODO: only for testing! accessToken must be hidden
|
data/lib/ishapi.rb
CHANGED
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.286
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -212,9 +212,11 @@ files:
|
|
212
212
|
- app/controllers/ishapi/email_contexts_controller.rb
|
213
213
|
- app/controllers/ishapi/email_conversations_controller.rb
|
214
214
|
- app/controllers/ishapi/email_messages_controller.rb
|
215
|
+
- app/controllers/ishapi/email_unsubscribes_controller.rb
|
215
216
|
- app/controllers/ishapi/galleries_controller.rb
|
216
217
|
- app/controllers/ishapi/gameui_controller.rb
|
217
218
|
- app/controllers/ishapi/invoices_controller.rb
|
219
|
+
- app/controllers/ishapi/lead_actions_controller.rb
|
218
220
|
- app/controllers/ishapi/leads_controller.rb
|
219
221
|
- app/controllers/ishapi/leadsets_controller.rb
|
220
222
|
- app/controllers/ishapi/locations_controller.rb
|
@@ -223,6 +225,7 @@ files:
|
|
223
225
|
- app/controllers/ishapi/my/reports_controller.rb
|
224
226
|
- app/controllers/ishapi/my/videos_controller.rb
|
225
227
|
- app/controllers/ishapi/newsitems_controller.rb
|
228
|
+
- app/controllers/ishapi/obfuscated_redirects_controller.rb
|
226
229
|
- app/controllers/ishapi/option_price_items_controller.rb
|
227
230
|
- app/controllers/ishapi/order_items_controller.rb
|
228
231
|
- app/controllers/ishapi/orders_controller.rb
|
@@ -248,6 +251,7 @@ files:
|
|
248
251
|
- app/views/ishapi/application_mailer/forwarder_notify.html.erb
|
249
252
|
- app/views/ishapi/email_contexts/summary.csv.erb
|
250
253
|
- app/views/ishapi/email_messages/show.haml
|
254
|
+
- app/views/ishapi/email_unsubscribes/create.haml
|
251
255
|
- app/views/ishapi/galleries/_index.jbuilder
|
252
256
|
- app/views/ishapi/galleries/_show.jbuilder
|
253
257
|
- app/views/ishapi/galleries/index.jbuilder
|
@@ -274,6 +278,7 @@ files:
|
|
274
278
|
- app/views/ishapi/newsitems/_show.haml
|
275
279
|
- app/views/ishapi/newsitems/_show.haml-trash
|
276
280
|
- app/views/ishapi/newsitems/index.jbuilder
|
281
|
+
- app/views/ishapi/obfuscated_redirects/show.haml
|
277
282
|
- app/views/ishapi/option_price_items/index.jbuilder
|
278
283
|
- app/views/ishapi/option_price_items/view.jbuilder
|
279
284
|
- app/views/ishapi/orders/_item.jbuilder
|