Pour que ça soit plus ou moins compatible en ligne
This commit is contained in:
parent
2a33815c9c
commit
5adc180307
18
home.php
18
home.php
|
@ -3,6 +3,7 @@
|
||||||
require_once('config.php');
|
require_once('config.php');
|
||||||
require_once('lib/Gchange.class.php');
|
require_once('lib/Gchange.class.php');
|
||||||
require_once('lib/Keygen.class.php');
|
require_once('lib/Keygen.class.php');
|
||||||
|
require_once('lib/Fred.class.php');
|
||||||
|
|
||||||
$bodyIds = 'home';
|
$bodyIds = 'home';
|
||||||
include_once('header.php');
|
include_once('header.php');
|
||||||
|
@ -11,19 +12,32 @@ $gchange = new Gchange();
|
||||||
|
|
||||||
$keygen = new Keygen();
|
$keygen = new Keygen();
|
||||||
|
|
||||||
$ipfsHost = 'http://astroport.localhost:8080';
|
// $ipfsHost = 'http://astroport.localhost:8080';
|
||||||
|
$ipfsHost = 'http://libra.copylaradio.com:8080';
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$player = $gchange->getUser($_SESSION['player_pubkey']);
|
$player = $gchange->getUser($_SESSION['player_pubkey']);
|
||||||
|
|
||||||
$twLink = $ipfsHost . '/ipns/' . $keygen->getIPNSPub($_SESSION['salt'], $_SESSION['pepper']);
|
|
||||||
|
|
||||||
} catch (Exception $errMsg) {
|
} catch (Exception $errMsg) {
|
||||||
|
|
||||||
ErrorsHandler::kaput($errMsg);
|
ErrorsHandler::kaput($errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$twLink = $ipfsHost . '/ipns/' . $keygen->getIPNSPub($_SESSION['salt'], $_SESSION['pepper']);
|
||||||
|
|
||||||
|
} catch (Exception $errMsg) {
|
||||||
|
|
||||||
|
$twLink = '#';
|
||||||
|
$fred = new Fred();
|
||||||
|
$twLink = $ipfsHost . '/ipns/' . $fred->donneMoiLaPutainDeClefIPNS($_SESSION['salt'], $_SESSION['pepper']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<header>
|
<header>
|
||||||
|
|
|
@ -4,9 +4,9 @@ class Fred {
|
||||||
|
|
||||||
private $gatewayProtocol = 'http';
|
private $gatewayProtocol = 'http';
|
||||||
|
|
||||||
// private $gatewayDomain = 'libra.copylaradio.com';
|
private $gatewayDomain = 'libra.copylaradio.com';
|
||||||
// private $gatewayDomain = 'aries.copylaradio.com';
|
// private $gatewayDomain = 'aries.copylaradio.com';
|
||||||
private $gatewayDomain = 'astroport.localhost';
|
// private $gatewayDomain = 'astroport.localhost';
|
||||||
|
|
||||||
private $gatewayPort = '1234';
|
private $gatewayPort = '1234';
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class Fred {
|
||||||
$salt = $prenomNom;
|
$salt = $prenomNom;
|
||||||
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday;
|
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday;
|
||||||
|
|
||||||
$query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper);
|
$query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper) . '&getipns=on';
|
||||||
|
|
||||||
$page1 = file_get_contents($this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query);
|
$page1 = file_get_contents($this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query);
|
||||||
|
|
||||||
|
@ -39,8 +39,9 @@ class Fred {
|
||||||
preg_match("`url='([^']+)'`isU", $page1, $matches);
|
preg_match("`url='([^']+)'`isU", $page1, $matches);
|
||||||
|
|
||||||
$url = $matches[1];
|
$url = $matches[1];
|
||||||
|
$url .= '/?'. $query;
|
||||||
|
|
||||||
die($url);
|
// die($url);
|
||||||
$opts2 = array(
|
$opts2 = array(
|
||||||
'http'=>array(
|
'http'=>array(
|
||||||
'method'=>"GET",
|
'method'=>"GET",
|
||||||
|
@ -49,7 +50,7 @@ class Fred {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
echo 'fred 2';
|
// echo 'fred 2';
|
||||||
|
|
||||||
$context2 = stream_context_create($opts2);
|
$context2 = stream_context_create($opts2);
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ class Fred {
|
||||||
throw new Exception("J'ai pas pû récupérer la putain de deuxième page.");
|
throw new Exception("J'ai pas pû récupérer la putain de deuxième page.");
|
||||||
}
|
}
|
||||||
|
|
||||||
preg_match("`url='.*/ipns/([^']+)'`isU", $page2, $matches);
|
preg_match("`/ipns/(.+)`is", $page2, $matches);
|
||||||
|
|
||||||
$ipnsKey = $matches[1];
|
$ipnsKey = $matches[1];
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const nodes = {
|
const nodes = {
|
||||||
gchange: [
|
gchange: [
|
||||||
'http://data.gchange.fr'
|
'https://data.gchange.fr'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
13
login.php
13
login.php
|
@ -12,17 +12,26 @@ $playerG1Id = null;
|
||||||
|
|
||||||
if (isset($_POST['salt'], $_POST['pepper'])) {
|
if (isset($_POST['salt'], $_POST['pepper'])) {
|
||||||
|
|
||||||
$keygen = new Keygen();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
$keygen = new Keygen();
|
||||||
|
|
||||||
$playerG1Id = $keygen->getG1Pub($_POST['salt'], $_POST['pepper']);
|
$playerG1Id = $keygen->getG1Pub($_POST['salt'], $_POST['pepper']);
|
||||||
$keygen->generatePubsec($_POST['salt'], $_POST['pepper']);
|
$keygen->generatePubsec($_POST['salt'], $_POST['pepper']);
|
||||||
|
|
||||||
|
} catch (Exception $errMsg) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$fred = new Fred();
|
||||||
|
|
||||||
|
$playerG1Id = $fred->donneMoiSaPutainDeG1Pub($_POST['salt'], $_POST['pepper']);
|
||||||
|
|
||||||
} catch (Exception $errMsg) {
|
} catch (Exception $errMsg) {
|
||||||
|
|
||||||
ErrorsHandler::kaput($errMsg);
|
ErrorsHandler::kaput($errMsg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$_SESSION['salt'] = $_POST['salt'];
|
$_SESSION['salt'] = $_POST['salt'];
|
||||||
$_SESSION['pepper'] = $_POST['pepper'];
|
$_SESSION['pepper'] = $_POST['pepper'];
|
||||||
|
|
Loading…
Reference in New Issue