Add X-Accel-Expires for non-authorized users

This commit is contained in:
Celestora 2022-04-04 16:43:40 +03:00
parent 3281cd0c1b
commit 8b3917e863
2 changed files with 4 additions and 0 deletions

View file

@ -205,6 +205,7 @@ abstract class OpenVKPresenter extends SimplePresenter
$this->template->isTimezoned = Session::i()->get("_timezoneOffset"); $this->template->isTimezoned = Session::i()->get("_timezoneOffset");
$userValidated = 0; $userValidated = 0;
$cacheTime = OPENVK_ROOT_CONF["openvk"]["preferences"]["nginxCacheTime"] ?? 0;
if(!is_null($user)) { if(!is_null($user)) {
$this->user = (object) []; $this->user = (object) [];
$this->user->raw = $user; $this->user->raw = $user;
@ -263,6 +264,7 @@ abstract class OpenVKPresenter extends SimplePresenter
} }
$userValidated = 1; $userValidated = 1;
$cacheTime = 0; # Force no cache
if ($this->user->identity->onlineStatus() == 0) { if ($this->user->identity->onlineStatus() == 0) {
$this->user->identity->setOnline(time()); $this->user->identity->setOnline(time());
$this->user->identity->save(); $this->user->identity->save();
@ -274,6 +276,7 @@ abstract class OpenVKPresenter extends SimplePresenter
} }
header("X-OpenVK-User-Validated: $userValidated"); header("X-OpenVK-User-Validated: $userValidated");
header("X-Accel-Expires: $cacheTime");
setlocale(LC_TIME, ...(explode(";", tr("__locale")))); setlocale(LC_TIME, ...(explode(";", tr("__locale"))));
parent::onStartup(); parent::onStartup();

View file

@ -6,6 +6,7 @@ openvk:
preferences: preferences:
femaleGenderPriority: true femaleGenderPriority: true
nginxCacheTime: null
uploads: uploads:
disableLargeUploads: false disableLargeUploads: false
mode: "basic" mode: "basic"