diff --git a/package-lock.json b/package-lock.json index 9fba6d0a..47baa963 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13812,12 +13812,6 @@ "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", "dev": true }, - "ng2-cookies": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/ng2-cookies/-/ng2-cookies-1.0.12.tgz", - "integrity": "sha1-Pz5hPgE3sGSbcFxngHS0vQgUnMw=", - "dev": true - }, "ngx-bootstrap": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/ngx-bootstrap/-/ngx-bootstrap-6.2.0.tgz", @@ -13842,6 +13836,23 @@ } } }, + "ngx-cookie-service": { + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/ngx-cookie-service/-/ngx-cookie-service-11.0.2.tgz", + "integrity": "sha512-nsjzdcjK+gNAweE/DDdnOyHo04jlxTeMXOL/oJNp8MHtOTvCXnOtIFYgq4Sb2JU6UXTovO9tHEMIf9TxjlsdgQ==", + "dev": true, + "requires": { + "tslib": "^2.0.0" + }, + "dependencies": { + "tslib": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", + "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==", + "dev": true + } + } + }, "ngx-toastr": { "version": "13.2.1", "resolved": "https://registry.npmjs.org/ngx-toastr/-/ngx-toastr-13.2.1.tgz", diff --git a/package.json b/package.json index 4686a566..6442e959 100644 --- a/package.json +++ b/package.json @@ -123,9 +123,9 @@ "karma-systemjs": "0.16.0", "mocha": "8.3.2", "natural-orderby": "2.0.3", - "ng2-cookies": "1.0.12", "ngx-bootstrap": "6.2.0", "ngx-clipboard": "14.0.1", + "ngx-cookie-service": "^11.0.2", "ngx-toastr": "13.2.1", "nyc": "15.1.0", "open-iconic": "1.1.1", @@ -142,7 +142,7 @@ "zone.js": "0.11.4" }, "//": { - "TODO":"sharp 0.28.1 fails arm/v7 build as Prebuilt libvips 8.10.6 binaries are not yet available for linuxmusl-armv7. https://sharp.pixelplumbing.com/install" + "TODO": "sharp 0.28.1 fails arm/v7 build as Prebuilt libvips 8.10.6 binaries are not yet available for linuxmusl-armv7. https://sharp.pixelplumbing.com/install" }, "optionalDependencies": { "@ffmpeg-installer/ffmpeg": "1.0.20", diff --git a/src/backend/model/Localizations.ts b/src/backend/model/Localizations.ts index 582a7f9d..a693f50e 100644 --- a/src/backend/model/Localizations.ts +++ b/src/backend/model/Localizations.ts @@ -13,7 +13,7 @@ export class Localizations { const dirCont = fs.readdirSync(ProjectPath.FrontendFolder) .filter((f): any => fs.statSync(path.join(ProjectPath.FrontendFolder, f)).isDirectory()); Config.Client.languages = dirCont.filter((d): boolean => notLanguage.indexOf(d) === -1); - Config.Client.languages.push('en'); + Config.Client.languages.sort(); } } diff --git a/src/frontend/app/app.module.ts b/src/frontend/app/app.module.ts index 193fc86e..2b632f9c 100644 --- a/src/frontend/app/app.module.ts +++ b/src/frontend/app/app.module.ts @@ -97,6 +97,7 @@ import {AutoCompleteService} from './ui/gallery/search/autocomplete.service'; import {SearchQueryParserService} from './ui/gallery/search/search-query-parser.service'; import {GallerySearchFieldComponent} from './ui/gallery/search/search-field/search-field.gallery.component'; import {AppRoutingModule} from './app.routing'; +import {CookieService} from 'ngx-cookie-service'; @Injectable() @@ -239,7 +240,8 @@ export class CustomUrlSerializer implements UrlSerializer { FacesService, VersionService, ScheduledJobsService, - BackendtextService + BackendtextService, + CookieService ], bootstrap: [AppComponent] }) diff --git a/src/frontend/app/model/network/authentication.service.ts b/src/frontend/app/model/network/authentication.service.ts index 0ce0fcfe..b269d884 100644 --- a/src/frontend/app/model/network/authentication.service.ts +++ b/src/frontend/app/model/network/authentication.service.ts @@ -3,12 +3,12 @@ import {UserDTO, UserRoles} from '../../../../common/entities/UserDTO'; import {BehaviorSubject} from 'rxjs'; import {UserService} from './user.service'; import {LoginCredential} from '../../../../common/entities/LoginCredential'; -import {Cookie} from 'ng2-cookies'; import {Config} from '../../../../common/config/public/Config'; import {NetworkService} from './network.service'; import {ErrorCodes, ErrorDTO} from '../../../../common/entities/Error'; import {CookieNames} from '../../../../common/CookieNames'; import {ShareService} from '../../ui/gallery/share.service'; +import { CookieService } from 'ngx-cookie-service'; /* Injected config / user from server side */ // tslint:disable-next-line:no-internal-module no-namespace @@ -23,11 +23,12 @@ export class AuthenticationService { constructor(private userService: UserService, private networkService: NetworkService, - private shareService: ShareService) { + private shareService: ShareService, + private cookieService: CookieService) { this.user = new BehaviorSubject(null); // picking up session.. - if (this.isAuthenticated() === false && Cookie.get(CookieNames.session) != null) { + if (this.isAuthenticated() === false && this.cookieService.get(CookieNames.session) != null) { if (typeof ServerInject !== 'undefined' && typeof ServerInject.user !== 'undefined') { this.user.next(ServerInject.user); } diff --git a/src/frontend/app/ui/language/language.component.ts b/src/frontend/app/ui/language/language.component.ts index 26f624cc..ec0a07be 100644 --- a/src/frontend/app/ui/language/language.component.ts +++ b/src/frontend/app/ui/language/language.component.ts @@ -1,7 +1,7 @@ import {Component, Input} from '@angular/core'; import {Config} from '../../../../common/config/public/Config'; -import {Cookie} from 'ng2-cookies'; import {CookieNames} from '../../../../common/CookieNames'; +import {CookieService} from 'ngx-cookie-service'; @Component({ selector: 'app-language', @@ -14,10 +14,10 @@ export class LanguageComponent { languages: string[] = []; current: string = null; - constructor() { + constructor(private cookieService: CookieService) { this.languages = Config.Client.languages; - if (Cookie.get(CookieNames.lang) != null) { - this.current = Cookie.get(CookieNames.lang); + if (this.cookieService.get(CookieNames.lang) != null) { + this.current = this.cookieService.get(CookieNames.lang); } }