You've already forked pigallery2
							
							
				mirror of
				https://github.com/bpatrik/pigallery2.git
				synced 2025-10-30 23:57:43 +02:00 
			
		
		
		
	minor bugfixes
This commit is contained in:
		| @@ -20,6 +20,7 @@ | ||||
|       "testTsconfig": "tsconfig.spec.json", | ||||
|       "prefix": "app", | ||||
|       "styles": [ | ||||
|         "../node_modules/ng2-toastr/bundles/ng2-toastr.min.css", | ||||
|         "../node_modules/bootstrap/dist/css/bootstrap.css", | ||||
|         "styles.css" | ||||
|       ], | ||||
|   | ||||
| @@ -20,6 +20,10 @@ class ProjectPathClass { | ||||
|   } | ||||
|  | ||||
|   constructor() { | ||||
|     this.reset(); | ||||
|   } | ||||
|  | ||||
|   reset() { | ||||
|     this.Root = path.join(__dirname, "/../"); | ||||
|     this.ImageFolder = this.getAbsolutePath(Config.Server.imagesFolder); | ||||
|     this.ThumbnailFolder = this.getAbsolutePath(Config.Server.thumbnail.folder); | ||||
|   | ||||
| @@ -9,7 +9,7 @@ import {ConfigDiagnostics} from "../model/ConfigDiagnostics"; | ||||
| import {ClientConfig} from "../../common/config/public/ConfigClass"; | ||||
| import {BasicConfigDTO} from "../../common/entities/settings/BasicConfigDTO"; | ||||
| import {OtherConfigDTO} from "../../common/entities/settings/OtherConfigDTO"; | ||||
| import set = Reflect.set; | ||||
| import {ProjectPath} from "../ProjectPath"; | ||||
|  | ||||
|  | ||||
| const LOG_TAG = "[AdminMWs]"; | ||||
| @@ -165,6 +165,7 @@ export class AdminMWs { | ||||
|       original.Server.thumbnail = settings.server; | ||||
|       original.Client.Thumbnail = settings.client; | ||||
|       original.save(); | ||||
|       ProjectPath.reset(); | ||||
|       await ConfigDiagnostics.runDiagnostics(); | ||||
|       Logger.info(LOG_TAG, "new config:"); | ||||
|       Logger.info(LOG_TAG, JSON.stringify(Config, null, '\t')); | ||||
| @@ -197,6 +198,7 @@ export class AdminMWs { | ||||
|       original.Client.publicUrl = settings.publicUrl; | ||||
|       original.Client.applicationTitle = settings.applicationTitle; | ||||
|       original.save(); | ||||
|       ProjectPath.reset(); | ||||
|       await ConfigDiagnostics.runDiagnostics(); | ||||
|       Logger.info(LOG_TAG, "new config:"); | ||||
|       Logger.info(LOG_TAG, JSON.stringify(Config, null, '\t')); | ||||
|   | ||||
| @@ -1,12 +1,17 @@ | ||||
| import * as bcryptjs from "bcryptjs"; | ||||
| let bcrypt; | ||||
| try { | ||||
|   bcrypt = require("bcrypt"); | ||||
| } catch (err) { | ||||
|   bcrypt = require("bcryptjs"); | ||||
| } | ||||
|  | ||||
| export class PasswordHelper { | ||||
|   public static cryptPassword(password) { | ||||
|     const salt = bcryptjs.genSaltSync(10); | ||||
|     return bcryptjs.hashSync(password, salt); | ||||
|     const salt = bcrypt.genSaltSync(9); | ||||
|     return bcrypt.hashSync(password, salt); | ||||
|   } | ||||
|  | ||||
|   public static comparePassword(password, encryptedPassword) { | ||||
|     return bcryptjs.compareSync(password, encryptedPassword); | ||||
|     return bcrypt.compareSync(password, encryptedPassword); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -19,6 +19,7 @@ import {ConfigDiagnostics} from "./model/ConfigDiagnostics"; | ||||
| import _session = require('cookie-session'); | ||||
|  | ||||
| const LOG_TAG = "[server]"; | ||||
|  | ||||
| export class Server { | ||||
|  | ||||
|   private app: any; | ||||
| @@ -103,6 +104,7 @@ export class Server { | ||||
|    */ | ||||
|   private onError = (error: any) => { | ||||
|     if (error.syscall !== 'listen') { | ||||
|       Logger.error(LOG_TAG, 'Server error', error); | ||||
|       throw error; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -31,7 +31,7 @@ export class PrivateConfigClass extends PublicConfigClass implements IPrivateCon | ||||
|       updateTimeout: 1000 * 60 * 5 | ||||
|     }, | ||||
|     enableThreading: true, | ||||
|     folderPreviewSize: 5 | ||||
|     folderPreviewSize: 2 | ||||
|   }; | ||||
|   private ConfigLoader: any; | ||||
|  | ||||
|   | ||||
| @@ -59,7 +59,7 @@ export class PublicConfigClass { | ||||
|       googleApiKey: "" | ||||
|     }, | ||||
|     concurrentThumbnailGenerations: 1, | ||||
|     enableCache: false, | ||||
|     enableCache: true, | ||||
|     enableOnScrollRendering: true, | ||||
|     enableOnScrollThumbnailPrioritising: true, | ||||
|     authenticationRequired: true, | ||||
|   | ||||
| @@ -41,7 +41,7 @@ | ||||
|           <!-- Button --> | ||||
|           <div class="col-sm-12 controls"> | ||||
|             <button class="btn btn-primary pull-right" | ||||
|                     [disabled]="!LoginForm.form.valid" | ||||
|                     [disabled]="!LoginForm.form.valid || inProgress" | ||||
|                     type="submit" | ||||
|                     name="action">Login | ||||
|             </button> | ||||
|   | ||||
| @@ -14,6 +14,7 @@ export class LoginComponent implements OnInit { | ||||
|   loginCredential: LoginCredential; | ||||
|   loginError: any = null; | ||||
|   title: string; | ||||
|   inProgress = false; | ||||
|  | ||||
|   constructor(private _authService: AuthenticationService, private _navigation: NavigationService) { | ||||
|     this.loginCredential = new LoginCredential(); | ||||
| @@ -29,14 +30,16 @@ export class LoginComponent implements OnInit { | ||||
|   async onLogin() { | ||||
|     this.loginError = null; | ||||
|  | ||||
|     this.inProgress = true; | ||||
|     try { | ||||
|       await this._authService.login(this.loginCredential); | ||||
|     } catch (error) { | ||||
|       if (error && error.code === ErrorCodes.CREDENTIAL_NOT_FOUND) { | ||||
|         this.loginError = "Wrong username or password"; | ||||
|         return; | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     this.inProgress = false; | ||||
|   } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -6,7 +6,6 @@ | ||||
|   <title>Loading..</title> | ||||
|   <link rel="shortcut icon" href="assets/icon.png"> | ||||
|   <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|   <link href="../node_modules/ng2-toastr/bundles/ng2-toastr.min.css" rel="stylesheet"/> | ||||
|   <!-- Latest compiled and minified CSS --> | ||||
|  | ||||
|   <link rel="stylesheet" | ||||
|   | ||||
| @@ -35,7 +35,7 @@ | ||||
|     "mysql": "2.13.0", | ||||
|     "reflect-metadata": "0.1.10", | ||||
|     "ts-exif-parser": "^0.1.23", | ||||
|     "ts-node-iptc": "^1.0.8", | ||||
|     "ts-node-iptc": "^1.0.9", | ||||
|     "typeconfig": "1.0.4", | ||||
|     "typeorm": "0.0.11", | ||||
|     "winston": "2.3.1" | ||||
| @@ -106,6 +106,7 @@ | ||||
|     "zone.js": "^0.8.13" | ||||
|   }, | ||||
|   "optionalDependencies": { | ||||
|     "bcrypt": "^1.0.2", | ||||
|     "gm": "^1.23.0", | ||||
|     "sharp": "^0.18.2" | ||||
|   } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user