fix: use custom 404 page

pull/75/head
sualko 2020-08-31 16:27:47 +02:00
parent 39acceb24d
commit e7bcdffe0a
3 changed files with 35 additions and 1 deletions

View File

@ -6,8 +6,8 @@ use OCA\BigBlueButton\Controller\JoinController;
use OCA\BigBlueButton\NoPermissionException; use OCA\BigBlueButton\NoPermissionException;
use OCA\BigBlueButton\NoPermissionResponse; use OCA\BigBlueButton\NoPermissionResponse;
use OCA\BigBlueButton\NotFoundException; use OCA\BigBlueButton\NotFoundException;
use OCA\BigBlueButton\NotFoundResponse;
use OCP\AppFramework\Middleware; use OCP\AppFramework\Middleware;
use OCP\AppFramework\Http\NotFoundResponse;
use OCP\IRequest; use OCP\IRequest;
class JoinMiddleware extends Middleware { class JoinMiddleware extends Middleware {

21
lib/NotFoundResponse.php Normal file
View File

@ -0,0 +1,21 @@
<?php
namespace OCA\BigBlueButton;
use OCP\Template;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http\ContentSecurityPolicy;
class NotFoundResponse extends Response {
public function __construct() {
parent::__construct();
$this->setContentSecurityPolicy(new ContentSecurityPolicy());
$this->setStatus(404);
}
public function render() {
$template = new Template('bbb', '404', 'guest');
return $template->fetchPage();
}
}

13
templates/404.php Normal file
View File

@ -0,0 +1,13 @@
<?php
/** @var array $_ */
/** @var \OCP\IL10N $l */
/** @var \OCP\Defaults $theme */
?>
<div class="body-login-container update">
<div class="icon-big icon-search icon-white"></div>
<h2><?php p($l->t('Room not found')); ?></h2>
<p class="infogroup"><?php p($l->t('The room could not be found. Maybe it was deleted?')); ?></p>
<p><a class="button primary" href="<?php p(\OC::$server->getURLGenerator()->linkTo('', 'index.php')) ?>">
<?php p($l->t('Back to %s', [$theme->getName()])); ?>
</a></p>
</div>