diff --git a/.gitignore b/.gitignore index 8a30d25..d2e0280 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## -## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore - +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore +.idea/ # User-specific files *.rsuser *.suo @@ -23,7 +23,6 @@ mono_crash.* [Rr]eleases/ x64/ x86/ -[Ww][Ii][Nn]32/ [Aa][Rr][Mm]/ [Aa][Rr][Mm]64/ bld/ @@ -62,9 +61,6 @@ project.lock.json project.fragment.lock.json artifacts/ -# ASP.NET Scaffolding -ScaffoldingReadMe.txt - # StyleCop StyleCopReport.xml @@ -90,7 +86,6 @@ StyleCopReport.xml *.tmp_proj *_wpftmp.csproj *.log -*.tlog *.vspscc *.vssscc .builds @@ -142,11 +137,6 @@ _TeamCity* .axoCover/* !.axoCover/settings.json -# Coverlet is a free, cross platform Code Coverage Tool -coverage*.json -coverage*.xml -coverage*.info - # Visual Studio code coverage results *.coverage *.coveragexml @@ -294,17 +284,6 @@ node_modules/ # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) *.vbw -# Visual Studio 6 auto-generated project file (contains which files were open etc.) -*.vbp - -# Visual Studio 6 workspace and project file (working project files containing files to include in project) -*.dsw -*.dsp - -# Visual Studio 6 technical files -*.ncb -*.aps - # Visual Studio LightSwitch build output **/*.HTMLClient/GeneratedArtifacts **/*.DesktopClient/GeneratedArtifacts @@ -361,9 +340,6 @@ ASALocalRun/ # Local History for Visual Studio .localhistory/ -# Visual Studio History (VSHistory) files -.vshistory/ - # BeatPulse healthcheck temp database healthchecksdb @@ -372,27 +348,3 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ - -# Fody - auto-generated XML schema -FodyWeavers.xsd - -# VS Code files for those working on multiple tools -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -*.code-workspace - -# Local History for Visual Studio Code -.history/ - -# Windows Installer files from build outputs -*.cab -*.msi -*.msix -*.msm -*.msp - -# JetBrains Rider -*.sln.iml diff --git a/SharpRSS.sln b/SharpRSS.sln new file mode 100644 index 0000000..0d958ac --- /dev/null +++ b/SharpRSS.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebSharpRSS", "WebSharpRSS\WebSharpRSS.csproj", "{749FE445-8D46-4631-BB57-FC648E22ADB6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpRss", "SharpRss\SharpRss.csproj", "{DB3777BA-A383-4B83-AF65-DE51907CE75A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {749FE445-8D46-4631-BB57-FC648E22ADB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {749FE445-8D46-4631-BB57-FC648E22ADB6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {749FE445-8D46-4631-BB57-FC648E22ADB6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {749FE445-8D46-4631-BB57-FC648E22ADB6}.Release|Any CPU.Build.0 = Release|Any CPU + {DB3777BA-A383-4B83-AF65-DE51907CE75A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB3777BA-A383-4B83-AF65-DE51907CE75A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB3777BA-A383-4B83-AF65-DE51907CE75A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB3777BA-A383-4B83-AF65-DE51907CE75A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/SharpRss/Models/FeedInfo.cs b/SharpRss/Models/FeedInfo.cs new file mode 100644 index 0000000..a7fb64b --- /dev/null +++ b/SharpRss/Models/FeedInfo.cs @@ -0,0 +1,10 @@ +using CodeHollow.FeedReader; + +namespace SharpRss.Models +{ + public class FeedInfo + { + public string FeedName { get; set; } + public string Url { get; set; } + } +} \ No newline at end of file diff --git a/SharpRss/RssService.cs b/SharpRss/RssService.cs new file mode 100644 index 0000000..da99c92 --- /dev/null +++ b/SharpRss/RssService.cs @@ -0,0 +1,24 @@ +using System.Linq; +using CodeHollow.FeedReader; + +namespace SharpRss +{ + public class RssService + { + public async void GetFeeds() + { + //TODO: Load from db or something. + + var urls = await FeedReader.GetFeedUrlsFromUrlAsync(_feeds[0]); + string url; + if (urls.Count() < 1) + url = _feeds[0]; + else + url = urls.First().Url; + + Feed f = await FeedReader.ReadAsync(url); + } + + private readonly string[] _feeds = { "https://www.reddit.com/r/freshrss/.rss", "http://fedoramagazine.org/" }; + } +} \ No newline at end of file diff --git a/SharpRss/SharpRss.csproj b/SharpRss/SharpRss.csproj new file mode 100644 index 0000000..cdcac24 --- /dev/null +++ b/SharpRss/SharpRss.csproj @@ -0,0 +1,14 @@ + + + + netstandard2.1 + enable + enable + 10 + + + + + + + diff --git a/WebSharpRSS/App.razor b/WebSharpRSS/App.razor new file mode 100644 index 0000000..37a2310 --- /dev/null +++ b/WebSharpRSS/App.razor @@ -0,0 +1,12 @@ + + + + + + + Not found + +

Sorry, there's nothing at this address.

+
+
+
\ No newline at end of file diff --git a/WebSharpRSS/MainLayout.razor b/WebSharpRSS/MainLayout.razor new file mode 100644 index 0000000..4d6da0e --- /dev/null +++ b/WebSharpRSS/MainLayout.razor @@ -0,0 +1,34 @@ +@inherits LayoutComponentBase + + + + + + + + + + + + + RSS + + + + + + + + + @Body + + + +@code { + bool _drawerOpen = true; + + void DrawerToggle() + { + _drawerOpen = !_drawerOpen; + } +} diff --git a/WebSharpRSS/Pages/Index.razor b/WebSharpRSS/Pages/Index.razor new file mode 100644 index 0000000..2f95661 --- /dev/null +++ b/WebSharpRSS/Pages/Index.razor @@ -0,0 +1,8 @@ +@page "/" +@inject RssService _rssService + + + +@code { + +} \ No newline at end of file diff --git a/WebSharpRSS/Pages/_Host.cshtml b/WebSharpRSS/Pages/_Host.cshtml new file mode 100644 index 0000000..7119ff3 --- /dev/null +++ b/WebSharpRSS/Pages/_Host.cshtml @@ -0,0 +1,32 @@ +@page "/" +@using Microsoft.AspNetCore.Components.Web +@namespace WebSharpRSS.Pages +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers + + + + + + + + + + + + + + +
+ + An error has occurred. This application may no longer respond until reloaded. + + + An unhandled exception has occurred. See browser dev tools for details. + + Reload + 🗙 +
+ + + + \ No newline at end of file diff --git a/WebSharpRSS/Program.cs b/WebSharpRSS/Program.cs new file mode 100644 index 0000000..b8e327b --- /dev/null +++ b/WebSharpRSS/Program.cs @@ -0,0 +1,37 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using MudBlazor; +using MudBlazor.Services; +using SharpRss; + +var builder = WebApplication.CreateBuilder(args); +builder.Services.AddRazorPages(); +builder.Services.AddServerSideBlazor(); +builder.Services.AddTransient(); +builder.Services.AddMudServices(config => +{ + config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomRight; + config.SnackbarConfiguration.PreventDuplicates = true; + config.SnackbarConfiguration.ShowCloseIcon = true; + config.SnackbarConfiguration.SnackbarVariant = Variant.Filled; +}); + +var app = builder.Build(); + +if (!app.Environment.IsDevelopment()) +{ + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); +} + +app.UseHttpsRedirection(); + +app.UseStaticFiles(); + +app.UseRouting(); + +app.MapBlazorHub(); +app.MapFallbackToPage("/_Host"); + +app.Run(); \ No newline at end of file diff --git a/WebSharpRSS/Properties/launchSettings.json b/WebSharpRSS/Properties/launchSettings.json new file mode 100644 index 0000000..94032c1 --- /dev/null +++ b/WebSharpRSS/Properties/launchSettings.json @@ -0,0 +1,35 @@ +{ + "iisSettings": { + "iisExpress": { + "applicationUrl": "http://localhost:48266", + "sslPort": 44309 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:5164", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7031;http://localhost:5164", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/WebSharpRSS/WebSharpRSS.csproj b/WebSharpRSS/WebSharpRSS.csproj new file mode 100644 index 0000000..dd3cc12 --- /dev/null +++ b/WebSharpRSS/WebSharpRSS.csproj @@ -0,0 +1,22 @@ + + + + net7.0 + enable + enable + 10 + + + + + + + + + + + + + + + diff --git a/WebSharpRSS/_Imports.razor b/WebSharpRSS/_Imports.razor new file mode 100644 index 0000000..b2e2f6c --- /dev/null +++ b/WebSharpRSS/_Imports.razor @@ -0,0 +1,6 @@ +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using Microsoft.JSInterop +@using WebSharpRSS +@using MudBlazor +@using SharpRss diff --git a/WebSharpRSS/appsettings.Development.json b/WebSharpRSS/appsettings.Development.json new file mode 100644 index 0000000..770d3e9 --- /dev/null +++ b/WebSharpRSS/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "DetailedErrors": true, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/WebSharpRSS/appsettings.json b/WebSharpRSS/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/WebSharpRSS/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/WebSharpRSS/wwwroot/css/site.css b/WebSharpRSS/wwwroot/css/site.css new file mode 100644 index 0000000..08e7f0b --- /dev/null +++ b/WebSharpRSS/wwwroot/css/site.css @@ -0,0 +1,28 @@ +#blazor-error-ui { + background: lightyellow; + bottom: 0; + box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); + display: none; + left: 0; + padding: 0.6rem 1.25rem 0.7rem 1.25rem; + position: fixed; + width: 100%; + z-index: 1000; +} + + #blazor-error-ui .dismiss { + cursor: pointer; + position: absolute; + right: 3.5rem; + top: 0.5rem; + } + +.blazor-error-boundary { + background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2N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