diff --git a/backend/middlewares/RenderingMWs.ts b/backend/middlewares/RenderingMWs.ts index 80f902e8..2e16ab94 100644 --- a/backend/middlewares/RenderingMWs.ts +++ b/backend/middlewares/RenderingMWs.ts @@ -42,7 +42,7 @@ export class RenderingMWs { if (!req.resultPipe) return next(); - return res.sendFile(req.resultPipe); + return res.sendFile(req.resultPipe, {maxAge: 31536000}); } public static renderOK(req: Request, res: Response, next: NextFunction) { diff --git a/backend/routes/PublicRouter.ts b/backend/routes/PublicRouter.ts index 772e5c80..501b67be 100644 --- a/backend/routes/PublicRouter.ts +++ b/backend/routes/PublicRouter.ts @@ -10,7 +10,7 @@ export class PublicRouter { public static route(app) { const renderIndex = (req: Request, res: Response) => { - res.sendFile(_path.resolve(__dirname, './../../dist/index.html')); + res.sendFile(_path.resolve(ProjectPath.FrontendFolder, 'index.html'), {maxAge: 31536000}); }; app.use( @@ -29,18 +29,16 @@ export class PublicRouter { }); app.get('/config_inject.js', (req: Request, res: Response) => { - res.render(_path.resolve(__dirname, './../../dist/config_inject.ejs'), res.tpl); + res.render(_path.resolve(ProjectPath.FrontendFolder, 'config_inject.ejs'), res.tpl); }); app.get(['/', '/login', "/gallery*", "/share*", "/admin", "/search*"], AuthenticationMWs.tryAuthenticate, renderIndex ); - app.use(_express.static(ProjectPath.FrontendFolder)); - app.use('/node_modules', _express.static(_path.resolve(__dirname, './../../node_modules'))); - app.use('/common', _express.static(_path.resolve(__dirname, './../../common'))); - - + app.use(_express.static(ProjectPath.FrontendFolder, {maxAge: 31536000})); + // app.use('/node_modules', _express.static(_path.resolve(__dirname, './../../node_modules'))); + // app.use('/common', _express.static(_path.resolve(__dirname, './../../common'))); } } diff --git a/common/config/private/PrivateConfigClass.ts b/common/config/private/PrivateConfigClass.ts index 21aa500f..ef86d6be 100644 --- a/common/config/private/PrivateConfigClass.ts +++ b/common/config/private/PrivateConfigClass.ts @@ -42,7 +42,7 @@ export class PrivateConfigClass extends PublicConfigClass implements IPrivateCon indexing: { folderPreviewSize: 2, cachedFolderTimeout: 1000 * 60 * 60, - reIndexingSensitivity: ReIndexingSensitivity.high + reIndexingSensitivity: ReIndexingSensitivity.medium }, enableThreading: true }; diff --git a/frontend/app/gallery/gallery.service.ts b/frontend/app/gallery/gallery.service.ts index 651274f4..9cd1360c 100644 --- a/frontend/app/gallery/gallery.service.ts +++ b/frontend/app/gallery/gallery.service.ts @@ -81,6 +81,7 @@ export class GalleryService { return null } + this.content.next(null); const cw: ContentWrapper = await this.networkService.getJson("/search/" + text, {type: type}); console.log("photos", cw.searchResult.photos.length); console.log("direcotries", cw.searchResult.directories.length); @@ -106,7 +107,7 @@ export class GalleryService { this.searchId = setTimeout(() => { this.search(text); this.searchId = null; - }, Config.Client.Search.InstantSearchTimeout); //TODO: set timeout to config + }, Config.Client.Search.InstantSearchTimeout); const cw = await this.networkService.getJson("/instant-search/" + text); this.content.next(cw); diff --git a/frontend/app/gallery/lightbox/lightbox.gallery.component.ts b/frontend/app/gallery/lightbox/lightbox.gallery.component.ts index 37f95663..1283ea59 100644 --- a/frontend/app/gallery/lightbox/lightbox.gallery.component.ts +++ b/frontend/app/gallery/lightbox/lightbox.gallery.component.ts @@ -404,6 +404,9 @@ export class GalleryLightboxComponent implements OnDestroy { public play() { this.pause(); this.timerSub = this.timer.filter(t => t % 2 == 0).subscribe(() => { + if (this.photoElement.imageLoadFinished == false) { + return; + } if (this.navigation.hasNext) { this.nextImage(); } else { @@ -416,6 +419,9 @@ export class GalleryLightboxComponent implements OnDestroy { public fastForward() { this.pause(); this.timerSub = this.timer.subscribe(() => { + if (this.photoElement.imageLoadFinished == false) { + return; + } if (this.navigation.hasNext) { this.nextImage(); } else { diff --git a/frontend/app/gallery/lightbox/photo/photo.lightbox.gallery.component.ts b/frontend/app/gallery/lightbox/photo/photo.lightbox.gallery.component.ts index d3e2027b..dd1ef6d9 100644 --- a/frontend/app/gallery/lightbox/photo/photo.lightbox.gallery.component.ts +++ b/frontend/app/gallery/lightbox/photo/photo.lightbox.gallery.component.ts @@ -15,6 +15,7 @@ export class GalleryLightboxPhotoComponent implements OnChanges { public imageSize = {width: "auto", height: "100"}; imageLoaded: boolean = false; + public imageLoadFinished: boolean = false; constructor(public elementRef: ElementRef) { } @@ -22,6 +23,7 @@ export class GalleryLightboxPhotoComponent implements OnChanges { ngOnChanges() { this.imageLoaded = false; + this.imageLoadFinished = false; this.setImageSize(); } @@ -44,11 +46,13 @@ export class GalleryLightboxPhotoComponent implements OnChanges { onImageLoad() { + this.imageLoadFinished = true; this.imageLoaded = true; } onImageError() { //TODO:handle error + this.imageLoadFinished = true; console.error("cant load image"); } diff --git a/frontend/app/gallery/share/share.gallery.component.ts b/frontend/app/gallery/share/share.gallery.component.ts index 9343a2d6..5cf1527a 100644 --- a/frontend/app/gallery/share/share.gallery.component.ts +++ b/frontend/app/gallery/share/share.gallery.component.ts @@ -31,7 +31,7 @@ export class GalleryShareComponent implements OnInit, OnDestroy { }; validityTypes = []; currentDir: string = ""; - sharing: SharingDTO; + sharing: SharingDTO = null; contentSubscription = null; passwordProtection = false; @@ -76,6 +76,9 @@ export class GalleryShareComponent implements OnInit, OnDestroy { } async update() { + if (this.sharing == null) { + return; + } this.url = "loading.."; this.sharing = await this._sharingService.updateSharing(this.currentDir, this.sharing.id, this.input.includeSubfolders, this.input.password, this.calcValidity()); console.log(this.sharing); diff --git a/frontend/app/settings/_abstract/abstract.settings.component.ts b/frontend/app/settings/_abstract/abstract.settings.component.ts index 776087f1..c3f837f3 100644 --- a/frontend/app/settings/_abstract/abstract.settings.component.ts +++ b/frontend/app/settings/_abstract/abstract.settings.component.ts @@ -9,7 +9,8 @@ import {AbstractSettingsService} from "./abstract.settings.service"; import {IPrivateConfig} from "../../../../common/config/private/IPrivateConfig"; -export abstract class SettingsComponent implements OnInit, OnDestroy, OnChanges { +export abstract class SettingsComponent=AbstractSettingsService> + implements OnInit, OnDestroy, OnChanges { @Input() public simplifiedMode: boolean = true; @@ -32,7 +33,7 @@ export abstract class SettingsComponent implements OnInit, OnDestroy, OnChang constructor(private name, private _authService: AuthenticationService, private _navigation: NavigationService, - public _settingsService: AbstractSettingsService, + public _settingsService: S, protected notification: NotificationService, private sliceFN?: (s: IPrivateConfig) => T) { if (this.sliceFN) { diff --git a/frontend/app/settings/indexing/indexing.settings.component.ts b/frontend/app/settings/indexing/indexing.settings.component.ts index c7bb5f03..63cdb0d8 100644 --- a/frontend/app/settings/indexing/indexing.settings.component.ts +++ b/frontend/app/settings/indexing/indexing.settings.component.ts @@ -16,7 +16,7 @@ import {Utils} from "../../../../common/Utils"; './../_abstract/abstract.settings.component.css'], providers: [IndexingSettingsService], }) -export class IndexingSettingsComponent extends SettingsComponent { +export class IndexingSettingsComponent extends SettingsComponent { types: Array = []; @@ -79,7 +79,7 @@ export class IndexingSettingsComponent extends SettingsComponent this.inProgress = true; this.error = ""; try { - await (this._settingsService).index(); + await this._settingsService.index(); this.updateProgress(); this.notification.success("Folder indexed", "Success"); this.inProgress = false;