1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/common/config/public/ConfigClass.ts

140 lines
3.1 KiB
TypeScript
Raw Normal View History

2018-05-29 02:03:12 +08:00
import {SortingMethods} from '../../entities/SortingMethods';
import {UserRoles} from '../../entities/UserDTO';
2018-05-29 02:03:12 +08:00
2017-07-15 18:47:11 +08:00
export module ClientConfig {
export enum MapProviders {
OpenStreetMap, Custom
}
2017-07-15 18:47:11 +08:00
export interface SearchConfig {
enabled: boolean;
instantSearchEnabled: boolean;
autocompleteEnabled: boolean;
2017-07-22 01:33:24 +08:00
InstantSearchTimeout: number;
2017-07-30 05:39:06 +08:00
autocompleteCacheTimeout: number;
2017-07-30 15:06:12 +08:00
instantSearchCacheTimeout: number;
searchCacheTimeout: number;
2017-07-15 18:47:11 +08:00
}
2017-07-15 18:47:11 +08:00
export interface SharingConfig {
enabled: boolean;
passwordProtected: boolean;
}
2017-07-04 01:17:49 +08:00
export interface RandomPhotoConfig {
enabled: boolean;
}
2017-07-15 18:47:11 +08:00
export interface MapConfig {
enabled: boolean;
mapProvider: MapProviders;
tileUrl: string;
2017-07-15 18:47:11 +08:00
}
2017-07-30 05:39:06 +08:00
2017-07-15 18:47:11 +08:00
export interface ThumbnailConfig {
iconSize: number;
thumbnailSizes: Array<number>;
concurrentThumbnailGenerations: number;
}
export interface NavBarConfig {
showItemCount: boolean;
}
export interface OtherConfig {
enableCache: boolean;
enableOnScrollRendering: boolean;
defaultPhotoSortingMethod: SortingMethods;
enableOnScrollThumbnailPrioritising: boolean;
NavBar: NavBarConfig;
captionFirstNaming: boolean; // shows the caption instead of the filename in the phot grid
2017-07-15 18:47:11 +08:00
}
2017-07-14 05:39:09 +08:00
2018-11-19 03:26:29 +08:00
export interface VideoConfig {
enabled: boolean;
}
2018-12-01 00:19:37 +08:00
export interface MetaFileConfig {
enabled: boolean;
}
2018-11-19 03:26:29 +08:00
2017-07-15 18:47:11 +08:00
export interface Config {
applicationTitle: string;
publicUrl: string;
urlBase: string;
2017-07-15 18:47:11 +08:00
Thumbnail: ThumbnailConfig;
Search: SearchConfig;
Sharing: SharingConfig;
Map: MapConfig;
RandomPhoto: RandomPhotoConfig;
Other: OtherConfig;
2017-07-15 18:47:11 +08:00
authenticationRequired: boolean;
unAuthenticatedUserRole: UserRoles;
languages: string[];
2018-11-19 03:26:29 +08:00
Video: VideoConfig;
2018-12-01 00:19:37 +08:00
MetaFile: MetaFileConfig;
2017-07-15 18:47:11 +08:00
}
2017-07-15 18:47:11 +08:00
}
2017-07-30 05:39:06 +08:00
2017-06-04 21:25:08 +08:00
/**
* These configuration will be available at frontend and backend too
*/
export class PublicConfigClass {
2017-07-15 18:47:11 +08:00
public Client: ClientConfig.Config = {
applicationTitle: 'PiGallery 2',
2017-07-15 18:47:11 +08:00
Thumbnail: {
concurrentThumbnailGenerations: 1,
2017-07-15 18:47:11 +08:00
thumbnailSizes: [200, 400, 600],
iconSize: 30
},
Search: {
2017-07-14 05:39:09 +08:00
enabled: true,
instantSearchEnabled: true,
2017-07-22 01:33:24 +08:00
autocompleteEnabled: true,
2017-07-30 05:39:06 +08:00
InstantSearchTimeout: 3000,
2017-07-30 15:06:12 +08:00
autocompleteCacheTimeout: 1000 * 60 * 60,
searchCacheTimeout: 1000 * 60 * 60,
instantSearchCacheTimeout: 1000 * 60 * 60
},
2017-07-04 01:17:49 +08:00
Sharing: {
enabled: true,
passwordProtected: true
},
2017-07-14 05:39:09 +08:00
Map: {
enabled: true,
mapProvider: ClientConfig.MapProviders.OpenStreetMap,
tileUrl: ''
2017-07-14 05:39:09 +08:00
},
RandomPhoto: {
enabled: true
},
2018-11-19 03:26:29 +08:00
Video: {
enabled: true
},
2018-12-01 00:19:37 +08:00
MetaFile: {
enabled: true
},
Other: {
captionFirstNaming: false,
enableCache: true,
enableOnScrollRendering: true,
enableOnScrollThumbnailPrioritising: true,
defaultPhotoSortingMethod: SortingMethods.ascDate,
NavBar: {
showItemCount: true
}
},
authenticationRequired: true,
unAuthenticatedUserRole: UserRoles.Admin,
publicUrl: '',
urlBase: '',
languages: []
};
}