use current host for urls

This commit is contained in:
Kieran 2018-10-04 23:39:49 +08:00
parent 56089892d0
commit 510bf92054
3 changed files with 13 additions and 11 deletions

View File

@ -152,13 +152,13 @@
openLink() {
if (this.response !== undefined && this.response !== null && this.response.link !== undefined && this.response.link !== null && this.response.link.length > 0) {
window.open(this.response.link, '_blank');
window.open(window.location.href + this.response.publichash, '_blank');
}
}
openViewLink() {
if (this.response !== undefined && this.response !== null && this.response.link !== undefined && this.response.link !== null && this.response.link.length > 0) {
window.open(this.response.link.replace(this.response.publichash, '#' + this.response.publichash), '_blank');
window.open(window.location.href + '#' + this.response.publichash, '_blank');
}
}

View File

@ -23,7 +23,7 @@
/* GENERAL SETTINGS */
define('_PUB_HASH', 'ripemd160');
define('_DEFAULT_TYPE', 'application/octet-stream');
define('_SITEURL', 'https://void.cat/');
define('_SITEURL', (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/');
define('_UPLOADDIR', '/files/');
define('_FILEPATH', '/var/www/void.cat' . _UPLOADDIR);
define('_DISCORD_WEBHOOK', 'DISCORD_HOOK_URL');

View File

@ -8,17 +8,10 @@
if(!isset($_SERVER['HTTP_RANGE'])) {
matomo_page_view($redis);
}
$hash = substr($_SERVER["REQUEST_URI"], 1);
$hashKey = _UIP . ':' . $hash;
$redis->publish('dl-track', json_encode(array(
"uid" => $_COOKIE["VC:UID"],
"uip" => _UIP,
"hash" => $hash,
"range" => $_SERVER['HTTP_RANGE']
)));
if(_IS_LB_HOST == False && count(_LB_HOSTS) > 0) {
$has_cache = $redis->sIsMember("VC:DL:LB", $hash);
if($has_cache == False) {
@ -40,6 +33,14 @@
header("location: https://" . _LB_HOSTNAME . "/" . $hash, true, 301);
exit();
}
} else {
$redis->publish('dl-track', json_encode(array(
"host" => gethostname(),
"uid" => isset($_COOKIE["VC:UID"]) ? $_COOKIE["VC:UID"] : NULL,
"uip" => _UIP,
"hash" => $hash,
"range" => isset($_SERVER['HTTP_RANGE']) ? $_SERVER['HTTP_RANGE'] : NULL
)));
}
$refr = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : False;
@ -97,6 +98,7 @@
$redis->sadd($cfbk, _UIP);
AddFirewallRule(_UIP);
}
header('location: /');
exit();
}else if($dlCounter >= _DL_CAPTCHA){
//redirect for captcha check