Fix some bugs

pull/37/head
Varun Patil 2022-08-17 20:59:26 +00:00
parent 4936a2fdf8
commit cb5487065e
4 changed files with 16 additions and 5 deletions

View File

@ -20,7 +20,7 @@
<navigations> <navigations>
<navigation> <navigation>
<name>Polaroid</name> <name>Polaroid</name>
<route>polaroid.page.index</route> <route>polaroid.page.main</route>
</navigation> </navigation>
</navigations> </navigations>
</info> </info>

View File

@ -1,13 +1,15 @@
<?php <?php
return [ return [
'routes' => [ 'routes' => [
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'], ['name' => 'page#main', 'url' => '/', 'verb' => 'GET'],
['name' => 'page#index', 'url' => '/albums/{path}', 'verb' => 'GET', 'postfix' => 'albums', ['name' => 'page#album', 'url' => '/albusms/{path}/{path1}', 'verb' => 'GET',
'requirements' => [ 'requirements' => [
'path' => '.*', 'path' => '.*',
'path1' => '.*',
], ],
'defaults' => [ 'defaults' => [
'path' => '', 'path' => '',
'path1' => '',
] ]
], ],

View File

@ -29,7 +29,7 @@ class PageController extends Controller {
* @NoAdminRequired * @NoAdminRequired
* @NoCSRFRequired * @NoCSRFRequired
*/ */
public function index() { public function main() {
Util::addScript($this->appName, 'polaroid-main'); Util::addScript($this->appName, 'polaroid-main');
Util::addStyle($this->appName, 'icons'); Util::addStyle($this->appName, 'icons');
@ -39,4 +39,11 @@ class PageController extends Controller {
return $response; return $response;
} }
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function album() {
return $this->main();
}
} }

View File

@ -413,6 +413,8 @@ export default {
try { try {
this.loading = true; this.loading = true;
fileInfos = await dav.getFiles(ids); fileInfos = await dav.getFiles(ids);
} catch {
console.error('Failed to load fileInfos');
} finally { } finally {
this.loading = false; this.loading = false;
} }
@ -431,7 +433,7 @@ export default {
}); });
} }
const photo = fileInfos.find(d => Number(d.fileid) === Number(img.id)); const photo = fileInfos.find(d => Number(d.fileid) === Number(img.file_id));
if (!photo) { if (!photo) {
alert('Cannot find this photo anymore!'); alert('Cannot find this photo anymore!');
return; return;