diff --git a/src/backend/middlewares/SharingMWs.ts b/src/backend/middlewares/SharingMWs.ts index e4c0c68d..0ec63663 100644 --- a/src/backend/middlewares/SharingMWs.ts +++ b/src/backend/middlewares/SharingMWs.ts @@ -55,7 +55,9 @@ export class SharingMWs { path: directoryName, password: createSharing.password, creator: req.session.user, - expires: Date.now() + createSharing.valid, + expires: createSharing.valid >= 0 ? // if === -1 its forever + Date.now() + createSharing.valid : + (new Date(9999, 0, 1)).getTime(), // never expire includeSubfolders: createSharing.includeSubfolders, timeStamp: Date.now() }; @@ -86,7 +88,9 @@ export class SharingMWs { sharingKey: '', password: (updateSharing.password && updateSharing.password !== '') ? updateSharing.password : null, creator: req.session.user, - expires: Date.now() + updateSharing.valid, + expires: updateSharing.valid >= 0 // if === -1 its forever + ? Date.now() + updateSharing.valid : + (new Date(9999, 0, 1)).getTime(), // never expire includeSubfolders: updateSharing.includeSubfolders, timeStamp: Date.now() }; diff --git a/src/frontend/app/ui/gallery/gallery.component.ts b/src/frontend/app/ui/gallery/gallery.component.ts index ab98fbdd..b860390a 100644 --- a/src/frontend/app/ui/gallery/gallery.component.ts +++ b/src/frontend/app/ui/gallery/gallery.component.ts @@ -60,6 +60,11 @@ export class GalleryComponent implements OnInit, OnDestroy { if (this.shareService.sharingSubject.value == null) { return; } + // if the timer is longer than 10 years, just do not show it + if ((this.shareService.sharingSubject.value.expires - Date.now()) / 1000 / 86400 / 365 > 10) { + return; + } + t = Math.floor((this.shareService.sharingSubject.value.expires - Date.now()) / 1000); this.countDown = ({} as any); this.countDown.day = Math.floor(t / 86400); @@ -132,7 +137,7 @@ export class GalleryComponent implements OnInit, OnDestroy { directoryName = directoryName || ''; this.galleryService.loadDirectory(directoryName); - } + }; private onContentChange = (content: ContentWrapper): void => { const tmp = (content.searchResult || content.directory || { @@ -153,7 +158,7 @@ export class GalleryComponent implements OnInit, OnDestroy { break; } } - } + }; private sortDirectories(): void { if (!this.directories) { diff --git a/src/frontend/app/ui/gallery/share/share.gallery.component.html b/src/frontend/app/ui/gallery/share/share.gallery.component.html index a15a8a99..4b466926 100644 --- a/src/frontend/app/ui/gallery/share/share.gallery.component.html +++ b/src/frontend/app/ui/gallery/share/share.gallery.component.html @@ -49,7 +49,7 @@
- +
@@ -95,7 +96,8 @@ + [disabled]="input.valid.type === ValidityTypes.Forever" + type="number" min="1" step="1"/>
diff --git a/src/frontend/app/ui/gallery/share/share.gallery.component.ts b/src/frontend/app/ui/gallery/share/share.gallery.component.ts index 5436db63..8e7691a1 100644 --- a/src/frontend/app/ui/gallery/share/share.gallery.component.ts +++ b/src/frontend/app/ui/gallery/share/share.gallery.component.ts @@ -26,7 +26,7 @@ export class GalleryShareComponent implements OnInit, OnDestroy { includeSubfolders: true, valid: { amount: 30, - type: ValidityTypes.Days + type: ValidityTypes.Days as ValidityTypes }, password: null as string }; @@ -79,6 +79,8 @@ export class GalleryShareComponent implements OnInit, OnDestroy { return this.input.valid.amount * 1000 * 60 * 60 * 24; case ValidityTypes.Months: return this.input.valid.amount * 1000 * 60 * 60 * 24 * 30; + case ValidityTypes.Forever: + return -1; } throw new Error('unknown type: ' + this.input.valid.type); } @@ -124,5 +126,5 @@ export class GalleryShareComponent implements OnInit, OnDestroy { export enum ValidityTypes { - Minutes = 1, Hours = 2, Days = 3, Months = 4 + Minutes = 1, Hours = 2, Days = 3, Months = 4, Forever = 99 } diff --git a/src/frontend/app/ui/sharelogin/share-login.component.ts b/src/frontend/app/ui/sharelogin/share-login.component.ts index bcc450cc..b57967ec 100644 --- a/src/frontend/app/ui/sharelogin/share-login.component.ts +++ b/src/frontend/app/ui/sharelogin/share-login.component.ts @@ -32,7 +32,8 @@ export class ShareLoginComponent implements OnInit { await this.authService.shareLogin(this.password); } catch (error) { - if (error && error.code === ErrorCodes.CREDENTIAL_NOT_FOUND) { + if (error && error.code === ErrorCodes.CREDENTIAL_NOT_FOUND || + error === 'Unauthorized') { this.loginError = true; } } diff --git a/src/frontend/translate/messages.en.xlf b/src/frontend/translate/messages.en.xlf index 10a5b213..8905492a 100644 --- a/src/frontend/translate/messages.en.xlf +++ b/src/frontend/translate/messages.en.xlf @@ -2732,6 +2732,10 @@ User creation error! User creation error! + + Forever + Forever + \ No newline at end of file diff --git a/src/frontend/translate/messages.es.xlf b/src/frontend/translate/messages.es.xlf index c9f5e536..4b04e722 100644 --- a/src/frontend/translate/messages.es.xlf +++ b/src/frontend/translate/messages.es.xlf @@ -2732,6 +2732,10 @@ User creation error! User creation error! + + Forever + Forever + \ No newline at end of file diff --git a/src/frontend/translate/messages.fr.xlf b/src/frontend/translate/messages.fr.xlf index 15327e25..b4467d72 100644 --- a/src/frontend/translate/messages.fr.xlf +++ b/src/frontend/translate/messages.fr.xlf @@ -2732,6 +2732,10 @@ User creation error! User creation error! + + Forever + Forever + \ No newline at end of file diff --git a/src/frontend/translate/messages.hu.xlf b/src/frontend/translate/messages.hu.xlf index e3b98a40..15b48cfb 100644 --- a/src/frontend/translate/messages.hu.xlf +++ b/src/frontend/translate/messages.hu.xlf @@ -2732,6 +2732,10 @@ User creation error! User creation error! + + Forever + Örökké + diff --git a/src/frontend/translate/messages.it.xlf b/src/frontend/translate/messages.it.xlf index fa57dae0..4d1f77fb 100644 --- a/src/frontend/translate/messages.it.xlf +++ b/src/frontend/translate/messages.it.xlf @@ -951,7 +951,7 @@ src/frontend/app/ui/settings/database/database.settings.component.html 49 - Database + Database Override keywords @@ -967,7 +967,7 @@ src/frontend/app/ui/settings/faces/faces.settings.component.html 33 - Se una foto ha lo stesso volto (persona) nome e parola chiave, l'applicazione rimuove il duplicato, mantenendo solo il volto. + Se una foto ha lo stesso volto (persona) nome e parola chiave, l'applicazione rimuove il duplicato, mantenendo solo il volto. Face starring right @@ -983,7 +983,7 @@ src/frontend/app/ui/settings/faces/faces.settings.component.html 40 - Required minimum right to star (favourite) a face. + Required minimum right to star (favourite) a face. Faces are not supported with these settings. @@ -1127,7 +1127,7 @@ src/frontend/app/ui/settings/indexing/indexing.settings.component.html 116 - Video + Video Persons @@ -1179,7 +1179,7 @@ src/frontend/app/ui/settings/jobs/jobs.settings.component.html 118 - ogni + ogni never @@ -1219,7 +1219,7 @@ src/frontend/app/ui/settings/jobs/jobs.settings.component.html 76,77 - Imposta l'orario di esecuzione del lavoro. + Imposta l'orario di esecuzione del lavoro. After: @@ -1235,14 +1235,14 @@ src/frontend/app/ui/settings/jobs/jobs.settings.component.html 93,94 - Il lavoro verrà eseguito dopo la fine di quel lavoro. + Il lavoro verrà eseguito dopo la fine di quel lavoro. At: src/frontend/app/ui/settings/jobs/jobs.settings.component.html 100 - + src/frontend/app/ui/settings/jobs/jobs.settings.component.html 110 @@ -1511,7 +1511,7 @@ src/frontend/app/ui/settings/other/other.settings.component.html 15 - Runs directory scanning in a different thread. + Runs directory scanning in a different thread. Thumbnail threads @@ -1671,7 +1671,7 @@ src/frontend/app/ui/settings/photo/photo.settings.component.html 12 - Ridimensiona le foto per un caricamento più veloce dell'anteprima. (Ingrandendo la foto si carica l'originale). + Ridimensiona le foto per un caricamento più veloce dell'anteprima. (Ingrandendo la foto si carica l'originale). On the fly converting @@ -1695,7 +1695,7 @@ src/frontend/app/ui/settings/photo/photo.settings.component.html 27 - + src/frontend/app/ui/settings/video/video.settings.component.html 66 @@ -1723,7 +1723,7 @@ src/frontend/app/ui/settings/random-photo/random-photo.settings.component.html 36,37 - La generazione di link di foto casuali non è supportata con le impostazioni correnti + La generazione di link di foto casuali non è supportata con le impostazioni correnti Autocomplete @@ -1731,7 +1731,7 @@ src/frontend/app/ui/settings/search/search.settings.component.html 32 - Autocompleta + Autocompleta Show hints while typing search query. @@ -1763,7 +1763,7 @@ src/frontend/app/ui/settings/search/search.settings.component.html 49,50 - La ricerca non è supportata con le impostazioni correnti. + La ricerca non è supportata con le impostazioni correnti. Password protected @@ -1779,7 +1779,7 @@ src/frontend/app/ui/settings/share/share.settings.component.html 30 - Abilita la condivisione di link protetti da password. + Abilita la condivisione di link protetti da password. Sharing is not supported with these settings @@ -2019,7 +2019,7 @@ src/frontend/app/ui/settings/video/video.settings.component.html 78 - Il video di output avrà questi frame al secondo. + Il video di output avrà questi frame al secondo. Bit rate @@ -2043,7 +2043,7 @@ src/frontend/app/ui/settings/video/video.settings.component.html 112 - CRF + CRF The range of the Constant Rate Factor (CRF) scale is 0–51, where 0 is lossless, 23 is the default, and 51 is worst quality possible. @@ -2051,7 +2051,7 @@ src/frontend/app/ui/settings/video/video.settings.component.html 113 - La scala del fattore qualità (CRF) è da 0 a 51, dove 0 è lossless, 23 è il default e 51 è la peggior qualità possibile. + La scala del fattore qualità (CRF) è da 0 a 51, dove 0 è lossless, 23 è il default e 51 è la peggior qualità possibile. Preset @@ -2059,7 +2059,7 @@ src/frontend/app/ui/settings/video/video.settings.component.html 121 - Preimpostazioni + Preimpostazioni A preset is a collection of options that will provide a certain encoding speed to compression ratio. A slower preset will provide better compression (compression is quality per filesize). @@ -2732,6 +2732,10 @@ User creation error! User creation error! + + Forever + Forever + \ No newline at end of file diff --git a/src/frontend/translate/messages.ro.xlf b/src/frontend/translate/messages.ro.xlf index 6d2720d8..dce72057 100644 --- a/src/frontend/translate/messages.ro.xlf +++ b/src/frontend/translate/messages.ro.xlf @@ -2732,6 +2732,10 @@ User creation error! User creation error! + + Forever + Forever + \ No newline at end of file diff --git a/src/frontend/translate/messages.ru.xlf b/src/frontend/translate/messages.ru.xlf index 119ed239..0df43a16 100644 --- a/src/frontend/translate/messages.ru.xlf +++ b/src/frontend/translate/messages.ru.xlf @@ -2732,6 +2732,10 @@ User creation error! User creation error! + + Forever + Forever + \ No newline at end of file diff --git a/src/frontend/translate/messages.sv.xlf b/src/frontend/translate/messages.sv.xlf index d370bb7b..63c46bc3 100644 --- a/src/frontend/translate/messages.sv.xlf +++ b/src/frontend/translate/messages.sv.xlf @@ -2732,6 +2732,10 @@ User creation error! User creation error! + + Forever + Forever + \ No newline at end of file