Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit fcad313

Browse files
committed
Add protocol and show a warning on unsecure protocols, fixes #495
1 parent 428b734 commit fcad313

4 files changed

Lines changed: 40 additions & 1 deletion

File tree

backend/index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
`release` = "' . $db->escape_string($payload->release) . '",
159159
`timestamp` = NOW(),
160160
`ip` = "' . $db->escape_string(get_ip_address()) . '",
161+
`protocol` = "' . $db->escape_string($payload->protocol) . '",
161162
`source` = ' . (is_null($payload->source) ? 'NULL' : '"' . $db->escape_string($payload->source) . '"') . ',
162163
`identifier` = ' . (is_null($payload->identifier) ? 'NULL' : '"' . $db->escape_string($payload->identifier) . '"') . ',
163164
`task` = ' . (is_null($payload->task) ? 'NULL' : '"' . $db->escape_string($payload->task) . '"') . ',

backend/other/database.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ CREATE TABLE `results` (
8888
`revision` int(11) NOT NULL DEFAULT '0',
8989
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
9090
`ip` varchar(16) CHARACTER SET latin1 NOT NULL,
91+
`protocol` varchar(8) CHARACTER SET latin1 NOT NULL,
9192
`uniqueid` varchar(20) CHARACTER SET latin1 NOT NULL,
9293
`score` int(11) NOT NULL,
9394
`maximum` int(11) NOT NULL DEFAULT '0',

css/main.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2161,4 +2161,24 @@ body.indexVisible > div#index button#indexbutton {
21612161

21622162

21632163

2164+
.upgradeWarning {
2165+
background: #ec6534;
2166+
color: #fff;
21642167

2168+
padding: 20px;
2169+
margin-top: 10px;
2170+
margin-bottom: 40px;
2171+
}
2172+
.upgradeWarning p {
2173+
font-size: 0.8em;
2174+
}
2175+
2176+
.upgradeWarning a {
2177+
display: inline-block;
2178+
background: #fff;
2179+
margin-top: 16px;
2180+
padding: 8px 12px;
2181+
font-size: 0.85em;
2182+
text-decoration: none;
2183+
color: #000;
2184+
}

index.html

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ <h3>Help us improve HTML5 test by donating</h3>
276276
var payload = '{' +
277277
'"release": "' + r.release + '",' +
278278
'"source": "' + source + '",' +
279+
'"protocol": "' + location.protocol + '",' +
279280
'"identifier": "' + escapeSlashes(identifier) + '",' +
280281
'"task": "' + task + '",' +
281282
'"uniqueid": "' + r.uniqueid + '",' +
@@ -324,7 +325,6 @@ <h3>Help us improve HTML5 test by donating</h3>
324325
"</div>",
325326
c);
326327

327-
328328
/* Show box for confirming useragent detection */
329329
new Confirm(container, {
330330
id: r.uniqueid,
@@ -374,6 +374,23 @@ <h3>Help us improve HTML5 test by donating</h3>
374374
button.innerHTML = '<span>Donate</span>';
375375
buttons.appendChild(button);
376376

377+
378+
if (location.protocol == "http:") {
379+
var warning = document.createElement('div');
380+
warning.className = 'upgradeWarning';
381+
warning.innerHTML =
382+
"<h4>Your browser may support even more features on a secure connection</h4>" +
383+
"<p>Modern browsers only support some advanced features using on websites that uses a secure connection. " +
384+
"This is because these features expose privacy sensitive data. Because you are now using an insecure connection, " +
385+
"these features may not be available and are not detected.</p>" +
386+
"<a href='https://html5test.com'>Try again, but using a secure connection</a>";
387+
388+
container.appendChild(warning);
389+
}
390+
391+
392+
393+
377394
/* Show detailed report of scores */
378395
var container = document.getElementById('results');
379396
var div = document.createElement('div');

0 commit comments

Comments
 (0)