From 0f758a015d30ff5e78cf1cfdc11fe4674fd160a1 Mon Sep 17 00:00:00 2001 From: InF Date: Sun, 31 Mar 2024 16:46:53 +0500 Subject: [PATCH] Update to .NET 8, this time without force merging (#122) * switch to .NET 8 * switch to primary constructors --- .github/workflows/main.yml | 13 +++---- .github/workflows/r2r.yml | 11 +++--- Dockerfile | 11 +++--- LightTube/Contexts/ChannelsContext.cs | 5 +-- LightTube/Contexts/ImportContext.cs | 12 ++----- LightTube/Contexts/ModalContext.cs | 21 +++-------- LightTube/Contexts/SubscriptionsContext.cs | 5 +-- LightTube/Controllers/ApiController.cs | 11 ++---- LightTube/Controllers/FeedController.cs | 11 ++---- LightTube/Controllers/HomeController.cs | 11 ++---- LightTube/Controllers/MediaController.cs | 11 ++---- LightTube/Controllers/OauthApiController.cs | 11 ++---- LightTube/Controllers/OpenSearchController.cs | 11 ++---- LightTube/Controllers/SettingsController.cs | 11 ++---- LightTube/Controllers/YoutubeController.cs | 14 +++----- LightTube/Database/CacheManager.cs | 16 +++------ LightTube/Database/Oauth2Manager.cs | 11 ++---- LightTube/Database/PlaylistManager.cs | 18 ++++------ LightTube/Database/UserManager.cs | 36 +++++++------------ LightTube/DropdownItem.cs | 15 +++----- LightTube/GuideItem.cs | 18 +++------- LightTube/Importer/ImportedData.cs | 17 +++------ LightTube/LightTube.csproj | 10 +++--- LightTube/SettingsTab.cs | 12 ++----- 24 files changed, 99 insertions(+), 223 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b4fd0209..ed01bc0f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: if: "!contains(github.event.head_commit.message, 'skip ci')" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 name: Check out code - name: Set version @@ -18,25 +18,20 @@ jobs: - name: Check version run: echo Building version ${{ env.LIGHTTUBE_VERSION }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 with: platforms: linux/amd64,linux/arm64 - driver-opts: | - image=moby/buildkit:v0.10.6 - name: Login to Docker Hub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build and push - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: push: true platforms: linux/arm64,linux/amd64 diff --git a/.github/workflows/r2r.yml b/.github/workflows/r2r.yml index 09d24c67..7883133c 100644 --- a/.github/workflows/r2r.yml +++ b/.github/workflows/r2r.yml @@ -21,7 +21,6 @@ jobs: - linux-arm - linux-arm64 - osx-x64 - - osx.11.0-arm64 if: | !contains(github.event.head_commit.message, 'skip ci') @@ -32,11 +31,11 @@ jobs: contents: write # In order to be able to push releases steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup .NET - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Restore dependencies run: dotnet restore - name: Build @@ -47,7 +46,7 @@ jobs: run: dotnet publish -c Release -r ${{ matrix.platform }} -p:PublishSingleFile=true -p:PublishReadyToRun=true -p:PublishReadyToRunShowWarnings=true -p:PublishTrimmed=true -p:TrimMode=partial --self-contained true - name: Upload binaries - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.platform }} R2R Binaries path: '*/bin/Release/*/${{ matrix.platform }}/publish/' @@ -64,7 +63,7 @@ jobs: - name: Create Release # You may pin to the exact commit or the version. # uses: ncipollo/release-action@a2e71bdd4e7dab70ca26a852f29600c98b33153e - uses: ncipollo/release-action@v1.12.0 + uses: ncipollo/release-action@v1.13.0 if: | github.event_name == 'push' && github.ref == 'refs/heads/master' with: diff --git a/Dockerfile b/Dockerfile index cde97c58..edff1f4f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,18 @@ -FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base WORKDIR /app EXPOSE 80 -FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build +ARG TARGETARCH WORKDIR /src COPY ["LightTube/LightTube.csproj", "LightTube/"] -RUN dotnet restore "LightTube/LightTube.csproj" +RUN dotnet restore -a $TARGETARCH "LightTube/LightTube.csproj" COPY . . WORKDIR "/src/LightTube" -RUN dotnet build "LightTube.csproj" -c Release -o /app/build /p:Version=`date +0.%Y.%m.%d` +RUN dotnet build "LightTube.csproj" -a $TARGETARCH -c Release -o /app/build /p:Version=`date +0.%Y.%m.%d` FROM build AS publish -RUN dotnet publish "LightTube.csproj" -c Release -o /app/publish /p:Version=`date +0.%Y.%m.%d` +RUN dotnet publish "LightTube.csproj" -a $TARGETARCH -c Release -o /app/publish /p:Version=`date +0.%Y.%m.%d` FROM base AS final WORKDIR /app diff --git a/LightTube/Contexts/ChannelsContext.cs b/LightTube/Contexts/ChannelsContext.cs index 642160da..38e4ab24 100644 --- a/LightTube/Contexts/ChannelsContext.cs +++ b/LightTube/Contexts/ChannelsContext.cs @@ -2,10 +2,7 @@ namespace LightTube.Contexts; -public class ChannelsContext : BaseContext +public class ChannelsContext(HttpContext context) : BaseContext(context) { public IEnumerable Channels; - - public ChannelsContext(HttpContext context) : base(context) - { } } \ No newline at end of file diff --git a/LightTube/Contexts/ImportContext.cs b/LightTube/Contexts/ImportContext.cs index 6a267770..972d7f16 100644 --- a/LightTube/Contexts/ImportContext.cs +++ b/LightTube/Contexts/ImportContext.cs @@ -1,13 +1,7 @@ namespace LightTube.Contexts; -public class ImportContext : BaseContext +public class ImportContext(HttpContext context, string? message = null, bool isError = false) : BaseContext(context) { - public string? Message { get; } - public bool IsError { get; } - - public ImportContext(HttpContext context, string? message = null, bool isError = false) : base(context) - { - Message = message; - IsError = isError; - } + public string? Message { get; } = message; + public bool IsError { get; } = isError; } \ No newline at end of file diff --git a/LightTube/Contexts/ModalContext.cs b/LightTube/Contexts/ModalContext.cs index a01dcc9f..e8da0aaa 100644 --- a/LightTube/Contexts/ModalContext.cs +++ b/LightTube/Contexts/ModalContext.cs @@ -1,26 +1,15 @@ namespace LightTube.Contexts; -public class ModalContext : BaseContext +public class ModalContext(HttpContext context) : BaseContext(context) { public string Title { get; set; } public ModalButton[] Buttons { get; set; } public bool AlignToStart { get; set; } - - public ModalContext(HttpContext context) : base(context) - { - } } -public class ModalButton +public class ModalButton(string label, string target, string type) { - public string Type; - public string Target; - public string Label; - - public ModalButton(string label, string target, string type) - { - Label = label; - Target = target; - Type = type; - } + public string Type = type; + public string Target = target; + public string Label = label; } \ No newline at end of file diff --git a/LightTube/Contexts/SubscriptionsContext.cs b/LightTube/Contexts/SubscriptionsContext.cs index 70f65b1b..c59a9d5a 100644 --- a/LightTube/Contexts/SubscriptionsContext.cs +++ b/LightTube/Contexts/SubscriptionsContext.cs @@ -2,10 +2,7 @@ namespace LightTube.Contexts; -public class SubscriptionsContext : BaseContext +public class SubscriptionsContext(HttpContext context) : BaseContext(context) { public FeedVideo[] Videos; - - public SubscriptionsContext(HttpContext context) : base(context) - { } } \ No newline at end of file diff --git a/LightTube/Controllers/ApiController.cs b/LightTube/Controllers/ApiController.cs index d90d99ef..69b870b1 100644 --- a/LightTube/Controllers/ApiController.cs +++ b/LightTube/Controllers/ApiController.cs @@ -10,19 +10,14 @@ namespace LightTube.Controllers; [Route("/api")] -public class ApiController : Controller +public class ApiController(InnerTube.InnerTube youtube) : Controller { private const string VIDEO_ID_REGEX = @"[a-zA-Z0-9_-]{11}"; private const string CHANNEL_ID_REGEX = @"[a-zA-Z0-9_-]{24}"; private const string PLAYLIST_ID_REGEX = @"[a-zA-Z0-9_-]{34}"; - private readonly InnerTube.InnerTube _youtube; + private readonly InnerTube.InnerTube _youtube = youtube; - public ApiController(InnerTube.InnerTube youtube) - { - _youtube = youtube; - } - - [Route("info")] + [Route("info")] public LightTubeInstanceInfo GetInstanceInfo() => new() { diff --git a/LightTube/Controllers/FeedController.cs b/LightTube/Controllers/FeedController.cs index 03df4fae..3a355e06 100644 --- a/LightTube/Controllers/FeedController.cs +++ b/LightTube/Controllers/FeedController.cs @@ -11,16 +11,11 @@ namespace LightTube.Controllers; [Route("/feed")] -public class FeedController : Controller +public class FeedController(InnerTube.InnerTube youtube) : Controller { - private InnerTube.InnerTube _youtube; + private InnerTube.InnerTube _youtube = youtube; - public FeedController(InnerTube.InnerTube youtube) - { - _youtube = youtube; - } - - [Route("subscriptions")] + [Route("subscriptions")] public async Task Subscription() { SubscriptionsContext ctx = new(HttpContext); diff --git a/LightTube/Controllers/HomeController.cs b/LightTube/Controllers/HomeController.cs index 209f851b..af08a092 100644 --- a/LightTube/Controllers/HomeController.cs +++ b/LightTube/Controllers/HomeController.cs @@ -5,16 +5,11 @@ namespace LightTube.Controllers; -public class HomeController : Controller +public class HomeController(ILogger logger) : Controller { - private readonly ILogger _logger; + private readonly ILogger _logger = logger; - public HomeController(ILogger logger) - { - _logger = logger; - } - - public IActionResult Index() => View(new HomepageContext(HttpContext)); + public IActionResult Index() => View(new HomepageContext(HttpContext)); [Route("/rss")] public IActionResult Rss() => View(new BaseContext(HttpContext)); diff --git a/LightTube/Controllers/MediaController.cs b/LightTube/Controllers/MediaController.cs index 2cbea57c..519daa52 100644 --- a/LightTube/Controllers/MediaController.cs +++ b/LightTube/Controllers/MediaController.cs @@ -11,9 +11,9 @@ namespace LightTube.Controllers; [Route("/proxy")] -public class ProxyController : Controller +public class ProxyController(InnerTube.InnerTube youtube) : Controller { - private readonly InnerTube.InnerTube _youtube; + private readonly InnerTube.InnerTube _youtube = youtube; private readonly HttpClient client = new HttpClient(); private string[] _blockedHeaders = @@ -31,12 +31,7 @@ public class ProxyController : Controller "cross-origin-resource-policy" }; - public ProxyController(InnerTube.InnerTube youtube) - { - _youtube = youtube; - } - - [Route("media/{videoId}/{formatId}")] + [Route("media/{videoId}/{formatId}")] [Route("media/{videoId}/{formatId}.{extension}")] public async Task Media(string videoId, string formatId, string? audioTrackId, string? extension = null) { diff --git a/LightTube/Controllers/OauthApiController.cs b/LightTube/Controllers/OauthApiController.cs index 4a9530b4..c20e2e5b 100644 --- a/LightTube/Controllers/OauthApiController.cs +++ b/LightTube/Controllers/OauthApiController.cs @@ -11,16 +11,11 @@ namespace LightTube.Controllers; [Route("/api")] [ApiDisableable] -public class OauthApiController : Controller +public class OauthApiController(InnerTube.InnerTube youtube) : Controller { - private readonly InnerTube.InnerTube _youtube; + private readonly InnerTube.InnerTube _youtube = youtube; - public OauthApiController(InnerTube.InnerTube youtube) - { - _youtube = youtube; - } - - private ApiResponse Error(string message, int code, + private ApiResponse Error(string message, int code, HttpStatusCode statusCode) { Response.StatusCode = (int)statusCode; diff --git a/LightTube/Controllers/OpenSearchController.cs b/LightTube/Controllers/OpenSearchController.cs index 8c415a11..dbec2ae8 100644 --- a/LightTube/Controllers/OpenSearchController.cs +++ b/LightTube/Controllers/OpenSearchController.cs @@ -7,16 +7,11 @@ namespace LightTube.Controllers; [Route("/opensearch")] -public class OpenSearchController : Controller +public class OpenSearchController(InnerTube.InnerTube youtube) : Controller { - private readonly InnerTube.InnerTube _youtube; + private readonly InnerTube.InnerTube _youtube = youtube; - public OpenSearchController(InnerTube.InnerTube youtube) - { - _youtube = youtube; - } - - [Route("osdd.xml")] + [Route("osdd.xml")] public IActionResult OpenSearchDescriptionDocument() { XmlDocument doc = new(); diff --git a/LightTube/Controllers/SettingsController.cs b/LightTube/Controllers/SettingsController.cs index 8bf70c2b..ab47f787 100644 --- a/LightTube/Controllers/SettingsController.cs +++ b/LightTube/Controllers/SettingsController.cs @@ -9,16 +9,11 @@ namespace LightTube.Controllers; [Route("/settings")] -public class SettingsController : Controller +public class SettingsController(InnerTube.InnerTube youtube) : Controller { - private readonly InnerTube.InnerTube _youtube; + private readonly InnerTube.InnerTube _youtube = youtube; - public SettingsController(InnerTube.InnerTube youtube) - { - _youtube = youtube; - } - - [Route("/settings")] + [Route("/settings")] public IActionResult Settings() => RedirectPermanent("/settings/appearance"); [Route("content")] diff --git a/LightTube/Controllers/YoutubeController.cs b/LightTube/Controllers/YoutubeController.cs index 2c2a044d..4023c667 100644 --- a/LightTube/Controllers/YoutubeController.cs +++ b/LightTube/Controllers/YoutubeController.cs @@ -7,18 +7,12 @@ namespace LightTube.Controllers; -public class YoutubeController : Controller +public class YoutubeController(InnerTube.InnerTube youtube, HttpClient client) : Controller { - private readonly InnerTube.InnerTube _youtube; - private readonly HttpClient _client; + private readonly InnerTube.InnerTube _youtube = youtube; + private readonly HttpClient _client = client; - public YoutubeController(InnerTube.InnerTube youtube, HttpClient client) - { - _youtube = youtube; - _client = client; - } - - [Route("/embed/{v}")] + [Route("/embed/{v}")] public async Task Embed(string v, bool contentCheckOk, bool compatibility = false) { InnerTubePlayer player; diff --git a/LightTube/Database/CacheManager.cs b/LightTube/Database/CacheManager.cs index 04317510..f40ecff8 100644 --- a/LightTube/Database/CacheManager.cs +++ b/LightTube/Database/CacheManager.cs @@ -5,19 +5,13 @@ namespace LightTube.Database; -public class CacheManager +public class CacheManager(IMongoCollection channelCollection, + IMongoCollection videoCollection) { - public IMongoCollection ChannelCollection; - public IMongoCollection VideoCollection; + public IMongoCollection ChannelCollection = channelCollection; + public IMongoCollection VideoCollection = videoCollection; - public CacheManager(IMongoCollection channelCollection, - IMongoCollection videoCollection) - { - ChannelCollection = channelCollection; - VideoCollection = videoCollection; - } - - public async Task AddChannel(DatabaseChannel channel, bool updateOnly = false) + public async Task AddChannel(DatabaseChannel channel, bool updateOnly = false) { if (await ChannelCollection.CountDocumentsAsync(x => x.ChannelId == channel.ChannelId) > 0) await ChannelCollection.ReplaceOneAsync(x => x.ChannelId == channel.ChannelId, channel); diff --git a/LightTube/Database/Oauth2Manager.cs b/LightTube/Database/Oauth2Manager.cs index dd077278..fb2fc441 100644 --- a/LightTube/Database/Oauth2Manager.cs +++ b/LightTube/Database/Oauth2Manager.cs @@ -4,16 +4,11 @@ namespace LightTube.Database; -public class Oauth2Manager +public class Oauth2Manager(IMongoCollection oauthTokensCollection) { - public IMongoCollection OauthTokensCollection { get; } + public IMongoCollection OauthTokensCollection { get; } = oauthTokensCollection; - public Oauth2Manager(IMongoCollection oauthTokensCollection) - { - OauthTokensCollection = oauthTokensCollection; - } - - public async Task CreateOauthToken(string loginToken, string clientId, string[] scopes) + public async Task CreateOauthToken(string loginToken, string clientId, string[] scopes) { DatabaseUser user = (await DatabaseManager.Users.GetUserFromToken(loginToken))!; string refreshToken = Utils.GenerateToken(512); diff --git a/LightTube/Database/PlaylistManager.cs b/LightTube/Database/PlaylistManager.cs index 4d030954..c418125d 100644 --- a/LightTube/Database/PlaylistManager.cs +++ b/LightTube/Database/PlaylistManager.cs @@ -6,22 +6,16 @@ namespace LightTube.Database; -public class PlaylistManager +public class PlaylistManager( + IMongoCollection playlistCollection, + IMongoCollection videoCacheCollection) { private const string INNERTUBE_PLAYLIST_VIDEO_RENDERER_TEMPLATE = "{\"videoId\":\"%%ID%%\",\"isPlayable\":true,\"thumbnail\":{\"thumbnails\":[{\"url\":\"%%THUMBNAIL%%\",\"width\":0,\"height\":0}]},\"title\":{\"runs\":[{\"text\":\"%%TITLE%%\"}]},\"index\":{\"simpleText\":\"%%INDEX%%\"},\"shortBylineText\":{\"runs\":[{\"text\":\"%%CHANNEL_TITLE%%\",\"navigationEndpoint\":{\"browseEndpoint\":{\"browseId\":\"%%CHANNEL_ID%%\"}}}]},\"lengthText\":{\"simpleText\":\"%%DURATION%%\"},\"navigationEndpoint\":{\"watchEndpoint\":{\"videoId\":\"%%ID%%\"}},\"lengthSeconds\":\"%%DURATION_SECONDS%%\",\"isPlayable\":true,\"thumbnailOverlays\":[{\"thumbnailOverlayTimeStatusRenderer\":{\"text\":{\"simpleText\":\"%%DURATION%%\"}}}],\"videoInfo\":{\"runs\":[{\"text\":\"%%VIEWS%%\"},{\"text\":\" • \"},{\"text\":\"%%UPLOADED_AT%%\"}]}}"; private const string INNERTUBE_PLAYLIST_PANEL_VIDEO_RENDERER_TEMPLATE = "{\"title\":{\"simpleText\":\"%%TITLE%%\"},\"thumbnail\":{\"thumbnails\":[{\"url\":\"%%THUMBNAIL%%\",\"width\":0,\"height\":0}]},\"lengthText\":{\"simpleText\":\"%%DURATION%%\"},\"indexText\":{\"simpleText\":\"%%INDEX%%\"},\"selected\":%%SELECTED%%,\"navigationEndpoint\":{\"watchEndpoint\":{\"params\":\"OAE%3D\"}},\"videoId\":\"%%ID%%\",\"shortBylineText\":{\"runs\":[{\"text\":\"%%CHANNEL_TITLE%%\",\"navigationEndpoint\":{\"browseEndpoint\":{\"browseId\":\"%%CHANNEL_ID%%\"}}}]}}"; - public IMongoCollection PlaylistCollection { get; } - public IMongoCollection VideoCacheCollection { get; } + public IMongoCollection PlaylistCollection { get; } = playlistCollection; + public IMongoCollection VideoCacheCollection { get; } = videoCacheCollection; - public PlaylistManager( - IMongoCollection playlistCollection, - IMongoCollection videoCacheCollection) - { - PlaylistCollection = playlistCollection; - VideoCacheCollection = videoCacheCollection; - } - - public DatabasePlaylist? GetPlaylist(string id) => PlaylistCollection.FindSync(x => x.Id == id).FirstOrDefault(); + public DatabasePlaylist? GetPlaylist(string id) => PlaylistCollection.FindSync(x => x.Id == id).FirstOrDefault(); public IEnumerable GetUserPlaylists(string userId, PlaylistVisibility minVisibility) { diff --git a/LightTube/Database/UserManager.cs b/LightTube/Database/UserManager.cs index f42b369b..90f4ec61 100644 --- a/LightTube/Database/UserManager.cs +++ b/LightTube/Database/UserManager.cs @@ -5,25 +5,17 @@ namespace LightTube.Database; -public class UserManager +public class UserManager(IMongoCollection userCollection, + IMongoCollection tokensCollection, + IMongoCollection playlistCollection, + IMongoCollection oauth2TokensCollection) { - public IMongoCollection UserCollection { get; } - public IMongoCollection TokensCollection { get; } - public IMongoCollection Oauth2TokensCollection { get; } - public IMongoCollection PlaylistCollection { get; } - - public UserManager(IMongoCollection userCollection, - IMongoCollection tokensCollection, - IMongoCollection playlistCollection, - IMongoCollection oauth2TokensCollection) - { - UserCollection = userCollection; - TokensCollection = tokensCollection; - PlaylistCollection = playlistCollection; - Oauth2TokensCollection = oauth2TokensCollection; - } + public IMongoCollection UserCollection { get; } = userCollection; + public IMongoCollection TokensCollection { get; } = tokensCollection; + public IMongoCollection Oauth2TokensCollection { get; } = oauth2TokensCollection; + public IMongoCollection PlaylistCollection { get; } = playlistCollection; - public async Task GetUserFromUsernamePassword(string userId, string password) + public async Task GetUserFromUsernamePassword(string userId, string password) { IAsyncCursor users = await UserCollection.FindAsync(x => x.UserID == userId); if (!await users.AnyAsync()) @@ -132,12 +124,11 @@ public async Task> GetAllUserTokens(string token) public async Task<(string channelId, SubscriptionType subscriptionType)> UpdateSubscription(string token, string channelId, SubscriptionType type) { - DatabaseUser? user = await GetUserFromToken(token); - if (user is null) throw new UnauthorizedAccessException(); + DatabaseUser? user = await GetUserFromToken(token) ?? throw new UnauthorizedAccessException(); - // TODO: update the channel cache + // TODO: update the channel cache - if (user.Subscriptions.ContainsKey(channelId)) + if (user.Subscriptions.ContainsKey(channelId)) if (type == SubscriptionType.NONE) user.Subscriptions.Remove(channelId); else @@ -147,8 +138,7 @@ public async Task> GetAllUserTokens(string token) await UserCollection.ReplaceOneAsync(x => x.UserID == user.UserID, user); - return user.Subscriptions.ContainsKey(channelId) - ? (channelId, user.Subscriptions[channelId]) + return user.Subscriptions.TryGetValue(channelId, out SubscriptionType value) ? (channelId, value) : (channelId, SubscriptionType.NONE); } diff --git a/LightTube/DropdownItem.cs b/LightTube/DropdownItem.cs index 264e950e..0047fc3b 100644 --- a/LightTube/DropdownItem.cs +++ b/LightTube/DropdownItem.cs @@ -1,15 +1,8 @@ namespace LightTube; -public class DropdownItem +public class DropdownItem(string label, string target, string icon) { - public string Label; - public string Target; - public string Icon; - - public DropdownItem(string label, string target, string icon) - { - Label = label; - Target = target; - Icon = icon; - } + public string Label = label; + public string Target = target; + public string Icon = icon; } \ No newline at end of file diff --git a/LightTube/GuideItem.cs b/LightTube/GuideItem.cs index d39ee86a..bc856135 100644 --- a/LightTube/GuideItem.cs +++ b/LightTube/GuideItem.cs @@ -1,17 +1,9 @@ namespace LightTube; -public class GuideItem +public class GuideItem(string title, string iconId, string path, bool visibleOnMinifiedGuide) { - public string Title; - public string IconId; - public string Path; - public bool VisibleOnMinifiedGuide; - - public GuideItem(string title, string iconId, string path, bool visibleOnMinifiedGuide) - { - Title = title; - IconId = iconId; - Path = path; - VisibleOnMinifiedGuide = visibleOnMinifiedGuide; - } + public string Title = title; + public string IconId = iconId; + public string Path = path; + public bool VisibleOnMinifiedGuide = visibleOnMinifiedGuide; } \ No newline at end of file diff --git a/LightTube/Importer/ImportedData.cs b/LightTube/Importer/ImportedData.cs index f1f4fda5..dd864d04 100644 --- a/LightTube/Importer/ImportedData.cs +++ b/LightTube/Importer/ImportedData.cs @@ -4,20 +4,13 @@ namespace LightTube; -public class ImportedData +public class ImportedData(ImportSource source) { - public ImportSource Source; - public List Subscriptions; - public List Playlists; + public ImportSource Source = source; + public List Subscriptions = new List(); + public List Playlists = new List(); - public ImportedData(ImportSource source) - { - Source = source; - Subscriptions = new List(); - Playlists = new List(); - } - - public override string ToString() + public override string ToString() { StringBuilder sb = new(); sb.AppendLine("=== EXPORTED DATA ===") diff --git a/LightTube/LightTube.csproj b/LightTube/LightTube.csproj index 958fca2f..295cc14d 100644 --- a/LightTube/LightTube.csproj +++ b/LightTube/LightTube.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 enable enable @@ -10,13 +10,13 @@ - - + + - + - + diff --git a/LightTube/SettingsTab.cs b/LightTube/SettingsTab.cs index 8127f0ef..b43f9936 100644 --- a/LightTube/SettingsTab.cs +++ b/LightTube/SettingsTab.cs @@ -1,13 +1,7 @@ namespace LightTube; -public class SettingsTab +public class SettingsTab(string label, string path) { - public string Label; - public string Path; - - public SettingsTab(string label, string path) - { - Label = label; - Path = path; - } + public string Label = label; + public string Path = path; } \ No newline at end of file