ht/ rework for onions step 2

This commit is contained in:
Miraty 2022-05-04 21:18:43 +02:00
parent f9a31faea1
commit 91441c5f1d
1 changed files with 3 additions and 1 deletions

View File

@ -64,7 +64,7 @@ HiddenServicePort 80 [::1]:" . INTERNAL_ONION_HTTP_PORT . "
";
file_put_contents(TOR_CONFIG_PATH, $torConf);
exec(SUDO_PATH . " " . SYSTEMCTL_PATH . " reload-tor", $output);
exec(SUDO_PATH . " " . SYSTEMCTL_PATH . " reload tor", $output);
addNiverLog("Tor reloaded by " . $_SESSION['username'], $output);
// Copy generated address to a location readable by PHP
@ -77,6 +77,8 @@ HiddenServicePort 80 [::1]:" . INTERNAL_ONION_HTTP_PORT . "
// Get the address generated by Tor
$onion = file_get_contents(HT_PATH . "/" . $_SESSION['username'] . "/" . $_POST['dir'] . "/hostname");
$onion = str_replace(array("\r", "\n"), "", $onion);
if (preg_match("/[0-9a-z]{56}\.onion/", $onion) !== 1)
exit("ERROR: No onion address found");
// Store it in the database
addSite($_SESSION['username'], $_POST['dir'], $onion, "onion", "http");