From f947d852f096a0c35cbbf3b7de711e8c143883e3 Mon Sep 17 00:00:00 2001 From: Maarten Heebink Date: Tue, 4 Jan 2022 00:34:27 +0100 Subject: [PATCH 01/11] Added custom favicon --- .../Settings/Models/CustomizationSettings.cs | 1 + src/Ombi/ClientApp/src/app/app.component.ts | 13 +- .../ClientApp/src/app/interfaces/ISettings.ts | 3 +- .../customization.component.html | 137 ++++++++++-------- src/Ombi/ClientApp/src/index.html | 4 +- src/Ombi/Views/Shared/_Layout.cshtml | 6 + 6 files changed, 94 insertions(+), 70 deletions(-) diff --git a/src/Ombi.Settings/Settings/Models/CustomizationSettings.cs b/src/Ombi.Settings/Settings/Models/CustomizationSettings.cs index 1f2155331..c8406493f 100644 --- a/src/Ombi.Settings/Settings/Models/CustomizationSettings.cs +++ b/src/Ombi.Settings/Settings/Models/CustomizationSettings.cs @@ -12,6 +12,7 @@ public bool RecentlyAddedPage { get; set; } public bool UseCustomPage { get; set; } public bool HideAvailableFromDiscover { get; set; } + public string Favicon { get; set; } public string AddToUrl(string part) { diff --git a/src/Ombi/ClientApp/src/app/app.component.ts b/src/Ombi/ClientApp/src/app/app.component.ts index cbfcf0af0..2c543606b 100644 --- a/src/Ombi/ClientApp/src/app/app.component.ts +++ b/src/Ombi/ClientApp/src/app/app.component.ts @@ -1,4 +1,4 @@ -import { OverlayContainer } from '@angular/cdk/overlay'; +import { OverlayContainer } from '@angular/cdk/overlay'; import { Component, OnInit, HostBinding, Inject } from "@angular/core"; import { NavigationStart, Router } from "@angular/router"; @@ -34,6 +34,7 @@ export class AppComponent implements OnInit { public userName: string; public userEmail: string; public accessToken: string; + public favicon: string; private hubConnected: boolean; @@ -88,9 +89,15 @@ export class AppComponent implements OnInit { this.customizationFacade.settings$().subscribe(x => { this.customizationSettings = x; if (this.customizationSettings && this.customizationSettings.applicationName) { - this.applicationName = this.customizationSettings.applicationName; - this.document.getElementsByTagName('title')[0].innerText = this.applicationName; + this.applicationName = this.customizationSettings.applicationName; + this.document.getElementsByTagName('title')[0].innerText = this.applicationName; } + + if (this.customizationSettings && this.customizationSettings.favicon) { + this.favicon = this.customizationSettings.favicon; + this.document.getElementById('favicon').setAttribute('href', this.favicon); + } + if (this.customizationSettings && this.customizationSettings.customCss) { var dom = this.document.getElementsByTagName('head')[0]; var css = document.createElement("style"); diff --git a/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts b/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts index c5dcaffc6..c7990215f 100644 --- a/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts +++ b/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts @@ -1,4 +1,4 @@ -import { ISettings } from "./ICommon"; +import { ISettings } from "./ICommon"; import { RequestLimitType } from "."; export interface IExternalSettings extends ISettings { @@ -193,6 +193,7 @@ export interface ICustomizationSettings extends ISettings { recentlyAddedPage: boolean; useCustomPage: boolean; hideAvailableFromDiscover: boolean; + favicon: string; } export interface IJobSettings { diff --git a/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html b/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html index b2168bb72..dd079524f 100644 --- a/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html +++ b/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html @@ -5,71 +5,80 @@ Customization
-
- - Application Name - - -
-
- The application url should be your Externally Accessible URL (the address you use to reach Ombi from outside your system). For example, 'https://example.com/requests'.
Please ensure this field is correct as it drives a lot of functionality, including the QR code for the - mobile app, and the way email notifications are sent. -
- - Application URL - - -
-
- - Custom Logo - - -
-
-
- -
- -
-
-
-
- - Hide Available Content On The Discover Page - -
-
- - Enable Custom Donation Link - -
-
- - Custom Donation URL - - -
-
- - Custom Donation Message - - -
-
- - Enable Custom Page - -
-
- - Custom CSS - - -
-
- +
+ + Application Name + + +
+
+ The application url should be your Externally Accessible URL (the address you use to reach Ombi from outside your system). For example, 'https://example.com/requests'.
Please ensure this field is correct as it drives a lot of functionality, including the QR code for the + mobile app, and the way email notifications are sent. +
+ + Application URL + + +
+
+ + Custom Logo + + +
+ + The favicon url should be an externally accesible URL. + +
+ + Custom Favicon + + +
+
+
+ +
+ +
+
+
+ + Hide Available Content On The Discover Page + +
+
+ + Enable Custom Donation Link + +
+
+ + Custom Donation URL + + +
+
+ + Custom Donation Message + + +
+
+ + Enable Custom Page + +
+
+ + Custom CSS + + +
+
+ +
diff --git a/src/Ombi/ClientApp/src/index.html b/src/Ombi/ClientApp/src/index.html index e9c1ed486..4f7786647 100644 --- a/src/Ombi/ClientApp/src/index.html +++ b/src/Ombi/ClientApp/src/index.html @@ -1,12 +1,12 @@ - + - + diff --git a/src/Ombi/Views/Shared/_Layout.cshtml b/src/Ombi/Views/Shared/_Layout.cshtml index 5cee9c275..3cd9ccc56 100644 --- a/src/Ombi/Views/Shared/_Layout.cshtml +++ b/src/Ombi/Views/Shared/_Layout.cshtml @@ -23,6 +23,12 @@ appName = "Ombi"; } + var favicon = customization.Favicon; + if (string.IsNullOrEmpty(favicon)) + { + favicon = "images/favicon/favicon.ico"; + } + } From 6e91716edf375cf11c03786cdb16aba97f9dc42c Mon Sep 17 00:00:00 2001 From: Maarten Heebink Date: Tue, 4 Jan 2022 00:35:01 +0100 Subject: [PATCH 02/11] Added extra info --- .../src/app/settings/customization/customization.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html b/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html index dd079524f..283dc6a8f 100644 --- a/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html +++ b/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html @@ -27,7 +27,7 @@
- The favicon url should be an externally accesible URL. + The favicon url should be an externally accesible URL. Leave blank for default.
From ccc277aca186789e2fa1f041a803eabf9727b76d Mon Sep 17 00:00:00 2001 From: maartenheebink Date: Tue, 4 Jan 2022 11:44:07 +0100 Subject: [PATCH 03/11] Update customization.component.html --- .../customization.component.html | 142 +++++++++--------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html b/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html index 283dc6a8f..32b4058ef 100644 --- a/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html +++ b/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html @@ -5,80 +5,80 @@ Customization
-
- - Application Name - - -
-
- The application url should be your Externally Accessible URL (the address you use to reach Ombi from outside your system). For example, 'https://example.com/requests'.
Please ensure this field is correct as it drives a lot of functionality, including the QR code for the - mobile app, and the way email notifications are sent. +
+ + Application Name + + +
+
+ The application url should be your Externally Accessible URL (the address you use to reach Ombi from outside your system). For example, 'https://example.com/requests'.
Please ensure this field is correct as it drives a lot of functionality, including the QR code for the + mobile app, and the way email notifications are sent. +
+ + Application URL + + +
+
+ + Custom Logo + + +
+ + The favicon url should be an externally accesible URL. Leave blank for default. - - Application URL - - -
-
- - Custom Logo - - -
- - The favicon url should be an externally accesible URL. Leave blank for default. - -
- - Custom Favicon - - -
-
-
- -
- +
+ + Custom Favicon + + +
+
+
+ +
+ +
-
-
- - Hide Available Content On The Discover Page - -
-
- - Enable Custom Donation Link - -
-
- - Custom Donation URL - - -
-
- - Custom Donation Message - - -
-
- - Enable Custom Page - -
-
- - Custom CSS - - -
-
- -
+
+ + Hide Available Content On The Discover Page + +
+
+ + Enable Custom Donation Link + +
+
+ + Custom Donation URL + + +
+
+ + Custom Donation Message + + +
+
+ + Enable Custom Page + +
+
+ + Custom CSS + + +
+
+ +
From 5dde21b9bcf7ae0931f4e8033935406895365fb5 Mon Sep 17 00:00:00 2001 From: maartenheebink Date: Tue, 4 Jan 2022 11:47:52 +0100 Subject: [PATCH 04/11] Update customization.component.html Indentation fixes --- .../customization.component.html | 100 +++++++++--------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html b/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html index 32b4058ef..4c8bcecb6 100644 --- a/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html +++ b/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html @@ -6,78 +6,78 @@
- - Application Name - - + + Application Name + +
- The application url should be your Externally Accessible URL (the address you use to reach Ombi from outside your system). For example, 'https://example.com/requests'.
Please ensure this field is correct as it drives a lot of functionality, including the QR code for the - mobile app, and the way email notifications are sent. -
- - Application URL - - + The application url should be your Externally Accessible URL (the address you use to reach Ombi from outside your system). For example, 'https://example.com/requests'.
Please ensure this field is correct as it drives a lot of functionality, including the QR code for the + mobile app, and the way email notifications are sent. +
+ + Application URL + +
- - Custom Logo - - + + Custom Logo + + +
+
+
+ +
+ +
+
- The favicon url should be an externally accesible URL. Leave blank for default. + The favicon url should be an externally accesible URL. Leave blank for default.
- - Custom Favicon - - + + Custom Favicon + +
-
- -
- -
-
+ + Hide Available Content On The Discover Page +
- - Hide Available Content On The Discover Page - + + Enable Custom Donation Link +
- - Enable Custom Donation Link - + + Custom Donation URL + +
- - Custom Donation URL - - + + Custom Donation Message + +
- - Custom Donation Message - - + + Enable Custom Page +
- - Enable Custom Page - -
-
- - Custom CSS - - + + Custom CSS + +
- +
From 4c2fecaee776b5168aa2c28571758386dafafdc6 Mon Sep 17 00:00:00 2001 From: Maarten Heebink Date: Tue, 4 Jan 2022 22:09:24 +0100 Subject: [PATCH 05/11] Looks like i anonimized the requests --- src/Ombi.Core/Engine/BaseMediaEngine.cs | 2 + src/Ombi.Core/Engine/MovieRequestEngine.cs | 22 +-- src/Ombi.Core/Engine/UserStatsEngine.cs | 3 +- src/Ombi.Notifications/BaseNotification.cs | 2 +- .../Settings/Models/OmbiSettings.cs | 1 + .../Requests/IMovieRequestRepository.cs | 2 +- .../Requests/MovieRequestRepository.cs | 17 +- .../ClientApp/src/app/interfaces/ISettings.ts | 3 +- .../movies-grid/movies-grid.component.html | 2 +- .../movies-grid/movies-grid.component.ts | 17 +- .../src/app/settings/ombi/ombi.component.html | 160 +++++++++--------- .../src/app/settings/ombi/ombi.component.ts | 3 +- 12 files changed, 132 insertions(+), 102 deletions(-) diff --git a/src/Ombi.Core/Engine/BaseMediaEngine.cs b/src/Ombi.Core/Engine/BaseMediaEngine.cs index 277144ab1..0498bf58d 100644 --- a/src/Ombi.Core/Engine/BaseMediaEngine.cs +++ b/src/Ombi.Core/Engine/BaseMediaEngine.cs @@ -157,6 +157,7 @@ namespace Ombi.Core.Engine var result = new HideResult { Hide = settings.HideRequestsUsers, + Anonimize = settings.AnonimizeRequests, UserId = user.Id }; return result; @@ -245,6 +246,7 @@ namespace Ombi.Core.Engine public class HideResult { public bool Hide { get; set; } + public bool Anonimize { get; set; } public string UserId { get; set; } } } diff --git a/src/Ombi.Core/Engine/MovieRequestEngine.cs b/src/Ombi.Core/Engine/MovieRequestEngine.cs index f69e890be..e2276eb52 100644 --- a/src/Ombi.Core/Engine/MovieRequestEngine.cs +++ b/src/Ombi.Core/Engine/MovieRequestEngine.cs @@ -179,7 +179,7 @@ namespace Ombi.Core.Engine { allRequests = MovieRepository - .GetWithUser(); //.Skip(position).Take(count).OrderByDescending(x => x.ReleaseDate).ToListAsync(); + .GetWithUser(shouldHide.Anonimize); //.Skip(position).Take(count).OrderByDescending(x => x.ReleaseDate).ToListAsync(); } switch (orderFilter.AvailabilityFilter) @@ -240,8 +240,8 @@ namespace Ombi.Core.Engine { allRequests = MovieRepository - .GetWithUser(); - } + .GetWithUser(shouldHide.Anonimize); + } var prop = TypeDescriptor.GetProperties(typeof(MovieRequests)).Find(sortProperty, true); @@ -284,7 +284,7 @@ namespace Ombi.Core.Engine { allRequests = MovieRepository - .GetWithUser(); + .GetWithUser(shouldHide.Anonimize); } switch (status) @@ -346,7 +346,7 @@ namespace Ombi.Core.Engine { allRequests = MovieRepository - .GetWithUser().Where(x => !x.Available && x.Approved); + .GetWithUser(shouldHide.Anonimize).Where(x => !x.Available && x.Approved); } var prop = TypeDescriptor.GetProperties(typeof(MovieRequests)).Find(sortProperty, true); @@ -428,7 +428,7 @@ namespace Ombi.Core.Engine } else { - return await MovieRepository.GetWithUser().CountAsync(); + return await MovieRepository.GetWithUser(shouldHide.Anonimize).CountAsync(); } } @@ -446,7 +446,7 @@ namespace Ombi.Core.Engine } else { - allRequests = await MovieRepository.GetWithUser().ToListAsync(); + allRequests = await MovieRepository.GetWithUser(shouldHide.Anonimize).ToListAsync(); } await CheckForSubscription(shouldHide, allRequests); @@ -456,7 +456,8 @@ namespace Ombi.Core.Engine public async Task GetRequest(int requestId) { - var request = await MovieRepository.GetWithUser().Where(x => x.Id == requestId).FirstOrDefaultAsync(); + var shouldHide = await HideFromOtherUsers(); + var request = await MovieRepository.GetWithUser(shouldHide.Anonimize).Where(x => x.Id == requestId).FirstOrDefaultAsync(); await CheckForSubscription(new HideResult(), new List { request }); return request; @@ -499,7 +500,7 @@ namespace Ombi.Core.Engine } else { - allRequests = await MovieRepository.GetWithUser().ToListAsync(); + allRequests = await MovieRepository.GetWithUser(shouldHide.Anonimize).ToListAsync(); } var results = allRequests.Where(x => x.Title.Contains(search, CompareOptions.IgnoreCase)).ToList(); @@ -630,7 +631,8 @@ namespace Ombi.Core.Engine /// public async Task UpdateMovieRequest(MovieRequests request) { - var allRequests = await MovieRepository.GetWithUser().ToListAsync(); + var shouldHide = await HideFromOtherUsers(); + var allRequests = await MovieRepository.GetWithUser(shouldHide.Anonimize).ToListAsync(); var results = allRequests.FirstOrDefault(x => x.Id == request.Id); results.Approved = request.Approved; diff --git a/src/Ombi.Core/Engine/UserStatsEngine.cs b/src/Ombi.Core/Engine/UserStatsEngine.cs index 6b26591f4..6d2e29597 100644 --- a/src/Ombi.Core/Engine/UserStatsEngine.cs +++ b/src/Ombi.Core/Engine/UserStatsEngine.cs @@ -23,8 +23,9 @@ namespace Ombi.Core.Engine public async Task GetSummary(SummaryRequest request) { + // get all movie requests - var movies = _movieRequest.GetWithUser(); + var movies = _movieRequest.GetWithUser(false); var filteredMovies = movies.Where(x => x.RequestedDate >= request.From && x.RequestedDate <= request.To); var tv = _tvRequest.GetLite(); var children = tv.SelectMany(x => diff --git a/src/Ombi.Notifications/BaseNotification.cs b/src/Ombi.Notifications/BaseNotification.cs index ac9de5736..092b2766d 100644 --- a/src/Ombi.Notifications/BaseNotification.cs +++ b/src/Ombi.Notifications/BaseNotification.cs @@ -139,7 +139,7 @@ namespace Ombi.Notifications { if (type == RequestType.Movie) { - MovieRequest = await MovieRepository.GetWithUser().FirstOrDefaultAsync(x => x.Id == requestId); + MovieRequest = await MovieRepository.GetWithUser(false).FirstOrDefaultAsync(x => x.Id == requestId); } else if (type == RequestType.TvShow) { diff --git a/src/Ombi.Settings/Settings/Models/OmbiSettings.cs b/src/Ombi.Settings/Settings/Models/OmbiSettings.cs index ba460a2bd..c6c0eb58f 100644 --- a/src/Ombi.Settings/Settings/Models/OmbiSettings.cs +++ b/src/Ombi.Settings/Settings/Models/OmbiSettings.cs @@ -8,6 +8,7 @@ public string ApiKey { get; set; } public bool DoNotSendNotificationsForAutoApprove { get; set; } public bool HideRequestsUsers { get; set; } + public bool AnonimizeRequests { get; set; } public bool DisableHealthChecks { get; set; } public string DefaultLanguageCode { get; set; } = "en"; public bool AutoDeleteAvailableRequests { get; set; } diff --git a/src/Ombi.Store/Repository/Requests/IMovieRequestRepository.cs b/src/Ombi.Store/Repository/Requests/IMovieRequestRepository.cs index 5c44b2d6c..04c13a574 100644 --- a/src/Ombi.Store/Repository/Requests/IMovieRequestRepository.cs +++ b/src/Ombi.Store/Repository/Requests/IMovieRequestRepository.cs @@ -11,7 +11,7 @@ namespace Ombi.Store.Repository.Requests Task Update(MovieRequests request); Task Save(); Task MarkAsAvailable(int id); - IQueryable GetWithUser(); + IQueryable GetWithUser(bool anonimize); IQueryable GetWithUser(string userId); IQueryable GetAll(string userId); } diff --git a/src/Ombi.Store/Repository/Requests/MovieRequestRepository.cs b/src/Ombi.Store/Repository/Requests/MovieRequestRepository.cs index bbf52c7f0..739fce105 100644 --- a/src/Ombi.Store/Repository/Requests/MovieRequestRepository.cs +++ b/src/Ombi.Store/Repository/Requests/MovieRequestRepository.cs @@ -35,8 +35,8 @@ namespace Ombi.Store.Repository.Requests } public IQueryable GetAll(string userId) - { - return GetWithUser().Where(x => x.RequestedUserId == userId); + { + return GetWithUser(false).Where(x => x.RequestedUserId == userId); } public MovieRequests GetRequest(int theMovieDbId) @@ -46,12 +46,19 @@ namespace Ombi.Store.Repository.Requests .FirstOrDefault(); } - public IQueryable GetWithUser() + public IQueryable GetWithUser(bool anonimize) { - return Db.MovieRequests + var allRequests = Db.MovieRequests .Include(x => x.RequestedUser) .ThenInclude(x => x.NotificationUserIds) - .AsQueryable(); + .ToList(); + + if (anonimize) + { + allRequests.ForEach(x => x.RequestedUser = null); + allRequests.ForEach(x => x.RequestedUserId = null); + } + return allRequests.AsQueryable(); } public async Task MarkAsAvailable(int id) diff --git a/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts b/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts index c5dcaffc6..4f9b16a13 100644 --- a/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts +++ b/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts @@ -1,4 +1,4 @@ -import { ISettings } from "./ICommon"; +import { ISettings } from "./ICommon"; import { RequestLimitType } from "."; export interface IExternalSettings extends ISettings { @@ -15,6 +15,7 @@ export interface IOmbiSettings extends ISettings { apiKey: string; doNotSendNotificationsForAutoApprove: boolean; hideRequestsUsers: boolean; + anonimizeRequests: boolean; defaultLanguageCode: string; disableHealthChecks: boolean; autoDeleteAvailableRequests: boolean; diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.html b/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.html index 61baa3eaa..7143a90b6 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.html +++ b/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.html @@ -92,4 +92,4 @@ - \ No newline at end of file + diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts b/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts index 111c299c5..7e370b1f4 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts +++ b/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts @@ -32,6 +32,7 @@ export class MoviesGridComponent implements OnInit, AfterViewInit { public currentFilter: RequestFilterType = RequestFilterType.All; public selection = new SelectionModel(true, []); public userName: string; + public anonimized: boolean = true; public RequestFilter = RequestFilterType; @@ -55,11 +56,11 @@ export class MoviesGridComponent implements OnInit, AfterViewInit { } public ngOnInit() { - this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser"); + this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser"); this.manageOwnRequests = this.auth.hasRole("ManageOwnRequests") if (this.isAdmin) { this.displayedColumns.unshift('select'); - } + } const defaultCount = this.storageService.get(this.storageKeyGridCount); const defaultSort = this.storageService.get(this.storageKey); const defaultOrder = this.storageService.get(this.storageKeyOrder); @@ -102,7 +103,15 @@ export class MoviesGridComponent implements OnInit, AfterViewInit { // Flip flag to show that loading has finished. this.isLoadingResults = false; this.resultsLength = data.total; - + if (data.collection.filter(x => x.requestedUserId != null).length > 0 && + data.collection.filter(x => x.requestedUser != null).length > 0) { + this.anonimized = false; + } + if (this.anonimized) { + this.displayedColumns.forEach((element, index) => { + if (element == 'requestedUser.requestedBy') this.displayedColumns.splice(index, 1); + }); + } return data.collection; }), catchError((err) => { @@ -199,4 +208,4 @@ export class MoviesGridComponent implements OnInit, AfterViewInit { this.ngAfterViewInit(); }) } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.html b/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.html index a575c24a7..042028e51 100644 --- a/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.html +++ b/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.html @@ -1,85 +1,91 @@ - +
Ombi Configuration
-
-
- - Base URL - - -
-
- - Api Key - - - - -
-
- - - - Stable - - - Develop - - - -
-
- - Do not send Notifications if a User has the Auto Approve permission -
-
- - Hide requests from other users - -
-
- - Auto Delete Available Requests - -
-
- - Delete After Days of Availbility - - -
-
- - Allow us to collect anonymous analytical data e.g. browser used - -
- -
- - - -- - - {{lang.nativeName}} - - - -
-
-
- -
-
+
+
+ + Base URL + +
+
+ + Api Key + + + + +
+
+ + + + Stable + + + Develop + + + +
+
+ + Do not send Notifications if a User has the Auto Approve permission + +
+
+ + Hide requests from other users + +
+
+ + Anonimize requests for other users + +
+
+ + Auto Delete Available Requests + +
+
+ + Delete After Days of Availbility + + +
+
+ + Allow us to collect anonymous analytical data e.g. browser used + +
+ +
+ + + -- + + {{lang.nativeName}} + + + +
+
+
+ +
+
+
-
\ No newline at end of file +
diff --git a/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.ts b/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.ts index f797703bc..59d935ba7 100644 --- a/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.ts +++ b/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from "@angular/core"; +import { Component, OnInit } from "@angular/core"; import { FormBuilder, FormGroup } from "@angular/forms"; import { Branch, ILanguageRefine, IOmbiSettings } from "../../interfaces"; @@ -29,6 +29,7 @@ export class OmbiComponent implements OnInit { baseUrl: [x.baseUrl], doNotSendNotificationsForAutoApprove: [x.doNotSendNotificationsForAutoApprove], hideRequestsUsers: [x.hideRequestsUsers], + anonimizeRequests: [x.anonimizeRequests], defaultLanguageCode: [x.defaultLanguageCode], disableHealthChecks: [x.disableHealthChecks], autoDeleteAvailableRequests: [x.autoDeleteAvailableRequests], From 4004c9ec7b9091c27bdc7dd41ee370ed8270bcb7 Mon Sep 17 00:00:00 2001 From: maartenheebink Date: Wed, 5 Jan 2022 13:13:41 +0100 Subject: [PATCH 06/11] Update src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts Co-authored-by: Jamie --- .../components/movies-grid/movies-grid.component.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts b/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts index 7e370b1f4..8a9f1aec0 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts +++ b/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts @@ -109,7 +109,10 @@ export class MoviesGridComponent implements OnInit, AfterViewInit { } if (this.anonimized) { this.displayedColumns.forEach((element, index) => { - if (element == 'requestedUser.requestedBy') this.displayedColumns.splice(index, 1); + if (element === 'requestedUser.requestedBy') + { + this.displayedColumns.splice(index, 1); + } }); } return data.collection; From 1a1c7757aaa72e2b2a387552cd8f8868b732b2ad Mon Sep 17 00:00:00 2001 From: Maarten Heebink Date: Wed, 5 Jan 2022 20:43:58 +0100 Subject: [PATCH 07/11] this should at least fix the unit tests --- src/Ombi.Core.Tests/Engine/V2/MovieRequestEngineTests.cs | 2 +- src/Ombi.Schedule/Jobs/Ombi/AutoDeleteRequests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Ombi.Core.Tests/Engine/V2/MovieRequestEngineTests.cs b/src/Ombi.Core.Tests/Engine/V2/MovieRequestEngineTests.cs index 3c651b167..c17ac6dfe 100644 --- a/src/Ombi.Core.Tests/Engine/V2/MovieRequestEngineTests.cs +++ b/src/Ombi.Core.Tests/Engine/V2/MovieRequestEngineTests.cs @@ -51,7 +51,7 @@ namespace Ombi.Core.Tests.Engine.V2 [Ignore("Needs to be tested")] public async Task Get_UnavailableRequests() { - _movieRequestRepository.Setup(x => x.GetWithUser()).Returns(new List + _movieRequestRepository.Setup(x => x.GetWithUser(false)).Returns(new List { new MovieRequests { diff --git a/src/Ombi.Schedule/Jobs/Ombi/AutoDeleteRequests.cs b/src/Ombi.Schedule/Jobs/Ombi/AutoDeleteRequests.cs index a2a7e4ed1..eba3c4998 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/AutoDeleteRequests.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/AutoDeleteRequests.cs @@ -25,7 +25,7 @@ namespace Ombi.Schedule.Jobs.Ombi _ombiSettings = ombiSettings; _movieRequests = movieRequest; _tvRequestRepository = tvRequestRepository; - _musicRequestRepository = _musicRequestRepository; + _musicRequestRepository = musicRequestRepository; _logger = logger; } From 96d73541242bcbd9fcef05ff9ae2d10b1e081120 Mon Sep 17 00:00:00 2001 From: Maarten Heebink Date: Wed, 5 Jan 2022 21:46:37 +0100 Subject: [PATCH 08/11] Small cleanup --- .../Requests/MovieRequestRepository.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Ombi.Store/Repository/Requests/MovieRequestRepository.cs b/src/Ombi.Store/Repository/Requests/MovieRequestRepository.cs index 739fce105..f3883ff89 100644 --- a/src/Ombi.Store/Repository/Requests/MovieRequestRepository.cs +++ b/src/Ombi.Store/Repository/Requests/MovieRequestRepository.cs @@ -48,17 +48,16 @@ namespace Ombi.Store.Repository.Requests public IQueryable GetWithUser(bool anonimize) { - var allRequests = Db.MovieRequests - .Include(x => x.RequestedUser) - .ThenInclude(x => x.NotificationUserIds) - .ToList(); - - if (anonimize) + if (!anonimize) { - allRequests.ForEach(x => x.RequestedUser = null); - allRequests.ForEach(x => x.RequestedUserId = null); - } - return allRequests.AsQueryable(); + return Db.MovieRequests + .Include(x => x.RequestedUser) + .ThenInclude(x => x.NotificationUserIds) + .AsQueryable(); + } else + { + return Db.MovieRequests.AsQueryable(); //This still populates the RequestedUser for the logged in user (or so it seems...) + } } public async Task MarkAsAvailable(int id) From 336d62ede3a51cb61f1847576ba0f673554c3b3d Mon Sep 17 00:00:00 2001 From: Maarten Heebink Date: Thu, 6 Jan 2022 19:28:57 +0100 Subject: [PATCH 09/11] Fully anonimized the movies --- src/Ombi.Store/Repository/Requests/IMovieRequestRepository.cs | 2 +- src/Ombi.Store/Repository/Requests/MovieRequestRepository.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Ombi.Store/Repository/Requests/IMovieRequestRepository.cs b/src/Ombi.Store/Repository/Requests/IMovieRequestRepository.cs index 04c13a574..9230684cc 100644 --- a/src/Ombi.Store/Repository/Requests/IMovieRequestRepository.cs +++ b/src/Ombi.Store/Repository/Requests/IMovieRequestRepository.cs @@ -11,7 +11,7 @@ namespace Ombi.Store.Repository.Requests Task Update(MovieRequests request); Task Save(); Task MarkAsAvailable(int id); - IQueryable GetWithUser(bool anonimize); + IQueryable GetWithUser(bool anonimize = false); IQueryable GetWithUser(string userId); IQueryable GetAll(string userId); } diff --git a/src/Ombi.Store/Repository/Requests/MovieRequestRepository.cs b/src/Ombi.Store/Repository/Requests/MovieRequestRepository.cs index f3883ff89..b47eabf49 100644 --- a/src/Ombi.Store/Repository/Requests/MovieRequestRepository.cs +++ b/src/Ombi.Store/Repository/Requests/MovieRequestRepository.cs @@ -46,7 +46,7 @@ namespace Ombi.Store.Repository.Requests .FirstOrDefault(); } - public IQueryable GetWithUser(bool anonimize) + public IQueryable GetWithUser(bool anonimize = false) { if (!anonimize) { @@ -56,7 +56,7 @@ namespace Ombi.Store.Repository.Requests .AsQueryable(); } else { - return Db.MovieRequests.AsQueryable(); //This still populates the RequestedUser for the logged in user (or so it seems...) + return Db.MovieRequests.AsNoTracking().AsQueryable(); } } From 2610c016925245dcfa21bb0814563dcb3c4785e6 Mon Sep 17 00:00:00 2001 From: Maarten Heebink Date: Thu, 6 Jan 2022 19:49:52 +0100 Subject: [PATCH 10/11] Anomized tv-series --- src/Ombi.Core/Engine/TvRequestEngine.cs | 4 +-- .../Requests/ITvRequestRepository.cs | 2 +- .../Requests/TvRequestRepository.cs | 25 +++++++++++++------ .../components/tv-grid/tv-grid.component.ts | 14 +++++++++++ 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/Ombi.Core/Engine/TvRequestEngine.cs b/src/Ombi.Core/Engine/TvRequestEngine.cs index edfa7b392..28e70315f 100644 --- a/src/Ombi.Core/Engine/TvRequestEngine.cs +++ b/src/Ombi.Core/Engine/TvRequestEngine.cs @@ -369,7 +369,7 @@ namespace Ombi.Core.Engine } else { - allRequests = await TvRepository.GetChild().ToListAsync(); + allRequests = await TvRepository.GetChild(shouldHide.Anonimize).ToListAsync(); } @@ -424,7 +424,7 @@ namespace Ombi.Core.Engine } else { - allRequests = await TvRepository.GetChild().ToListAsync(); + allRequests = await TvRepository.GetChild(shouldHide.Anonimize).ToListAsync(); } diff --git a/src/Ombi.Store/Repository/Requests/ITvRequestRepository.cs b/src/Ombi.Store/Repository/Requests/ITvRequestRepository.cs index d7106c086..46d50e859 100644 --- a/src/Ombi.Store/Repository/Requests/ITvRequestRepository.cs +++ b/src/Ombi.Store/Repository/Requests/ITvRequestRepository.cs @@ -19,7 +19,7 @@ namespace Ombi.Store.Repository.Requests TvRequests GetRequest(int theMovieDbId); Task Update(TvRequests request); Task UpdateChild(ChildRequests request); - IQueryable GetChild(); + IQueryable GetChild(bool anonimize = false); IQueryable GetChild(string userId); Task MarkEpisodeAsAvailable(int id); Task MarkChildAsAvailable(int id); diff --git a/src/Ombi.Store/Repository/Requests/TvRequestRepository.cs b/src/Ombi.Store/Repository/Requests/TvRequestRepository.cs index 0a72b1b32..a9f0b441d 100644 --- a/src/Ombi.Store/Repository/Requests/TvRequestRepository.cs +++ b/src/Ombi.Store/Repository/Requests/TvRequestRepository.cs @@ -80,14 +80,25 @@ namespace Ombi.Store.Repository.Requests .AsQueryable(); } - public IQueryable GetChild() + public IQueryable GetChild(bool anonimize = false) { - return Db.ChildRequests - .Include(x => x.RequestedUser) - .Include(x => x.ParentRequest) - .Include(x => x.SeasonRequests) - .ThenInclude(x => x.Episodes) - .AsQueryable(); + if (!anonimize) { + return Db.ChildRequests + .Include(x => x.RequestedUser) + .Include(x => x.ParentRequest) + .Include(x => x.SeasonRequests) + .ThenInclude(x => x.Episodes) + .AsQueryable(); + } + else + { + return Db.ChildRequests + .AsNoTracking() + .Include(x => x.ParentRequest) + .Include(x => x.SeasonRequests) + .ThenInclude(x => x.Episodes) + .AsQueryable(); + } } public IQueryable GetChild(string userId) diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/tv-grid/tv-grid.component.ts b/src/Ombi/ClientApp/src/app/requests-list/components/tv-grid/tv-grid.component.ts index 5e8521302..d288c817b 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/tv-grid/tv-grid.component.ts +++ b/src/Ombi/ClientApp/src/app/requests-list/components/tv-grid/tv-grid.component.ts @@ -25,6 +25,7 @@ export class TvGridComponent implements OnInit, AfterViewInit { public defaultSort: string = "requestedDate"; public defaultOrder: string = "desc"; public currentFilter: RequestFilterType = RequestFilterType.All; + public anonimized: boolean = true; public RequestFilter = RequestFilterType; public manageOwnRequests: boolean; @@ -90,6 +91,19 @@ export class TvGridComponent implements OnInit, AfterViewInit { this.isLoadingResults = false; this.resultsLength = data.total; + if (data.collection.filter(x => x.requestedUser != null).length > 0) { + this.anonimized = false; + } + + if (this.anonimized) { + this.displayedColumns.forEach((element, index) => { + if (element == 'requestedBy') this.displayedColumns.splice(index, 1); + }); + } + + console.log(this.anonimized); + console.log(data.collection); + return data.collection; }), catchError((err) => { From 622b1f69f86f9f4da0c71bc6c2f01afd4cf941f6 Mon Sep 17 00:00:00 2001 From: Maarten Heebink Date: Thu, 6 Jan 2022 19:58:46 +0100 Subject: [PATCH 11/11] cleanup --- .../requests-list/components/tv-grid/tv-grid.component.ts | 3 --- .../ClientApp/src/app/settings/ombi/ombi.component.html | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/tv-grid/tv-grid.component.ts b/src/Ombi/ClientApp/src/app/requests-list/components/tv-grid/tv-grid.component.ts index d288c817b..767a16d0e 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/tv-grid/tv-grid.component.ts +++ b/src/Ombi/ClientApp/src/app/requests-list/components/tv-grid/tv-grid.component.ts @@ -101,9 +101,6 @@ export class TvGridComponent implements OnInit, AfterViewInit { }); } - console.log(this.anonimized); - console.log(data.collection); - return data.collection; }), catchError((err) => { diff --git a/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.html b/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.html index 042028e51..181d65fa9 100644 --- a/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.html +++ b/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.html @@ -1,7 +1,7 @@
- -
+ +
Ombi Configuration
@@ -87,5 +87,5 @@
- +