From f8c17775ed2a989d266a588caea12fe06f68e293 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Mon, 29 Dec 2014 15:03:49 +0100 Subject: [PATCH] [pro-merge] Add config entries from travis pro --- assets/scripts/app/pusher.coffee | 15 +++++++++++---- assets/scripts/travis.coffee | 15 +++++++++++++++ assets/scripts/vendor/customerio.js | 14 ++++++++++++++ config.ru | 18 ++++++++++++++++-- 4 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 assets/scripts/vendor/customerio.js diff --git a/assets/scripts/app/pusher.coffee b/assets/scripts/app/pusher.coffee index 5cc394b9..9bb2241d 100644 --- a/assets/scripts/app/pusher.coffee +++ b/assets/scripts/app/pusher.coffee @@ -2,10 +2,17 @@ Travis.Pusher = (config) -> @init(config) this -$.extend Travis.Pusher, - CHANNELS: ['common'] - CHANNEL_PREFIX: '' - ENCRYPTED: false +if Travis.config.pro + $.extend Travis.Pusher, + CHANNELS: [] + CHANNEL_PREFIX: 'private-' + ENCRYPTED: true + KEY: '' +else + $.extend Travis.Pusher, + CHANNELS: ['common'] + CHANNEL_PREFIX: '' + ENCRYPTED: false $.extend Travis.Pusher.prototype, active_channels: [] diff --git a/assets/scripts/travis.coffee b/assets/scripts/travis.coffee index 90e69f30..773a4c4e 100644 --- a/assets/scripts/travis.coffee +++ b/assets/scripts/travis.coffee @@ -71,6 +71,11 @@ window.Travis = TravisApplication.create( Travis.deferReadiness() +pages_endpoint = $('meta[rel="travis.pages_endpoint"]').attr('href') +billing_endpoint = $('meta[rel="travis.billing_endpoint"]').attr('href') +customer_io_site_id = $('meta[name="travis.customer_io_site_id"]').attr('value') +setupCustomerio(customer_io_site_id) if customer_io_site_id + $.extend Travis, run: -> Travis.advanceReadiness() # bc, remove once merged to master @@ -89,6 +94,16 @@ $.extend Travis, show_repos_hint: 'private' avatar_default_url: 'https://travis-ci.org/images/ui/default-avatar.png' pusher_log_fallback: $('meta[name="travis.pusher_log_fallback"]').attr('value') == 'true' + pro: $('meta[name="travis.pro"]').attr('value') == 'true' + + pages_endpoint: pages_endpoint || billing_endpoint + billing_endpoint: billing_endpoint + + url_legal: "#{billing_endpoint}/pages/legal" + url_imprint: "#{billing_endpoint}/pages/imprint" + url_security: "#{billing_endpoint}/pages/security" + url_terms: "#{billing_endpoint}/pages/terms" + customer_io_site_id: customer_io_site_id CONFIG_KEYS_MAP: { go: 'Go' diff --git a/assets/scripts/vendor/customerio.js b/assets/scripts/vendor/customerio.js new file mode 100644 index 00000000..10522d01 --- /dev/null +++ b/assets/scripts/vendor/customerio.js @@ -0,0 +1,14 @@ +var _cio = _cio || []; + +function setupCustomerio(siteId) { + var a,b,c;a=function(f){return function(){_cio.push([f]. + concat(Array.prototype.slice.call(arguments,0)))}};b=["load","identify", + "sidentify","track","page"];for(c=0;c ENV['MOBILE_ENDPOINT'] if ENV['MOBILE_ENDPOINT'] use Travis::Web::SetToken use Travis::Web::Allow + use Travis::Web::ApiRedirect do |app| app.settings.api_endpoint = ENV['API_ENDPOINT'] if ENV['API_ENDPOINT'] end @@ -28,13 +36,19 @@ end run Travis::Web::App.build( environment: ENV['RACK_ENV'] || 'development', api_endpoint: ENV['API_ENDPOINT'], + pages_endpoint: ENV['PAGES_ENDPOINT'], + billing_endpoint: ENV['BILLING_ENDPOINT'] || 'https://billing.travis-ci.com', source_endpoint: ENV['SOURCE_ENDPOINT'] || 'https://github.com', pusher_key: ENV['PUSHER_KEY'], pusher_host: ENV['PUSHER_HOST'] || 'ws.pusherapp.com', + pusher_path: ENV['PUSHER_PATH'], ga_code: ENV['GA_CODE'], root: File.expand_path('../public', __FILE__), server_start: Time.now, caches_enabled: ENV['CACHES_ENABLED'], ssh_key_enabled: ENV['SSH_KEY_ENABLED'], - pusher_log_fallback: ENV['PUSHER_LOG_FALLBACK'] + pusher_log_fallback: ENV['PUSHER_LOG_FALLBACK'], + charm_key: ENV['CHARM_KEY'], + customer_io_site_id: ENV['CUSTOMER_IO_SITE_ID'], + pro: ENV['TRAVIS_PRO'] )