Pour que ça soit plus ou moins compatible en ligne

This commit is contained in:
Boris 2022-11-18 01:42:39 +01:00
parent 2a33815c9c
commit 5adc180307
4 changed files with 43 additions and 19 deletions

View File

@ -3,6 +3,7 @@
require_once('config.php');
require_once('lib/Gchange.class.php');
require_once('lib/Keygen.class.php');
require_once('lib/Fred.class.php');
$bodyIds = 'home';
include_once('header.php');
@ -11,17 +12,30 @@ $gchange = new Gchange();
$keygen = new Keygen();
$ipfsHost = 'http://astroport.localhost:8080';
// $ipfsHost = 'http://astroport.localhost:8080';
$ipfsHost = 'http://libra.copylaradio.com:8080';
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) {
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']);
}

View File

@ -1,12 +1,12 @@
<?php
class Fred {
private $gatewayProtocol = 'http';
// private $gatewayDomain = 'libra.copylaradio.com';
private $gatewayDomain = 'libra.copylaradio.com';
// private $gatewayDomain = 'aries.copylaradio.com';
private $gatewayDomain = 'astroport.localhost';
// private $gatewayDomain = 'astroport.localhost';
private $gatewayPort = '1234';
@ -27,20 +27,21 @@ class Fred {
$salt = $prenomNom;
$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);
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);
$url = $matches[1];
$url .= '/?'. $query;
die($url);
// die($url);
$opts2 = array(
'http'=>array(
'method'=>"GET",
@ -49,7 +50,7 @@ class Fred {
)
);
echo 'fred 2';
// echo 'fred 2';
$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.");
}
preg_match("`url='.*/ipns/([^']+)'`isU", $page2, $matches);
preg_match("`/ipns/(.+)`is", $page2, $matches);
$ipnsKey = $matches[1];
@ -170,8 +171,8 @@ class Fred {
preg_match("`url='([^']+)'`isU", $page1, $matches);
// die(
// '<pre>' . htmlspecialchars($page1) . '</pre>' .
// '<pre>' . print_r($matches, true) . '</pre>'
// '<pre>' . htmlspecialchars($page1) . '</pre>' .
// '<pre>' . print_r($matches, true) . '</pre>'
// );
$url = $matches[1];

View File

@ -1,6 +1,6 @@
const nodes = {
gchange: [
'http://data.gchange.fr'
'https://data.gchange.fr'
]
}

View File

@ -11,17 +11,26 @@ $boris = '25zB1gSC7Qhwnx463cuDLDCKLRVieLAgFiPbYq6jVHG9';
$playerG1Id = null;
if (isset($_POST['salt'], $_POST['pepper'])) {
$keygen = new Keygen();
try {
$keygen = new Keygen();
$playerG1Id = $keygen->getG1Pub($_POST['salt'], $_POST['pepper']);
$keygen->generatePubsec($_POST['salt'], $_POST['pepper']);
} 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'];