mirror of
https://github.com/bpatrik/pigallery2.git
synced 2024-12-12 11:15:22 +02:00
Adding never expiring sharing link. #260
It works by setting the expirity to -1 that setts the expire dat to 01/01/9999. Now the UI does not show expiration if it is longer than 10 years
This commit is contained in:
parent
07012ebd3c
commit
4af6c16aef
@ -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()
|
||||
};
|
||||
|
@ -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) {
|
||||
|
@ -49,7 +49,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<label class="control-label" for="includeSubfolders" i18n>Include subfolders:</label>
|
||||
<label class="control-label" for="includeSubfolders" i18n>Include subfolders:</label>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<bSwitch
|
||||
@ -71,7 +71,8 @@
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<label class="control-label" for="share-password">
|
||||
<ng-container i18n>Password</ng-container>*:
|
||||
<ng-container i18n>Password</ng-container>
|
||||
*:
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-8" *ngIf="passwordProtection">
|
||||
@ -95,7 +96,8 @@
|
||||
<input class="form-control" [(ngModel)]="input.valid.amount" (change)="update()"
|
||||
name="valid-from"
|
||||
id="valid-from"
|
||||
type="number" min="0" step="1"/>
|
||||
[disabled]="input.valid.type === ValidityTypes.Forever"
|
||||
type="number" min="1" step="1"/>
|
||||
</div>
|
||||
<div class="col-4" style="padding-left: 1px">
|
||||
<select class="form-control"
|
||||
@ -105,6 +107,7 @@
|
||||
<option [ngValue]="ValidityTypes.Hours" i18n>Hours</option>
|
||||
<option [ngValue]="ValidityTypes.Days" i18n>Days</option>
|
||||
<option [ngValue]="ValidityTypes.Months" i18n>Months</option>
|
||||
<option [ngValue]="ValidityTypes.Forever" i18n>Forever</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -2732,6 +2732,10 @@
|
||||
<source>User creation error!</source>
|
||||
<target>User creation error!</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="233324084168950985" datatype="html">
|
||||
<source>Forever</source>
|
||||
<target>Forever</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -2732,6 +2732,10 @@
|
||||
<source>User creation error!</source>
|
||||
<target>User creation error!</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="233324084168950985" datatype="html">
|
||||
<source>Forever</source>
|
||||
<target>Forever</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -2732,6 +2732,10 @@
|
||||
<source>User creation error!</source>
|
||||
<target>User creation error!</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="233324084168950985" datatype="html">
|
||||
<source>Forever</source>
|
||||
<target>Forever</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -2732,6 +2732,10 @@
|
||||
<source>User creation error!</source>
|
||||
<target>User creation error!</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="233324084168950985" datatype="html">
|
||||
<source>Forever</source>
|
||||
<target>Örökké</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
@ -951,7 +951,7 @@
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/database/database.settings.component.html</context>
|
||||
<context context-type="linenumber">49</context>
|
||||
</context-group>
|
||||
<target state="translated">Database</target>
|
||||
<target state="translated">Database</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6946816815826261880" datatype="html">
|
||||
<source>Override keywords</source>
|
||||
@ -967,7 +967,7 @@
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/faces/faces.settings.component.html</context>
|
||||
<context context-type="linenumber">33</context>
|
||||
</context-group>
|
||||
<target state="translated">Se una foto ha lo stesso volto (persona) nome e parola chiave, l'applicazione rimuove il duplicato, mantenendo solo il volto.</target>
|
||||
<target state="translated">Se una foto ha lo stesso volto (persona) nome e parola chiave, l'applicazione rimuove il duplicato, mantenendo solo il volto.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6000343568689359565" datatype="html">
|
||||
<source>Face starring right</source>
|
||||
@ -983,7 +983,7 @@
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/faces/faces.settings.component.html</context>
|
||||
<context context-type="linenumber">40</context>
|
||||
</context-group>
|
||||
<target>Required minimum right to star (favourite) a face.</target>
|
||||
<target>Required minimum right to star (favourite) a face.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3603301297464446974" datatype="html">
|
||||
<source> Faces are not supported with these settings. </source>
|
||||
@ -1127,7 +1127,7 @@
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/indexing/indexing.settings.component.html</context>
|
||||
<context context-type="linenumber">116</context>
|
||||
</context-group>
|
||||
<target state="translated">Video</target>
|
||||
<target state="translated">Video</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="258586247001688466" datatype="html">
|
||||
<source>Persons</source>
|
||||
@ -1179,7 +1179,7 @@
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/jobs/jobs.settings.component.html</context>
|
||||
<context context-type="linenumber">118</context>
|
||||
</context-group>
|
||||
<target state="translated">ogni</target>
|
||||
<target state="translated">ogni</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="4101442988100757762" datatype="html">
|
||||
<source>never</source>
|
||||
@ -1219,7 +1219,7 @@
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/jobs/jobs.settings.component.html</context>
|
||||
<context context-type="linenumber">76,77</context>
|
||||
</context-group>
|
||||
<target state="translated">Imposta l'orario di esecuzione del lavoro.</target>
|
||||
<target state="translated">Imposta l'orario di esecuzione del lavoro.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="1598058373778280238" datatype="html">
|
||||
<source>After:</source>
|
||||
@ -1235,14 +1235,14 @@
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/jobs/jobs.settings.component.html</context>
|
||||
<context context-type="linenumber">93,94</context>
|
||||
</context-group>
|
||||
<target state="translated">Il lavoro verrà eseguito dopo la fine di quel lavoro.</target>
|
||||
<target state="translated">Il lavoro verrà eseguito dopo la fine di quel lavoro.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="7479716926471212179" datatype="html">
|
||||
<source>At:</source>
|
||||
<context-group purpose="location">
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/jobs/jobs.settings.component.html</context>
|
||||
<context context-type="linenumber">100</context>
|
||||
</context-group>
|
||||
</context-group>
|
||||
<context-group purpose="location">
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/jobs/jobs.settings.component.html</context>
|
||||
<context context-type="linenumber">110</context>
|
||||
@ -1511,7 +1511,7 @@
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/other/other.settings.component.html</context>
|
||||
<context context-type="linenumber">15</context>
|
||||
</context-group>
|
||||
<target>Runs directory scanning in a different thread.</target>
|
||||
<target>Runs directory scanning in a different thread.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="4920945982811848923" datatype="html">
|
||||
<source>Thumbnail threads</source>
|
||||
@ -1671,7 +1671,7 @@
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/photo/photo.settings.component.html</context>
|
||||
<context context-type="linenumber">12</context>
|
||||
</context-group>
|
||||
<target state="translated">Ridimensiona le foto per un caricamento più veloce dell'anteprima. (Ingrandendo la foto si carica l'originale).</target>
|
||||
<target state="translated">Ridimensiona le foto per un caricamento più veloce dell'anteprima. (Ingrandendo la foto si carica l'originale).</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="4328921999658902771" datatype="html">
|
||||
<source>On the fly converting</source>
|
||||
@ -1695,7 +1695,7 @@
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/photo/photo.settings.component.html</context>
|
||||
<context context-type="linenumber">27</context>
|
||||
</context-group>
|
||||
<context-group purpose="location">
|
||||
<context-group purpose="location">
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/video/video.settings.component.html</context>
|
||||
<context context-type="linenumber">66</context>
|
||||
</context-group>
|
||||
@ -1723,7 +1723,7 @@
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/random-photo/random-photo.settings.component.html</context>
|
||||
<context context-type="linenumber">36,37</context>
|
||||
</context-group>
|
||||
<target state="translated">La generazione di link di foto casuali non è supportata con le impostazioni correnti</target>
|
||||
<target state="translated">La generazione di link di foto casuali non è supportata con le impostazioni correnti</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6507738516307254402" datatype="html">
|
||||
<source>Autocomplete</source>
|
||||
@ -1731,7 +1731,7 @@
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/search/search.settings.component.html</context>
|
||||
<context context-type="linenumber">32</context>
|
||||
</context-group>
|
||||
<target state="translated">Autocompleta</target>
|
||||
<target state="translated">Autocompleta</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="7703111577289302879" datatype="html">
|
||||
<source>Show hints while typing search query.</source>
|
||||
@ -1763,7 +1763,7 @@
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/search/search.settings.component.html</context>
|
||||
<context context-type="linenumber">49,50</context>
|
||||
</context-group>
|
||||
<target state="translated">La ricerca non è supportata con le impostazioni correnti.</target>
|
||||
<target state="translated">La ricerca non è supportata con le impostazioni correnti.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="166448092104563965" datatype="html">
|
||||
<source>Password protected</source>
|
||||
@ -1779,7 +1779,7 @@
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/share/share.settings.component.html</context>
|
||||
<context context-type="linenumber">30</context>
|
||||
</context-group>
|
||||
<target state="translated">Abilita la condivisione di link protetti da password.</target>
|
||||
<target state="translated">Abilita la condivisione di link protetti da password.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5314273501490247820" datatype="html">
|
||||
<source> Sharing is not supported with these settings </source>
|
||||
@ -2019,7 +2019,7 @@
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/video/video.settings.component.html</context>
|
||||
<context context-type="linenumber">78</context>
|
||||
</context-group>
|
||||
<target state="translated">Il video di output avrà questi frame al secondo.</target>
|
||||
<target state="translated">Il video di output avrà questi frame al secondo.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="306805200938050070" datatype="html">
|
||||
<source>Bit rate</source>
|
||||
@ -2043,7 +2043,7 @@
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/video/video.settings.component.html</context>
|
||||
<context context-type="linenumber">112</context>
|
||||
</context-group>
|
||||
<target state="translated">CRF</target>
|
||||
<target state="translated">CRF</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="639575417147182282" datatype="html">
|
||||
<source>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.</source>
|
||||
@ -2051,7 +2051,7 @@
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/video/video.settings.component.html</context>
|
||||
<context context-type="linenumber">113</context>
|
||||
</context-group>
|
||||
<target state="translated">La scala del fattore qualità (CRF) è da 0 a 51, dove 0 è lossless, 23 è il default e 51 è la peggior qualità possibile.</target>
|
||||
<target state="translated">La scala del fattore qualità (CRF) è da 0 a 51, dove 0 è lossless, 23 è il default e 51 è la peggior qualità possibile.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6333857424161463201" datatype="html">
|
||||
<source>Preset</source>
|
||||
@ -2059,7 +2059,7 @@
|
||||
<context context-type="sourcefile">src/frontend/app/ui/settings/video/video.settings.component.html</context>
|
||||
<context context-type="linenumber">121</context>
|
||||
</context-group>
|
||||
<target state="translated">Preimpostazioni</target>
|
||||
<target state="translated">Preimpostazioni</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5666144931223883408" datatype="html">
|
||||
<source>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).</source>
|
||||
@ -2732,6 +2732,10 @@
|
||||
<source>User creation error!</source>
|
||||
<target>User creation error!</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="233324084168950985" datatype="html">
|
||||
<source>Forever</source>
|
||||
<target>Forever</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -2732,6 +2732,10 @@
|
||||
<source>User creation error!</source>
|
||||
<target>User creation error!</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="233324084168950985" datatype="html">
|
||||
<source>Forever</source>
|
||||
<target>Forever</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -2732,6 +2732,10 @@
|
||||
<source>User creation error!</source>
|
||||
<target>User creation error!</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="233324084168950985" datatype="html">
|
||||
<source>Forever</source>
|
||||
<target>Forever</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -2732,6 +2732,10 @@
|
||||
<source>User creation error!</source>
|
||||
<target>User creation error!</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="233324084168950985" datatype="html">
|
||||
<source>Forever</source>
|
||||
<target>Forever</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
Loading…
Reference in New Issue
Block a user