From 08d8a8eeb85f1039f9f7df3742662ada82b8e7d2 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Fri, 28 Dec 2018 00:48:39 +0100 Subject: [PATCH] adding host config to UI. fixing toastr error --- backend/middlewares/AdminMWs.ts | 2 + backend/server.ts | 3 +- common/config/private/PrivateConfigClass.ts | 1 - common/entities/settings/BasicConfigDTO.ts | 1 + .../basic/basic.settings.component.html | 12 +++++ .../basic/basic.settings.component.ts | 1 + frontend/translate/messages.en.xlf | 50 ++++++++++++------- frontend/translate/messages.hu.xlf | 50 ++++++++++++------- package.json | 2 +- 9 files changed, 81 insertions(+), 41 deletions(-) diff --git a/backend/middlewares/AdminMWs.ts b/backend/middlewares/AdminMWs.ts index 36ffd644..0175fa97 100644 --- a/backend/middlewares/AdminMWs.ts +++ b/backend/middlewares/AdminMWs.ts @@ -305,6 +305,7 @@ export class AdminMWs { const settings: BasicConfigDTO = req.body.settings; await ConfigDiagnostics.testImageFolder(settings.imagesFolder); Config.Server.port = settings.port; + Config.Server.host = settings.host; Config.Server.imagesFolder = settings.imagesFolder; Config.Client.publicUrl = settings.publicUrl; Config.Client.urlBase = settings.urlBase; @@ -312,6 +313,7 @@ export class AdminMWs { // only updating explicitly set config (not saving config set by the diagnostics) const original = Config.original(); original.Server.port = settings.port; + original.Server.host = settings.host; original.Server.imagesFolder = settings.imagesFolder; original.Client.publicUrl = settings.publicUrl; original.Client.urlBase = settings.urlBase; diff --git a/backend/server.ts b/backend/server.ts index 6749c433..bbbae590 100644 --- a/backend/server.ts +++ b/backend/server.ts @@ -2,6 +2,7 @@ import * as _express from 'express'; import * as _bodyParser from 'body-parser'; import * as cookieParser from 'cookie-parser'; import * as _http from 'http'; +import {Server as HttpServer} from 'http'; // @ts-ignore import * as locale from 'locale'; import {PublicRouter} from './routes/PublicRouter'; @@ -29,7 +30,7 @@ const LOG_TAG = '[server]'; export class Server { private app: _express.Express; - private server: any; + private server: HttpServer; /** * Event listener for HTTP server "error" event. diff --git a/common/config/private/PrivateConfigClass.ts b/common/config/private/PrivateConfigClass.ts index c13a0afd..f6f5d543 100644 --- a/common/config/private/PrivateConfigClass.ts +++ b/common/config/private/PrivateConfigClass.ts @@ -2,7 +2,6 @@ import {PublicConfigClass} from '../public/ConfigClass'; import {DatabaseType, IPrivateConfig, ReIndexingSensitivity, ServerConfig, ThumbnailProcessingLib} from './IPrivateConfig'; import * as path from 'path'; import {ConfigLoader} from 'typeconfig'; -import {UserService} from '../../../frontend/app/model/network/user.service'; import {Utils} from '../../Utils'; import {UserRoles} from '../../entities/UserDTO'; diff --git a/common/entities/settings/BasicConfigDTO.ts b/common/entities/settings/BasicConfigDTO.ts index 28911749..395cda5e 100644 --- a/common/entities/settings/BasicConfigDTO.ts +++ b/common/entities/settings/BasicConfigDTO.ts @@ -4,4 +4,5 @@ export interface BasicConfigDTO { urlBase: string; applicationTitle: string; port: number; + host: string; } diff --git a/frontend/app/settings/basic/basic.settings.component.html b/frontend/app/settings/basic/basic.settings.component.html index bead78e3..344990be 100644 --- a/frontend/app/settings/basic/basic.settings.component.html +++ b/frontend/app/settings/basic/basic.settings.component.html @@ -16,6 +16,18 @@ name="applicationTitle" required> + +
+ +
+ + Server will accept connections from this IPv6 or IPv4 address. +
+
+
diff --git a/frontend/app/settings/basic/basic.settings.component.ts b/frontend/app/settings/basic/basic.settings.component.ts index 7c688102..bdb60ad4 100644 --- a/frontend/app/settings/basic/basic.settings.component.ts +++ b/frontend/app/settings/basic/basic.settings.component.ts @@ -27,6 +27,7 @@ export class BasicSettingsComponent extends SettingsComponent { i18n: I18n) { super(i18n('Basic'), _authService, _navigation, _settingsService, notification, i18n, s => ({ port: s.Server.port, + host: s.Server.host, imagesFolder: s.Server.imagesFolder, applicationTitle: s.Client.applicationTitle, publicUrl: s.Client.publicUrl, diff --git a/frontend/translate/messages.en.xlf b/frontend/translate/messages.en.xlf index 7c48e33e..070e2eee 100644 --- a/frontend/translate/messages.en.xlf +++ b/frontend/translate/messages.en.xlf @@ -180,14 +180,6 @@ Zoom in, key: '+' - - Search - - app/gallery/search/search.gallery.component.html - 6 - - Search - Link availability @@ -230,6 +222,14 @@ Logout + + Search + + app/gallery/search/search.gallery.component.html + 6 + + Search + Share @@ -564,6 +564,10 @@ app/settings/database/database.settings.component.html 19 + + app/settings/basic/basic.settings.component.html + 21 + Host @@ -681,7 +685,7 @@ app/settings/basic/basic.settings.component.html - 79 + 94 app/settings/other/other.settings.component.html @@ -722,7 +726,7 @@ app/settings/basic/basic.settings.component.html - 82 + 97 app/settings/other/other.settings.component.html @@ -1028,11 +1032,19 @@ Page title + + Server will accept connections from this IPv6 or IPv4 address. + + app/settings/basic/basic.settings.component.html + 30 + + Server will accept connections from this IPv6 or IPv4 address. + Port app/settings/basic/basic.settings.component.html - 20 + 35 Port @@ -1040,7 +1052,7 @@ Port number. Port 80 is usually what you need. app/settings/basic/basic.settings.component.html - 29 + 44 Port number. Port 80 is usually what you need. @@ -1048,7 +1060,7 @@ Images folder app/settings/basic/basic.settings.component.html - 34 + 49 Images folder @@ -1056,7 +1068,7 @@ Images are loaded from this folder (read permission required) app/settings/basic/basic.settings.component.html - 40 + 55 Images are loaded from this folder (read permission required) @@ -1064,7 +1076,7 @@ Page public url app/settings/basic/basic.settings.component.html - 45 + 60 Page public url @@ -1074,7 +1086,7 @@ app/settings/basic/basic.settings.component.html - 52 + 67 If you access the page form local network its good to know the public url for creating sharing link @@ -1082,7 +1094,7 @@ Url Base app/settings/basic/basic.settings.component.html - 59 + 74 Url Base @@ -1093,7 +1105,7 @@ app/settings/basic/basic.settings.component.html - 66 + 81 If you access the gallery under a sub url (like: http://mydomain.com/myGallery), set it here. If not working you might miss the '/' from the beginning of the url. @@ -1103,7 +1115,7 @@ app/settings/basic/basic.settings.component.html - 73 + 88 The public url and the url base are not matching. Some of the functionality might not work. diff --git a/frontend/translate/messages.hu.xlf b/frontend/translate/messages.hu.xlf index 1bd4e7b6..7833f000 100644 --- a/frontend/translate/messages.hu.xlf +++ b/frontend/translate/messages.hu.xlf @@ -180,14 +180,6 @@ Nagyítás, gyorsgomb: '+' - - Search - - app/gallery/search/search.gallery.component.html - 6 - - Keresés - Link availability @@ -230,6 +222,14 @@ Kijelentkezés + + Search + + app/gallery/search/search.gallery.component.html + 6 + + Keresés + Share @@ -564,6 +564,10 @@ app/settings/database/database.settings.component.html 19 + + app/settings/basic/basic.settings.component.html + 21 + Host @@ -681,7 +685,7 @@ app/settings/basic/basic.settings.component.html - 79 + 94 app/settings/other/other.settings.component.html @@ -722,7 +726,7 @@ app/settings/basic/basic.settings.component.html - 82 + 97 app/settings/other/other.settings.component.html @@ -1028,11 +1032,19 @@ Oldal címe + + Server will accept connections from this IPv6 or IPv4 address. + + app/settings/basic/basic.settings.component.html + 30 + + A szerver csak erről az (IPv6 vagy az IPv4) címből származó kapcsolatokat fog fogadni. + Port app/settings/basic/basic.settings.component.html - 20 + 35 Port @@ -1040,7 +1052,7 @@ Port number. Port 80 is usually what you need. app/settings/basic/basic.settings.component.html - 29 + 44 Portszám. A 80-as port általában az, amire szükséged van. @@ -1048,7 +1060,7 @@ Images folder app/settings/basic/basic.settings.component.html - 34 + 49 Képek mappa @@ -1056,7 +1068,7 @@ Images are loaded from this folder (read permission required) app/settings/basic/basic.settings.component.html - 40 + 55 A képek ebből a mappából töltődnek be (olvasási engedély szükséges a mappára) @@ -1064,7 +1076,7 @@ Page public url app/settings/basic/basic.settings.component.html - 45 + 60 Oldal nyilvános url-je @@ -1074,7 +1086,7 @@ app/settings/basic/basic.settings.component.html - 52 + 67 Ha az oldalt a helyi hálózaton keresztül éred el, jó tudni a nyilvánosságot URL-t megosztási link létrehozásához @@ -1082,7 +1094,7 @@ Url Base app/settings/basic/basic.settings.component.html - 59 + 74 Al cím @@ -1093,7 +1105,7 @@ app/settings/basic/basic.settings.component.html - 66 + 81 Ha a galériát egy al-url alatt érheti el (például: http://mydomain.com/myGallery), állítsa be itt. Ha nem működik, akkor hiányozhat a "/" a kezdetétől url. @@ -1103,7 +1115,7 @@ app/settings/basic/basic.settings.component.html - 73 + 88 A nyilvános url és az al url nem eggyeznek meg. Néhány funkció lehet hogy nem fog működni. diff --git a/package.json b/package.json index ce5a6bf8..cf9af14a 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ "@types/sharp": "0.21.0", "@types/winston": "2.3.9", "@yaga/leaflet-ng2": "^1.0.0", - "bootstrap": "4.2.1", + "bootstrap": "4.1.3", "chai": "4.2.0", "codelyzer": "4.5.0", "core-js": "2.6.1",