HTTPS adjustments and fixes
parent
bc3ed987fe
commit
bafbea08f9
|
@ -88,17 +88,6 @@
|
|||
<div class="content_box small_box developers">
|
||||
<h1 id="use-api" class="lichess_title">Lichess Widgets</h1>
|
||||
<p>Let your website/blog visitors know that you're playing on lichess!</p>
|
||||
<br />
|
||||
<link rel="stylesheet" href="//rubenwardy.github.io/lichess_widgets/lichess_widgets.css" />
|
||||
@if(ctx.currentBg == "dark") {
|
||||
<link rel="stylesheet" href="//rubenwardy.github.io/lichess_widgets/dark.css" />
|
||||
} else {
|
||||
<link rel="stylesheet" href="//rubenwardy.github.io/lichess_widgets/light.css" />
|
||||
}
|
||||
<script src="//rubenwardy.github.io/lichess_widgets/lichess_widgets.js"></script>
|
||||
@defining(ctx.me.fold("thibault")(_.id)) { userId =>
|
||||
<script>lichess_widgets.profile_scores("@ctx.currentBg", "@userId");</script>
|
||||
}
|
||||
<p><a href="//rubenwardy.github.io/lichess_widgets/">See more examples and installation instructions</a></p>
|
||||
<p>See <a href="http://rubenwardy.com/lichess_widgets/">rubenwardy.com/lichess_widgets/</a> for widgets with your username and rating.</p>
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<iframe
|
||||
frameborder="0"
|
||||
scrolling="no"
|
||||
src="//twitch.tv/@s.streamId/chat?popout="
|
||||
src="https://twitch.tv/@s.streamId/chat?popout="
|
||||
height="418"></iframe>
|
||||
}
|
||||
case lila.tv.StreamerList.Hitbox => {
|
||||
|
|
|
@ -8,7 +8,7 @@ var geoLag = process.argv[2];
|
|||
var password = process.argv[3];
|
||||
if (!password) throw "missing SMS password";
|
||||
var domain = process.argv[4] || 'lichess.org';
|
||||
var url = 'wss://socket.en.' + domain + '/socket';
|
||||
var url = 'wss://socket.' + domain + '/socket';
|
||||
var averageLag;
|
||||
var lagAlert = 100; // in milliseconds
|
||||
var fail = 0;
|
||||
|
|
|
@ -3,7 +3,7 @@ var HttpClient = require('request');
|
|||
|
||||
var lichessSri = Math.random().toString(36).substring(2);
|
||||
|
||||
var url = 'wss://socket.en.lichess.org/socket';
|
||||
var url = 'wss://socket.lichess.org/socket';
|
||||
var client = new WebSocketClient();
|
||||
var geoLag = process.argv[2];
|
||||
var password = process.argv[3];
|
||||
|
|
|
@ -3,7 +3,7 @@ var HttpClient = require('request');
|
|||
|
||||
var lichessSri = Math.random().toString(36).substring(2);
|
||||
|
||||
var url = 'wss://socket.en.lichess.org/socket';
|
||||
var url = 'wss://socket.lichess.org/socket';
|
||||
var client = new WebSocketClient();
|
||||
var geoLag = process.argv[2];
|
||||
var password = process.argv[3];
|
||||
|
|
|
@ -976,7 +976,7 @@ lichess.notifyApp = (function() {
|
|||
};
|
||||
|
||||
$.urlToLink = function(text) {
|
||||
var exp = /\bhttp:\/\/(?:[a-z]{0,3}\.)?(lichess\.org[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
|
||||
var exp = /\bhttps?:\/\/(?:[a-z]{0,3}\.)?(lichess\.org[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
|
||||
return text.replace(exp, "<a href='//$1'>$1</a>");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,209 +0,0 @@
|
|||
$(function() {
|
||||
|
||||
var $monitors = $('#monitors');
|
||||
var charts = [];
|
||||
var disabled = {
|
||||
enabled: false
|
||||
};
|
||||
var noText = {
|
||||
text: null
|
||||
};
|
||||
var colors = Highcharts.theme.colors;
|
||||
var height = 165;
|
||||
var width = document.body.clientWidth / 2 - 25;
|
||||
var maxPoints = width / 4;
|
||||
var counter = 0;
|
||||
var chartDefaults = {
|
||||
credits: disabled,
|
||||
legend: disabled,
|
||||
chart: {
|
||||
backgroundColor: {
|
||||
stops: [
|
||||
[0, 'rgb(46, 46, 46)'],
|
||||
[1, 'rgb(16, 16, 16)']
|
||||
]
|
||||
},
|
||||
defaultSeriesType: 'line',
|
||||
animation: false,
|
||||
borderRadius: 0,
|
||||
},
|
||||
title: {
|
||||
floating: true,
|
||||
style: {
|
||||
font: '12px Noto Sans, Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif',
|
||||
color: '#bababa',
|
||||
}
|
||||
},
|
||||
plotOptions: {
|
||||
series: {
|
||||
shadow: false,
|
||||
marker: {
|
||||
lineColor: null,
|
||||
fillColor: 'none'
|
||||
}
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'datetime',
|
||||
title: noText,
|
||||
labels: disabled,
|
||||
},
|
||||
yAxis: {
|
||||
title: noText,
|
||||
opposite: true
|
||||
}
|
||||
};
|
||||
|
||||
function getMillis() {
|
||||
return (new Date()).getTime();
|
||||
}
|
||||
|
||||
function add(info) {
|
||||
++counter;
|
||||
var color = colors[counter % colors.length];
|
||||
$monitors.append($('<div>').attr('id', info.id).width(width).height(height));
|
||||
charts[info.id] = new Highcharts.Chart($.extend(true, {}, chartDefaults, {
|
||||
chart: {
|
||||
defaultSeriesType: info.type || 'line',
|
||||
renderTo: info.id,
|
||||
},
|
||||
title: {
|
||||
text: info.title,
|
||||
},
|
||||
colors: [color],
|
||||
yAxis: {
|
||||
labels: {
|
||||
format: info.format || '{value}'
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
name: info.title,
|
||||
data: []
|
||||
}
|
||||
]
|
||||
}));
|
||||
}
|
||||
|
||||
add({
|
||||
id: 'users',
|
||||
title: 'Open Websockets'
|
||||
});
|
||||
|
||||
add({
|
||||
id: 'lat',
|
||||
title: 'Report generation time',
|
||||
type: 'area',
|
||||
format: '{value} ms'
|
||||
});
|
||||
|
||||
add({
|
||||
id: 'rps',
|
||||
title: "HTTP Requests /s",
|
||||
});
|
||||
|
||||
add({
|
||||
id: 'cpu',
|
||||
title: "JVM CPU usage",
|
||||
format: "{value}%"
|
||||
});
|
||||
|
||||
add({
|
||||
id: 'mps',
|
||||
title: "Chess Moves /s"
|
||||
});
|
||||
|
||||
add({
|
||||
id: 'mlat',
|
||||
title: "Time to process a move",
|
||||
format: '{value} ms'
|
||||
});
|
||||
|
||||
add({
|
||||
id: 'load',
|
||||
title: "Load Average"
|
||||
});
|
||||
|
||||
add({
|
||||
id: 'dbMemory',
|
||||
title: "MongoDB Memory usage",
|
||||
format: "{value} MB"
|
||||
});
|
||||
|
||||
add({
|
||||
id: 'dbQps',
|
||||
title: "MongoDB Queries /s",
|
||||
});
|
||||
|
||||
add({
|
||||
id: 'memory',
|
||||
title: "JVM Memory usage",
|
||||
format: "{value} MB"
|
||||
});
|
||||
|
||||
add({
|
||||
id: 'thread',
|
||||
title: "JVM Threads"
|
||||
});
|
||||
|
||||
// add({
|
||||
// id: 'dbConn',
|
||||
// title: "MongoDB Connections",
|
||||
// });
|
||||
|
||||
var lastCall = getMillis();
|
||||
|
||||
var sri = Math.random().toString(36).substring(5);
|
||||
var wsUrl = "wss://socket." + document.domain + "/monitor/socket?sri=" + sri;
|
||||
var ws = window.MozWebSocket ? new MozWebSocket(wsUrl) : new WebSocket(wsUrl);
|
||||
ws.onmessage = function(e) {
|
||||
var m = JSON.parse(e.data);
|
||||
if (m.t == 'monitor') {
|
||||
var msg = m.d;
|
||||
var ds = msg.split(";");
|
||||
lastCall = getMillis();
|
||||
var allUsers = {};
|
||||
for (var i in ds) {
|
||||
var d = ds[i].split(":");
|
||||
if (d.length == 2) {
|
||||
var id = d[1];
|
||||
var val = d[0];
|
||||
if (id == 'ai') {
|
||||
var loads = val.split(',').map(parseLoad);
|
||||
loads.forEach(updateAi);
|
||||
} else update(id, 0, parseFloat(val));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function update(id, serie, val) {
|
||||
var chart = charts[id];
|
||||
if (!isNaN(val) && typeof chart != 'undefined') {
|
||||
var series = chart.series[serie];
|
||||
var shift = series.data.length > maxPoints;
|
||||
var point = [lastCall, val];
|
||||
series.addPoint(point, true, shift);
|
||||
}
|
||||
}
|
||||
|
||||
function updateAi(load, i) {
|
||||
update('ai', i, load);
|
||||
}
|
||||
|
||||
function parseLoad(load) {
|
||||
return parseInt(load, 10);
|
||||
}
|
||||
|
||||
function setStatus(s) {
|
||||
window.document.body.className = s;
|
||||
}
|
||||
|
||||
setInterval(function() {
|
||||
if (getMillis() - lastCall > 3000) {
|
||||
setStatus("down");
|
||||
} else if (lastCall) {
|
||||
setStatus("up");
|
||||
}
|
||||
}, 1100);
|
||||
|
||||
});
|
|
@ -24,7 +24,7 @@ lichess.StrongSocket = function(url, version, settings) {
|
|||
var autoReconnect = true;
|
||||
var nbConnects = 0;
|
||||
if (options.resetUrl || options.prodPipe) lichess.storage.remove(options.baseUrlKey);
|
||||
if (options.prodPipe) options.baseUrls = ['socket.lichess.org:9021'];
|
||||
if (options.prodPipe) options.baseUrls = ['socket.lichess.org'];
|
||||
|
||||
var connect = function() {
|
||||
destroy();
|
||||
|
@ -294,11 +294,13 @@ lichess.StrongSocket.defaults = {
|
|||
protocol: location.protocol === 'https:' ? 'wss:' : 'ws:',
|
||||
baseUrls: (function(domain) {
|
||||
var base = domain.split('.').slice(1).join('.');
|
||||
var main = 'socket.' + base;
|
||||
var extra = /lichess\.org/.test(base) ? [9021, 9022, 9023, 9024].map(function(port) {
|
||||
return 'socket.' + base + ':' + port;
|
||||
}) : []
|
||||
return [main].concat(extra);
|
||||
var urls = ['socket.' + base];
|
||||
if (/lichess\.org/.test(base) && location.protocol === 'http') {
|
||||
urls = urls.concat([9021, 9022, 9023, 9024].map(function(port) {
|
||||
return 'socket.' + base + ':' + port;
|
||||
}));
|
||||
}
|
||||
return urls;
|
||||
})(document.domain),
|
||||
onFirstConnect: $.noop,
|
||||
baseUrlKey: 'surl4'
|
||||
|
|
|
@ -39,7 +39,7 @@ $(function() {
|
|||
point[1] + Math.random() - 0.5);
|
||||
};
|
||||
|
||||
var source = new EventSource("http://en.lichess.org/network/stream");
|
||||
var source = new EventSource("//en.lichess.org/network/stream");
|
||||
|
||||
var removeFunctions = {};
|
||||
|
||||
|
|
Loading…
Reference in New Issue