forked from La_Bureautique/zeg1jeux
Pour que ça soit plus ou moins compatible en ligne
This commit is contained in:
parent
2a33815c9c
commit
5adc180307
22
home.php
22
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,17 +12,30 @@ $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']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Fred {
|
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,20 +27,21 @@ 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);
|
||||||
|
|
||||||
if (empty($page1)) {
|
if (empty($page1)) {
|
||||||
|
|
||||||
throw new Exception("J'ai pas pû récupérer la putain de première page.");
|
throw new Exception("J'ai pas pû récupérer la putain de première page.");
|
||||||
}
|
}
|
||||||
|
|
||||||
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];
|
||||||
|
|
||||||
|
@ -170,8 +171,8 @@ class Fred {
|
||||||
preg_match("`url='([^']+)'`isU", $page1, $matches);
|
preg_match("`url='([^']+)'`isU", $page1, $matches);
|
||||||
|
|
||||||
// die(
|
// die(
|
||||||
// '<pre>' . htmlspecialchars($page1) . '</pre>' .
|
// '<pre>' . htmlspecialchars($page1) . '</pre>' .
|
||||||
// '<pre>' . print_r($matches, true) . '</pre>'
|
// '<pre>' . print_r($matches, true) . '</pre>'
|
||||||
// );
|
// );
|
||||||
|
|
||||||
$url = $matches[1];
|
$url = $matches[1];
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const nodes = {
|
const nodes = {
|
||||||
gchange: [
|
gchange: [
|
||||||
'http://data.gchange.fr'
|
'https://data.gchange.fr'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
15
login.php
15
login.php
|
@ -11,17 +11,26 @@ $boris = '25zB1gSC7Qhwnx463cuDLDCKLRVieLAgFiPbYq6jVHG9';
|
||||||
$playerG1Id = null;
|
$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) {
|
} catch (Exception $errMsg) {
|
||||||
|
|
||||||
ErrorsHandler::kaput($errMsg);
|
try {
|
||||||
|
|
||||||
|
$fred = new Fred();
|
||||||
|
|
||||||
|
$playerG1Id = $fred->donneMoiSaPutainDeG1Pub($_POST['salt'], $_POST['pepper']);
|
||||||
|
|
||||||
|
} catch (Exception $errMsg) {
|
||||||
|
|
||||||
|
ErrorsHandler::kaput($errMsg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$_SESSION['salt'] = $_POST['salt'];
|
$_SESSION['salt'] = $_POST['salt'];
|
||||||
|
|
Loading…
Reference in New Issue