2016-05-11 03:33:58 +08:00
|
|
|
export enum DatabaseType{
|
2016-12-27 23:09:47 +08:00
|
|
|
memory = 0, mysql = 1
|
|
|
|
}
|
|
|
|
|
|
|
|
interface MySQLConfig {
|
|
|
|
host: string;
|
|
|
|
database: string;
|
|
|
|
username: string;
|
|
|
|
password: string;
|
|
|
|
}
|
|
|
|
interface DataBaseConfig {
|
|
|
|
type: DatabaseType;
|
|
|
|
mysql?: MySQLConfig;
|
2016-05-11 03:33:58 +08:00
|
|
|
}
|
2017-05-28 18:33:18 +08:00
|
|
|
interface ThumbnailConfig {
|
|
|
|
folder: string;
|
|
|
|
hardwareAcceleration: boolean;
|
|
|
|
}
|
2016-05-11 03:33:58 +08:00
|
|
|
|
|
|
|
interface ServerConfig {
|
2017-03-21 04:37:23 +08:00
|
|
|
port: number;
|
|
|
|
imagesFolder: string;
|
2017-05-28 18:33:18 +08:00
|
|
|
thumbnail: ThumbnailConfig;
|
2016-12-27 23:09:47 +08:00
|
|
|
database: DataBaseConfig;
|
2016-05-11 03:33:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
interface SearchConfig {
|
2017-03-21 04:37:23 +08:00
|
|
|
searchEnabled: boolean
|
|
|
|
instantSearchEnabled: boolean
|
|
|
|
autocompleteEnabled: boolean
|
2016-05-11 03:33:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
interface ClientConfig {
|
2017-03-21 04:37:23 +08:00
|
|
|
iconSize: number;
|
|
|
|
thumbnailSizes: Array<number>;
|
|
|
|
Search: SearchConfig;
|
|
|
|
concurrentThumbnailGenerations: number;
|
|
|
|
enableCache: boolean;
|
|
|
|
enableOnScrollRendering: boolean;
|
|
|
|
enableOnScrollThumbnailPrioritising: boolean;
|
|
|
|
authenticationRequired: boolean;
|
2017-01-23 05:31:29 +08:00
|
|
|
googleApiKey: string;
|
2016-05-11 03:33:58 +08:00
|
|
|
}
|
|
|
|
export class ConfigClass {
|
|
|
|
|
2017-03-21 04:37:23 +08:00
|
|
|
public Server: ServerConfig = null;
|
2016-05-11 03:33:58 +08:00
|
|
|
|
2017-03-21 04:37:23 +08:00
|
|
|
public Client: ClientConfig = {
|
2016-05-12 17:00:46 +08:00
|
|
|
thumbnailSizes: [200, 400, 600],
|
2017-03-21 04:37:23 +08:00
|
|
|
iconSize: 30,
|
2016-05-11 03:33:58 +08:00
|
|
|
Search: {
|
2016-12-28 18:50:05 +08:00
|
|
|
searchEnabled: true,
|
|
|
|
instantSearchEnabled: true,
|
|
|
|
autocompleteEnabled: true
|
2016-06-17 17:25:15 +08:00
|
|
|
},
|
2016-06-26 21:53:48 +08:00
|
|
|
concurrentThumbnailGenerations: 1,
|
|
|
|
enableCache: false,
|
|
|
|
enableOnScrollRendering: true,
|
2016-07-07 18:19:08 +08:00
|
|
|
enableOnScrollThumbnailPrioritising: true,
|
2017-01-23 05:31:29 +08:00
|
|
|
authenticationRequired: true,
|
|
|
|
googleApiKey: ""
|
2016-05-11 03:33:58 +08:00
|
|
|
};
|
|
|
|
|
2017-03-21 04:37:23 +08:00
|
|
|
public setDatabaseType(type: DatabaseType) {
|
2016-12-27 23:09:47 +08:00
|
|
|
this.Server.database.type = type;
|
2016-05-11 03:33:58 +08:00
|
|
|
if (type === DatabaseType.memory) {
|
|
|
|
this.Client.Search.searchEnabled = false;
|
|
|
|
this.Client.Search.instantSearchEnabled = false;
|
|
|
|
this.Client.Search.autocompleteEnabled = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|