Organize code some more
This commit is contained in:
@@ -1,84 +0,0 @@
|
||||
import {Routes} from '@angular/router';
|
||||
import {BookBrowserComponent} from '../features/book/components/book-browser/book-browser.component';
|
||||
import {AppLayoutComponent} from '../shared/layout/component/layout-main/app.layout.component';
|
||||
import {LoginComponent} from '../shared/components/login/login.component';
|
||||
import {AuthGuard} from './auth.guard';
|
||||
import {SettingsComponent} from '../features/settings/settings.component';
|
||||
import {ChangePasswordComponent} from '../shared/components/change-password/change-password.component';
|
||||
import {BookMetadataCenterComponent} from '../features/metadata/component/book-metadata-center/book-metadata-center.component';
|
||||
import {SetupComponent} from '../shared/components/setup/setup.component';
|
||||
import {SetupGuard} from '../shared/components/setup/setup.guard';
|
||||
import {SetupRedirectGuard} from '../shared/components/setup/setup-redirect.guard';
|
||||
import {EmptyComponent} from '../shared/components/empty/empty.component';
|
||||
import {LoginGuard} from '../shared/components/setup/ login.guard';
|
||||
import {OidcCallbackComponent} from './security/oidc-callback/oidc-callback.component';
|
||||
import {CbxReaderComponent} from '../features/readers/cbx-reader/cbx-reader.component';
|
||||
import {MainDashboardComponent} from '../features/dashboard/components/main-dashboard/main-dashboard.component';
|
||||
import {SeriesPageComponent} from '../features/book/components/series-page/series-page.component';
|
||||
import {MetadataManagerComponent} from '../features/metadata/component/metadata-manager/metadata-manager.component';
|
||||
import {StatsComponent} from '../features/stats/component/stats-component';
|
||||
import {EpubReaderComponent} from '../features/readers/epub-reader/component/epub-reader.component';
|
||||
import {PdfReaderComponent} from '../features/readers/pdf-reader/pdf-reader.component';
|
||||
import {BookdropFileReviewComponent} from '../features/bookdrop/component/bookdrop-file-review/bookdrop-file-review.component';
|
||||
|
||||
export const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
canActivate: [SetupRedirectGuard],
|
||||
pathMatch: 'full',
|
||||
component: EmptyComponent
|
||||
},
|
||||
{
|
||||
path: 'setup',
|
||||
component: SetupComponent,
|
||||
canActivate: [SetupGuard]
|
||||
},
|
||||
{path: 'oauth2-callback', component: OidcCallbackComponent},
|
||||
{
|
||||
path: '',
|
||||
component: AppLayoutComponent,
|
||||
children: [
|
||||
{path: 'dashboard', component: MainDashboardComponent, canActivate: [AuthGuard]},
|
||||
{path: 'all-books', component: BookBrowserComponent, canActivate: [AuthGuard]},
|
||||
{path: 'settings', component: SettingsComponent, canActivate: [AuthGuard]},
|
||||
{path: 'library/:libraryId/books', component: BookBrowserComponent, canActivate: [AuthGuard]},
|
||||
{path: 'shelf/:shelfId/books', component: BookBrowserComponent, canActivate: [AuthGuard]},
|
||||
{path: 'unshelved-books', component: BookBrowserComponent, canActivate: [AuthGuard]},
|
||||
{path: 'series/:seriesName', component: SeriesPageComponent, canActivate: [AuthGuard]},
|
||||
{path: 'magic-shelf/:magicShelfId/books', component: BookBrowserComponent, canActivate: [AuthGuard]},
|
||||
{path: 'book/:bookId', component: BookMetadataCenterComponent, canActivate: [AuthGuard]},
|
||||
{path: 'bookdrop', component: BookdropFileReviewComponent, canActivate: [AuthGuard]},
|
||||
{path: 'metadata-manager', component: MetadataManagerComponent, canActivate: [AuthGuard]},
|
||||
{path: 'stats', component: StatsComponent, canActivate: [AuthGuard]},
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'pdf-reader/book/:bookId',
|
||||
component: PdfReaderComponent,
|
||||
canActivate: [AuthGuard]
|
||||
},
|
||||
{
|
||||
path: 'epub-reader/book/:bookId',
|
||||
component: EpubReaderComponent,
|
||||
canActivate: [AuthGuard]
|
||||
},
|
||||
{
|
||||
path: 'cbx-reader/book/:bookId',
|
||||
component: CbxReaderComponent,
|
||||
canActivate: [AuthGuard]
|
||||
},
|
||||
{
|
||||
path: 'login',
|
||||
component: LoginComponent,
|
||||
canActivate: [LoginGuard]
|
||||
},
|
||||
{
|
||||
path: 'change-password',
|
||||
component: ChangePasswordComponent
|
||||
},
|
||||
{
|
||||
path: '**',
|
||||
redirectTo: 'login',
|
||||
pathMatch: 'full'
|
||||
}
|
||||
];
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
import {inject} from '@angular/core';
|
||||
import {OAuthService} from 'angular-oauth2-oidc';
|
||||
import {AuthService, websocketInitializer} from '../shared/service/auth.service';
|
||||
import {AppSettingsService} from '../shared/service/app-settings.service';
|
||||
import {AuthInitializationService} from './service/auth-initialization-service';
|
||||
import {AuthService, websocketInitializer} from '../../shared/service/auth.service';
|
||||
import {AppSettingsService} from '../../shared/service/app-settings.service';
|
||||
import {AuthInitializationService} from './auth-initialization-service';
|
||||
|
||||
const OIDC_BYPASS_KEY = 'booklore-oidc-bypass';
|
||||
const OIDC_ERROR_COUNT_KEY = 'booklore-oidc-error-count';
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { CanActivateFn } from '@angular/router';
|
||||
import { Router } from '@angular/router';
|
||||
import {AuthService} from '../shared/service/auth.service';
|
||||
import {AuthService} from '../../shared/service/auth.service';
|
||||
import {OAuthService} from 'angular-oauth2-oidc';
|
||||
|
||||
export const AuthGuard: CanActivateFn = (route, state) => {
|
||||
@@ -1,80 +0,0 @@
|
||||
import {inject, Injectable} from '@angular/core';
|
||||
import {DialogService, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {GithubSupportDialog} from '../../shared/components/github-support-dialog/github-support-dialog';
|
||||
import {LibraryCreatorComponent} from '../../features/library-creator/library-creator.component';
|
||||
import {BookUploaderComponent} from '../../shared/components/book-uploader/book-uploader.component';
|
||||
import {UserProfileDialogComponent} from '../../features/settings/user-profile-dialog/user-profile-dialog.component';
|
||||
import {MagicShelfComponent} from '../../features/magic-shelf/component/magic-shelf-component';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class DialogLauncherService {
|
||||
|
||||
dialogService = inject(DialogService);
|
||||
|
||||
open(options: { component: any; header: string; top?: string; width?: string }): DynamicDialogRef {
|
||||
const isMobile = window.innerWidth <= 768;
|
||||
const {component, header, top, width} = options;
|
||||
return this.dialogService.open(component, {
|
||||
header,
|
||||
modal: true,
|
||||
closable: true,
|
||||
contentStyle: {
|
||||
overflowY: 'hidden',
|
||||
},
|
||||
style: {
|
||||
position: 'absolute',
|
||||
...(top ? {top} : {}),
|
||||
...(isMobile
|
||||
? {
|
||||
width: '90vw',
|
||||
maxWidth: '90vw',
|
||||
minWidth: '90vw',
|
||||
}
|
||||
: width
|
||||
? {width}
|
||||
: {}),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
openGithubSupportDialog(): void {
|
||||
this.open({
|
||||
component: GithubSupportDialog,
|
||||
header: 'Support Booklore',
|
||||
top: '15%'
|
||||
});
|
||||
}
|
||||
|
||||
openLibraryCreatorDialog(): void {
|
||||
this.open({
|
||||
component: LibraryCreatorComponent,
|
||||
header: 'Create New Library',
|
||||
top: '15%'
|
||||
});
|
||||
}
|
||||
|
||||
openFileUploadDialog(): void {
|
||||
this.open({
|
||||
component: BookUploaderComponent,
|
||||
header: 'Book Uploader',
|
||||
top: '10%'
|
||||
});
|
||||
}
|
||||
|
||||
openUserProfileDialog(): void {
|
||||
this.open({
|
||||
component: UserProfileDialogComponent,
|
||||
header: 'User Profile Information',
|
||||
top: '10%'
|
||||
});
|
||||
}
|
||||
|
||||
openMagicShelfDialog(): void {
|
||||
this.open({
|
||||
component: MagicShelfComponent,
|
||||
header: 'Magic Shelf Creator'
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user