diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 523a893..276e990 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -7,12 +7,14 @@ import { SubscriptionComponent } from './subscription/subscription/subscription. import { PostsService } from './posts.services'; import { LoginComponent } from './components/login/login.component'; import { DownloadsComponent } from './components/downloads/downloads.component'; +import { SettingsComponent } from './settings/settings.component'; const routes: Routes = [ { path: 'home', component: MainComponent, canActivate: [PostsService] }, { path: 'player', component: PlayerComponent, canActivate: [PostsService]}, { path: 'subscriptions', component: SubscriptionsComponent, canActivate: [PostsService] }, { path: 'subscription', component: SubscriptionComponent, canActivate: [PostsService] }, + { path: 'settings', component: SettingsComponent, canActivate: [PostsService] }, { path: 'login', component: LoginComponent }, { path: 'downloads', component: DownloadsComponent }, { path: '', redirectTo: '/home', pathMatch: 'full' } diff --git a/src/app/app.component.html b/src/app/app.component.html index 4d8f2a7..df61ad2 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -23,10 +23,10 @@ Dark - -
@@ -31,9 +28,14 @@
-
- -
+
+ + +
+
+ + +
\ No newline at end of file diff --git a/src/app/components/login/login.component.scss b/src/app/components/login/login.component.scss index fe190de..77377ac 100644 --- a/src/app/components/login/login.component.scss +++ b/src/app/components/login/login.component.scss @@ -1,6 +1,33 @@ .login-card { - max-width: 600px; + max-width: 400px; width: 80%; margin: 0 auto; margin-top: 20px; + padding-top: 8px; +} + +.login-div { + height: calc(100% - 170px); + overflow-y: auto; +} + +.login-button-div { + margin-bottom: 10px; + margin-top: 10px; + margin-left: -16px; + margin-right: -16px; + bottom: 0px; + width: 100%; + position: absolute; +} + +.login-button-div > button { + width: 100%; + border-radius: 0px 0px 4px 4px !important; +} + +.login-progress-bar { + position: absolute; + bottom: 0px; + border-radius: 0px 0px 4px 4px; } \ No newline at end of file diff --git a/src/app/components/logs-viewer/logs-viewer.component.html b/src/app/components/logs-viewer/logs-viewer.component.html index 1fa902a..e10cf2b 100644 --- a/src/app/components/logs-viewer/logs-viewer.component.html +++ b/src/app/components/logs-viewer/logs-viewer.component.html @@ -1,4 +1,4 @@ -
+
@@ -10,7 +10,7 @@ --> -
+
{{log.text}}
diff --git a/src/app/components/modify-users/modify-users.component.html b/src/app/components/modify-users/modify-users.component.html index cd054af..d985417 100644 --- a/src/app/components/modify-users/modify-users.component.html +++ b/src/app/components/modify-users/modify-users.component.html @@ -1,7 +1,7 @@
-
+
diff --git a/src/app/components/modify-users/modify-users.component.scss b/src/app/components/modify-users/modify-users.component.scss index d509a56..0a4d589 100644 --- a/src/app/components/modify-users/modify-users.component.scss +++ b/src/app/components/modify-users/modify-users.component.scss @@ -1,5 +1,4 @@ .edit-role { position: relative; top: -50px; - left: 35px; } \ No newline at end of file diff --git a/src/app/components/recent-videos/recent-videos.component.html b/src/app/components/recent-videos/recent-videos.component.html index 9b00952..254082c 100644 --- a/src/app/components/recent-videos/recent-videos.component.html +++ b/src/app/components/recent-videos/recent-videos.component.html @@ -28,7 +28,7 @@
-
+
diff --git a/src/app/main/main.component.css b/src/app/main/main.component.css index 8411370..e2325f2 100644 --- a/src/app/main/main.component.css +++ b/src/app/main/main.component.css @@ -133,12 +133,16 @@ mat-form-field.mat-form-field { top: -5px; } +.border-radius-both { + border-radius: 16px; +} + .no-border-radius-bottom { - border-radius: 4px 4px 0px 0px; + border-radius: 16px 16px 0px 0px; } .no-border-radius-top { - border-radius: 0px 0px 4px 4px; + border-radius: 0px 0px 16px 16px; } @media (max-width: 576px) { diff --git a/src/app/main/main.component.html b/src/app/main/main.component.html index 80fb3c2..b81e866 100644 --- a/src/app/main/main.component.html +++ b/src/app/main/main.component.html @@ -1,6 +1,6 @@
- +
diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts index c57e926..8e63fc7 100644 --- a/src/app/main/main.component.ts +++ b/src/app/main/main.component.ts @@ -230,7 +230,7 @@ export class MainComponent implements OnInit { async loadConfig() { // loading config this.fileManagerEnabled = this.postsService.config['Extra']['file_manager_enabled'] - && (!this.postsService.isLoggedIn || this.postsService.permissions.includes('filemanager')); + && this.postsService.hasPermission('filemanager'); this.downloadOnlyMode = this.postsService.config['Extra']['download_only_mode']; this.allowMultiDownloadMode = this.postsService.config['Extra']['allow_multi_download_mode']; this.audioFolderPath = this.postsService.config['Downloader']['path-audio']; @@ -242,7 +242,7 @@ export class MainComponent implements OnInit { this.youtubeAPIKey = this.youtubeSearchEnabled ? this.postsService.config['API']['youtube_API_key'] : null; this.allowQualitySelect = this.postsService.config['Extra']['allow_quality_select']; this.allowAdvancedDownload = this.postsService.config['Advanced']['allow_advanced_download'] - && (!this.postsService.isLoggedIn || this.postsService.permissions.includes('advanced_download')); + && this.postsService.hasPermission('advanced_download'); this.useDefaultDownloadingAgent = this.postsService.config['Advanced']['use_default_downloading_agent']; this.customDownloadingAgent = this.postsService.config['Advanced']['custom_downloading_agent']; diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts index f951227..1bfd190 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -511,6 +511,12 @@ export class PostsService implements CanActivate { this.resetHttpParams(); } + hasPermission(permission) { + // assume not logged in users never have permission + if (this.config.Advanced.multi_user_mode && !this.isLoggedIn) return false; + return this.config.Advanced.multi_user_mode ? this.permissions.includes(permission) : true; + } + // user methods register(username, password) { const call = this.http.post(this.path + 'auth/register', {userid: username, diff --git a/src/app/settings/settings.component.html b/src/app/settings/settings.component.html index d08842b..618270c 100644 --- a/src/app/settings/settings.component.html +++ b/src/app/settings/settings.component.html @@ -1,13 +1,12 @@ -

Settings

+

Settings

- - + @@ -391,7 +390,7 @@
-
+
@@ -401,8 +400,7 @@ - -
+
Allow user registration
@@ -446,25 +444,23 @@
- +
-
+
- - -
- - -
-
+
+ + +
+ diff --git a/src/app/settings/settings.component.scss b/src/app/settings/settings.component.scss index 59c58af..f702e64 100644 --- a/src/app/settings/settings.component.scss +++ b/src/app/settings/settings.component.scss @@ -2,6 +2,15 @@ margin-bottom: 20px; } +.settings-title { + text-align: center; + margin-top: 15px; +} + +::ng-deep .mat-tab-body { + margin-left: 15px; +} + .ext-divider { margin-bottom: 14px; } @@ -90,4 +99,9 @@ .transfer-db-div { margin-bottom: 10px; +} + +.action-buttons { + position: absolute; + bottom: 15px; } \ No newline at end of file diff --git a/src/app/settings/settings.component.ts b/src/app/settings/settings.component.ts index d2d43e9..483c4db 100644 --- a/src/app/settings/settings.component.ts +++ b/src/app/settings/settings.component.ts @@ -51,8 +51,17 @@ export class SettingsComponent implements OnInit { private dialog: MatDialog) { } ngOnInit() { - this.getConfig(); - this.getDBInfo(); + if (this.postsService.initialized) { + this.getConfig(); + this.getDBInfo(); + } else { + this.postsService.service_initialized.subscribe(init => { + if (init) { + this.getConfig(); + this.getDBInfo(); + } + }); + } this.generated_bookmarklet_code = this.sanitizer.bypassSecurityTrustUrl(this.generateBookmarkletCode()); @@ -85,6 +94,10 @@ export class SettingsComponent implements OnInit { }) } + cancelSettings() { + this.new_config = JSON.parse(JSON.stringify(this.initial_config)); + } + dropCategory(event: CdkDragDrop) { moveItemInArray(this.postsService.categories, event.previousIndex, event.currentIndex); this.postsService.updateCategories(this.postsService.categories).subscribe(res => { diff --git a/src/styles.scss b/src/styles.scss index 41ef9ea..be060c8 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -42,6 +42,10 @@ $dark-theme: mat-dark-theme($dark-primary, $dark-accent, $dark-warn); @include angular-material-theme($dark-theme); } +.mat-stroked-button, .mat-raised-button, .mat-flat-button { + border-radius: 24px !important +} + // Light theme $light-primary: mat-palette($mat-grey, 200, 500, 300); $light-accent: mat-palette($mat-brown, 200); @@ -50,7 +54,7 @@ $light-warn: mat-palette($mat-deep-orange, 200); $light-theme: mat-light-theme($light-primary, $light-accent, $light-warn); .light-theme { - @include angular-material-theme($light-theme) + @include angular-material-theme($light-theme); } .no-outline {