diff --git a/.travis.yml b/.travis.yml index 94e0f4ea..ddf31572 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,27 +3,7 @@ node_js: - '7' - '6' -before_deploy: -- npm i gulp -g -- gulp build-release - deploy: - provider: npm - email: bra.patrik@gmail.com - api_key: - secure: bMv+DrQgqKtx3RNsHqZUOl9L3Bp/i/MSZ52ix8rWXfl1QYFzo7nCnFdHxeq67qCCApdsBrPnOqRsnR5IjLSJGiKwyOxlXNCawLJRKJ+EoM8IAolrZP0zg5DhyifZJ40M0QS8fCetDqKVSO6S52rs4I0nc5whFZ6E9j4EfmkBRoGyPGoTPmGCJdK6JrlN7oftCVm18r7kt7lXcr1EvBqDloJC+M4BukQc4v0iAY/psMEgExvvroCwweQEhumWma7DO1hdiixRh8Pclz+VUQwAggVdP1yZGabqnX80/G+KrmpbNrAGIUdgzMHGG5HkiMrxPUU6LAcDQ+IzZ08u3MzVy//ij4zcom7C99oy5/AL4oWh6tZQtefji9MlOOX4SJNikmsfD2D9skHeGwbFuqEPjrjpUPWtUhW9RS5kr5Dt/LJwMs3ADi9nEsAYAkTip1nH9Ts1Yw+ooy3lCfzuMJGMBzZ6vNlMoAGNyTkrjIkGDL76XuBYvn0X3e3USn+KuKF9qO+N6wCw8zTxI2aetx+z6/5gGiiAHPKkFGGz+2jkl+2ZO4DcOX1lR6AgrHwT/52bQF3UQVT02mUohqfUnpn6rSpYkvh+u3e3GE59sqAPcRleEKdkp68KFSFDstzwF/m7uoAjOIHSfKUjN22s7FP818BulikEhHiCknMJsnOYUZ4= - on: - tags: true - repo: bpatrik/pigallery2 - - provider: releases - api_key: - secure: NrgDMoHY4j9r4Ht9oPT6cYiGkcpbNsvR6DxEk51kD5qVRPtUq+V5gpIo0tSwIFfPzgY+5hsqK6Onl2AdSsaotHB8PT2CoZ9oZPJO8BlZFvD7iT83Qi49QcsMo6jjmgqByg6EwzhHLeAiMfYrNSqw1gT0tEONc9Ygq5deFolYSqf6yfplBkcT0HEFSncnDhn5i+s4SS/wOy/UppXJxKk9DE0GaRwaIuBC/aSAtDfoFUuxVwjahTiTb8YuqwguzoZA5lYC/EcoCxbSyb5y58XrsMB13AZmH271NlbSTYmo3c4+HGO4BkcIB/WATw9VcI1NU/huTgSNZnVzAalbtF9oWKG+IKyfa9gMbe6fj07CvB7KwCkaeJmToi5Hw3Eiw0+ioadEzD3KXRr0dchUjlYuYnmZEUxSAVW9jD+tJSdCxQKyna3PxtIcD7QvRlu8/ZXurcerZXVib5FbwmoXUzLZvbMeyaFHEMbawepp5xups/YYqp+I6H0SUqbMcNIAntENb/0doteXKwdOgsSUkdtMVoEM0p6PhFngFJLFPYAdq0yZiC8WQNwHNTBHcSME3CrIWk1sjrDjN8WylFTPljy7fNm2Rl2UFHvdtGHo5e5YEltHGdlcnSD4ZhXKCn3blR7O87taNUEAjljgjxdridbUrAJ3ooJRVPicVfeslVCM+OQ= - file: pigallery2.zip - skip_cleanup: true - on: - tags: true - provider: heroku api_key: secure: blREfw45CnFXyS1BJKY8pgQ1ZiMDYV5nLWqVMLUufBiO85CRataJNRzyjkPC1E53AkavXB9HQPAzc6bzFlbZZ21xsrfDxmhjhPcUrAeaOWN9uSj68D5hlGyFJGc6P6hEu4n/UrX4H6F2hW0lWfLcl1Mtc62VMpmn5OjBOFdxhk+KtQaXpHN4j5YTeMeUh3U6HTpSfgg6rrGvmLUp5+zCxFzzMZ8Wp1MnRAf5N4oOW3Wj8ax9JB/c4EljQO4sb2LWZk9iSUYxQcXMTK6KmMhY+tGBrKqLz37ZK1DLp3jmFEcUyy+bUGgajIsFW0dLCPlB0bVKjK2Ry1u7SSZ/zpfDlma/nwQ1vVYLhmxhE+LnXxyfIjWN8IXqa6EcovpDbBe7arQ2mxsYf4WMebteDszMPPCcF2FgKE44Re83fzIVJk3R69D1gBxGzXlarPtV8k11L09ZoCSz9RCDBn2ng1ZOaprKpopp3bBPFD+LRwON9/ZRyRa4YbYkMPWxgj8krYNo50VSRrMz/3xR9py9hgVNnK5H/5QQTcdT0bPQf6lbJn3Q86QTUBxWI12FwKrcr2Nvw/setSACwRucGbbx9hLhrSmjYetsENWba1F2ouBdSpENvpjxETvyE2Z+GRNu4xbuFD9aSttogjJqjTYvRc/RJejvbENIc2/UIqnv/ra0PPY= diff --git a/backend/middlewares/GalleryMWs.ts b/backend/middlewares/GalleryMWs.ts index 19681c9e..77d8f51e 100644 --- a/backend/middlewares/GalleryMWs.ts +++ b/backend/middlewares/GalleryMWs.ts @@ -2,7 +2,7 @@ import * as path from "path"; import * as fs from "fs"; import {NextFunction, Request, Response} from "express"; import {ErrorCodes, ErrorDTO} from "../../common/entities/Error"; -import {DirectoryDTO, NotModifiedDirectoryDTO} from "../../common/entities/DirectoryDTO"; +import {DirectoryDTO} from "../../common/entities/DirectoryDTO"; import {ObjectManagerRepository} from "../model/ObjectManagerRepository"; import {SearchTypes} from "../../common/entities/AutoCompleteItem"; import {ContentWrapper} from "../../common/entities/ConentWrapper"; @@ -28,8 +28,8 @@ export class GalleryMWs { try { const directory = await ObjectManagerRepository.getInstance().GalleryManager.listDirectory(directoryName, req.query.knownLastModified, req.query.knownLastScanned); - if ((directory).notModified == true) { - req.resultPipe = new ContentWrapper(directory, null); + if (directory == null) { + req.resultPipe = new ContentWrapper(null, null, true); return next(); } if (req.session.user.permissions && @@ -52,7 +52,7 @@ export class GalleryMWs { return next(); let cw: ContentWrapper = req.resultPipe; - if ((cw.directory).notModified == true) { + if (cw.notModified == true) { return next(); } let removeDirs = (dir) => { diff --git a/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.ts b/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.ts index 1abeffbe..56bfeb75 100644 --- a/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.ts +++ b/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.ts @@ -6,7 +6,7 @@ import * as os from "os"; import {NextFunction, Request, Response} from "express"; import {ErrorCodes, ErrorDTO} from "../../../common/entities/Error"; import {ContentWrapper} from "../../../common/entities/ConentWrapper"; -import {DirectoryDTO, NotModifiedDirectoryDTO} from "../../../common/entities/DirectoryDTO"; +import {DirectoryDTO} from "../../../common/entities/DirectoryDTO"; import {ProjectPath} from "../../ProjectPath"; import {PhotoDTO} from "../../../common/entities/PhotoDTO"; import {Config} from "../../../common/config/private/Config"; @@ -85,7 +85,7 @@ export class ThumbnailGeneratorMWs { return next(); let cw: ContentWrapper = req.resultPipe; - if ((cw.directory).notModified == true) { + if (cw.notModified == true) { return next(); } if (cw.directory) { diff --git a/backend/model/interfaces/IGalleryManager.ts b/backend/model/interfaces/IGalleryManager.ts index b5100fc3..ca380590 100644 --- a/backend/model/interfaces/IGalleryManager.ts +++ b/backend/model/interfaces/IGalleryManager.ts @@ -1,7 +1,7 @@ -import {DirectoryDTO, NotModifiedDirectoryDTO} from "../../../common/entities/DirectoryDTO"; +import {DirectoryDTO} from "../../../common/entities/DirectoryDTO"; export interface IGalleryManager { listDirectory(relativeDirectoryName: string, knownLastModified?: number, - knownLastScanned?: number): Promise; + knownLastScanned?: number): Promise; } diff --git a/backend/model/interfaces/ISearchManager.ts b/backend/model/interfaces/ISearchManager.ts index d0c35d8b..d0859af7 100644 --- a/backend/model/interfaces/ISearchManager.ts +++ b/backend/model/interfaces/ISearchManager.ts @@ -1,5 +1,6 @@ import {AutoCompleteItem, SearchTypes} from "../../../common/entities/AutoCompleteItem"; -import {SearchResultDTO} from "../../../common/entities/SearchResult"; +import {SearchResultDTO} from "../../../common/entities/SearchResultDTO"; + export interface ISearchManager { autocomplete(text: string): Promise; search(text: string, searchType: SearchTypes): Promise; diff --git a/backend/model/memory/GalleryManager.ts b/backend/model/memory/GalleryManager.ts index 6a3c499b..cff5b963 100644 --- a/backend/model/memory/GalleryManager.ts +++ b/backend/model/memory/GalleryManager.ts @@ -1,4 +1,4 @@ -import {DirectoryDTO, NotModifiedDirectoryDTO} from "../../../common/entities/DirectoryDTO"; +import {DirectoryDTO} from "../../../common/entities/DirectoryDTO"; import {IGalleryManager} from "../interfaces/IGalleryManager"; import * as path from "path"; import * as fs from "fs"; @@ -8,13 +8,13 @@ import {Config} from "../../../common/config/private/Config"; export class GalleryManager implements IGalleryManager { - public listDirectory(relativeDirectoryName: string, knownLastModified?: number, knownLastScanned?: number): Promise { + public listDirectory(relativeDirectoryName: string, knownLastModified?: number, knownLastScanned?: number): Promise { //If it seems that the content did not changed, do not work on it if (knownLastModified && knownLastScanned) { const stat = fs.statSync(path.join(ProjectPath.ImageFolder, relativeDirectoryName)); const lastModified = Math.max(stat.ctime.getTime(), stat.mtime.getTime()); if (Date.now() - knownLastScanned <= Config.Server.cachedFolderTimeout && lastModified == knownLastModified) { - return Promise.resolve({notModified: true}); + return Promise.resolve(null); } } return DiskManager.scanDirectory(relativeDirectoryName); diff --git a/backend/model/memory/SearchManager.ts b/backend/model/memory/SearchManager.ts index b9314e9a..8aadcaa3 100644 --- a/backend/model/memory/SearchManager.ts +++ b/backend/model/memory/SearchManager.ts @@ -1,6 +1,6 @@ import {AutoCompleteItem, SearchTypes} from "../../../common/entities/AutoCompleteItem"; import {ISearchManager} from "../interfaces/ISearchManager"; -import {SearchResultDTO} from "../../../common/entities/SearchResult"; +import {SearchResultDTO} from "../../../common/entities/SearchResultDTO"; export class SearchManager implements ISearchManager { autocomplete(text: string): Promise { diff --git a/backend/model/mysql/GalleryManager.ts b/backend/model/mysql/GalleryManager.ts index 7f3032a6..dec326d8 100644 --- a/backend/model/mysql/GalleryManager.ts +++ b/backend/model/mysql/GalleryManager.ts @@ -1,5 +1,5 @@ import {IGalleryManager} from "../interfaces/IGalleryManager"; -import {DirectoryDTO, NotModifiedDirectoryDTO} from "../../../common/entities/DirectoryDTO"; +import {DirectoryDTO} from "../../../common/entities/DirectoryDTO"; import * as path from "path"; import * as fs from "fs"; import {DirectoryEntity} from "./enitites/DirectoryEntity"; @@ -15,7 +15,7 @@ export class GalleryManager implements IGalleryManager { public async listDirectory(relativeDirectoryName: string, knownLastModified?: number, - knownLastScanned?: number): Promise { + knownLastScanned?: number): Promise { relativeDirectoryName = path.normalize(path.join("." + path.sep, relativeDirectoryName)); const directoryName = path.basename(relativeDirectoryName); const directoryParent = path.join(path.dirname(relativeDirectoryName), path.sep); @@ -40,7 +40,7 @@ export class GalleryManager implements IGalleryManager { if (Date.now() - knownLastScanned <= Config.Server.cachedFolderTimeout && lastModified == knownLastModified && dir.lastScanned == knownLastScanned) { - return Promise.resolve({notModified: true}); + return null; } } if (dir.photos) { diff --git a/backend/model/mysql/SearchManager.ts b/backend/model/mysql/SearchManager.ts index ef6d3402..410d17b9 100644 --- a/backend/model/mysql/SearchManager.ts +++ b/backend/model/mysql/SearchManager.ts @@ -1,6 +1,6 @@ import {AutoCompleteItem, SearchTypes} from "../../../common/entities/AutoCompleteItem"; import {ISearchManager} from "../interfaces/ISearchManager"; -import {SearchResultDTO} from "../../../common/entities/SearchResult"; +import {SearchResultDTO} from "../../../common/entities/SearchResultDTO"; import {MySQLConnection} from "./MySQLConnection"; import {PhotoEntity} from "./enitites/PhotoEntity"; import {DirectoryEntity} from "./enitites/DirectoryEntity"; diff --git a/common/entities/ConentWrapper.ts b/common/entities/ConentWrapper.ts index dc9984af..a4d08601 100644 --- a/common/entities/ConentWrapper.ts +++ b/common/entities/ConentWrapper.ts @@ -1,14 +1,9 @@ -import {DirectoryDTO, NotModifiedDirectoryDTO} from "./DirectoryDTO"; -import {SearchResultDTO} from "./SearchResult"; +import {DirectoryDTO} from "./DirectoryDTO"; +import {SearchResultDTO} from "./SearchResultDTO"; export class ContentWrapper { - - public directory: DirectoryDTO | NotModifiedDirectoryDTO; - public searchResult: SearchResultDTO; - - constructor(directory: DirectoryDTO | NotModifiedDirectoryDTO = null, searchResult: SearchResultDTO = null) { - this.directory = directory; - this.searchResult = searchResult; + constructor(public directory: DirectoryDTO = null, + public searchResult: SearchResultDTO = null, + public notModified?: boolean) { } - } diff --git a/common/entities/DirectoryDTO.ts b/common/entities/DirectoryDTO.ts index 7c2ef132..f9ff366a 100644 --- a/common/entities/DirectoryDTO.ts +++ b/common/entities/DirectoryDTO.ts @@ -11,10 +11,6 @@ export interface DirectoryDTO { photos: Array; } -export interface NotModifiedDirectoryDTO { - notModified: boolean; -} - export module DirectoryDTO { export const addReferences = (dir: DirectoryDTO): void => { dir.photos.forEach((photo: PhotoDTO) => { diff --git a/common/entities/SearchResult.ts b/common/entities/SearchResultDTO.ts similarity index 99% rename from common/entities/SearchResult.ts rename to common/entities/SearchResultDTO.ts index 2d88c6a3..ac6eb6bd 100644 --- a/common/entities/SearchResult.ts +++ b/common/entities/SearchResultDTO.ts @@ -1,6 +1,7 @@ import {DirectoryDTO} from "./DirectoryDTO"; import {PhotoDTO} from "./PhotoDTO"; import {SearchTypes} from "./AutoCompleteItem"; + export interface SearchResultDTO { searchText: string; searchType: SearchTypes; diff --git a/frontend/app/app.component.ts b/frontend/app/app.component.ts index b881d80d..950b53d0 100644 --- a/frontend/app/app.component.ts +++ b/frontend/app/app.component.ts @@ -21,8 +21,8 @@ export class AppComponent implements OnInit, OnDestroy { private _authenticationService: AuthenticationService, private _shareService: ShareService, private _title: Title, vcr: ViewContainerRef, - notificatin: NotificationService) { - notificatin.setRootViewContainerRef(vcr); + notificationService: NotificationService) { + notificationService.setRootViewContainerRef(vcr); } async ngOnInit() { diff --git a/frontend/app/gallery/directory/directory.gallery.component.css b/frontend/app/gallery/directory/directory.gallery.component.css index 0643b14d..5428d229 100644 --- a/frontend/app/gallery/directory/directory.gallery.component.css +++ b/frontend/app/gallery/directory/directory.gallery.component.css @@ -12,9 +12,9 @@ a { .no-image { color: #7f7f7f; - font-size: 50px; - top: calc(50% - 25px); - left: calc(50% - 25px); + font-size: 80px; + top: calc(50% - 40px); + left: calc(50% - 40px); } .photo { diff --git a/frontend/app/gallery/directory/directory.gallery.component.html b/frontend/app/gallery/directory/directory.gallery.component.html index 4237c95c..7fadf6f2 100644 --- a/frontend/app/gallery/directory/directory.gallery.component.html +++ b/frontend/app/gallery/directory/directory.gallery.component.html @@ -4,8 +4,8 @@
+ [style.width.px]="calcSize()" + [style.height.px]="calcSize()">
diff --git a/frontend/app/gallery/directory/directory.gallery.component.ts b/frontend/app/gallery/directory/directory.gallery.component.ts index 4b2cfb21..febb1514 100644 --- a/frontend/app/gallery/directory/directory.gallery.component.ts +++ b/frontend/app/gallery/directory/directory.gallery.component.ts @@ -24,11 +24,7 @@ export class GalleryDirectoryComponent implements OnInit, OnDestroy { } - ngOnInit() { - if (this.directory.photos.length > 0) { - this.thumbnail = this.thumbnailService.getThumbnail(new Photo(this.directory.photos[0], this.size(), this.size())); - } - } + size: number = null; getSanitizedThUrl() { return this._sanitizer.bypassSecurityTrustStyle('url(' + encodeURI(this.thumbnail.Src).replace(/\(/g, "%28").replace(/\)/g, "%29") + ')'); @@ -50,13 +46,20 @@ export class GalleryDirectoryComponent implements OnInit, OnDestroy { } } - size() { - let size = 220 + 5; - const containerWidth = this.container.nativeElement.parentElement.parentElement.clientWidth; - size = containerWidth / Math.round((containerWidth / size)); + ngOnInit() { + if (this.directory.photos.length > 0) { + this.thumbnail = this.thumbnailService.getThumbnail(new Photo(this.directory.photos[0], this.calcSize(), this.calcSize())); + } + } - - return Math.floor(size - 5); + calcSize() { + if (this.size == null || + document.getElementsByTagName('body')[0].style.overflowY == 'scroll') { + let size = 220 + 5; + const containerWidth = this.container.nativeElement.parentElement.parentElement.clientWidth; + this.size = containerWidth / Math.round((containerWidth / size)); + } + return Math.floor(this.size - 5); } } diff --git a/frontend/app/gallery/gallery.component.ts b/frontend/app/gallery/gallery.component.ts index 832594a5..f751ac4b 100644 --- a/frontend/app/gallery/gallery.component.ts +++ b/frontend/app/gallery/gallery.component.ts @@ -7,7 +7,7 @@ import {GallerySearchComponent} from "./search/search.gallery.component"; import {SearchTypes} from "../../../common/entities/AutoCompleteItem"; import {Config} from "../../../common/config/public/Config"; import {DirectoryDTO} from "../../../common/entities/DirectoryDTO"; -import {SearchResultDTO} from "../../../common/entities/SearchResult"; +import {SearchResultDTO} from "../../../common/entities/SearchResultDTO"; import {ShareService} from "./share.service"; import {NavigationService} from "../model/navigation.service"; import {UserRoles} from "../../../common/entities/UserDTO"; diff --git a/frontend/app/gallery/gallery.service.ts b/frontend/app/gallery/gallery.service.ts index 7e6b5621..2e513ffb 100644 --- a/frontend/app/gallery/gallery.service.ts +++ b/frontend/app/gallery/gallery.service.ts @@ -1,7 +1,7 @@ import {Injectable} from "@angular/core"; import {NetworkService} from "../model/network/network.service"; import {ContentWrapper} from "../../../common/entities/ConentWrapper"; -import {DirectoryDTO, NotModifiedDirectoryDTO} from "../../../common/entities/DirectoryDTO"; +import {DirectoryDTO} from "../../../common/entities/DirectoryDTO"; import {SearchTypes} from "../../../common/entities/AutoCompleteItem"; import {GalleryCacheService} from "./cache.gallery.service"; import {BehaviorSubject} from "rxjs/BehaviorSubject"; @@ -51,11 +51,11 @@ export class GalleryService { const cw = await this.networkService.getJson("/gallery/content/" + directoryName, params); - if (!cw || (cw.directory).notModified == true) { + if (!cw || cw.notModified == true) { return; } - this.galleryCacheService.setDirectory(cw.directory); //save it before adding references + this.galleryCacheService.setDirectory(cw.directory); //save it before adding references if (this.lastRequest.directory != directoryName) { return; diff --git a/frontend/app/gallery/map/lightbox/lightbox.map.gallery.component.ts b/frontend/app/gallery/map/lightbox/lightbox.map.gallery.component.ts index 0b99d4eb..33e1dee0 100644 --- a/frontend/app/gallery/map/lightbox/lightbox.map.gallery.component.ts +++ b/frontend/app/gallery/map/lightbox/lightbox.map.gallery.component.ts @@ -55,7 +55,7 @@ export class GalleryMapLightboxComponent implements OnChanges { }; this.map.triggerResize(); - document.getElementsByTagName('body')[0].style.overflow = 'hidden'; + document.getElementsByTagName('body')[0].style.overflowY = 'hidden'; this.showImages(); setTimeout(() => { @@ -79,7 +79,7 @@ export class GalleryMapLightboxComponent implements OnChanges { this.lightboxDimension = this.startPosition; this.lightboxDimension.top -= this.getBodyScrollTop(); - document.getElementsByTagName('body')[0].style.overflow = 'scroll'; + document.getElementsByTagName('body')[0].style.overflowY = 'scroll'; this.opacity = 0.0; setTimeout(() => { this.visible = false; diff --git a/frontend/app/gallery/overlay.service.ts b/frontend/app/gallery/overlay.service.ts index a3e03828..b86966a5 100644 --- a/frontend/app/gallery/overlay.service.ts +++ b/frontend/app/gallery/overlay.service.ts @@ -10,7 +10,7 @@ export class OverlayService { public showOverlay() { //disable scrolling - document.getElementsByTagName('body')[0].style.overflow = 'hidden'; + document.getElementsByTagName('body')[0].style.overflowY = 'hidden'; this.OnOverlayChange.trigger(true); } @@ -33,7 +33,7 @@ export class OverlayService { let widthNoScroll = outer.offsetWidth; // force scrollbars - outer.style.overflow = "scroll"; + outer.style.overflowY = "scroll"; // add innerdiv let inner = document.createElement("div"); @@ -51,7 +51,7 @@ export class OverlayService { } getPhantomScrollbarWidth() { - if (document.getElementsByTagName('body')[0].style.overflow == 'hidden') { + if (document.getElementsByTagName('body')[0].style.overflowY == 'hidden') { return this.getScrollbarWidth(); } return 0;