Bookmark RBS + Dynamic PGO (#1503)
* Allow .NET to optimize code as it's running. * Implemented the ability to restrict users Bookmark ability. By default, users will need to now opt-in to get bookmark roles. * Fixed a tachiyomi progress syncing logic bug
This commit is contained in:
parent
30500a441c
commit
2283ae5d61
14 changed files with 75 additions and 28 deletions
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using API.Constants;
|
||||
using API.Entities;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.StaticFiles;
|
||||
|
|
@ -14,17 +13,12 @@ public interface IDownloadService
|
|||
{
|
||||
Tuple<string, string, string> GetFirstFileDownload(IEnumerable<MangaFile> files);
|
||||
string GetContentTypeFromFile(string filepath);
|
||||
Task<bool> HasDownloadPermission(AppUser user);
|
||||
}
|
||||
public class DownloadService : IDownloadService
|
||||
{
|
||||
private readonly UserManager<AppUser> _userManager;
|
||||
private readonly FileExtensionContentTypeProvider _fileTypeProvider = new FileExtensionContentTypeProvider();
|
||||
|
||||
public DownloadService(UserManager<AppUser> userManager)
|
||||
{
|
||||
_userManager = userManager;
|
||||
}
|
||||
public DownloadService() { }
|
||||
|
||||
/// <summary>
|
||||
/// Downloads the first file in the file enumerable for download
|
||||
|
|
@ -62,9 +56,5 @@ public class DownloadService : IDownloadService
|
|||
return contentType;
|
||||
}
|
||||
|
||||
public async Task<bool> HasDownloadPermission(AppUser user)
|
||||
{
|
||||
var roles = await _userManager.GetRolesAsync(user);
|
||||
return roles.Contains(PolicyConstants.DownloadRole) || roles.Contains(PolicyConstants.AdminRole);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue