mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
Merge remote-tracking branch 'origin/master'
# Conflicts: # src/frontend/app/ui/gallery/gallery.component.ts
This commit is contained in:
commit
007962cc8d
5
package-lock.json
generated
5
package-lock.json
generated
@ -13509,6 +13509,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz",
|
||||||
"integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg=="
|
"integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg=="
|
||||||
},
|
},
|
||||||
|
"natural-orderby": {
|
||||||
|
"version": "2.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/natural-orderby/-/natural-orderby-2.0.3.tgz",
|
||||||
|
"integrity": "sha512-p7KTHxU0CUrcOXe62Zfrb5Z13nLvPhSWR/so3kFulUQU0sgUll2Z0LwpsLN351eOOD+hRGu/F1g+6xDfPeD++Q=="
|
||||||
|
},
|
||||||
"needle": {
|
"needle": {
|
||||||
"version": "2.5.2",
|
"version": "2.5.2",
|
||||||
"resolved": "https://registry.npmjs.org/needle/-/needle-2.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/needle/-/needle-2.5.2.tgz",
|
||||||
|
@ -30,13 +30,12 @@
|
|||||||
"url": "https://github.com/bpatrik/PiGallery2/issues"
|
"url": "https://github.com/bpatrik/PiGallery2/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"bcrypt": "5.0.0",
|
||||||
"body-parser": "1.19.0",
|
"body-parser": "1.19.0",
|
||||||
"cookie-parser": "1.4.5",
|
"cookie-parser": "1.4.5",
|
||||||
"cookie-session": "2.0.0-rc.1",
|
"cookie-session": "2.0.0-rc.1",
|
||||||
"csurf": "1.11.0",
|
"csurf": "1.11.0",
|
||||||
"ejs": "3.1.5",
|
"ejs": "3.1.5",
|
||||||
"bcrypt": "5.0.0",
|
|
||||||
"sharp": "0.23.4",
|
|
||||||
"exifreader": "3.13.0",
|
"exifreader": "3.13.0",
|
||||||
"express": "4.17.1",
|
"express": "4.17.1",
|
||||||
"express-unless": "0.5.0",
|
"express-unless": "0.5.0",
|
||||||
@ -44,7 +43,9 @@
|
|||||||
"image-size": "0.9.3",
|
"image-size": "0.9.3",
|
||||||
"jimp": "0.16.1",
|
"jimp": "0.16.1",
|
||||||
"locale": "0.1.0",
|
"locale": "0.1.0",
|
||||||
|
"natural-orderby": "^2.0.3",
|
||||||
"reflect-metadata": "0.1.13",
|
"reflect-metadata": "0.1.13",
|
||||||
|
"sharp": "0.23.4",
|
||||||
"sqlite3": "5.0.0",
|
"sqlite3": "5.0.0",
|
||||||
"ts-exif-parser": "0.2.1",
|
"ts-exif-parser": "0.2.1",
|
||||||
"ts-node-iptc": "1.0.11",
|
"ts-node-iptc": "1.0.11",
|
||||||
|
@ -240,18 +240,27 @@ export class GalleryManager implements IGalleryManager, ISQLGalleryManager {
|
|||||||
}
|
}
|
||||||
if (dir.directories) {
|
if (dir.directories) {
|
||||||
for (let i = 0; i < dir.directories.length; i++) {
|
for (let i = 0; i < dir.directories.length; i++) {
|
||||||
|
const dirName = GalleryManager.getAbsoluteDirName(dir.directories[i]);
|
||||||
dir.directories[i].media = await connection
|
dir.directories[i].media = await connection
|
||||||
.getRepository(MediaEntity)
|
.getRepository(MediaEntity)
|
||||||
.createQueryBuilder('media')
|
.createQueryBuilder('media')
|
||||||
|
.innerJoinAndSelect('media.directory', 'directory')
|
||||||
.where('media.directory = :dir', {
|
.where('media.directory = :dir', {
|
||||||
dir: dir.directories[i].id
|
dir: dir.directories[i].id
|
||||||
})
|
})
|
||||||
.orderBy('media.metadata.creationDate', 'ASC')
|
.orWhere("directory.path like :parentPath||'%'", {
|
||||||
|
parentPath: dirName
|
||||||
|
})
|
||||||
|
.orderBy('media.metadata.creationDate', 'DESC')
|
||||||
.limit(Config.Server.Indexing.folderPreviewSize)
|
.limit(Config.Server.Indexing.folderPreviewSize)
|
||||||
.getMany();
|
.getMany();
|
||||||
dir.directories[i].isPartial = true;
|
dir.directories[i].isPartial = true;
|
||||||
|
|
||||||
for (let j = 0; j < dir.directories[i].media.length; j++) {
|
const dirs = dir.directories[i]
|
||||||
|
for (let j = 0; j < dirs.media.length; j++) {
|
||||||
|
const mediaDirName = GalleryManager.getAbsoluteDirName(dirs.media[j].directory);
|
||||||
|
const name = mediaDirName.substring(dirName.length);
|
||||||
|
dir.directories[i].media[j].name = name + dir.directories[i].media[j].name
|
||||||
dir.directories[i].media[j].directory = dir.directories[i];
|
dir.directories[i].media[j].directory = dir.directories[i];
|
||||||
dir.directories[i].media[j].readyThumbnails = [];
|
dir.directories[i].media[j].readyThumbnails = [];
|
||||||
dir.directories[i].media[j].readyIcon = false;
|
dir.directories[i].media[j].readyIcon = false;
|
||||||
@ -260,4 +269,9 @@ export class GalleryManager implements IGalleryManager, ISQLGalleryManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static getAbsoluteDirName(dir: DirectoryEntity) {
|
||||||
|
const path = dir.path;
|
||||||
|
const currentRoot = (path === "./" ? "" : path) ;
|
||||||
|
return currentRoot + dir.name + "/";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ export class ConfigDiagnostics {
|
|||||||
if (databaseConfig.type !== ServerConfig.DatabaseType.memory) {
|
if (databaseConfig.type !== ServerConfig.DatabaseType.memory) {
|
||||||
await SQLConnection.tryConnection(databaseConfig);
|
await SQLConnection.tryConnection(databaseConfig);
|
||||||
}
|
}
|
||||||
if (databaseConfig.type !== ServerConfig.DatabaseType.sqlite) {
|
if (databaseConfig.type === ServerConfig.DatabaseType.sqlite) {
|
||||||
try {
|
try {
|
||||||
await this.checkReadWritePermission(SQLConnection.getSQLiteDB(databaseConfig));
|
await this.checkReadWritePermission(SQLConnection.getSQLiteDB(databaseConfig));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -105,7 +105,7 @@ export class PublicRouter {
|
|||||||
],
|
],
|
||||||
display: 'standalone',
|
display: 'standalone',
|
||||||
orientation: 'any',
|
orientation: 'any',
|
||||||
start_url: Config.Client.publicUrl,
|
start_url: Config.Client.publicUrl === '' ? '.' : Config.Client.publicUrl,
|
||||||
background_color: '#000000',
|
background_color: '#000000',
|
||||||
theme_color: '#000000'
|
theme_color: '#000000'
|
||||||
});
|
});
|
||||||
|
@ -3,6 +3,7 @@ import {AuthenticationService} from '../../model/network/authentication.service'
|
|||||||
import {ActivatedRoute, Params, Router} from '@angular/router';
|
import {ActivatedRoute, Params, Router} from '@angular/router';
|
||||||
import {GalleryService} from './gallery.service';
|
import {GalleryService} from './gallery.service';
|
||||||
import {GalleryGridComponent} from './grid/grid.gallery.component';
|
import {GalleryGridComponent} from './grid/grid.gallery.component';
|
||||||
|
import {SearchTypes} from '../../../../common/entities/AutoCompleteItem';
|
||||||
import {Config} from '../../../../common/config/public/Config';
|
import {Config} from '../../../../common/config/public/Config';
|
||||||
import {DirectoryDTO} from '../../../../common/entities/DirectoryDTO';
|
import {DirectoryDTO} from '../../../../common/entities/DirectoryDTO';
|
||||||
import {SearchResultDTO} from '../../../../common/entities/SearchResultDTO';
|
import {SearchResultDTO} from '../../../../common/entities/SearchResultDTO';
|
||||||
@ -18,6 +19,7 @@ import {QueryParams} from '../../../../common/QueryParams';
|
|||||||
import {SeededRandomService} from '../../model/seededRandom.service';
|
import {SeededRandomService} from '../../model/seededRandom.service';
|
||||||
import {take} from 'rxjs/operators';
|
import {take} from 'rxjs/operators';
|
||||||
import {SearchQueryTypes} from '../../../../common/entities/SearchQueryDTO';
|
import {SearchQueryTypes} from '../../../../common/entities/SearchQueryDTO';
|
||||||
|
import { compare } from 'natural-orderby';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-gallery',
|
selector: 'app-gallery',
|
||||||
@ -36,7 +38,7 @@ export class GalleryComponent implements OnInit, OnDestroy {
|
|||||||
public isPhotoWithLocation = false;
|
public isPhotoWithLocation = false;
|
||||||
public countDown: { day: number, hour: number, minute: number, second: number } = null;
|
public countDown: { day: number, hour: number, minute: number, second: number } = null;
|
||||||
public readonly mapEnabled: boolean;
|
public readonly mapEnabled: boolean;
|
||||||
readonly SearchTypes: typeof SearchQueryTypes;
|
readonly SearchTypes: typeof SearchTypes;
|
||||||
private $counter: Observable<number>;
|
private $counter: Observable<number>;
|
||||||
private subscription: { [key: string]: Subscription } = {
|
private subscription: { [key: string]: Subscription } = {
|
||||||
content: null,
|
content: null,
|
||||||
@ -53,7 +55,7 @@ export class GalleryComponent implements OnInit, OnDestroy {
|
|||||||
private _navigation: NavigationService,
|
private _navigation: NavigationService,
|
||||||
private rndService: SeededRandomService) {
|
private rndService: SeededRandomService) {
|
||||||
this.mapEnabled = Config.Client.Map.enabled;
|
this.mapEnabled = Config.Client.Map.enabled;
|
||||||
this.SearchTypes = SearchQueryTypes;
|
this.SearchTypes = SearchTypes;
|
||||||
PageHelper.showScrollY();
|
PageHelper.showScrollY();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,28 +167,16 @@ export class GalleryComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
switch (this._galleryService.sorting.value) {
|
switch (this._galleryService.sorting.value) {
|
||||||
case SortingMethods.ascName:
|
case SortingMethods.ascName:
|
||||||
|
this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => compare()(a.name, b.name));
|
||||||
|
break;
|
||||||
case SortingMethods.ascDate:
|
case SortingMethods.ascDate:
|
||||||
this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => {
|
this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => compare()(a.lastModified, b.lastModified));
|
||||||
if (a.name.toLowerCase() < b.name.toLowerCase()) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (a.name.toLowerCase() > b.name.toLowerCase()) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case SortingMethods.descName:
|
case SortingMethods.descName:
|
||||||
|
this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => compare({ order: 'desc' })(a.name, b.name));
|
||||||
|
break;
|
||||||
case SortingMethods.descDate:
|
case SortingMethods.descDate:
|
||||||
this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => {
|
this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => compare({ order: 'desc' })(a.lastModified, b.lastModified));
|
||||||
if (a.name.toLowerCase() < b.name.toLowerCase()) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (a.name.toLowerCase() > b.name.toLowerCase()) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case SortingMethods.random:
|
case SortingMethods.random:
|
||||||
this.rndService.setSeed(this.directories.length);
|
this.rndService.setSeed(this.directories.length);
|
||||||
|
@ -28,6 +28,7 @@ import {SortingMethods} from '../../../../../common/entities/SortingMethods';
|
|||||||
import {MediaDTO} from '../../../../../common/entities/MediaDTO';
|
import {MediaDTO} from '../../../../../common/entities/MediaDTO';
|
||||||
import {QueryParams} from '../../../../../common/QueryParams';
|
import {QueryParams} from '../../../../../common/QueryParams';
|
||||||
import {SeededRandomService} from '../../../model/seededRandom.service';
|
import {SeededRandomService} from '../../../model/seededRandom.service';
|
||||||
|
import { compare } from 'natural-orderby';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-gallery-grid',
|
selector: 'app-gallery-grid',
|
||||||
@ -230,26 +231,10 @@ export class GalleryGridComponent implements OnChanges, OnInit, AfterViewInit, O
|
|||||||
private sortPhotos() {
|
private sortPhotos() {
|
||||||
switch (this.galleryService.sorting.value) {
|
switch (this.galleryService.sorting.value) {
|
||||||
case SortingMethods.ascName:
|
case SortingMethods.ascName:
|
||||||
this.media.sort((a: PhotoDTO, b: PhotoDTO) => {
|
this.media.sort((a: PhotoDTO, b: PhotoDTO) => compare()(a.name, b.name));
|
||||||
if (a.name.toLowerCase() < b.name.toLowerCase()) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (a.name.toLowerCase() > b.name.toLowerCase()) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case SortingMethods.descName:
|
case SortingMethods.descName:
|
||||||
this.media.sort((a: PhotoDTO, b: PhotoDTO) => {
|
this.media.sort((a: PhotoDTO, b: PhotoDTO) => compare({order: 'desc' })(a.name, b.name));
|
||||||
if (a.name.toLowerCase() < b.name.toLowerCase()) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (a.name.toLowerCase() > b.name.toLowerCase()) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case SortingMethods.ascDate:
|
case SortingMethods.ascDate:
|
||||||
this.media.sort((a: PhotoDTO, b: PhotoDTO) => {
|
this.media.sort((a: PhotoDTO, b: PhotoDTO) => {
|
||||||
|
2872
src/frontend/translate/messages.es.xlf
Normal file
2872
src/frontend/translate/messages.es.xlf
Normal file
File diff suppressed because it is too large
Load Diff
2833
src/frontend/translate/messages.sv.xlf
Normal file
2833
src/frontend/translate/messages.sv.xlf
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user