Fix default pro behaviour
This commit is contained in:
parent
c9e0337071
commit
4dc35f7932
|
@ -25,6 +25,7 @@ app.import('bower_components/visibilityjs/lib/visibility.timers.js');
|
||||||
app.import('bower_components/JavaScript-MD5/js/md5.js');
|
app.import('bower_components/JavaScript-MD5/js/md5.js');
|
||||||
app.import('vendor/ansiparse.js');
|
app.import('vendor/ansiparse.js');
|
||||||
app.import('vendor/log.js');
|
app.import('vendor/log.js');
|
||||||
|
app.import('vendor/customerio.js');
|
||||||
app.import('bower_components/moment/moment.js');
|
app.import('bower_components/moment/moment.js');
|
||||||
// Use `app.import` to add additional libraries to the generated
|
// Use `app.import` to add additional libraries to the generated
|
||||||
// output files.
|
// output files.
|
||||||
|
|
|
@ -41,7 +41,7 @@ Router.map ->
|
||||||
@route 'index', path: '/'
|
@route 'index', path: '/'
|
||||||
@resource 'env_vars', ->
|
@resource 'env_vars', ->
|
||||||
@route 'new'
|
@route 'new'
|
||||||
@resource 'ssh_key' if config.endpoints.ssh_key
|
@resource 'ssh_key' if config.endpoints.sshKey
|
||||||
|
|
||||||
@route 'first_sync'
|
@route 'first_sync'
|
||||||
@route 'insufficient_oauth_permissions'
|
@route 'insufficient_oauth_permissions'
|
||||||
|
|
|
@ -55,7 +55,6 @@ footer a:active
|
||||||
|
|
||||||
a
|
a
|
||||||
text-decoration : none
|
text-decoration : none
|
||||||
display : block
|
|
||||||
color : $footer-color
|
color : $footer-color
|
||||||
|
|
||||||
.status-circle
|
.status-circle
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
`import config from 'travis/config/environment'`
|
`import ENV from 'travis/config/environment'`
|
||||||
|
|
||||||
TravisPusher = (config) ->
|
TravisPusher = (config) ->
|
||||||
@init(config)
|
@init(config)
|
||||||
|
@ -38,7 +38,7 @@ TravisPusher.prototype.unsubscribe = (channel) ->
|
||||||
@pusher.unsubscribe(channel) if @pusher?.channel(channel)
|
@pusher.unsubscribe(channel) if @pusher?.channel(channel)
|
||||||
|
|
||||||
TravisPusher.prototype.prefix = (channel) ->
|
TravisPusher.prototype.prefix = (channel) ->
|
||||||
prefix = config.pusher.channel_prefix || ''
|
prefix = ENV.pusher.channel_prefix || ''
|
||||||
if channel.indexOf(prefix) != 0
|
if channel.indexOf(prefix) != 0
|
||||||
"#{prefix}#{channel}"
|
"#{prefix}#{channel}"
|
||||||
else
|
else
|
||||||
|
@ -100,9 +100,9 @@ TravisPusher.prototype.ignoreCode = (code) ->
|
||||||
TravisPusher.prototype.ignoreMessage = (message) ->
|
TravisPusher.prototype.ignoreMessage = (message) ->
|
||||||
message.indexOf('Existing subscription') == 0 or message.indexOf('No current subscription') == 0
|
message.indexOf('Existing subscription') == 0 or message.indexOf('No current subscription') == 0
|
||||||
|
|
||||||
Pusher.SockJSTransport.isSupported = -> false if config.pusher.host != 'ws.pusherapp.com'
|
Pusher.SockJSTransport.isSupported = -> false if ENV.pusher.host != 'ws.pusherapp.com'
|
||||||
|
|
||||||
if config.pro
|
if ENV.pro
|
||||||
Pusher.channel_auth_transport = 'bulk_ajax'
|
Pusher.channel_auth_transport = 'bulk_ajax'
|
||||||
|
|
||||||
Pusher.authorizers.bulk_ajax = (socketId, _callback) ->
|
Pusher.authorizers.bulk_ajax = (socketId, _callback) ->
|
||||||
|
@ -110,7 +110,7 @@ if config.pro
|
||||||
channels.callbacks ||= []
|
channels.callbacks ||= []
|
||||||
|
|
||||||
name = this.channel.name
|
name = this.channel.name
|
||||||
names = $.keys(channels.channels)
|
names = Object.keys(channels.channels)
|
||||||
|
|
||||||
channels.callbacks.push (auths) ->
|
channels.callbacks.push (auths) ->
|
||||||
_callback(false, auth: auths[name])
|
_callback(false, auth: auths[name])
|
||||||
|
@ -125,8 +125,8 @@ if config.pro
|
||||||
Pusher.getDefaultStrategy = (config) ->
|
Pusher.getDefaultStrategy = (config) ->
|
||||||
[
|
[
|
||||||
[":def", "ws_options", {
|
[":def", "ws_options", {
|
||||||
hostUnencrypted: config.wsHost + ":" + config.wsPort + (config.pusher.path && "/#{config.pusher.path}" || ''),
|
hostUnencrypted: config.wsHost + ":" + config.wsPort + (ENV.pusher.path && "/#{config.pusher.path}" || ''),
|
||||||
hostEncrypted: config.wsHost + ":" + config.wssPort + (config.pusher.path && "/#{config.pusher.path}" || '')
|
hostEncrypted: config.wsHost + ":" + config.wssPort + (ENV.pusher.path && "/#{config.pusher.path}" || '')
|
||||||
path: config.path
|
path: config.path
|
||||||
}],
|
}],
|
||||||
[":def", "sockjs_options", {
|
[":def", "sockjs_options", {
|
||||||
|
|
|
@ -31,6 +31,26 @@ module.exports = function(environment) {
|
||||||
intervals: { updateTimes: 1000 }
|
intervals: { updateTimes: 1000 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (typeof process !== 'undefined') {
|
||||||
|
if (process.env.TRAVIS_PRO) {
|
||||||
|
// set defaults for pro if it's used
|
||||||
|
// TODO: we have the same defaults also in ruby process,
|
||||||
|
// it would be nice to move it to one place. In theory
|
||||||
|
// we could just remove it from ruby process and rely
|
||||||
|
// on things set here, but I haven't tested that yet.
|
||||||
|
ENV.pro = true;
|
||||||
|
ENV.apiEndpoint = 'https://api.travis-ci.com';
|
||||||
|
ENV.pusher.key = '59236bc0716a551eab40';
|
||||||
|
ENV.pagesEndpoint = 'https://billing.travis-ci.com';
|
||||||
|
ENV.billingEndpoint = 'https://billing.travis-ci.com';
|
||||||
|
ENV.endpoints = {
|
||||||
|
sshKey: true,
|
||||||
|
caches: true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (environment === 'development') {
|
if (environment === 'development') {
|
||||||
// ENV.APP.LOG_RESOLVER = true;
|
// ENV.APP.LOG_RESOLVER = true;
|
||||||
// ENV.APP.LOG_ACTIVE_GENERATION = true;
|
// ENV.APP.LOG_ACTIVE_GENERATION = true;
|
||||||
|
@ -57,15 +77,20 @@ module.exports = function(environment) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: I insert values from ENV here, but in production
|
||||||
|
// this file is compiled and is not executed on runtime.
|
||||||
|
// We don't use CSP at the moment outside of development (ie. we don't
|
||||||
|
// set CSP headers), but it would be nice to do it and then we need to
|
||||||
|
// think about a better way to override it
|
||||||
ENV.contentSecurityPolicy = {
|
ENV.contentSecurityPolicy = {
|
||||||
'default-src': "'none'",
|
'default-src': "'none'",
|
||||||
'script-src': "'self'",
|
'script-src': "'self'",
|
||||||
'font-src': "'self' https://fonts.googleapis.com/css",
|
'font-src': "'self' https://fonts.googleapis.com/css https://fonts.gstatic.com",
|
||||||
'connect-src': "'self' https://api.travis-ci.org ws://ws.pusherapp.com wss://ws.pusherapp.com http://sockjs.pusher.com",
|
'connect-src': "'self' " + ENV.apiEndpoint + " ws://ws.pusherapp.com wss://ws.pusherapp.com http://sockjs.pusher.com https://s3.amazonaws.com/archive.travis-ci.com/ https://s3.amazonaws.com/archive.travis-ci.org/",
|
||||||
'img-src': "'self' data: https://www.gravatar.com http://www.gravatar.com",
|
'img-src': "'self' data: https://www.gravatar.com http://www.gravatar.com",
|
||||||
'style-src': "'self'",
|
'style-src': "'self' https://fonts.googleapis.com",
|
||||||
'media-src': "'self'",
|
'media-src': "'self'",
|
||||||
'frame-src': "'self' https://api.travis-ci.org"
|
'frame-src': "'self' " + ENV.apiEndpoint
|
||||||
}
|
}
|
||||||
|
|
||||||
return ENV;
|
return ENV;
|
||||||
|
|
14
vendor/customerio.js
vendored
Normal file
14
vendor/customerio.js
vendored
Normal file
|
@ -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<b.length;c++){_cio[b[c]]=a(b[c])};
|
||||||
|
var t = document.createElement('script'),
|
||||||
|
s = document.getElementsByTagName('script')[0];
|
||||||
|
t.async = true;
|
||||||
|
t.id = 'cio-tracker';
|
||||||
|
t.setAttribute('data-site-id', siteId);
|
||||||
|
t.src = 'https://assets.customer.io/assets/track.js';
|
||||||
|
s.parentNode.insertBefore(t, s);
|
||||||
|
}
|
|
@ -190,6 +190,11 @@ class Travis::Web::App
|
||||||
config['codeClimate'] = options[:code_climate] if options[:code_climate]
|
config['codeClimate'] = options[:code_climate] if options[:code_climate]
|
||||||
config['codeClimateUrl'] = options[:code_climate_url] if options[:code_climate_url]
|
config['codeClimateUrl'] = options[:code_climate_url] if options[:code_climate_url]
|
||||||
|
|
||||||
|
config['endpoints'] = {
|
||||||
|
'sshKey' => options[:ssh_key_enabled],
|
||||||
|
'caches' => options[:caches_enabled]
|
||||||
|
}
|
||||||
|
|
||||||
regexp = %r(<meta name="travis/config/environment"\s+content="([^"]+)")
|
regexp = %r(<meta name="travis/config/environment"\s+content="([^"]+)")
|
||||||
string.gsub!(regexp) do
|
string.gsub!(regexp) do
|
||||||
ember_config = JSON.parse(URI.unescape($1))
|
ember_config = JSON.parse(URI.unescape($1))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user