fly_admin 0.0.7 → 0.0.8
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/fly_admin/imbs/application_controller.rb +50 -49
- data/app/controllers/fly_admin/imbs/main_controller.rb +67 -63
- data/app/controllers/fly_admin/imbs/subscriptions_controller.rb +36 -34
- data/app/views/layouts/fly_admin/_error_flash_message.html.haml +0 -3
- data/lib/fly_admin/version.rb +1 -1
- metadata +38 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ff8f600f80383de43a04d4f11a07c8f7c6db9c5
|
4
|
+
data.tar.gz: 7b06437af87b727f5445a1bb9e1ffccd73ec35e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3215a3a921d9eb48b5239b968c7587b50cc38feeee0e05ccb7909cb7b03d5b9ced92edeb15b97612fef0270c522a929c58b5c9f4b7fc014d745aeb102128971
|
7
|
+
data.tar.gz: ad1cff36d4f4720869e568dab4d9bf8b2adec4de231f55f06039cf75c2789e7408ef7fea3f517b6b032f6e2241ed159732fc5fb3b0d3c9738bb6f33248622fc2
|
@@ -1,63 +1,64 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module FlyAdmin::Imbs
|
2
|
+
class ApplicationController < ActionController::Base
|
3
|
+
protect_from_forgery
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
5
|
+
before_filter :block_user, :store_link_param
|
6
|
+
before_filter :check_user_status, if: Proc.new { user_signed_in? && old_user? }, unless: :devise_controller?
|
7
|
+
before_filter :set_locale, :load_footer
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
def block_user
|
10
|
+
render_blocked if session[:blocked]
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
def store_link_param
|
14
|
+
session[:link] = params[:link] if params[:link].present?
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
-
|
17
|
+
def check_user_status
|
18
|
+
user_is_valid = FlyAdmin::Imbs::ConnectionApi.check_user(current_user)
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
if user_is_valid
|
21
|
+
current_user.update_attributes is_active: true
|
22
|
+
cookies[:active_user] = { value: 1, expires: 1.day.from_now }
|
23
|
+
else
|
24
|
+
current_user.update_attributes is_active: false
|
25
|
+
session[:blocked] = true
|
26
|
+
render_blocked
|
27
|
+
end
|
26
28
|
end
|
27
|
-
end
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
def load_footer
|
31
|
+
paysite = session['action_type'] || 'wap'
|
32
|
+
country = I18n.locale.to_s
|
33
|
+
@footer = SiteCache.read("content_#{paysite}_#{country}")
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
def old_user?
|
39
|
+
!(current_user.admin? || current_user.tester? || cookies[:active_user].present?)
|
40
|
+
end
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
def set_locale
|
43
|
+
locale = params["locale"].try(:downcase).try(:to_sym)
|
44
|
+
I18n.locale = locale && I18n.available_locales.include?(params) ? locale : I18n.default_locale
|
45
|
+
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
47
|
+
# Locale for all url_helpers in rails
|
48
|
+
def default_url_options(options = {})
|
49
|
+
{ locale: I18n.locale }.merge options
|
50
|
+
end
|
51
|
+
|
52
|
+
def after_sign_in_path_for(resource)
|
53
|
+
root_url
|
54
|
+
end
|
54
55
|
|
55
|
-
|
56
|
-
|
57
|
-
|
56
|
+
def after_sign_out_path_for(resource)
|
57
|
+
root_url
|
58
|
+
end
|
58
59
|
|
59
|
-
|
60
|
-
|
60
|
+
def render_blocked
|
61
|
+
render 'errors/blocked', status: :forbidden
|
62
|
+
end
|
61
63
|
end
|
62
|
-
|
63
64
|
end
|
@@ -1,81 +1,85 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module FlyAdmin::Imbs
|
2
|
+
class MainController < ::ApplicationController
|
3
|
+
skip_before_filter :check_user_status
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
@env = request.env
|
9
|
-
end
|
5
|
+
def you_blocked
|
6
|
+
flash[:error] = t('service_not_supported')
|
7
|
+
redirect_to paysite_root_url
|
8
|
+
end
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
redirect_to "#{root_url}&operation_status=deviceblock" and return
|
10
|
+
def test_request_headers
|
11
|
+
@env = request.env
|
14
12
|
end
|
15
|
-
redirect_to paysite_root_url and return unless check_hash!
|
16
|
-
authorize_customer params[:key], params[:pass], params[:login]
|
17
|
-
end
|
18
13
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
:customer_key => customer_key
|
26
|
-
)
|
27
|
-
user.save
|
14
|
+
def enter
|
15
|
+
if params[:operation_status] == 'deviceblock'
|
16
|
+
redirect_to "#{root_url}&operation_status=deviceblock" and return
|
17
|
+
end
|
18
|
+
redirect_to paysite_root_url and return unless check_hash!
|
19
|
+
authorize_customer params[:key], params[:pass], params[:login]
|
28
20
|
end
|
29
21
|
|
30
|
-
|
31
|
-
|
32
|
-
|
22
|
+
def authorize_customer(customer_key, password, login)
|
23
|
+
user = User.find_by_login(login)
|
24
|
+
if user.nil?
|
25
|
+
user = User.new(
|
26
|
+
:login => login,
|
27
|
+
:password => password,
|
28
|
+
:customer_key => customer_key
|
29
|
+
)
|
30
|
+
user.save
|
31
|
+
end
|
33
32
|
|
34
|
-
|
33
|
+
sign_in user unless user_signed_in?
|
34
|
+
flash[:notice] = [ t('your_login') + " #{login}" ]
|
35
|
+
flash[:notice] << "#{t('your_password')} #{password}"
|
35
36
|
|
36
|
-
|
37
|
-
end
|
37
|
+
cookies[:active_user] = { value: 1, expires: 1.day.from_now }
|
38
38
|
|
39
|
-
|
39
|
+
redirect_to item_link
|
40
|
+
end
|
40
41
|
|
41
|
-
|
42
|
-
true_hash = Digest::MD5.hexdigest(params[:login].to_s + params[:pass].to_s + SiteConfig['wc_service_salt'].to_s)
|
43
|
-
true_hash == params[:hash]
|
44
|
-
end
|
42
|
+
private
|
45
43
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
item_link_for_serials
|
50
|
-
when "news"
|
51
|
-
item_link_for_news
|
44
|
+
def check_hash!
|
45
|
+
true_hash = Digest::MD5.hexdigest(params[:login].to_s + params[:pass].to_s + SiteConfig['wc_service_salt'].to_s)
|
46
|
+
true_hash == params[:hash]
|
52
47
|
end
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
48
|
+
|
49
|
+
def item_link
|
50
|
+
case FlyAdmin.paysite_type
|
51
|
+
when "serials"
|
52
|
+
item_link_for_serials
|
53
|
+
when "news"
|
54
|
+
item_link_for_news
|
55
|
+
end
|
61
56
|
end
|
62
|
-
|
57
|
+
|
58
|
+
def paysite_root_url
|
59
|
+
case FlyAdmin.paysite_type
|
60
|
+
when "serials"
|
61
|
+
main_app.root_url
|
62
|
+
when "news"
|
63
|
+
main_app.root_url
|
64
|
+
end
|
65
|
+
end
|
63
66
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
67
|
+
def item_link_for_news
|
68
|
+
if session[:item]
|
69
|
+
item = JSON.parse session[:item]
|
70
|
+
category_article_path(item['category_id'], item['id'])
|
71
|
+
else
|
72
|
+
paysite_root_url
|
73
|
+
end
|
70
74
|
end
|
71
|
-
end
|
72
75
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
76
|
+
def item_link_for_serials
|
77
|
+
if session[:item]
|
78
|
+
item = JSON.parse session[:item]
|
79
|
+
category_season_video_path(item['category_id'], item['season_id'], item['id'])
|
80
|
+
else
|
81
|
+
paysite_root_url
|
82
|
+
end
|
83
|
+
end
|
80
84
|
end
|
81
85
|
end
|
@@ -1,38 +1,40 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
module FlyAdmin::Imbs
|
2
|
+
class SubscriptionsController < ApplicationController
|
3
|
+
def start
|
4
|
+
save_data_to_session
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
6
|
+
link_uuid = session[:link] || SiteConfig['default_uuid']
|
7
|
+
back_url = CGI.escape "http://#{request.host_with_port}/you_blocked"
|
8
|
+
redirect_to "#{SiteConfig['wap_click_addr']}/start/#{link_uuid}?back_url=#{back_url}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def splash
|
12
|
+
begin
|
13
|
+
link = params[:back_url] + "?key=#{params[:customer_key]}"
|
14
|
+
redirect_to link
|
15
|
+
rescue Exception => e
|
16
|
+
SUBSCRIPTION_LOG.error "#{e.message}\n\t#{e.backtrace}"
|
17
|
+
render nothing: true
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def save_data_to_session
|
24
|
+
case FlyAdmin.paysite_type
|
25
|
+
when "serials"
|
26
|
+
save_serials_data_to_session
|
27
|
+
when "news"
|
28
|
+
save_news_data_to_session
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def save_serials_data_to_session
|
33
|
+
session[:item] = JSON.generate({ :id => params[:video_id], :category_id => params[:category_id], :season_id => params[:season_id] })
|
28
34
|
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def save_serials_data_to_session
|
32
|
-
session[:item] = JSON.generate({ :id => params[:video_id], :category_id => params[:category_id], :season_id => params[:season_id] })
|
33
|
-
end
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
def save_news_data_to_session
|
37
|
+
session[:item] = JSON.generate({ :id => params[:item_id], :category_id => params[:category_id] })
|
38
|
+
end
|
39
|
+
end
|
38
40
|
end
|
data/lib/fly_admin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fly_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruslan Korolev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -1060,58 +1060,59 @@ signing_key:
|
|
1060
1060
|
specification_version: 4
|
1061
1061
|
summary: FlyAdmin Rails Engine
|
1062
1062
|
test_files:
|
1063
|
-
- test/
|
1064
|
-
- test/
|
1065
|
-
- test/
|
1066
|
-
- test/
|
1067
|
-
- test/
|
1068
|
-
- test/dummy/app/helpers/application_helper.rb
|
1069
|
-
- test/dummy/app/assets/stylesheets/application.css
|
1063
|
+
- test/controllers/fly_admin/footers_controller_test.rb
|
1064
|
+
- test/controllers/fly_admin/serials_controller_test.rb
|
1065
|
+
- test/controllers/fly_admin/settings_controller_test.rb
|
1066
|
+
- test/controllers/fly_admin/upload_controller_controller_test.rb
|
1067
|
+
- test/controllers/fly_admin/videos_controller_test.rb
|
1070
1068
|
- test/dummy/app/assets/javascripts/application.js
|
1069
|
+
- test/dummy/app/assets/stylesheets/application.css
|
1071
1070
|
- test/dummy/app/controllers/application_controller.rb
|
1071
|
+
- test/dummy/app/helpers/application_helper.rb
|
1072
1072
|
- test/dummy/app/views/layouts/application.html.erb
|
1073
|
+
- test/dummy/bin/bundle
|
1074
|
+
- test/dummy/bin/rails
|
1075
|
+
- test/dummy/bin/rake
|
1076
|
+
- test/dummy/config/application.rb
|
1077
|
+
- test/dummy/config/boot.rb
|
1073
1078
|
- test/dummy/config/database.yml
|
1074
|
-
- test/dummy/config/
|
1075
|
-
- test/dummy/config/environments/production.rb
|
1079
|
+
- test/dummy/config/environment.rb
|
1076
1080
|
- test/dummy/config/environments/development.rb
|
1081
|
+
- test/dummy/config/environments/production.rb
|
1077
1082
|
- test/dummy/config/environments/test.rb
|
1078
|
-
- test/dummy/config/routes.rb
|
1079
|
-
- test/dummy/config/environment.rb
|
1080
|
-
- test/dummy/config/initializers/cookies_serializer.rb
|
1081
|
-
- test/dummy/config/initializers/mime_types.rb
|
1082
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
1083
1083
|
- test/dummy/config/initializers/assets.rb
|
1084
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
1085
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
1084
1086
|
- test/dummy/config/initializers/filter_parameter_logging.rb
|
1085
1087
|
- test/dummy/config/initializers/inflections.rb
|
1086
|
-
- test/dummy/config/initializers/
|
1088
|
+
- test/dummy/config/initializers/mime_types.rb
|
1087
1089
|
- test/dummy/config/initializers/session_store.rb
|
1088
|
-
- test/dummy/config/
|
1089
|
-
- test/dummy/config/
|
1090
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
1091
|
+
- test/dummy/config/locales/en.yml
|
1092
|
+
- test/dummy/config/routes.rb
|
1090
1093
|
- test/dummy/config/secrets.yml
|
1091
|
-
- test/dummy/
|
1094
|
+
- test/dummy/config.ru
|
1095
|
+
- test/dummy/db/schema.rb
|
1092
1096
|
- test/dummy/public/404.html
|
1097
|
+
- test/dummy/public/422.html
|
1093
1098
|
- test/dummy/public/500.html
|
1094
1099
|
- test/dummy/public/favicon.ico
|
1095
1100
|
- test/dummy/Rakefile
|
1096
1101
|
- test/dummy/README.rdoc
|
1097
|
-
- test/
|
1098
|
-
- test/
|
1099
|
-
- test/
|
1100
|
-
- test/dummy/bin/rake
|
1101
|
-
- test/dummy/db/schema.rb
|
1102
|
-
- test/test_helper.rb
|
1103
|
-
- test/controllers/fly_admin/serials_controller_test.rb
|
1104
|
-
- test/controllers/fly_admin/videos_controller_test.rb
|
1105
|
-
- test/controllers/fly_admin/upload_controller_controller_test.rb
|
1106
|
-
- test/controllers/fly_admin/settings_controller_test.rb
|
1107
|
-
- test/controllers/fly_admin/footers_controller_test.rb
|
1102
|
+
- test/fixtures/fly_admin/countries.yml
|
1103
|
+
- test/fixtures/fly_admin/footers.yml
|
1104
|
+
- test/fixtures/fly_admin/paysites.yml
|
1108
1105
|
- test/fly_admin_test.rb
|
1109
|
-
- test/
|
1110
|
-
- test/
|
1106
|
+
- test/helpers/fly_admin/footers_helper_test.rb
|
1107
|
+
- test/helpers/fly_admin/serials_helper_test.rb
|
1108
|
+
- test/helpers/fly_admin/upload_controller_helper_test.rb
|
1109
|
+
- test/integration/navigation_test.rb
|
1111
1110
|
- test/jobs/fly_admin/convert_video_job_test.rb
|
1112
|
-
- test/
|
1111
|
+
- test/jobs/fly_admin/daemon_control_job_test.rb
|
1112
|
+
- test/jobs/fly_admin/stop_f_fmpeg_job_test.rb
|
1113
|
+
- test/lib/generators/fly_admin/install_generator_test.rb
|
1113
1114
|
- test/models/fly_admin/country_test.rb
|
1114
1115
|
- test/models/fly_admin/footer_test.rb
|
1115
|
-
- test/
|
1116
|
-
- test/
|
1117
|
-
|
1116
|
+
- test/models/fly_admin/paysite_test.rb
|
1117
|
+
- test/test_helper.rb
|
1118
|
+
has_rdoc:
|