1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-01-10 04:07:35 +02:00

Preview will show from all child directoris (not only direct childs)

This commit is contained in:
Alexey.Vlasov 2020-06-28 22:41:37 -07:00
parent 3deb8e26f5
commit 77551eadd9
2 changed files with 17 additions and 3 deletions

View File

@ -290,18 +290,27 @@ export class GalleryManager implements IGalleryManager, ISQLGalleryManager {
}
if (dir.directories) {
for (let i = 0; i < dir.directories.length; i++) {
const dirName = GalleryManager.getAbsoluteDirName(dir.directories[i]);
dir.directories[i].media = await connection
.getRepository(MediaEntity)
.createQueryBuilder('media')
.innerJoinAndSelect('media.directory', 'directory')
.where('media.directory = :dir', {
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)
.getMany();
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].readyThumbnails = [];
dir.directories[i].media[j].readyIcon = false;
@ -310,4 +319,9 @@ export class GalleryManager implements IGalleryManager, ISQLGalleryManager {
}
}
public static getAbsoluteDirName(dir: DirectoryEntity) {
const path = dir.path;
const currentRoot = (path === "./" ? "" : path) ;
return currentRoot + dir.name + "/";
}
}

View File

@ -30,7 +30,7 @@ export class ConfigDiagnostics {
if (databaseConfig.type !== ServerConfig.DatabaseType.memory) {
await SQLConnection.tryConnection(databaseConfig);
}
if (databaseConfig.type !== ServerConfig.DatabaseType.sqlite) {
if (databaseConfig.type === ServerConfig.DatabaseType.sqlite) {
try {
await this.checkReadWritePermission(SQLConnection.getSQLiteDB(databaseConfig));
} catch (e) {