pull/3528/head
Jamie Rees 5 years ago
commit 8789ac81cf

@ -19,7 +19,7 @@ variables:
testProj: '**/*.Tests.csproj'
csProj: '**/*.csproj'
buildConfiguration: 'Release'
publishLocation: '$(Build.SourcesDirectory)/src/Ombi/bin/Release/netcoreapp3.0'
publishLocation: '$(Build.SourcesDirectory)/src/Ombi/bin/Release/netcoreapp3.1'
buildVersion: '4.0.$(Build.BuildId)'
gitTag: 'v$(buildVersion)'
uiLocation: '$(Build.SourcesDirectory)/src/Ombi/ClientApp/'

@ -13,7 +13,7 @@ namespace Ombi.Notifications.Templates
if (string.IsNullOrEmpty(_templateLocation))
{
#if DEBUG
_templateLocation = Path.Combine(Directory.GetCurrentDirectory(), "bin", "Debug", "netcoreapp2.2", "Templates",
_templateLocation = Path.Combine(Directory.GetCurrentDirectory(), "bin", "Debug", "netcoreapp3.1", "Templates",
"BasicTemplate.html");
#else
_templateLocation = Path.Combine(Directory.GetCurrentDirectory(), "Templates","BasicTemplate.html");

@ -61,7 +61,7 @@ namespace Ombi.Store.Context
using (var tran = Database.BeginTransaction())
{
// Make sure we have the API User
var apiUserExists = Users.ToList().Any(x => x.UserName.Equals("Api", StringComparison.CurrentCultureIgnoreCase));
var apiUserExists = Users.ToList().Any(x => x.NormalizedUserName == "API");
if (!apiUserExists)
{
Users.Add(new OmbiUser

@ -10,6 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\appveyor.yml = ..\appveyor.yml
..\build.cake = ..\build.cake
..\CHANGELOG.md = ..\CHANGELOG.md
..\ci-build.yaml = ..\ci-build.yaml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Core", "Ombi.Core\Ombi.Core.csproj", "{F56E79C7-791D-4668-A0EC-29E3BBC8D24B}"
@ -116,7 +117,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.HealthChecks", "Ombi.H
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Api.Webhook", "Ombi.Api.Webhook\Ombi.Api.Webhook.csproj", "{E2186FDA-D827-4781-8663-130AC382F12C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ombi.Api.CloudService", "Ombi.Api.CloudService\Ombi.Api.CloudService.csproj", "{5DE40A66-B369-469E-8626-ECE23D9D8034}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Api.CloudService", "Ombi.Api.CloudService\Ombi.Api.CloudService.csproj", "{5DE40A66-B369-469E-8626-ECE23D9D8034}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

@ -96,7 +96,7 @@
</div>
</div>
<div class="row top-spacing">
<div class="row top-spacing overview">
<div class="col-12">
{{data.overview}}
</div>
@ -119,11 +119,11 @@
{{ 'Common.Requested' | translate }}</button>
</ng-template>
<ng-template #notRequestedBtn>
<button mat-raised-button class="btn-spacing btn-orange" (click)="request()">
<i *ngIf="movie.requestProcessing" class="fa fa-circle-o-notch fa-spin fa-fw"></i> <i
*ngIf="!movie.requestProcessing && !movie.processed" class="fa fa-plus"></i>
<i *ngIf="movie.processed && !movie.requestProcessing" class="fa fa-check"></i> {{
'Common.Request' | translate }}</button>
<button mat-raised-button class="btn-spacing" color="primary" (click)="request()">
<i *ngIf="movie.requestProcessing" class="fa fa-circle-o-notch fa-spin fa-fw"></i> <i
*ngIf="!movie.requestProcessing && !movie.processed" class="fa fa-plus"></i>
<i *ngIf="movie.processed && !movie.requestProcessing" class="fa fa-check"></i> {{
'Common.Request' | translate }}</button>
</ng-template>
</span>
</div>
@ -138,10 +138,11 @@
</button>
</div>
<button mat-raised-button class="btn-green btn-spacing" *ngIf="tv.available"> {{
'Common.Available' | translate }}</button>
<button mat-raised-button class="btn-orange btn-spacing" *ngIf="tv.partlyAvailable && !tv.available"> {{
'Common.PartlyAvailable' | translate }}</button>
<button *ngIf="tv.fullyAvailable" mat-raised-button class="btn-spacing" color="accent" [disabled]>
<i class="fa fa-check"></i> {{'Common.Available' | translate }}</button>
<button *ngIf="tv.partlyAvailable && !tv.fullyAvailable" mat-raised-button class="btn-spacing" color="accent"
[disabled]>
<i class="fa fa-check"></i> {{'Common.PartiallyAvailable' | translate }}</button>
<span *ngIf="tv.available">
<a *ngIf="tv.plexUrl" mat-raised-button style="text-align: right" class="btn-spacing btn-greem"

@ -44,3 +44,7 @@ h3 strong {
}
}
.overview {
height:300px;
overflow-y: scroll;
}

@ -3,18 +3,13 @@
<a [routerLink]="result.type === RequestType.movie ? '/details/movie/' + result.id : '/details/tv/' + result.id">
<img id="cardImage" mat-card-image src="{{result.posterPath}}" class="card-poster" [ngClass]="getStatusClass()" alt="{{result.title}}">
</a>
<mat-card-content>
<mat-card-content (click)="openDetails(result);">
<h6 *ngIf="result.title.length <= 13">{{result.title}}</h6>
<h6 *ngIf="result.title.length > 13" matTooltip="{{result.title}}">{{result.title | truncate:13}}</h6>
<h6 *ngIf="result.title.length <= 20">{{result.title}}</h6>
<h6 *ngIf="result.title.length > 20" matTooltip="{{result.title}}">{{result.title | truncate:20}}</h6>
<div class="fade-text">
<small class="overview-text">{{result.overview | truncate: 50}}</small>
<small class="overview-text">{{result.overview | truncate: 75}}</small>
</div>
</mat-card-content>
<mat-card-actions class="expand">
<button mat-icon-button (click)="openDetails(result);">
<mat-icon>expand_more</mat-icon>
</button>
</mat-card-actions>
</mat-card>
</div>

@ -16,8 +16,8 @@
</div>
</div>
<div *ngIf="discoverResults" class="row full-height discoverResults" infiniteScroll [fromRoot]="false" [infiniteScrollDistance]="0.5" [infiniteScrollDisabled]="scrollDisabled" (scrolled)="onScroll()">
<div class="col-xl-2 col-lg-3 col-md-3 col-6 col-sm-4 small-padding" *ngFor="let result of discoverResults">
<div *ngIf="discoverResults" class="row full-height discoverResults col" infiniteScroll [fromRoot]="false" [infiniteScrollDistance]="0.5" [infiniteScrollDisabled]="scrollDisabled" (scrolled)="onScroll()">
<div class="col-xl-2 col-lg-3 col-md-4 col-12 col-sm-6 small-padding" *ngFor="let result of discoverResults">
<discover-card [result]="result"></discover-card>
</div>
</div>

@ -135,7 +135,7 @@ namespace Ombi.Controllers.V1
public async Task<SaveWizardResult> CreateWizardUser([FromBody] CreateUserWizardModel user)
{
var users = UserManager.Users;
if (users.Any(x => !x.UserName.Equals("api", StringComparison.InvariantCultureIgnoreCase)))
if (users.Any(x => x.NormalizedUserName != "API"))
{
// No one should be calling this. Only the wizard
return new SaveWizardResult { Result = false, Errors = new List<string> { "Looks like there is an existing user!" } };
@ -280,7 +280,8 @@ namespace Ombi.Controllers.V1
[Authorize]
public async Task<UserViewModel> GetCurrentUser()
{
var user = await UserManager.Users.FirstOrDefaultAsync(x => x.UserName.Equals(User.Identity.Name, StringComparison.InvariantCultureIgnoreCase));
var username = User.Identity.Name.ToUpper();
var user = await UserManager.Users.FirstOrDefaultAsync(x => x.NormalizedUserName == username);
return await GetUserWithRoles(user);
}
@ -875,7 +876,9 @@ namespace Ombi.Controllers.V1
[ApiExplorerSettings(IgnoreApi = true)]
public async Task<string> GetUserAccessToken()
{
var user = await UserManager.Users.FirstOrDefaultAsync(x => x.UserName.Equals(User.Identity.Name, StringComparison.InvariantCultureIgnoreCase));
var username = User.Identity.Name.ToUpper();
var user = await UserManager.Users.FirstOrDefaultAsync(x => x.NormalizedUserName == username);
if (user == null)
{
return Guid.Empty.ToString("N");
@ -897,7 +900,8 @@ namespace Ombi.Controllers.V1
[HttpGet("notificationpreferences")]
public async Task<List<UserNotificationPreferences>> GetUserPreferences()
{
var user = await UserManager.Users.FirstOrDefaultAsync(x => x.UserName.Equals(User.Identity.Name, StringComparison.InvariantCultureIgnoreCase));
var username = User.Identity.Name.ToUpper();
var user = await UserManager.Users.FirstOrDefaultAsync(x => x.NormalizedUserName == username);
return await GetPreferences(user);
}
@ -950,7 +954,9 @@ namespace Ombi.Controllers.V1
return NotFound();
}
// Check if we are editing a different user than ourself, if we are then we need to power user role
var me = await UserManager.Users.FirstOrDefaultAsync(x => x.UserName.Equals(User.Identity.Name, StringComparison.InvariantCultureIgnoreCase));
var username = User.Identity.Name.ToUpper();
var me = await UserManager.Users.FirstOrDefaultAsync(x => x.NormalizedUserName == username);
if (!me.Id.Equals(user.Id, StringComparison.InvariantCultureIgnoreCase))
{
var isPowerUser = await UserManager.IsInRoleAsync(me, OmbiRoles.PowerUser);

@ -130,7 +130,9 @@ namespace Ombi.Controllers.V1
public async Task<int> CreateIssue([FromBody]Issues i)
{
i.IssueCategory = null;
i.UserReportedId = (await _userManager.Users.FirstOrDefaultAsync(x => x.UserName.Equals(User.Identity.Name, StringComparison.InvariantCultureIgnoreCase))).Id;
var username = User.Identity.Name.ToUpper();
i.UserReportedId = (await _userManager.Users.FirstOrDefaultAsync(x => x.NormalizedUserName == username)).Id;
await _issues.Add(i);
var category = await _categories.GetAll().FirstOrDefaultAsync(x => i.IssueCategoryId == x.Id);
if (category != null)

@ -40,7 +40,8 @@ namespace Ombi.Controllers.V1
{
if (body?.PlayerId.HasValue() ?? false)
{
var user = await _userManager.Users.FirstOrDefaultAsync(x => x.UserName.Equals(User.Identity.Name, StringComparison.InvariantCultureIgnoreCase));
var username = User.Identity.Name.ToUpper();
var user = await _userManager.Users.FirstOrDefaultAsync(x => x.NormalizedUserName == username);
// Check if we already have this notification id
var alreadyExists = await _notification.GetAll().AnyAsync(x => x.PlayerId == body.PlayerId && x.UserId == user.Id);

@ -36,7 +36,9 @@ namespace Ombi.Controllers.V2
{
if (!string.IsNullOrEmpty(body?.Token))
{
var user = await _userManager.Users.FirstOrDefaultAsync(x => x.UserName.Equals(User.Identity.Name, StringComparison.InvariantCultureIgnoreCase));
var username = User.Identity.Name.ToUpper();
var user = await _userManager.Users.FirstOrDefaultAsync(x => x.NormalizedUserName == username);
// Check if we already have this notification id
var alreadyExists = await _mobileDevices.GetAll().AnyAsync(x => x.Token == body.Token && x.UserId == user.Id);
@ -64,7 +66,8 @@ namespace Ombi.Controllers.V2
public async Task<IActionResult> RemoveNotifications()
{
var user = await _userManager.Users.FirstOrDefaultAsync(x => x.UserName.Equals(User.Identity.Name, StringComparison.InvariantCultureIgnoreCase));
var username = User.Identity.Name.ToUpper();
var user = await _userManager.Users.FirstOrDefaultAsync(x => x.NormalizedUserName == username);
// Check if we already have this notification id
var currentDevices = await _mobileDevices.GetAll().Where(x => x.UserId == user.Id).ToListAsync();

@ -102,10 +102,16 @@ namespace Ombi
if (username.IsNullOrEmpty())
{
UseApiUser(context);
}
else
{
username = username.ToUpper();
}
var um = context.RequestServices.GetService<OmbiUserManager>();
var user = await um.Users.FirstOrDefaultAsync(x =>
x.UserName.Equals(username, StringComparison.InvariantCultureIgnoreCase));
x.NormalizedUserName == username);
if (user == null)
{
context.Response.StatusCode = (int)HttpStatusCode.Unauthorized;

@ -4,6 +4,8 @@
<RuntimeIdentifiers>win10-x64;win10-x86;osx-x64;linux-x64;linux-arm;linux-arm64;</RuntimeIdentifiers>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<!-- <PublishTrimmed>true</PublishTrimmed>
<PublishReadyToRun>true</PublishReadyToRun> -->
<AssemblyVersion>$(SemVer)</AssemblyVersion>
<FileVersion>$(SemVer)</FileVersion>
<Version>$(FullVer)</Version>

Loading…
Cancel
Save