Merge branch 'master' of https://github.com/haytjes/arewefastyet
This commit is contained in:
Коммит
e656b0ff04
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
|
||||
$migrate = function() {
|
||||
mysql_query("ALTER TABLE `control_task_queue` CHANGE `start` `start` INT(10) UNSIGNED NOT NULL DEFAULT '0'");
|
||||
mysql_query("ALTER TABLE `control_task_queue` CHANGE `finish` `finish` INT(10) UNSIGNED NOT NULL DEFAULT '0'");
|
||||
mysql_query("ALTER TABLE `control_task_queue` CHANGE `output` `output` LONGTEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL") or die(mysql_error());
|
||||
mysql_query("ALTER TABLE `control_task_queue` CHANGE `error` `error` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL;");
|
||||
};
|
||||
|
||||
$rollback = function() {
|
||||
};
|
|
@ -172,6 +172,14 @@ class Context(object):
|
|||
return o
|
||||
|
||||
def exportSuites(self):
|
||||
o = { }
|
||||
for b in self.benchmarks:
|
||||
if b.visible == 2:
|
||||
continue
|
||||
o[b.name] = b.export()
|
||||
return o
|
||||
|
||||
def exportSuitesAll(self):
|
||||
o = { }
|
||||
for b in self.benchmarks:
|
||||
o[b.name] = b.export()
|
||||
|
|
|
@ -340,6 +340,15 @@ def export_master(cx):
|
|||
with open(path, 'w') as fp:
|
||||
fp.write(text)
|
||||
|
||||
j["suites"] = cx.exportSuitesAll()
|
||||
text = "var AWFYMaster = " + json.dumps(j) + ";\n"
|
||||
|
||||
path = os.path.join(awfy.path, 'auth-master.js')
|
||||
if os.path.exists(path):
|
||||
os.remove(path)
|
||||
with open(path, 'w') as fp:
|
||||
fp.write(text)
|
||||
|
||||
def update_all(cx):
|
||||
for machine in cx.machines:
|
||||
# Don't try to update machines that we're no longer tracking.
|
||||
|
|
|
@ -210,7 +210,7 @@ class WebkitBuilder(Builder):
|
|||
Run(["sed","-i.bac","s/GCC_TREAT_WARNINGS_AS_ERRORS = YES;/GCC_TREAT_WARNINGS_AS_ERRORS=NO;/","Source/bmalloc/Configurations/Base.xcconfig"])
|
||||
Run(["sed","-i.bac","s/GCC_TREAT_WARNINGS_AS_ERRORS = YES;/GCC_TREAT_WARNINGS_AS_ERRORS=NO;/","Source/WTF/Configurations/Base.xcconfig"])
|
||||
Run(["sed","-i.bac","s/std::numeric_limits<unsigned char>::max()/255/","Source/bmalloc/bmalloc/SmallLine.h"])
|
||||
Run(["sed","-i.bac","s/std::numeric_limits<unsigned char>::max()/255/","Source/bmalloc/bmalloc/SmallRun.h"])
|
||||
#Run(["sed","-i.bac","s/std::numeric_limits<unsigned char>::max()/255/","Source/bmalloc/bmalloc/SmallRun.h"])
|
||||
|
||||
# Hack 2: This check fails currently. Disable checking to still have a build.
|
||||
os.remove("Tools/Scripts/check-for-weak-vtables-and-externals")
|
||||
|
@ -223,7 +223,7 @@ class WebkitBuilder(Builder):
|
|||
Run(["svn","revert","Source/bmalloc/Configurations/Base.xcconfig"])
|
||||
Run(["svn","revert","Source/WTF/Configurations/Base.xcconfig"])
|
||||
Run(["svn","revert","Source/bmalloc/bmalloc/SmallLine.h"])
|
||||
Run(["svn","revert","Source/bmalloc/bmalloc/SmallPage.h"])
|
||||
#Run(["svn","revert","Source/bmalloc/bmalloc/SmallPage.h"])
|
||||
|
||||
def make(self):
|
||||
try:
|
||||
|
|
|
@ -48,7 +48,7 @@ class BrowserExecutor(object):
|
|||
env = os.environ.copy()
|
||||
env.update(config.env())
|
||||
env.update(self.engineInfo["env"])
|
||||
args = [benchmark.url] + config.args() + self.engineInfo["args"]
|
||||
args = config.args() + self.engineInfo["args"] + [benchmark.url]
|
||||
|
||||
self.execute(benchmark, env, args, config.profile())
|
||||
|
||||
|
@ -167,8 +167,18 @@ class ChromeExecutor(BrowserExecutor):
|
|||
# reset the result
|
||||
self.resetResults()
|
||||
|
||||
# enforce an empty user data directory to clear caches and previous
|
||||
# settings
|
||||
runner.rm("profile/")
|
||||
runner.mkdir("profile/")
|
||||
runner.write("profile/First Run", "")
|
||||
|
||||
effective_args = ["--disable-setuid-sandbox"] + \
|
||||
["--user-data-dir=profile"] + \
|
||||
args
|
||||
|
||||
# start browser
|
||||
process = runner.start(binary, ["--disable-setuid-sandbox"] + args, env)
|
||||
process = runner.start(binary, effective_args, env)
|
||||
|
||||
# wait for results
|
||||
self.waitForResults(benchmark.timeout)
|
||||
|
|
|
@ -1,42 +1,18 @@
|
|||
<?php
|
||||
|
||||
// Demo site using Auth_BrowserID for authentication
|
||||
if (isset($_POST['idtoken'])) {
|
||||
$json = file_get_contents("https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=".$_POST['idtoken']);
|
||||
$obj = json_decode($json);
|
||||
echo $obj->email;
|
||||
|
||||
if(isset($_GET['persona'])) {
|
||||
require_once 'BrowserID.php';
|
||||
|
||||
// Login
|
||||
if(isset($_GET['assertion'])) {
|
||||
if ($_SERVER['HTTP_HOST'] == "www.arewefastyet.com")
|
||||
$verifier = new Auth_BrowserID('https://www.arewefastyet.com');
|
||||
else
|
||||
$verifier = new Auth_BrowserID('https://arewefastyet.com');
|
||||
$result = $verifier->verifyAssertion($_GET['assertion']);
|
||||
|
||||
if ($result->status === 'okay') {
|
||||
session_start();
|
||||
$email = htmlentities($result->email, ENT_QUOTES);
|
||||
$_SESSION["persona"] = $email;
|
||||
setcookie ("persona", $email, 0, "/");
|
||||
}
|
||||
}
|
||||
|
||||
// Logout
|
||||
if(isset($_GET['logout'])) {
|
||||
session_start();
|
||||
unset($_SESSION['persona']);
|
||||
setcookie ("persona", "", 1, "/");
|
||||
}
|
||||
|
||||
if(isset($_GET['check'])) {
|
||||
session_start();
|
||||
echo isset($_SESSION['persona'])?$_SESSION['persona']:"";
|
||||
exit();
|
||||
}
|
||||
|
||||
echo "<script>history.back();</script>";
|
||||
exit();
|
||||
session_start();
|
||||
$_SESSION["persona"] = $obj->email;
|
||||
setcookie ("persona", $obj->email, 0, "/");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
// Now you can use $_SESSION['persona'] to check if people is logged in. It is a email adress.
|
||||
if (isset($_GET['check'])) {
|
||||
session_start();
|
||||
echo isset($_SESSION['persona'])?$_SESSION['persona']:"";
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ AWFY.loadAggregateGraph = function (blobgraph) {
|
|||
return graph;
|
||||
}
|
||||
|
||||
AWFY.displayNewGraph = function (id, domid, graph) {
|
||||
AWFY.displayNewGraph = function (prefix, id, domid, graph) {
|
||||
var elt = $('#' + domid + '-graph');
|
||||
var title = $('#' + domid + '-title');
|
||||
if (!elt.length)
|
||||
|
@ -155,7 +155,7 @@ AWFY.displayNewGraph = function (id, domid, graph) {
|
|||
title.show();
|
||||
var display = elt.data('awfy-display');
|
||||
if (!display) {
|
||||
display = new Display(this, id, domid, elt);
|
||||
display = new Display(this, prefix, id, domid, elt);
|
||||
elt.data('awfy-display', display);
|
||||
}
|
||||
if (display.shouldRefresh()) {
|
||||
|
@ -249,7 +249,7 @@ AWFY.drawLegend = function () {
|
|||
this.hasLegend = true;
|
||||
}
|
||||
|
||||
AWFY.computeBreakdown = function (data, id, domid) {
|
||||
AWFY.computeBreakdown = function (data, prefix, id, domid) {
|
||||
var blob = typeof data == "string"
|
||||
? JSON.parse(data)
|
||||
: data;
|
||||
|
@ -261,7 +261,7 @@ AWFY.computeBreakdown = function (data, id, domid) {
|
|||
}
|
||||
|
||||
var graph = this.loadAggregateGraph(blob['graph']);
|
||||
this.displayNewGraph(id, domid, graph);
|
||||
this.displayNewGraph(prefix, id, domid, graph);
|
||||
}
|
||||
|
||||
AWFY.computeAggregate = function (received) {
|
||||
|
@ -287,7 +287,7 @@ AWFY.computeAggregate = function (received) {
|
|||
this.aggregate = graphs;
|
||||
|
||||
for (var id in graphs) {
|
||||
this.displayNewGraph(id, id, graphs[id]);
|
||||
this.displayNewGraph("", id, id, graphs[id]);
|
||||
}
|
||||
|
||||
this.drawLegend();
|
||||
|
@ -529,15 +529,12 @@ AWFY.requestZoom = function (display, kind, start_t, end_t) {
|
|||
? end.getUTCMonth() + 1
|
||||
: 12;
|
||||
for (var month = firstMonth; month <= lastMonth; month++) {
|
||||
var name = kind + '-' +
|
||||
var name = display.prefix +
|
||||
kind + '-' +
|
||||
display.id + '-' +
|
||||
this.machineId + '-' +
|
||||
year + '-' +
|
||||
month;
|
||||
if (this.view == 'breakdown')
|
||||
name = 'bk-' + name;
|
||||
else if (this.view == 'single' && this.subtest)
|
||||
name = 'bk-' + name;
|
||||
files.push(name);
|
||||
}
|
||||
}
|
||||
|
@ -598,11 +595,36 @@ AWFY.showBreakdown = function (name) {
|
|||
|
||||
var total = 0;
|
||||
|
||||
// Create a div showing the full benchmark score.
|
||||
var id = name;
|
||||
var prefix = "";
|
||||
var domid = id.replace(/ /g,'-').replace(/\./g, '-') + "-single";
|
||||
var title = $('<div id="' + domid + '-title"></div>').html('<b>' + id + '</b>').appendTo(breakdown);
|
||||
title.hide();
|
||||
var div = $('<div id="' + domid + '-graph" class="graph"></div>');
|
||||
div.appendTo(breakdown);
|
||||
div.hide();
|
||||
$('<br><br>').appendTo(breakdown);
|
||||
|
||||
this.panes.push(div);
|
||||
|
||||
var callback = (function (prefix, id, domid) {
|
||||
return (function (received) {
|
||||
if (received[0])
|
||||
this.computeBreakdown(received[0], prefix, id, domid);
|
||||
this.drawLegend();
|
||||
}).bind(this);
|
||||
}).bind(this)(prefix, id, domid);
|
||||
|
||||
var file = prefix + 'aggregate-' + id + '-' + this.machineId;
|
||||
this.request([file], callback);
|
||||
|
||||
// Create a div for each sub-test.
|
||||
var suite = AWFYMaster.suites[name];
|
||||
for (var i = 0; i < suite.tests.length; i++) {
|
||||
var test = suite.tests[i];
|
||||
var id = name + '-' + test;
|
||||
var prefix = "bk-";
|
||||
var domid = id.replace(/ /g,'-').replace(/\./g, '-');
|
||||
( function (name, test) {
|
||||
var title = $('<div id="' + domid + '-title"></div>').click(
|
||||
|
@ -621,17 +643,17 @@ AWFY.showBreakdown = function (name) {
|
|||
|
||||
this.panes.push(div);
|
||||
|
||||
var callback = (function (id, domid) {
|
||||
var callback = (function (prefix, id, domid) {
|
||||
return (function (received) {
|
||||
if (received[0])
|
||||
this.computeBreakdown(received[0], id, domid);
|
||||
this.computeBreakdown(received[0], prefix, id, domid);
|
||||
if (++total == suite.tests.length)
|
||||
this.drawLegend();
|
||||
}).bind(this);
|
||||
}).bind(this)(id, domid);
|
||||
}).bind(this)(prefix, id, domid);
|
||||
|
||||
// Fire off an XHR request for each test.
|
||||
var file = 'bk-aggregate-' + id + '-' + this.machineId;
|
||||
var file = prefix + 'aggregate-' + id + '-' + this.machineId;
|
||||
this.request([file], callback);
|
||||
}
|
||||
this.lastRefresh = Date.now();
|
||||
|
@ -666,6 +688,7 @@ AWFY.showSingle = function (name, subtest, start, end) {
|
|||
|
||||
if (found) {
|
||||
var id = name + '-' + test;
|
||||
var prefix = "bk-";
|
||||
var domid = id.replace(/ /g,'-').replace(/\./g, '-');
|
||||
var title = $('<div id="' + domid + '-title"></div>').html('<b>' + id + '</b>').appendTo(breakdown);
|
||||
title.hide();
|
||||
|
@ -676,18 +699,19 @@ AWFY.showSingle = function (name, subtest, start, end) {
|
|||
|
||||
this.panes.push(div);
|
||||
|
||||
var callback = (function (id, domid) {
|
||||
var callback = (function (prefix, id, domid) {
|
||||
return (function (received) {
|
||||
if (received[0])
|
||||
this.computeBreakdown(received[0], id, domid);
|
||||
this.computeBreakdown(received[0], prefix, id, domid);
|
||||
this.drawLegend();
|
||||
}).bind(this);
|
||||
}).bind(this)(id, domid);
|
||||
}).bind(this)(prefix, id, domid);
|
||||
|
||||
var file = 'bk-aggregate-' + id + '-' + this.machineId;
|
||||
var file = prefix + 'aggregate-' + id + '-' + this.machineId;
|
||||
this.request([file], callback);
|
||||
} else {
|
||||
var id = name;
|
||||
var prefix = "";
|
||||
var domid = id.replace(/ /g,'-').replace(/\./g, '-') + "-single";
|
||||
var title = $('<div id="' + domid + '-title"></div>').html('<b>' + id + '</b>').appendTo(breakdown);
|
||||
title.hide();
|
||||
|
@ -698,15 +722,15 @@ AWFY.showSingle = function (name, subtest, start, end) {
|
|||
|
||||
this.panes.push(div);
|
||||
|
||||
var callback = (function (id, domid) {
|
||||
var callback = (function (prefix, id, domid) {
|
||||
return (function (received) {
|
||||
if (received[0])
|
||||
this.computeBreakdown(received[0], id, domid);
|
||||
this.computeBreakdown(received[0], prefix, id, domid);
|
||||
this.drawLegend();
|
||||
}).bind(this);
|
||||
}).bind(this)(id, domid);
|
||||
}).bind(this)(prefix, id, domid);
|
||||
|
||||
var file = 'aggregate-' + id + '-' + this.machineId;
|
||||
var file = prefix + 'aggregate-' + id + '-' + this.machineId;
|
||||
this.request([file], callback);
|
||||
}
|
||||
|
||||
|
@ -736,16 +760,17 @@ AWFY.requestRedraw = function () {
|
|||
var total = 0;
|
||||
for (var i = 0; i < suite.tests.length; i++) {
|
||||
var id = this.suiteName + '-' + suite.tests[i];
|
||||
var prefix = "bk-";
|
||||
var domid = id.replace(/ /g,'-').replace(/\./g, '-');
|
||||
var callback = (function (id, domid) {
|
||||
var callback = (function (prefix, id, domid) {
|
||||
return (function (received) {
|
||||
if (received[0])
|
||||
this.computeBreakdown(received[0], id, domid);
|
||||
this.computeBreakdown(received[0], prefix, id, domid);
|
||||
if (++total == suite.tests.length)
|
||||
this.drawLegend();
|
||||
}).bind(this);
|
||||
}).bind(this)(id, domid);
|
||||
var file = 'bk-aggregate-' + id + '-' + this.machineId;
|
||||
}).bind(this)(prefix, id, domid);
|
||||
var file = prefix + 'aggregate-' + id + '-' + this.machineId;
|
||||
this.request([file], callback);
|
||||
}
|
||||
} else if (this.view == 'single') {
|
||||
|
@ -759,27 +784,29 @@ AWFY.requestRedraw = function () {
|
|||
}
|
||||
if (found) {
|
||||
var id = this.suiteName + '-' + this.subtest;
|
||||
var prefix = "bk-";
|
||||
var domid = id.replace(/ /g,'-').replace(/\./g, '-');
|
||||
var callback = (function (id, domid) {
|
||||
var callback = (function (prefix, id, domid) {
|
||||
return (function (received) {
|
||||
if (received[0])
|
||||
this.computeBreakdown(received[0], id, domid);
|
||||
this.computeBreakdown(received[0], prefix, id, domid);
|
||||
this.drawLegend();
|
||||
}).bind(this);
|
||||
}).bind(this)(id, domid);
|
||||
var file = 'bk-aggregate-' + id + '-' + this.machineId;
|
||||
}).bind(this)(prefix, id, domid);
|
||||
var file = prefix + 'aggregate-' + id + '-' + this.machineId;
|
||||
this.request([file], callback);
|
||||
} else {
|
||||
var id = this.suiteName;
|
||||
var prefix = "";
|
||||
var domid = id.replace(/ /g,'-').replace(/\./g, '-') + "-single";
|
||||
var callback = (function (id, domid) {
|
||||
var callback = (function (prefix, id, domid) {
|
||||
return (function (received) {
|
||||
if (received[0])
|
||||
this.computeBreakdown(received[0], id, domid);
|
||||
this.computeBreakdown(received[0], prefix, id, domid);
|
||||
this.drawLegend();
|
||||
}).bind(this);
|
||||
}).bind(this)(id, domid);
|
||||
var file = 'aggregate-' + id + '-' + this.machineId;
|
||||
}).bind(this)(prefix, id, domid);
|
||||
var file = prefix + 'aggregate-' + id + '-' + this.machineId;
|
||||
this.request([file], callback);
|
||||
}
|
||||
}
|
||||
|
@ -990,7 +1017,7 @@ AWFY.updateSuiteList = function (machineId) {
|
|||
var suites = [];
|
||||
for (var i=0; i < AWFYMaster.machines[machineId].suites.length; i++) {
|
||||
var name = AWFYMaster.machines[machineId].suites[i];
|
||||
if (AWFYMaster.suites[name] && AWFYMaster.suites[name].visible == 1)
|
||||
if (AWFYMaster.suites[name])
|
||||
suites.push([name, AWFYMaster.suites[name]]);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,14 +20,13 @@ if (!preg_match("/^[a-zA-Z0-9-. _]*$/i", $name)) {
|
|||
}
|
||||
|
||||
$file = $config->data_folder.$name;
|
||||
if (!file_exists($file)) {
|
||||
if (!has_permissions())
|
||||
fault();
|
||||
|
||||
$file = $config->data_folder."auth-".$name;
|
||||
if (!file_exists($file))
|
||||
fault();
|
||||
if (has_permissions()) {
|
||||
$authfile = $config->data_folder."auth-".$name;
|
||||
if (file_exists($authfile))
|
||||
$file = $authfile;
|
||||
}
|
||||
if (!file_exists($file))
|
||||
fault();
|
||||
|
||||
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) &&
|
||||
strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == filemtime($file))
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
function Display(awfy, id, domid, elt)
|
||||
function Display(awfy, prefix, id, domid, elt)
|
||||
{
|
||||
this.awfy = awfy;
|
||||
this.prefix = prefix;
|
||||
this.id = id;
|
||||
this.domid = domid;
|
||||
this.elt = elt;
|
||||
|
|
|
@ -16,7 +16,7 @@ class Config {
|
|||
// General Config
|
||||
public $data_folder;
|
||||
|
||||
function Config($config_file_path)
|
||||
function __construct($config_file_path)
|
||||
{
|
||||
$this->init($config_file_path);
|
||||
}
|
||||
|
@ -184,5 +184,88 @@ function awfy_query($query)
|
|||
return $result;
|
||||
}
|
||||
|
||||
if (!function_exists("mysql_connect")){
|
||||
/* warning: fatal error "cannot redeclare" if a function was disabled in php.ini with disable_functions:
|
||||
disable_functions =mysql_connect,mysql_pconnect,mysql_select_db,mysql_ping,mysql_query,mysql_fetch_assoc,mysql_num_rows,mysql_fetch_array,mysql_error,mysql_insert_id,mysql_close,mysql_real_escape_string,mysql_data_seek,mysql_result
|
||||
*/
|
||||
|
||||
function mysql_connect($host, $username, $password){
|
||||
global $dbconnect;
|
||||
$dbconnect = mysqli_connect($host, $username, $password);
|
||||
return $dbconnect;
|
||||
}
|
||||
function mysql_pconnect($host, $username, $password){
|
||||
global $dbconnect;
|
||||
$dbconnect = mysqli_connect("p:".$host, $username, $password);
|
||||
return $dbconnect;
|
||||
}
|
||||
function mysql_select_db($db){
|
||||
global $dbconnect;
|
||||
return mysqli_select_db ( $dbconnect,$db );
|
||||
}
|
||||
function mysql_ping($dbconnect){
|
||||
return mysqli_ping ( $dbconnect );
|
||||
}
|
||||
function mysql_query($stmt){
|
||||
global $dbconnect;
|
||||
return mysqli_query ($dbconnect, $stmt );
|
||||
}
|
||||
function mysql_fetch_assoc($erg){
|
||||
return mysqli_fetch_assoc ($erg );
|
||||
}
|
||||
function mysql_num_rows($e){
|
||||
return mysqli_num_rows ($e );
|
||||
}
|
||||
function mysql_affected_rows($e=NULL){
|
||||
return mysqli_affected_rows ($e );
|
||||
}
|
||||
function mysql_fetch_array($e){
|
||||
return mysqli_fetch_array ($e );
|
||||
}
|
||||
function mysql_error(){
|
||||
global $dbconnect;
|
||||
return mysqli_error ($dbconnect);
|
||||
}
|
||||
function mysql_insert_id($cnx){
|
||||
return mysqli_insert_id ( $cnx );
|
||||
}
|
||||
function mysql_close(){
|
||||
return true;
|
||||
}
|
||||
function mysql_escape_string($s){
|
||||
global $dbconnect;
|
||||
return mysqli_real_escape_string($dbconnect,$s);
|
||||
}
|
||||
function mysql_real_escape_string($s){
|
||||
global $dbconnect;
|
||||
return mysqli_real_escape_string($dbconnect,$s);
|
||||
}
|
||||
function mysql_data_seek($re,$row){
|
||||
return mysqli_data_seek($re,$row);
|
||||
}
|
||||
function mysql_result($res,$row=0,$col=0){
|
||||
$numrows = mysqli_num_rows($res);
|
||||
if ($numrows && $row <= ($numrows-1) && $row >=0){
|
||||
mysqli_data_seek($res,$row);
|
||||
$resrow = (is_numeric($col)) ? mysqli_fetch_row($res) : mysqli_fetch_assoc($res);
|
||||
if (isset($resrow[$col])){
|
||||
return $resrow[$col];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function mysql_get_server_info() {
|
||||
global $dbconnect;
|
||||
return mysqli_get_server_info($dbconnect);
|
||||
}
|
||||
function mysql_set_charset($csname) {
|
||||
global $dbconnect;
|
||||
return mysqli_set_charset($dbconnect,$csname);
|
||||
}
|
||||
function mysql_fetch_object($result) {
|
||||
return mysqli_fetch_object($result);
|
||||
}
|
||||
}
|
||||
|
||||
// Init
|
||||
$config = new Config("/etc/awfy-server.config");
|
||||
|
|
|
@ -251,7 +251,7 @@ header {
|
|||
vertical-align: middle; }
|
||||
header .rightSide {
|
||||
text-align: right; }
|
||||
header .rightSide div {
|
||||
header .rightSide>div {
|
||||
margin-left: 24px; }
|
||||
header a {
|
||||
text-decoration: none;
|
||||
|
|
|
@ -14,11 +14,12 @@
|
|||
<script type="text/javascript" src="../jquery/jquery-1.8.3.min.js"></script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.js"></script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular-route.js"></script>
|
||||
<script src="//login.persona.org/include.js"></script>
|
||||
<script src="js/persona.js"></script>
|
||||
<script src="js/app.js"></script>
|
||||
<script src="js/controllers.js"></script>
|
||||
|
||||
<script src="https://apis.google.com/js/platform.js"></script>
|
||||
<script src="js/googlelogin.js"></script>
|
||||
|
||||
</head>
|
||||
<body ng-controller="pageCtrl">
|
||||
|
||||
|
@ -28,13 +29,10 @@
|
|||
<div class='rightSide'>
|
||||
<div><a href="http://h4writer.com"><span>Blog</span></a></div>
|
||||
<div><a href="/"><span>Graphs</span></a></div>
|
||||
<!--
|
||||
<div><a href="/regressions"><span>Regressions</span></a></div>
|
||||
-->
|
||||
<div class='userMenu'>
|
||||
<a href="javascript:doPersonaLogin()" ng-if="!currentUser"><span>Login</span></a>
|
||||
<a href="javascript:doPersonaLogout()" ng-if='currentUser'><span>Logout</span></a>
|
||||
<div class="g-signin2" data-onsuccess="onSignIn"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
function onSignIn(googleUser) {
|
||||
var id_token = googleUser.getAuthResponse().id_token;
|
||||
|
||||
//var profile = googleUser.getBasicProfile();
|
||||
//console.log('Email: ' + profile.getEmail());
|
||||
var url = window.location.href.replace(window.location.hash, "") + "../auth.php";
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', url);
|
||||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
xhr.onload = function() {
|
||||
console.log('Signed in as: ' + xhr.responseText);
|
||||
};
|
||||
xhr.send('idtoken=' + id_token);
|
||||
}
|
||||
|
||||
var currentUser;
|
||||
gapi.load('auth2', function(){
|
||||
gapi.auth2.init({
|
||||
client_id: '426737155695-li9p5ukm79p60loe0p27g9p2m5299mko.apps.googleusercontent.com'
|
||||
});
|
||||
});
|
|
@ -1,35 +0,0 @@
|
|||
|
||||
// Listen on Persona events
|
||||
var request = false;
|
||||
var currentUser = decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent("persona").replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null;
|
||||
var url = window.location.href.replace(window.location.hash, "") + "../auth.php";
|
||||
navigator.id.watch({
|
||||
loggedInUser: currentUser == "" ? null : currentUser,
|
||||
onlogin: function (assertion) {
|
||||
if(request) {
|
||||
window.location = url + "?persona=1&assertion=" + assertion;
|
||||
}
|
||||
},
|
||||
onlogout: function () {
|
||||
if(request) {
|
||||
window.location = url + "?persona=1&logout=1";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Do login in
|
||||
var doPersonaLogin = function() {
|
||||
if (location.href.substring(0, 9) == "https://") {
|
||||
alert("please use https:// to log in");
|
||||
return;
|
||||
}
|
||||
|
||||
request = true;
|
||||
navigator.id.request();
|
||||
}
|
||||
|
||||
// Do login out
|
||||
var doPersonaLogout = function() {
|
||||
request = true;
|
||||
navigator.id.logout();
|
||||
}
|
Загрузка…
Ссылка в новой задаче