diff --git a/config.php.sample b/config.php.sample index 0522db3..3dbc5e4 100644 --- a/config.php.sample +++ b/config.php.sample @@ -3,4 +3,5 @@ return [ 'username' => '', 'password' => '' + 'noAlbumToken' => '' ]; diff --git a/index.php b/index.php index 710f956..48c7c0d 100644 --- a/index.php +++ b/index.php @@ -17,7 +17,6 @@ use PhotoPrismUpload\API\PhotoPrism; label[for="album"] { grid-column: 1; grid-row: 1; - /* display: block; */ } #album { grid-column: 2; @@ -45,12 +44,24 @@ $api = new PhotoPrism($config); $albums = []; try { $api->login(); - $albums = $api->getAlbums(); } catch (\Exception $e) { die('Fehler: ' . $e->getMessage()); } if (!isset($_POST['submit'])) { + if (!isset($_GET['token'])) { + die('Sorry, kein Zugriff'); + } + $token = $_GET['token']; + $tokens = explode(',', $token); + try { + $albums = $api->getAlbumsByTokens($tokens); + } catch (\Exception $e) { + die('Fehler: ' . $e->getMessage()); + } + if (empty($albums) && (empty($config['noAlbumToken']) || !in_array($config['noAlbumToken'], $tokens))) { + die('Falscher Token'); + } ?>