mirror of
https://codeberg.org/demostf/api.git
synced 2026-06-03 09:54:17 +02:00
cast in controller
This commit is contained in:
parent
807c8c9a26
commit
54260646e0
1 changed files with 11 additions and 11 deletions
|
|
@ -71,39 +71,39 @@ class DemoController extends BaseController {
|
|||
public function listDemos() {
|
||||
$page = $this->query('page', 1);
|
||||
$order = $this->query('order', 'DESC') === 'ASC' ? 'ASC' : 'DESC';
|
||||
\Flight::json($this->demoListProvider->listDemos($page, $this->getFilter(), $order));
|
||||
\Flight::json($this->demoListProvider->listDemos((int)$page, $this->getFilter(), $order));
|
||||
}
|
||||
|
||||
public function listProfile($steamId) {
|
||||
$page = $this->query('page', 1);
|
||||
$where = $this->getFilter();
|
||||
$where['players'][] = $steamId;
|
||||
\Flight::json($this->demoListProvider->listProfile($page, $where));
|
||||
\Flight::json($this->demoListProvider->listProfile((int)$page, $where));
|
||||
}
|
||||
|
||||
public function listUploads($steamId) {
|
||||
$page = $this->query('page', 1);
|
||||
\Flight::json($this->demoListProvider->listUploads($steamId, $page, $this->getFilter()));
|
||||
\Flight::json($this->demoListProvider->listUploads($steamId, (int)$page, $this->getFilter()));
|
||||
}
|
||||
|
||||
public function chat($demoId) {
|
||||
\Flight::json($this->chatProvider->getChat($demoId));
|
||||
\Flight::json($this->chatProvider->getChat((int)$demoId));
|
||||
}
|
||||
|
||||
public function setDemoUrl($id) {
|
||||
$hash = (string) $this->post('hash', '');
|
||||
$backend = (string) $this->post('backend', '');
|
||||
$path = (string) $this->post('path', '');
|
||||
$url = (string) $this->post('url', '');
|
||||
$editKey = (string) $this->post('key', '');
|
||||
$hash = (string)$this->post('hash', '');
|
||||
$backend = (string)$this->post('backend', '');
|
||||
$path = (string)$this->post('path', '');
|
||||
$url = (string)$this->post('url', '');
|
||||
$editKey = (string)$this->post('key', '');
|
||||
if ($editKey !== $this->editKey || $editKey === '') {
|
||||
throw new \InvalidArgumentException('Invalid key');
|
||||
}
|
||||
|
||||
$demo = $this->demoProvider->get((int) $id);
|
||||
$demo = $this->demoProvider->get((int)$id);
|
||||
$existingHash = $demo->getHash();
|
||||
if ($existingHash === '' || $existingHash === $hash) {
|
||||
$this->demoProvider->setDemoUrl((int) $id, $backend, $url, $path);
|
||||
$this->demoProvider->setDemoUrl((int)$id, $backend, $url, $path);
|
||||
} else {
|
||||
throw new \InvalidArgumentException('Invalid demo hash');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue