diff --git a/inc/all.inc.php b/inc/all.inc.php index 3637c59..e752e5b 100644 --- a/inc/all.inc.php +++ b/inc/all.inc.php @@ -2,9 +2,9 @@ if (strpos($_SERVER['PHP_SELF'], "inc.php") !== false) exit("This file is meant to be included."); -function addNiverLog($message, $outputLines, $returnCode) { +function addNiverLog($message, $outputLines, $returnCode = false) { $logs = "\n" . date("Y-m-d H:i:s") . " " . $message . "\n"; - if (isset($returnCode)) + if ($returnCode !== false) $logs = $logs . "Return code: " . $returnCode . "\n"; else $logs = $logs . "No return code logged\n"; diff --git a/inc/auth.inc.php b/inc/auth.inc.php index 0e85d12..3a9f102 100644 --- a/inc/auth.inc.php +++ b/inc/auth.inc.php @@ -50,7 +50,7 @@ function antiCSRF() { if (!isset($_SERVER['HTTP_SEC_FETCH_SITE']) AND !isset($_SERVER['HTTP_ORIGIN'])) exit("ERROR: Browser sent neither Sec-Fetch-Site nor Origin HTTP headers, so anti-CSRF verification can't be done."); - if (isset($_SERVER['HTTP_ORIGIN']) AND $_SERVER['HTTP_ORIGIN'] !== "https://niver.4.niv.re") + if (isset($_SERVER['HTTP_ORIGIN']) AND $_SERVER['HTTP_ORIGIN'] !== ORIGIN) exit("ERROR: Anti-CSRF verification failed"); if (isset($_SERVER['HTTP_SEC_FETCH_SITE']) AND $_SERVER['HTTP_SEC_FETCH_SITE'] !== "same-origin") diff --git a/inc/const.inc.php b/inc/const.inc.php index eae9f01..b0baa36 100644 --- a/inc/const.inc.php +++ b/inc/const.inc.php @@ -5,8 +5,11 @@ if (strpos($_SERVER['PHP_SELF'], "inc.php") !== false) // --- Constants definitions --- // Public IP adresses (shown on the interface) -define("IPV4_ADDRESS", "82.66.61.19"); -define("IPV6_ADDRESS", "2a01:e0a:15c:2e40:acab:3:3:3"); +define("IPV4_ADDRESS", "127.0.0.1"); +define("IPV6_ADDRESS", "::1"); + +define("ORIGIN", "https://niver.test:42443"); +define("REGISTRY", "niver.test."); // Example IP adresses (for placeholders) define("IPV4_EXAMPLE", "203.0.113.42"); // See RFC5737: IPv4 Address Blocks Reserved for Documentation @@ -14,7 +17,7 @@ define("IPV6_EXAMPLE", "2001:db8::3"); // See RFC3849: IPv6 Address Prefix Reser define("DOMAIN_EXAMPLE", "example"); // From RFC2606: Reserved Top Level DNS Names > 2. TLDs for Testing, & Documentation Examples // Custom Niver paths -define("PREFIX", "/motrig"); // Prefix in URL, if any +define("PREFIX", ""); // Prefix in URL, if any define("ROOT_PATH", "/var/www/niver" . PREFIX); // Niver's directory define("SERVICE", substr(dirname($_SERVER['PHP_SELF']), strlen(PREFIX) + 1)); define("PAGE", basename($_SERVER['PHP_SELF'], '.php')); @@ -29,8 +32,6 @@ define("TOR_CONFIG_PATH", "/etc/tor/instances/niver/torrc"); // Tor configuratio define("TOR_KEYS_PATH", "/var/lib/tor-instances/niver/keys"); // Tor keys directory // Knot define("KNOT_ZONES_PATH", "/var/lib/knot/zones"); // Knot zones directory -// Twins -define("TWINS_PATH", "/var/local/twins"); // Twins directory containing configuration and TLS certificates // Executable files (you can get the full path of a command with $ which ) define("KNOTC_PATH", "/usr/sbin/knotc"); define("KEYMGR_PATH", "/usr/sbin/keymgr"); @@ -64,115 +65,11 @@ define("THEME", array( 'lightHtColor' => "#FFFF00", 'lightAuthColor' => "#00FF00", - //The old theme for both dark and light themes - /*'htColor' => "#FF0000", - 'regColor' => "#DA03E5", - 'authColor' => "#00FF00", - 'nsColor' => "#00A5A5",*/ - 'lightColor' => '#FFFFFF', 'darkColor' => '#000000', )); // Public suffixes define("SUFFIXES", array( - "4.niv.re.", - - "asso.4.niv.re.", - "org.4.niv.re.", - "perso.4.niv.re.", - "blog.4.niv.re.", - "me.4.niv.re.", - - "edu.4.niv.re.", - "info.4.niv.re.", - "wiki.4.niv.re.", - "sci.4.niv.re.", - - "pol.4.niv.re.", - "libre.4.niv.re.", - "fem.4.niv.re.", - "eco.4.niv.re.", - "veg.4.niv.re.", - "bio.4.niv.re.", - "anar.4.niv.re.", - "ancom.4.niv.re.", - "acab.4.niv.re.", - "handi.4.niv.re.", - - "queer.4.niv.re.", - "gay.4.niv.re.", - "enby.4.niv.re.", - "trans.4.niv.re.", - - "net.4.niv.re.", - "tech.4.niv.re.", - "io.4.niv.re.", - "sec.4.niv.re.", - "cyber.4.niv.re.", - "dev.4.niv.re.", - "geek.4.niv.re.", - "fs.4.niv.re.", - "ht.4.niv.re.", - "hyper.4.niv.re.", - "git.4.niv.re.", - "forge.4.niv.re.", - "code.4.niv.re.", - "lab.4.niv.re.", - "labs.4.niv.re.", - "gemini.4.niv.re.", - "gmi.4.niv.re.", - "gemlog.4.niv.re.", - "mail.4.niv.re.", - "ynh.4.niv.re.", - "yuno.4.niv.re.", - "sys.4.niv.re.", - - "fed.4.niv.re.", - "fedi.4.niv.re.", - "soc.4.niv.re.", - "masto.4.niv.re.", - "plero.4.niv.re.", - "pix.4.niv.re.", - "mobi.4.niv.re.", - - "art.4.niv.re.", - "music.4.niv.re.", - "video.4.niv.re.", - "draw.4.niv.re.", - "audio.4.niv.re.", - "ink.4.niv.re.", - - "na.4.niv.re.", - "psy.4.niv.re.", - "neuro.4.niv.re.", - "auti.4.niv.re.", - "plur.4.niv.re.", - - "blue.4.niv.re.", - "red.4.niv.re.", - "pink.4.niv.re.", - "green.4.niv.re.", - "black.4.niv.re.", - - "city.4.niv.re.", - "town.4.niv.re.", - "cafe.4.niv.re.", - "home.4.niv.re.", - "forum.4.niv.re.", - - "dream.4.niv.re.", - "space.4.niv.re.", - "forest.4.niv.re.", - "rain.4.niv.re.", - "snow.4.niv.re.", - "sun.4.niv.re.", - "earth.4.niv.re.", - "world.4.niv.re.", - "soft.4.niv.re.", - "cute.4.niv.re.", - "cutie.4.niv.re.", - "fun.4.niv.re.", - "play.4.niv.re.", - "game.4.niv.re.", + REGISTRY, )); diff --git a/inc/form/form.ns.inc.php b/inc/form/form.ns.inc.php index 726bc8c..21069d5 100644 --- a/inc/form/form.ns.inc.php +++ b/inc/form/form.ns.inc.php @@ -35,7 +35,7 @@

- +
diff --git a/top.inc.php b/top.inc.php index 5ed4f10..8779d4a 100644 --- a/top.inc.php +++ b/top.inc.php @@ -18,7 +18,7 @@ require "inc/pages.inc.php"; if ( isset($_COOKIE['niver']) // Resume session OR - (SERVICE === "auth" + (SERVICE === "auth" // Create new session AND PAGE === "login" AND isset($_POST['username'])) ) { @@ -38,12 +38,6 @@ if ( ]); } -// Redirect to the login page if not logged in -if (SERVICE != "auth" AND !isset($_SESSION['username'])) { - header('Location: ' . PREFIX . '/auth/login?redir=' . SERVICE . "/" . PAGE, true, 302); - exit; -} - // Remove .php from URL (if any) if (substr($_SERVER['REQUEST_URI'], -4) == ".php") { header("Location: " . PREFIX . "/" . SERVICE . "/" . PAGE, true, 301); // 301 Moved Permanently