wco_models 3.1.0.167 → 3.1.0.169
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/wco/sitemaps.scss +4 -0
- data/app/assets/stylesheets/wco/utils.scss +0 -1
- data/app/controllers/wco/sitemap_paths_controller.rb +25 -0
- data/app/mailers/wco_email/application_mailer.rb +2 -1
- data/app/models/wco/site.rb +4 -1
- data/app/models/wco/sitemap_path.rb +68 -1
- data/app/models/wco_email/message_stub.rb +6 -5
- data/app/views/wco/sitemap_paths/_form.haml +2 -2
- data/app/views/wco/sitemap_paths/_index.haml +2 -1
- data/app/views/wco/sitemap_paths/check.haml +3 -0
- data/app/views/wco/sitemap_paths/edit.haml +2 -1
- data/app/views/wco/sitemap_paths/new.haml +7 -0
- data/app/views/wco/sites/show.haml +14 -10
- data/config/routes.rb +1 -0
- metadata +5 -3
- data/app/mailers/wco_email/application_mailer.rb-trash +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55d9ac4131e23711ece162eeb0d966ad0a0a1d674eeaff4914e9a8f8a04d8854
|
4
|
+
data.tar.gz: dd2312d66791bc3bb0bf644632acc6f9d37513a5331a226ea911ad2f7fa1f5e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e886165a18d09abcc2798f081803c2fb645d0c664e152e5511b496a534b58b8c9ae8977aa64c2c728c2bda233546bb3a82418cdf25b731768060f2d6e87b9dc5
|
7
|
+
data.tar.gz: 88921f8da539770fd3698a7a98be6eff4f8043b8d4513d495f1a55a9b44763124221e939c98f8583a36a51d4b40541b7c71aaa090c626dc2a62e44ef96852d92
|
@@ -1,11 +1,36 @@
|
|
1
1
|
|
2
2
|
class Wco::SitemapPathsController < Wco::ApplicationController
|
3
3
|
|
4
|
+
def check
|
5
|
+
@spath = Wco::SitemapPath.find params[:id]
|
6
|
+
authorize! :check, @spath
|
7
|
+
@spath.check
|
8
|
+
end
|
9
|
+
|
10
|
+
def create
|
11
|
+
authorize! :create, Wco::SitemapPath
|
12
|
+
@spath = Wco::SitemapPath.new params[:spath].permit!
|
13
|
+
if @spath.save
|
14
|
+
flash_notice 'Success.'
|
15
|
+
redirect_to wco.site_path(params[:spath][:site_id])
|
16
|
+
else
|
17
|
+
flash_alert "Could not save spath: #{@spath.errors.full_messages}"
|
18
|
+
render 'new'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
4
22
|
def edit
|
5
23
|
@spath = Wco::SitemapPath.find params[:id]
|
24
|
+
@site = @spath.site
|
6
25
|
authorize! :edit, @spath
|
7
26
|
end
|
8
27
|
|
28
|
+
def new
|
29
|
+
@site = Wco::Site.find( params[:site_id] )
|
30
|
+
@spath = Wco::SitemapPath.new site: @site
|
31
|
+
authorize! :new, @spath
|
32
|
+
end
|
33
|
+
|
9
34
|
def update
|
10
35
|
@spath = Wco::SitemapPath.find params[:id]
|
11
36
|
authorize! :update, @spath
|
@@ -77,7 +77,8 @@ class WcoEmail::ApplicationMailer < ActionMailer::Base
|
|
77
77
|
mail( from: @ctx.from_email,
|
78
78
|
to: @ctx.to_email,
|
79
79
|
cc: @ctx.cc,
|
80
|
-
|
80
|
+
## 2024-07-30 I'm no longer sending these to google.
|
81
|
+
# bcc: "poxlovibb1@gmail.com",
|
81
82
|
subject: rendered_subject,
|
82
83
|
body: rendered_str,
|
83
84
|
content_type: "text/html" )
|
data/app/models/wco/site.rb
CHANGED
@@ -10,11 +10,78 @@ class Wco::SitemapPath
|
|
10
10
|
field :path, type: String
|
11
11
|
validates :path, presence: true, uniqueness: { scope: :site }
|
12
12
|
|
13
|
+
field :meta_description, type: String
|
13
14
|
field :redirect_to, type: String
|
14
15
|
field :selector, type: String
|
15
16
|
field :selectors, type: Array, default: []
|
16
17
|
|
17
|
-
field :
|
18
|
+
field :results, type: Array, default: []
|
19
|
+
field :status, type: String
|
20
|
+
|
21
|
+
def check
|
22
|
+
self.status = 'NOT_OK'
|
23
|
+
if self[:selector]
|
24
|
+
begin
|
25
|
+
body = HTTParty.get( "#{site.origin}#{self[:path]}" ).body
|
26
|
+
rescue OpenSSL::SSL::SSLError => err
|
27
|
+
results.push "NOT OK [ssl-exception] #{self[:path]}".red
|
28
|
+
return
|
29
|
+
end
|
30
|
+
doc = Nokogiri::HTML( body )
|
31
|
+
out = doc.search self[:selector]
|
32
|
+
if out.present?
|
33
|
+
results.push "OK #{self[:path]}"
|
34
|
+
self.status = 'OK'
|
35
|
+
else
|
36
|
+
results.push "NOT OK [selector-missing] #{self[:path]}".red
|
37
|
+
end
|
38
|
+
|
39
|
+
if self[:meta_description]
|
40
|
+
out = doc.search( 'head meta[name="description"]' )[0]['content']
|
41
|
+
if self[:meta_description] == out
|
42
|
+
results.push "OK #{self[:path]} meta_description"
|
43
|
+
self.status = 'OK'
|
44
|
+
else
|
45
|
+
results.push "NOT OK [meta-description-missing] #{self[:path]}".red
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
elsif self[:redirect_to]
|
50
|
+
out = HTTParty.get( "#{origin}#{self[:path]}", follow_redirects: false )
|
51
|
+
if( out.headers[:location] == self[:redirect_to] ||
|
52
|
+
out.headers[:location] == "#{origin}#{self[:redirect_to]}" )
|
53
|
+
results.push "OK #{self[:path]}"
|
54
|
+
self.status = 'OK'
|
55
|
+
else
|
56
|
+
results.push "NOT OK [redirect-missing] #{self[:path]}".red
|
57
|
+
|
58
|
+
puts!( out.response, 'response' ) if DEBUG
|
59
|
+
# puts!( out.body, 'body' ) if DEBUG
|
60
|
+
|
61
|
+
puts "NOT OK #{self[:path]}".red
|
62
|
+
puts out.headers[:location]
|
63
|
+
puts self[:redirect_to]
|
64
|
+
end
|
65
|
+
else
|
66
|
+
results.push "SKIP #{self[:path]}"
|
67
|
+
self.status = 'OK'
|
68
|
+
end
|
69
|
+
|
70
|
+
if self[:selectors].present?
|
71
|
+
self[:selectors].each do |selector|
|
72
|
+
body = HTTParty.get( "#{origin}#{self[:path]}" ).body
|
73
|
+
doc = Nokogiri::HTML( body )
|
74
|
+
out = doc.search selector
|
75
|
+
if out.present?
|
76
|
+
results.push "OK #{self[:path]} selectors:#{selector}"
|
77
|
+
self.status = 'OK'
|
78
|
+
else
|
79
|
+
results.push "NOT OK [selectors-missing:#{selector}] #{self[:path]}".red
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
self.save
|
84
|
+
end
|
18
85
|
|
19
86
|
end
|
20
87
|
|
@@ -221,11 +221,12 @@ class WcoEmail::MessageStub
|
|
221
221
|
if config['skip_notification']
|
222
222
|
;
|
223
223
|
else
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
224
|
+
## 2024-07-30 I'm no longer sending these to google.
|
225
|
+
# conv = WcoEmail::Conversation.find( conv.id )
|
226
|
+
# if conv.tags.include? Wco::Tag.inbox
|
227
|
+
# out = WcoEmail::ApplicationMailer.forwarder_notify( @message.id.to_s )
|
228
|
+
# Rails.env.production? ? out.deliver_later : out.deliver_now
|
229
|
+
# end
|
229
230
|
end
|
230
231
|
|
231
232
|
puts 'ok'
|
@@ -5,8 +5,8 @@
|
|
5
5
|
- url = spath_path(spath)
|
6
6
|
|
7
7
|
.sitemap-paths--form
|
8
|
-
= form_for spath, url: url do |f|
|
9
|
-
= hidden_field_tag
|
8
|
+
= form_for spath, url: url, as: :spath do |f|
|
9
|
+
= hidden_field_tag 'spath[site_id]', spath[:site_id] || params[:site_id]
|
10
10
|
|
11
11
|
.d-flex
|
12
12
|
.field
|
@@ -11,7 +11,8 @@
|
|
11
11
|
%tr
|
12
12
|
%td
|
13
13
|
= link_to '[~]', edit_spath_path(spath)
|
14
|
-
= spath
|
14
|
+
.d-inline-block= button_to 'check', check_spath_path(spath), method: :get
|
15
|
+
= link_to "#{@site.origin}#{spath.path}","#{@site.origin}#{spath.path}", target: :_blank
|
15
16
|
- if spath.redirect_to
|
16
17
|
%div
|
17
18
|
\->
|
@@ -5,14 +5,18 @@
|
|
5
5
|
%h5.title
|
6
6
|
= @site
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
.row
|
9
|
+
.Sitemaps.col-md-9
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
%h5.d-flex
|
12
|
+
Sitemap Paths
|
13
|
+
= link_to '[+]', new_spath_path( site_id: @site.id )
|
14
|
+
|
15
|
+
= button_to 'check', check_sitemap_path( site: @site ), data: { confirm: 'Are you sure?' }
|
16
|
+
|
17
|
+
-# %hr
|
18
|
+
= render '/wco/sitemap_paths/index', spaths: @site.sitemap_paths
|
19
|
+
|
20
|
+
.col-md-3
|
21
|
+
= render '/wco/tags/header'
|
22
|
+
= render '/wco/tags/index', tags: @site.tags
|
data/config/routes.rb
CHANGED
@@ -62,6 +62,7 @@ Wco::Engine.routes.draw do
|
|
62
62
|
|
63
63
|
post 'sites/:id/check_sitemap', to: 'sites#check_sitemap', as: :check_sitemap
|
64
64
|
resources :sites
|
65
|
+
get 'sitemap_paths/:id/check', to: 'sitemap_paths#check', as: :check_spath
|
65
66
|
resources :sitemap_paths, as: :spaths
|
66
67
|
resources :subscriptions
|
67
68
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wco_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.0.
|
4
|
+
version: 3.1.0.169
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Pudeyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ahoy_matey
|
@@ -424,6 +424,7 @@ files:
|
|
424
424
|
- app/assets/stylesheets/wco/office_action_templates.scss
|
425
425
|
- app/assets/stylesheets/wco/pagination.scss
|
426
426
|
- app/assets/stylesheets/wco/photos.scss
|
427
|
+
- app/assets/stylesheets/wco/sitemaps.scss
|
427
428
|
- app/assets/stylesheets/wco/utils.scss
|
428
429
|
- app/assets/stylesheets/wco/videos.scss
|
429
430
|
- app/controllers/wco/api/leads_controller.rb
|
@@ -454,7 +455,6 @@ files:
|
|
454
455
|
- app/helpers/wco/application_helper.rb
|
455
456
|
- app/jobs/wco_hosting/certbot_job.rb
|
456
457
|
- app/mailers/wco_email/application_mailer.rb
|
457
|
-
- app/mailers/wco_email/application_mailer.rb-trash
|
458
458
|
- app/models/ability.rb
|
459
459
|
- app/models/ahoy/event.rb
|
460
460
|
- app/models/ahoy/visit.rb
|
@@ -635,7 +635,9 @@ files:
|
|
635
635
|
- app/views/wco/reports/show.haml
|
636
636
|
- app/views/wco/sitemap_paths/_form.haml
|
637
637
|
- app/views/wco/sitemap_paths/_index.haml
|
638
|
+
- app/views/wco/sitemap_paths/check.haml
|
638
639
|
- app/views/wco/sitemap_paths/edit.haml
|
640
|
+
- app/views/wco/sitemap_paths/new.haml
|
639
641
|
- app/views/wco/sites/_form.haml
|
640
642
|
- app/views/wco/sites/_header.haml
|
641
643
|
- app/views/wco/sites/check_sitemap.haml
|
@@ -1,18 +0,0 @@
|
|
1
|
-
## From: https://www.fileformat.info/info/unicode/char/a.htm
|
2
|
-
## From: https://stackoverflow.com/questions/7019034/utf-8-encoding-in-ruby-using-a-variable
|
3
|
-
## From: https://stackoverflow.com/questions/52654509/random-generate-a-valid-unicode-character-in-ruby
|
4
|
-
## latin
|
5
|
-
# n1 = 0x192
|
6
|
-
# n2 = 0x687
|
7
|
-
##
|
8
|
-
## weird punctuation
|
9
|
-
# n1 = 0x133
|
10
|
-
# n2 = 0x255
|
11
|
-
|
12
|
-
# random_utf8 = Enumerator.new do |yielder|
|
13
|
-
# loop do
|
14
|
-
# yielder << ( rand(n2-n1)+n1 ).chr('UTF-8')
|
15
|
-
# rescue RangeError
|
16
|
-
# end
|
17
|
-
# end
|
18
|
-
# rendered_subject = "#{rendered_subject} #{ random_utf8.next }#{ random_utf8.next }"
|