diff --git a/src/Classes/Upload.php b/src/Classes/Upload.php index 66176c26..3aa170fc 100755 --- a/src/Classes/Upload.php +++ b/src/Classes/Upload.php @@ -209,11 +209,16 @@ public function uploadFile(): array } $this->Connector->newIntoDB($this->FILE_INFO, $this->fingerPrintInfo); } + if (substr($_SERVER['HTTP_HOST'], -6) === '.onion') { + $proper_url = 'http://' . $this->Connector->CONFIG['FILE_ONION_DOMAIN']; + } else { + $proper_url = 'https://' . $this->Connector->CONFIG['FILE_DOMAIN']; + } return [ 'hash' => $this->FILE_INFO['XXH'], 'name' => $this->FILE_INFO['NAME'], 'filename' => $this->FILE_INFO['FILENAME'], - 'url' => 'https://' . $this->Connector->CONFIG['FILE_DOMAIN'] . '/' . $this->FILE_INFO['FILENAME'], + 'url' => $proper_url . '/' . $this->FILE_INFO['FILENAME'], 'size' => $this->FILE_INFO['SIZE'], 'dupe' => $this->FILE_INFO['DUPE'], ]; diff --git a/src/config.json b/src/config.json index 2b867e6b..c8edb56b 100755 --- a/src/config.json +++ b/src/config.json @@ -15,6 +15,7 @@ "subTitle": "Temporary file hosting", "DOMAIN": "dev.uguu.se", "FILE_DOMAIN": "files.dev.uguu.se", + "FILE_ONION_DOMAIN": "zkaan2xfbuxia2wpf7ofnkbz6r5zdbbvxbunvp5g2iebopbfc4iqmbad.onion", "abuseContact": "abuse@email.com", "infoContact": "info@email.com", "ServerCountryLocation": "Sweden",