1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/src/frontend/app/app.module.ts

315 lines
14 KiB
TypeScript
Raw Normal View History

2022-04-05 01:37:31 +08:00
import { Injectable, NgModule } from '@angular/core';
import {
BrowserModule,
HAMMER_GESTURE_CONFIG,
HammerGestureConfig,
HammerModule,
} from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { UserService } from './model/network/user.service';
import { ContentService } from './ui/gallery/content.service';
import { NetworkService } from './model/network/network.service';
import { GalleryCacheService } from './ui/gallery/cache.gallery.service';
import { FullScreenService } from './ui/gallery/fullscreen.service';
import { AuthenticationService } from './model/network/authentication.service';
import { UserMangerSettingsComponent } from './ui/settings/usermanager/usermanager.settings.component';
import { FrameComponent } from './ui/frame/frame.component';
import { LeafletModule } from '@asymmetrik/ngx-leaflet';
import { LoadingBarModule } from '@ngx-loading-bar/core';
import { GalleryLightboxMediaComponent } from './ui/gallery/lightbox/media/media.lightbox.gallery.component';
import { GalleryPhotoLoadingComponent } from './ui/gallery/grid/photo/loading/loading.photo.grid.gallery.component';
import { GalleryNavigatorComponent } from './ui/gallery/navigator/navigator.gallery.component';
import { GallerySearchComponent } from './ui/gallery/search/search.gallery.component';
import { GalleryLightboxComponent } from './ui/gallery/lightbox/lightbox.gallery.component';
import { GalleryDirectoryComponent } from './ui/gallery/directories/directory/directory.gallery.component';
import { GalleryGridComponent } from './ui/gallery/grid/grid.gallery.component';
import { GalleryPhotoComponent } from './ui/gallery/grid/photo/photo.grid.gallery.component';
import { LoginComponent } from './ui/login/login.component';
import { AdminComponent } from './ui/admin/admin.component';
import { GalleryComponent } from './ui/gallery/gallery.component';
import { StringifyRole } from './pipes/StringifyRolePipe';
import { GPXFilesFilterPipe } from './pipes/GPXFilesFilterPipe';
import { GalleryMapComponent } from './ui/gallery/map/map.gallery.component';
import { GalleryMapLightboxComponent } from './ui/gallery/map/lightbox/lightbox.map.gallery.component';
import { ThumbnailManagerService } from './ui/gallery/thumbnailManager.service';
import { OverlayService } from './ui/gallery/overlay.service';
import { GalleryShareComponent } from './ui/gallery/share/share.gallery.component';
import { ShareLoginComponent } from './ui/sharelogin/share-login.component';
import { ShareService } from './ui/gallery/share.service';
import { ModalModule } from 'ngx-bootstrap/modal';
import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';
import { DatabaseSettingsComponent } from './ui/settings/database/database.settings.component';
import { ToastrModule } from 'ngx-toastr';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NotificationService } from './model/notification.service';
import { JwBootstrapSwitchNg2Module } from 'jw-bootstrap-switch-ng2';
import { ClipboardModule } from 'ngx-clipboard';
import { NavigationService } from './model/navigation.service';
import { InfoPanelLightboxComponent } from './ui/gallery/lightbox/infopanel/info-panel.lightbox.gallery.component';
import { MapSettingsComponent } from './ui/settings/map/map.settings.component';
import { TooltipModule } from 'ngx-bootstrap/tooltip';
import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
import { CollapseModule } from 'ngx-bootstrap/collapse';
import { PopoverModule } from 'ngx-bootstrap/popover';
import { ThumbnailSettingsComponent } from './ui/settings/thumbnail/thumbnail.settings.component';
import { SearchSettingsComponent } from './ui/settings/search/search.settings.component';
import { SettingsService } from './ui/settings/settings.service';
import { ShareSettingsComponent } from './ui/settings/share/share.settings.component';
import { BasicSettingsComponent } from './ui/settings/basic/basic.settings.component';
import { OtherSettingsComponent } from './ui/settings/other/other.settings.component';
import {
HTTP_INTERCEPTORS,
HttpClient,
HttpClientModule,
} from '@angular/common/http';
import { DefaultUrlSerializer, UrlSerializer, UrlTree } from '@angular/router';
import { IndexingSettingsComponent } from './ui/settings/indexing/indexing.settings.component';
import { LanguageComponent } from './ui/language/language.component';
import { QueryService } from './model/query.service';
import { IconizeSortingMethod } from './pipes/IconizeSortingMethod';
import { StringifySortingMethod } from './pipes/StringifySortingMethod';
import { RandomQueryBuilderGalleryComponent } from './ui/gallery/random-query-builder/random-query-builder.gallery.component';
import { RandomPhotoSettingsComponent } from './ui/settings/random-photo/random-photo.settings.component';
import { VideoSettingsComponent } from './ui/settings/video/video.settings.component';
import { DurationPipe } from './pipes/DurationPipe';
import { MapService } from './ui/gallery/map/map.service';
import { MetaFileSettingsComponent } from './ui/settings/metafiles/metafile.settings.component';
import { ThumbnailLoaderService } from './ui/gallery/thumbnailLoader.service';
import { FileSizePipe } from './pipes/FileSizePipe';
import { DuplicateService } from './ui/duplicates/duplicates.service';
import { DuplicateComponent } from './ui/duplicates/duplicates.component';
import { DuplicatesPhotoComponent } from './ui/duplicates/photo/photo.duplicates.component';
import { SeededRandomService } from './model/seededRandom.service';
import { FacesComponent } from './ui/faces/faces.component';
import { FacesService } from './ui/faces/faces.service';
import { FaceComponent } from './ui/faces/face/face.component';
import { VersionService } from './model/version.service';
import { DirectoriesComponent } from './ui/gallery/directories/directories.component';
import { ControlsLightboxComponent } from './ui/gallery/lightbox/controls/controls.lightbox.gallery.component';
import { FacesSettingsComponent } from './ui/settings/faces/faces.settings.component';
import { TimepickerModule } from 'ngx-bootstrap/timepicker';
import { TimeStampDatePickerComponent } from './ui/utils/timestamp-datepicker/datepicker.component';
import { TimeStampTimePickerComponent } from './ui/utils/timestamp-timepicker/timepicker.component';
import { PhotoSettingsComponent } from './ui/settings/photo/photo.settings.component';
import { JobProgressComponent } from './ui/settings/jobs/progress/job-progress.settings.component';
import { JobsSettingsComponent } from './ui/settings/jobs/jobs.settings.component';
import { ScheduledJobsService } from './ui/settings/scheduled-jobs.service';
import { BackendtextService } from './model/backendtext.service';
import { JobButtonComponent } from './ui/settings/jobs/button/job-button.settings.component';
import { ErrorInterceptor } from './model/network/helper/error.interceptor';
import { CSRFInterceptor } from './model/network/helper/csrf.interceptor';
import { SettingsEntryComponent } from './ui/settings/_abstract/settings-entry/settings-entry.component';
import { GallerySearchQueryEntryComponent } from './ui/gallery/search/query-enrty/query-entry.search.gallery.component';
import { StringifySearchQuery } from './pipes/StringifySearchQuery';
import { AutoCompleteService } from './ui/gallery/search/autocomplete.service';
import { SearchQueryParserService } from './ui/gallery/search/search-query-parser.service';
import { GallerySearchFieldBaseComponent } from './ui/gallery/search/search-field-base/search-field-base.gallery.component';
import { AppRoutingModule } from './app.routing';
import { CookieService } from 'ngx-cookie-service';
import { LeafletMarkerClusterModule } from '@asymmetrik/ngx-leaflet-markercluster';
import { icon, Marker } from 'leaflet';
import { AlbumsComponent } from './ui/albums/albums.component';
import { AlbumComponent } from './ui/albums/album/album.component';
import { AlbumsService } from './ui/albums/albums.service';
import { GallerySearchQueryBuilderComponent } from './ui/gallery/search/query-builder/query-bulder.gallery.component';
import { SavedSearchPopupComponent } from './ui/albums/saved-search-popup/saved-search-popup.component';
import { AlbumsSettingsComponent } from './ui/settings/albums/albums.settings.component';
import { MarkdownModule } from 'ngx-markdown';
import { GalleryBlogComponent } from './ui/gallery/blog/blog.gallery.component';
import { MDFilesFilterPipe } from './pipes/MDFilesFilterPipe';
import { FileDTOToPathPipe } from './pipes/FileDTOToPathPipe';
import { BlogService } from './ui/gallery/blog/blog.service';
import { PhotoFilterPipe } from './pipes/PhotoFilterPipe';
import { PreviewSettingsComponent } from './ui/settings/preview/preview.settings.component';
import { GallerySearchFieldComponent } from './ui/gallery/search/search-field/search-field.gallery.component';
import { GalleryFilterComponent } from './ui/gallery/filter/filter.gallery.component';
import { GallerySortingService } from './ui/gallery/navigator/sorting.service';
import { FilterService } from './ui/gallery/filter/filter.service';
2016-12-27 06:36:38 +08:00
2018-05-08 03:42:32 +08:00
@Injectable()
2017-07-18 00:30:16 +08:00
export class MyHammerConfig extends HammerGestureConfig {
2018-12-18 07:06:25 +08:00
events: string[] = ['pinch'];
overrides = {
2022-04-05 01:37:31 +08:00
pan: { threshold: 1 },
swipe: { direction: 31 }, // enable swipe up
pinch: { enable: true },
2018-03-31 03:30:30 +08:00
};
2017-07-18 00:30:16 +08:00
}
2018-12-09 01:17:33 +08:00
export class CustomUrlSerializer implements UrlSerializer {
2022-04-05 01:37:31 +08:00
private defaultUrlSerializer: DefaultUrlSerializer =
new DefaultUrlSerializer();
2017-07-19 00:26:24 +08:00
parse(url: string): UrlTree {
// Encode parentheses
url = url.replace(/\(/g, '%28').replace(/\)/g, '%29');
// Use the default serializer.
return this.defaultUrlSerializer.parse(url);
2017-07-19 00:26:24 +08:00
}
serialize(tree: UrlTree): string {
2022-04-05 01:37:31 +08:00
return this.defaultUrlSerializer
.serialize(tree)
.replace(/%28/g, '(')
.replace(/%29/g, ')');
2017-07-19 00:26:24 +08:00
}
}
2021-05-02 01:35:18 +08:00
// Fixes Leaflet icon path issue:
// https://stackoverflow.com/questions/41144319/leaflet-marker-not-found-production-env
const iconRetinaUrl = 'assets/marker-icon-2x.png';
const iconUrl = 'assets/marker-icon.png';
const shadowUrl = 'assets/marker-shadow.png';
const iconDefault = icon({
iconRetinaUrl,
iconUrl,
shadowUrl,
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
tooltipAnchor: [16, -28],
2022-04-05 01:37:31 +08:00
shadowSize: [41, 41],
2021-05-02 01:35:18 +08:00
});
Marker.prototype.options.icon = iconDefault;
2016-12-27 06:36:38 +08:00
@NgModule({
imports: [
BrowserModule,
HammerModule,
FormsModule,
2018-03-31 03:30:30 +08:00
HttpClientModule,
2017-07-08 18:43:42 +08:00
BrowserAnimationsModule,
AppRoutingModule,
2017-07-09 18:03:17 +08:00
ClipboardModule,
JwBootstrapSwitchNg2Module,
2017-07-15 18:47:11 +08:00
TooltipModule.forRoot(),
2018-05-23 08:27:07 +08:00
ToastrModule.forRoot(),
2017-07-08 18:43:42 +08:00
ModalModule.forRoot(),
2018-05-14 04:59:57 +08:00
CollapseModule.forRoot(),
2019-01-18 07:26:20 +08:00
PopoverModule.forRoot(),
BsDropdownModule.forRoot(),
BsDatepickerModule.forRoot(),
TimepickerModule.forRoot(),
2021-04-26 01:07:02 +08:00
LoadingBarModule,
2021-05-01 05:40:32 +08:00
LeafletModule,
2022-01-01 01:50:21 +08:00
LeafletMarkerClusterModule,
2022-04-05 01:37:31 +08:00
MarkdownModule.forRoot({ loader: HttpClient }),
],
2022-04-05 01:37:31 +08:00
declarations: [
AppComponent,
LoginComponent,
2017-07-04 01:17:49 +08:00
ShareLoginComponent,
GalleryComponent,
2019-02-15 07:25:55 +08:00
FacesComponent,
2018-03-31 03:30:30 +08:00
// misc
FrameComponent,
LanguageComponent,
2019-08-20 18:54:45 +08:00
TimeStampDatePickerComponent,
TimeStampTimePickerComponent,
2021-05-29 03:01:59 +08:00
// Albums
AlbumsComponent,
AlbumComponent,
SavedSearchPopupComponent,
2018-03-31 03:30:30 +08:00
// Gallery
GalleryLightboxMediaComponent,
GalleryPhotoLoadingComponent,
GalleryGridComponent,
GalleryDirectoryComponent,
GalleryLightboxComponent,
2022-01-01 01:50:21 +08:00
GalleryBlogComponent,
GalleryMapComponent,
GalleryMapLightboxComponent,
FrameComponent,
GallerySearchComponent,
GallerySearchQueryEntryComponent,
GallerySearchFieldBaseComponent,
2021-03-27 03:57:13 +08:00
GallerySearchFieldComponent,
GallerySearchQueryBuilderComponent,
2017-07-04 01:17:49 +08:00
GalleryShareComponent,
GalleryNavigatorComponent,
GalleryFilterComponent,
GalleryPhotoComponent,
2017-07-08 18:43:42 +08:00
AdminComponent,
InfoPanelLightboxComponent,
2019-07-15 01:31:34 +08:00
ControlsLightboxComponent,
RandomQueryBuilderGalleryComponent,
2019-07-28 04:56:12 +08:00
DirectoriesComponent,
2019-02-15 07:25:55 +08:00
// Face
FaceComponent,
2019-07-28 04:56:12 +08:00
// Duplicates
DuplicateComponent,
DuplicatesPhotoComponent,
2018-03-31 03:30:30 +08:00
// Settings
2020-02-05 02:37:47 +08:00
SettingsEntryComponent,
2017-07-08 18:43:42 +08:00
UserMangerSettingsComponent,
DatabaseSettingsComponent,
2017-07-14 05:39:09 +08:00
MapSettingsComponent,
2017-07-15 18:47:11 +08:00
ThumbnailSettingsComponent,
2018-11-19 03:26:29 +08:00
VideoSettingsComponent,
2019-12-15 21:40:31 +08:00
PhotoSettingsComponent,
2018-12-02 06:53:35 +08:00
MetaFileSettingsComponent,
2017-07-15 20:27:12 +08:00
SearchSettingsComponent,
2017-07-15 21:29:04 +08:00
ShareSettingsComponent,
RandomPhotoSettingsComponent,
2017-07-15 22:09:48 +08:00
BasicSettingsComponent,
2019-07-21 22:39:52 +08:00
FacesSettingsComponent,
AlbumsSettingsComponent,
2017-07-15 22:31:43 +08:00
OtherSettingsComponent,
2017-07-26 03:09:37 +08:00
IndexingSettingsComponent,
2019-12-24 19:22:25 +08:00
JobProgressComponent,
JobsSettingsComponent,
2019-12-30 22:49:56 +08:00
JobButtonComponent,
PreviewSettingsComponent,
2019-12-30 22:49:56 +08:00
2019-07-28 04:56:12 +08:00
// Pipes
2018-05-29 02:03:12 +08:00
StringifyRole,
IconizeSortingMethod,
2018-11-02 17:40:09 +08:00
StringifySortingMethod,
2018-12-10 06:25:39 +08:00
DurationPipe,
FileSizePipe,
GPXFilesFilterPipe,
2022-01-01 01:50:21 +08:00
MDFilesFilterPipe,
StringifySearchQuery,
2022-01-14 05:41:30 +08:00
FileDTOToPathPipe,
2022-04-05 01:37:31 +08:00
PhotoFilterPipe,
2018-11-02 17:40:09 +08:00
],
providers: [
2022-04-05 01:37:31 +08:00
{ provide: HTTP_INTERCEPTORS, useClass: CSRFInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true },
{ provide: UrlSerializer, useClass: CustomUrlSerializer },
{ provide: HAMMER_GESTURE_CONFIG, useClass: MyHammerConfig },
2020-02-05 02:37:47 +08:00
StringifySortingMethod,
NetworkService,
2017-07-04 01:17:49 +08:00
ShareService,
UserService,
2021-05-29 03:01:59 +08:00
AlbumsService,
GalleryCacheService,
2022-02-17 05:17:38 +08:00
ContentService,
FilterService,
GallerySortingService,
2018-11-26 07:26:29 +08:00
MapService,
2022-01-01 01:50:21 +08:00
BlogService,
2021-03-20 21:37:56 +08:00
SearchQueryParserService,
AutoCompleteService,
AuthenticationService,
ThumbnailLoaderService,
ThumbnailManagerService,
2017-07-08 18:43:42 +08:00
NotificationService,
FullScreenService,
2017-07-09 18:03:17 +08:00
NavigationService,
2017-07-15 20:27:12 +08:00
SettingsService,
2019-01-28 06:27:41 +08:00
SeededRandomService,
2018-03-30 08:30:23 +08:00
OverlayService,
QueryService,
2019-01-18 07:26:20 +08:00
DuplicateService,
2019-02-15 07:25:55 +08:00
FacesService,
VersionService,
2019-12-24 19:22:25 +08:00
ScheduledJobsService,
BackendtextService,
2022-04-05 01:37:31 +08:00
CookieService,
2018-03-30 08:30:23 +08:00
],
2022-04-05 01:37:31 +08:00
bootstrap: [AppComponent],
2016-12-27 06:36:38 +08:00
})
2022-04-05 01:37:31 +08:00
export class AppModule {}