mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
parent
3bff1a4383
commit
19e23133f2
@ -12,7 +12,7 @@ import {
|
|||||||
DatabaseType,
|
DatabaseType,
|
||||||
ServerDataBaseConfig,
|
ServerDataBaseConfig,
|
||||||
ServerIndexingConfig,
|
ServerIndexingConfig,
|
||||||
ServerJobConfig,
|
ServerJobConfig, ServerMetaFileConfig,
|
||||||
ServerPhotoConfig,
|
ServerPhotoConfig,
|
||||||
ServerPreviewConfig,
|
ServerPreviewConfig,
|
||||||
ServerThumbnailConfig,
|
ServerThumbnailConfig,
|
||||||
@ -21,7 +21,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
ClientAlbumConfig,
|
ClientAlbumConfig,
|
||||||
ClientFacesConfig,
|
ClientFacesConfig,
|
||||||
ClientMapConfig,
|
ClientMapConfig, ClientMediaConfig,
|
||||||
ClientMetaFileConfig,
|
ClientMetaFileConfig,
|
||||||
ClientPhotoConfig,
|
ClientPhotoConfig,
|
||||||
ClientRandomPhotoConfig,
|
ClientRandomPhotoConfig,
|
||||||
@ -166,13 +166,21 @@ export class SettingsMWs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const original = await Config.original();
|
const settings: {
|
||||||
await ConfigDiagnostics.testMetaFileConfig(req.body.settings as ClientMetaFileConfig, original);
|
server: ServerMetaFileConfig,
|
||||||
|
client: ClientMetaFileConfig
|
||||||
|
} = req.body.settings;
|
||||||
|
|
||||||
Config.Client.MetaFile = (req.body.settings as ClientMetaFileConfig);
|
const original = await Config.original();
|
||||||
|
await ConfigDiagnostics.testClientMetaFileConfig(settings.client, original);
|
||||||
|
await ConfigDiagnostics.testServerMetaFileConfig(settings.server, original);
|
||||||
|
|
||||||
|
Config.Client.MetaFile = settings.client;
|
||||||
|
Config.Server.MetaFile = settings.server;
|
||||||
// only updating explicitly set config (not saving config set by the diagnostics)
|
// only updating explicitly set config (not saving config set by the diagnostics)
|
||||||
|
|
||||||
original.Client.MetaFile = (req.body.settings as ClientMetaFileConfig);
|
original.Client.MetaFile = settings.client;
|
||||||
|
original.Server.MetaFile = settings.server;
|
||||||
original.save();
|
original.save();
|
||||||
await ConfigDiagnostics.runDiagnostics();
|
await ConfigDiagnostics.runDiagnostics();
|
||||||
Logger.info(LOG_TAG, 'new config:');
|
Logger.info(LOG_TAG, 'new config:');
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { Config } from '../../../common/config/private/Config';
|
import {Config} from '../../../common/config/private/Config';
|
||||||
import { Logger } from '../../Logger';
|
import {Logger} from '../../Logger';
|
||||||
import { NotificationManager } from '../NotifocationManager';
|
import {NotificationManager} from '../NotifocationManager';
|
||||||
import { SQLConnection } from '../database/sql/SQLConnection';
|
import {SQLConnection} from '../database/sql/SQLConnection';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { FFmpegFactory } from '../FFmpegFactory';
|
import {FFmpegFactory} from '../FFmpegFactory';
|
||||||
import {
|
import {
|
||||||
ClientAlbumConfig,
|
ClientAlbumConfig,
|
||||||
ClientFacesConfig,
|
ClientFacesConfig,
|
||||||
@ -23,17 +23,18 @@ import {
|
|||||||
IPrivateConfig,
|
IPrivateConfig,
|
||||||
ServerDataBaseConfig,
|
ServerDataBaseConfig,
|
||||||
ServerJobConfig,
|
ServerJobConfig,
|
||||||
|
ServerMetaFileConfig,
|
||||||
ServerPhotoConfig,
|
ServerPhotoConfig,
|
||||||
ServerPreviewConfig,
|
ServerPreviewConfig,
|
||||||
ServerThumbnailConfig,
|
ServerThumbnailConfig,
|
||||||
ServerVideoConfig,
|
ServerVideoConfig,
|
||||||
} from '../../../common/config/private/PrivateConfig';
|
} from '../../../common/config/private/PrivateConfig';
|
||||||
import { SearchQueryParser } from '../../../common/SearchQueryParser';
|
import {SearchQueryParser} from '../../../common/SearchQueryParser';
|
||||||
import {
|
import {
|
||||||
SearchQueryTypes,
|
SearchQueryTypes,
|
||||||
TextSearch,
|
TextSearch,
|
||||||
} from '../../../common/entities/SearchQueryDTO';
|
} from '../../../common/entities/SearchQueryDTO';
|
||||||
import { Utils } from '../../../common/Utils';
|
import {Utils} from '../../../common/Utils';
|
||||||
|
|
||||||
const LOG_TAG = '[ConfigDiagnostics]';
|
const LOG_TAG = '[ConfigDiagnostics]';
|
||||||
|
|
||||||
@ -76,13 +77,13 @@ export class ConfigDiagnostics {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Cannot read or write sqlite storage file: ' +
|
'Cannot read or write sqlite storage file: ' +
|
||||||
SQLConnection.getSQLiteDB(databaseConfig)
|
SQLConnection.getSQLiteDB(databaseConfig)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static async testMetaFileConfig(
|
static async testClientMetaFileConfig(
|
||||||
metaFileConfig: ClientMetaFileConfig,
|
metaFileConfig: ClientMetaFileConfig,
|
||||||
config: IPrivateConfig
|
config: IPrivateConfig
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
@ -91,6 +92,13 @@ export class ConfigDiagnostics {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async testServerMetaFileConfig(
|
||||||
|
metaFileConfig: ServerMetaFileConfig,
|
||||||
|
config: IPrivateConfig
|
||||||
|
): Promise<void> {
|
||||||
|
// nothing to check at the moment
|
||||||
|
}
|
||||||
|
|
||||||
static testClientVideoConfig(videoConfig: ClientVideoConfig): Promise<void> {
|
static testClientVideoConfig(videoConfig: ClientVideoConfig): Promise<void> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
@ -101,7 +109,7 @@ export class ConfigDiagnostics {
|
|||||||
return reject(
|
return reject(
|
||||||
new Error(
|
new Error(
|
||||||
'Error accessing ffmpeg, cant find executable: ' +
|
'Error accessing ffmpeg, cant find executable: ' +
|
||||||
err.toString()
|
err.toString()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -110,7 +118,7 @@ export class ConfigDiagnostics {
|
|||||||
return reject(
|
return reject(
|
||||||
new Error(
|
new Error(
|
||||||
'Error accessing ffmpeg-probe, cant find executable: ' +
|
'Error accessing ffmpeg-probe, cant find executable: ' +
|
||||||
err2.toString()
|
err2.toString()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -150,7 +158,7 @@ export class ConfigDiagnostics {
|
|||||||
static testImageFolder(folder: string): Promise<void> {
|
static testImageFolder(folder: string): Promise<void> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (!fs.existsSync(folder)) {
|
if (!fs.existsSync(folder)) {
|
||||||
reject("Images folder not exists: '" + folder + "'");
|
reject('Images folder not exists: \'' + folder + '\'');
|
||||||
}
|
}
|
||||||
fs.access(folder, fs.constants.R_OK, (err) => {
|
fs.access(folder, fs.constants.R_OK, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -327,8 +335,8 @@ export class ConfigDiagnostics {
|
|||||||
Logger.warn(
|
Logger.warn(
|
||||||
LOG_TAG,
|
LOG_TAG,
|
||||||
'Thumbnail hardware acceleration is not possible.' +
|
'Thumbnail hardware acceleration is not possible.' +
|
||||||
" 'sharp' node module is not found." +
|
' \'sharp\' node module is not found.' +
|
||||||
' Falling back temporally to JS based thumbnail generation'
|
' Falling back temporally to JS based thumbnail generation'
|
||||||
);
|
);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
@ -362,7 +370,7 @@ export class ConfigDiagnostics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await ConfigDiagnostics.testMetaFileConfig(
|
await ConfigDiagnostics.testClientMetaFileConfig(
|
||||||
Config.Client.MetaFile,
|
Config.Client.MetaFile,
|
||||||
Config
|
Config
|
||||||
);
|
);
|
||||||
@ -380,6 +388,25 @@ export class ConfigDiagnostics {
|
|||||||
Config.Client.MetaFile.gpx = false;
|
Config.Client.MetaFile.gpx = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await ConfigDiagnostics.testServerMetaFileConfig(
|
||||||
|
Config.Server.MetaFile,
|
||||||
|
Config
|
||||||
|
);
|
||||||
|
} catch (ex) {
|
||||||
|
const err: Error = ex;
|
||||||
|
NotificationManager.warning(
|
||||||
|
'Meta file support error, switching off gpx..',
|
||||||
|
err.toString()
|
||||||
|
);
|
||||||
|
Logger.warn(
|
||||||
|
LOG_TAG,
|
||||||
|
'Meta file support error, switching off..',
|
||||||
|
err.toString()
|
||||||
|
);
|
||||||
|
Config.Client.MetaFile.gpx = false;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await ConfigDiagnostics.testAlbumsConfig(Config.Client.Album, Config);
|
await ConfigDiagnostics.testAlbumsConfig(Config.Client.Album, Config);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
@ -419,7 +446,7 @@ export class ConfigDiagnostics {
|
|||||||
const err: Error = ex;
|
const err: Error = ex;
|
||||||
NotificationManager.warning(
|
NotificationManager.warning(
|
||||||
'Search is not supported with these settings. Disabling temporally. ' +
|
'Search is not supported with these settings. Disabling temporally. ' +
|
||||||
'Please adjust the config properly.',
|
'Please adjust the config properly.',
|
||||||
err.toString()
|
err.toString()
|
||||||
);
|
);
|
||||||
Logger.warn(
|
Logger.warn(
|
||||||
@ -455,7 +482,7 @@ export class ConfigDiagnostics {
|
|||||||
const err: Error = ex;
|
const err: Error = ex;
|
||||||
NotificationManager.warning(
|
NotificationManager.warning(
|
||||||
'Faces are not supported with these settings. Disabling temporally. ' +
|
'Faces are not supported with these settings. Disabling temporally. ' +
|
||||||
'Please adjust the config properly.',
|
'Please adjust the config properly.',
|
||||||
err.toString()
|
err.toString()
|
||||||
);
|
);
|
||||||
Logger.warn(
|
Logger.warn(
|
||||||
@ -472,7 +499,7 @@ export class ConfigDiagnostics {
|
|||||||
const err: Error = ex;
|
const err: Error = ex;
|
||||||
NotificationManager.warning(
|
NotificationManager.warning(
|
||||||
'Some Tasks are not supported with these settings. Disabling temporally. ' +
|
'Some Tasks are not supported with these settings. Disabling temporally. ' +
|
||||||
'Please adjust the config properly.',
|
'Please adjust the config properly.',
|
||||||
err.toString()
|
err.toString()
|
||||||
);
|
);
|
||||||
Logger.warn(
|
Logger.warn(
|
||||||
@ -489,7 +516,7 @@ export class ConfigDiagnostics {
|
|||||||
const err: Error = ex;
|
const err: Error = ex;
|
||||||
NotificationManager.warning(
|
NotificationManager.warning(
|
||||||
'Sharing is not supported with these settings. Disabling temporally. ' +
|
'Sharing is not supported with these settings. Disabling temporally. ' +
|
||||||
'Please adjust the config properly.',
|
'Please adjust the config properly.',
|
||||||
err.toString()
|
err.toString()
|
||||||
);
|
);
|
||||||
Logger.warn(
|
Logger.warn(
|
||||||
@ -509,7 +536,7 @@ export class ConfigDiagnostics {
|
|||||||
const err: Error = ex;
|
const err: Error = ex;
|
||||||
NotificationManager.warning(
|
NotificationManager.warning(
|
||||||
'Random Media is not supported with these settings. Disabling temporally. ' +
|
'Random Media is not supported with these settings. Disabling temporally. ' +
|
||||||
'Please adjust the config properly.',
|
'Please adjust the config properly.',
|
||||||
err.toString()
|
err.toString()
|
||||||
);
|
);
|
||||||
Logger.warn(
|
Logger.warn(
|
||||||
@ -526,13 +553,13 @@ export class ConfigDiagnostics {
|
|||||||
const err: Error = ex;
|
const err: Error = ex;
|
||||||
NotificationManager.warning(
|
NotificationManager.warning(
|
||||||
'Maps is not supported with these settings. Using open street maps temporally. ' +
|
'Maps is not supported with these settings. Using open street maps temporally. ' +
|
||||||
'Please adjust the config properly.',
|
'Please adjust the config properly.',
|
||||||
err.toString()
|
err.toString()
|
||||||
);
|
);
|
||||||
Logger.warn(
|
Logger.warn(
|
||||||
LOG_TAG,
|
LOG_TAG,
|
||||||
'Maps is not supported with these settings. Using open street maps temporally ' +
|
'Maps is not supported with these settings. Using open street maps temporally ' +
|
||||||
'Please adjust the config properly.',
|
'Please adjust the config properly.',
|
||||||
err.toString()
|
err.toString()
|
||||||
);
|
);
|
||||||
Config.Client.Map.mapProvider = MapProviders.OpenStreetMap;
|
Config.Client.Map.mapProvider = MapProviders.OpenStreetMap;
|
||||||
|
@ -204,16 +204,16 @@ export class ClientMetaFileConfig {
|
|||||||
description: 'Reads *.gpx files and renders them on the map.',
|
description: 'Reads *.gpx files and renders them on the map.',
|
||||||
})
|
})
|
||||||
gpx: boolean = true;
|
gpx: boolean = true;
|
||||||
@ConfigProperty({
|
|
||||||
description: 'Reads *.gpx files and renders them on the map.',
|
|
||||||
})
|
|
||||||
@ConfigProperty()
|
@ConfigProperty()
|
||||||
GPXCompressing: ClientGPXCompressingConfig = new ClientGPXCompressingConfig();
|
GPXCompressing: ClientGPXCompressingConfig = new ClientGPXCompressingConfig();
|
||||||
|
|
||||||
@ConfigProperty({
|
@ConfigProperty({
|
||||||
description:
|
description:
|
||||||
'Reads *.md files in a directory and shows the next to the map.',
|
'Reads *.md files in a directory and shows the next to the map.',
|
||||||
})
|
})
|
||||||
markdown: boolean = true;
|
markdown: boolean = true;
|
||||||
|
|
||||||
@ConfigProperty({
|
@ConfigProperty({
|
||||||
description:
|
description:
|
||||||
'Reads *.pg2conf files (You can use it for custom sorting and save search (albums)).',
|
'Reads *.pg2conf files (You can use it for custom sorting and save search (albums)).',
|
||||||
|
@ -12,21 +12,42 @@
|
|||||||
description="Reads *.gpx files and renders them on the map."
|
description="Reads *.gpx files and renders them on the map."
|
||||||
i18n-description i18n-name
|
i18n-description i18n-name
|
||||||
[disabled]="!(settingsService.Settings | async).Client.Map.enabled"
|
[disabled]="!(settingsService.Settings | async).Client.Map.enabled"
|
||||||
[ngModel]="states.gpx">
|
[ngModel]="states.client.gpx">
|
||||||
</app-settings-entry>
|
</app-settings-entry>
|
||||||
|
|
||||||
|
<app-settings-entry
|
||||||
|
name="*.gpx compression"
|
||||||
|
description="Enables *.gpx file compression."
|
||||||
|
link="https://github.com/bpatrik/pigallery2/issues/504"
|
||||||
|
linkText="See 504."
|
||||||
|
i18n-description i18n-name
|
||||||
|
[disabled]="!(settingsService.Settings | async).Client.Map.enabled || !states.client.gpx.value"
|
||||||
|
[ngModel]="states.client.GPXCompressing.enabled">
|
||||||
|
</app-settings-entry>
|
||||||
|
|
||||||
|
<app-settings-entry
|
||||||
|
name="OnTheFly *.gpx compression"
|
||||||
|
description="Enables on the fly *.gpx compression."
|
||||||
|
i18n-description i18n-name
|
||||||
|
[simplifiedMode]="simplifiedMode"
|
||||||
|
[disabled]="!(settingsService.Settings | async).Client.Map.enabled || !states.client.GPXCompressing.enabled.value || !states.client.gpx.value"
|
||||||
|
[ngModel]="states.server.GPXCompressing.onTheFly">
|
||||||
|
</app-settings-entry>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
<app-settings-entry
|
<app-settings-entry
|
||||||
name="Markdown files"
|
name="Markdown files"
|
||||||
description="Reads *.md files in a directory and shows the next to the map."
|
description="Reads *.md files in a directory and shows the next to the map."
|
||||||
i18n-description i18n-name
|
i18n-description i18n-name
|
||||||
[ngModel]="states.markdown">
|
[ngModel]="states.client.markdown">
|
||||||
</app-settings-entry>
|
</app-settings-entry>
|
||||||
|
|
||||||
<app-settings-entry
|
<app-settings-entry
|
||||||
name="*.pg2conf files"
|
name="*.pg2conf files"
|
||||||
description="Reads *.pg2conf files (You can use it for custom sorting and save search (albums))."
|
description="Reads *.pg2conf files (You can use it for custom sorting and save search (albums))."
|
||||||
i18n-description i18n-name
|
i18n-description i18n-name
|
||||||
[ngModel]="states.pg2conf">
|
[ngModel]="states.client.pg2conf">
|
||||||
</app-settings-entry>
|
</app-settings-entry>
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,8 @@ import { SettingsComponentDirective } from '../_abstract/abstract.settings.compo
|
|||||||
import { AuthenticationService } from '../../../model/network/authentication.service';
|
import { AuthenticationService } from '../../../model/network/authentication.service';
|
||||||
import { NavigationService } from '../../../model/navigation.service';
|
import { NavigationService } from '../../../model/navigation.service';
|
||||||
import { NotificationService } from '../../../model/notification.service';
|
import { NotificationService } from '../../../model/notification.service';
|
||||||
import { ClientMetaFileConfig } from '../../../../../common/config/public/ClientConfig';
|
import {ClientMetaFileConfig, ClientPhotoConfig} from '../../../../../common/config/public/ClientConfig';
|
||||||
|
import {ServerMetaFileConfig, ServerPhotoConfig} from '../../../../../common/config/private/PrivateConfig';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-settings-meta-file',
|
selector: 'app-settings-meta-file',
|
||||||
@ -15,7 +16,10 @@ import { ClientMetaFileConfig } from '../../../../../common/config/public/Client
|
|||||||
],
|
],
|
||||||
providers: [MetaFileSettingsService],
|
providers: [MetaFileSettingsService],
|
||||||
})
|
})
|
||||||
export class MetaFileSettingsComponent extends SettingsComponentDirective<ClientMetaFileConfig> {
|
export class MetaFileSettingsComponent extends SettingsComponentDirective<{
|
||||||
|
server: ServerMetaFileConfig;
|
||||||
|
client: ClientMetaFileConfig;
|
||||||
|
}> {
|
||||||
constructor(
|
constructor(
|
||||||
authService: AuthenticationService,
|
authService: AuthenticationService,
|
||||||
navigation: NavigationService,
|
navigation: NavigationService,
|
||||||
@ -29,7 +33,10 @@ export class MetaFileSettingsComponent extends SettingsComponentDirective<Client
|
|||||||
navigation,
|
navigation,
|
||||||
settingsService,
|
settingsService,
|
||||||
notification,
|
notification,
|
||||||
(s) => s.Client.MetaFile
|
(s) => ({
|
||||||
|
client: s.Client.MetaFile,
|
||||||
|
server: s.Server.MetaFile,
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import { NetworkService } from '../../../model/network/network.service';
|
import {NetworkService} from '../../../model/network/network.service';
|
||||||
import { SettingsService } from '../settings.service';
|
import {SettingsService} from '../settings.service';
|
||||||
import { AbstractSettingsService } from '../_abstract/abstract.settings.service';
|
import {AbstractSettingsService} from '../_abstract/abstract.settings.service';
|
||||||
import { ClientMetaFileConfig } from '../../../../../common/config/public/ClientConfig';
|
import {ClientMetaFileConfig} from '../../../../../common/config/public/ClientConfig';
|
||||||
|
import {ServerMetaFileConfig} from '../../../../../common/config/private/PrivateConfig';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MetaFileSettingsService extends AbstractSettingsService<ClientMetaFileConfig> {
|
export class MetaFileSettingsService extends AbstractSettingsService<{
|
||||||
|
server: ServerMetaFileConfig;
|
||||||
|
client: ClientMetaFileConfig;
|
||||||
|
}> {
|
||||||
constructor(
|
constructor(
|
||||||
private networkService: NetworkService,
|
private networkService: NetworkService,
|
||||||
settingsService: SettingsService
|
settingsService: SettingsService
|
||||||
@ -21,7 +25,10 @@ export class MetaFileSettingsService extends AbstractSettingsService<ClientMetaF
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateSettings(settings: ClientMetaFileConfig): Promise<void> {
|
public updateSettings(settings: {
|
||||||
return this.networkService.putJson('/settings/metafile', { settings });
|
server: ServerMetaFileConfig;
|
||||||
|
client: ClientMetaFileConfig;
|
||||||
|
}): Promise<void> {
|
||||||
|
return this.networkService.putJson('/settings/metafile', {settings});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user