Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makes it an upgrade to host with tagsafe and enable performance monit… #64

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/controllers/containers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def new
end

def create
container_params[:tagsafe_js_reporting_sample_rate] = 0.0
container_params[:subscription_tier] = 'free'
@container = current_user.containers_created.new(container_params)
if @container.save
current_user.containers << @container
Expand Down
20 changes: 20 additions & 0 deletions app/models/container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,30 @@ class Container < ApplicationRecord
attribute :tagsafe_js_re_route_eligible_tags_sample_rate, default: 1.0
attribute :tagsafe_js_enabled, default: true
attribute :defer_script_tags_by_default, default: false
attribute :subscription_tier, default: 'free'

VALIDATE_SUBSCRIPTION_TIERS = %w[free pro enterprise]

validates :name, presence: true
validates :tagsafe_js_reporting_sample_rate, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1 }
validates :tagsafe_js_re_route_eligible_tags_sample_rate, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1 }
validates :subscription_tier, presence: true, inclusion: { in: VALIDATE_SUBSCRIPTION_TIERS }

self::VALIDATE_SUBSCRIPTION_TIERS.each do |tier|
define_method("#{tier}_subscription_tier?") { subscription_tier == tier }
end

def can_host_with_tagsafe?
free_subscription_tier?
end

def tagsafe_js_reporting_disabled?
tagsafe_js_reporting_sample_rate.zero?
end

def tagsafe_js_reporting_enabled?
!tagsafe_js_reporting_disabled?
end

def publish_instrumentation!(description = '')
InstrumentationBuild.create!(container: self, description: description)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ def determine!
if is_in_unhostable_tag_list? || !tag_has_static_content?
@tag.update!(is_tagsafe_hostable: false, is_tagsafe_hosted: false, release_monitoring_interval_in_minutes: 0)
else
@tag.update!(is_tagsafe_hostable: true, is_tagsafe_hosted: true)
if @tag.container.can_host_with_tagsafe?
@tag.update!(is_tagsafe_hostable: true, is_tagsafe_hosted: true)
else
@tag.update!(is_tagsafe_hostable: true, is_tagsafe_hosted: false)
end
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/views/tags/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
</div>
<p class="mt-2 text-sm text-gray-500">Override the default load strategy on the tag's `script` element</p>
</div>
<% if tag.is_tagsafe_hostable %>
<% if container.can_host_with_tagsafe? && tag.is_tagsafe_hostable %>
<fieldset class="sm:col-span-6">
<legend class="contents text-base font-medium text-gray-900">Optimize CDN</legend>
<p class="text-sm text-gray-500">Hosting with the Tagsafe CDN speeds up page load times, and gives you version control capabilities.</p>
Expand All @@ -101,7 +101,7 @@
</div>
</fieldset>
<% else %>
<fieldset class="sm:col-span-6" data-controller='tooltip' title="Due to the way <%= tag.tag_snippet.name %> is hosted it cannot be hosted on Tagsafe's CDN.">
<fieldset class="sm:col-span-6" data-controller='tooltip' title="<%= container.can_host_with_tagsafe? "Due to the way <%= tag.tag_snippet.name %> is hosted it cannot be hosted on Tagsafe's CDN." : "Please contact [email protected] to host your tags on the Tagsafe CDN." %>">
<legend class="contents text-base font-medium text-gray-400">Optimize CDN</legend>
<p class="text-sm text-gray-400">Hosting with the Tagsafe CDN speeds up page load times, and gives you version control capabilities.</p>
<div class="mt-4 space-y-4">
Expand Down
31 changes: 0 additions & 31 deletions aws-lambda-functions/domain-audits/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ module.exports.handle = async (event, _context) => {
// ['https://www.eightsleep.com']
// ['http://www.pourri.com', null],
// ['http://www.pourri.com', null],
// ['http://www.pourri.com', null],
// ['http://www.pourri.com', null],
// ['http://www.pourri.com', null],
// ['http://www.12news.com', null],
// ['http://www.4patriots.com', null],
// ['http://www.national.aaa.com', null],
Expand Down Expand Up @@ -68,58 +65,31 @@ module.exports.handle = async (event, _context) => {
// ['http://www.metamap.com', null],
// ['http://www.molekule.com', 'https://molekule.com'],
// ['http://www.neatmethod.com', null],
// ['http://www.neatmethod.com', null],
// ['http://www.newwavecom.com', null],
// ['http://www.nozzlenolen.com', null],
// ['http://www.nozzlenolen.com', null],
// ['http://www.oilchangers.com', null],
// ['http://www.pbsdistribution.org', null],
// ['http://www.newshour.org', null],
// ['http://www.pigtailsandcrewcuts.com', null],
// ['http://www.populationmedia.org', null],
// ['http://www.razor.com', null],
// ['http://www.razor.com', null],
// ['http://www.razor.com', null],
// ['http://www.red.com', null],
// ['http://www.red.com', null],
// ['http://www.red.com', null],
// ['http://www.red.com', null],
// ['http://www.reliableair.com', null],
// ['http://www.rightnowmedia.org', null],
// ['http://www.shopyourway.com', null],
// ['http://www.shopyourway.com', null],
// ['http://www.shopyourway.com', null],
// ['http://www.shopyourway.com', null],
// ['http://www.shophq.com', null],
// ['http://www.evine.com', null],
// ['http://www.solasalonstudios.com', null],
// ['http://www.solasalonstudios.com', null],
// ['http://www.hellosuper.com', null],
// ['http://www.hellosuper.com', null],
// ['http://www.surya.com', null],
// ['http://www.surya.com', null],
// ['http://www.tawkify.com', null],
// ['http://www.tawkify.com', null],
// ['http://www.tct.tv', null],
// ['http://www.thelashlounge.com', null],
// ['http://www.thelashlounge.com', null],
// ['http://www.maids.com', null],
// ['http://www.thermacell.com', null],
// ['http://www.thermacell.com', null],
// ['http://www.thermacell.com', null],
// ['http://www.thermacell.com', null],
// ['http://www.tricoci.com', null],
// ['http://www.tricoci.com', null],
// ['http://www.tricoci.com', null],
// ['http://www.tricoci.com', null],
// ['http://www.tricoci.com', null],
// ['http://www.turnerpest.com', null],
// ['http://www.tvunetworks.com', null],
// ['http://www.tvunetworks.com', null],
// ['http://www.tvunetworks.com', null],
// ['http://www.tvunetworks.com', null],
// ['http://www.tvunetworks.com', null],
// ['http://www.tvunetworks.com', null],
// ['http://www.twr.org', null],
// ['http://www.10tv.com', null],
// ['http://www.wfuv.org', null],
Expand All @@ -131,7 +101,6 @@ module.exports.handle = async (event, _context) => {
// ['http://www.wwltv.com', null],
// ['http://www.yogibo.com', null],
// ['http://www.youvegotmaids.com', null],
// ['http://www.yupptv.com', null],
// ['http://www.yupptv.com', null]
]

Expand Down
4 changes: 0 additions & 4 deletions aws-lambda-functions/domain-audits/results_to_words.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ def generate_outreach_from_results_file(file_path)
puts "Wrote outreach for #{site_name} to ./outreach/#{file_name.gsub('-results.json', '-outreach.txt')}"
end

<<<<<<< HEAD
Dir.glob('./results/www_prettylittlething_com-results.json'){ |file_path| generate_outreach_from_results_file(file_path) }
=======
Dir.glob('./results/mackweldon_com-results.json'){ |file_path| generate_outreach_from_results_file(file_path) }
>>>>>>> main

puts "DONE!"
Loading