mirror of https://github.com/ErsatzTV/ErsatzTV.git
Browse Source
* remove stale issue workflow [no ci] * rename and cleanup (#1) * rename artifacts; remove github changelog * update dependencies * remove unused markdown view * fix app name in macos scripts * fix unit tests * more dependency updates (#2)pull/2849/head
30 changed files with 111 additions and 358 deletions
@ -1,27 +0,0 @@
@@ -1,27 +0,0 @@
|
||||
name: 'Close stale issues' |
||||
|
||||
on: |
||||
schedule: |
||||
- cron: '30 1 * * *' |
||||
workflow_dispatch: |
||||
|
||||
jobs: |
||||
stale: |
||||
runs-on: ubuntu-latest |
||||
steps: |
||||
- uses: actions/stale@v9 |
||||
with: |
||||
ascending: true |
||||
days-before-stale: 120 |
||||
days-before-pr-stale: -1 |
||||
days-before-close: 21 |
||||
days-before-pr-close: -1 |
||||
operations-per-run: 500 |
||||
exempt-issue-labels: 'regression,security,roadmap,future,feature,enhancement,confirmed' |
||||
stale-issue-label: 'stale' |
||||
stale-issue-message: |- |
||||
This issue has gone 120 days without an update and will be closed within 21 days if there is no new activity. To prevent this issue from being closed, please confirm the issue has not already been fixed by providing updated examples or logs. |
||||
|
||||
If you have any questions you can use one of several ways to [contact us](https://ersatztv.org). |
||||
close-issue-message: |- |
||||
This issue was closed due to inactivity. |
||||
@ -1,7 +0,0 @@
@@ -1,7 +0,0 @@
|
||||
namespace ErsatzTV.Core.Interfaces.GitHub; |
||||
|
||||
public interface IGitHubApiClient |
||||
{ |
||||
Task<Either<BaseError, string>> GetLatestReleaseNotes(CancellationToken cancellationToken); |
||||
Task<Either<BaseError, string>> GetReleaseNotes(string tag, CancellationToken cancellationToken); |
||||
} |
||||
@ -1,34 +0,0 @@
@@ -1,34 +0,0 @@
|
||||
using ErsatzTV.Core; |
||||
using ErsatzTV.Core.Interfaces.GitHub; |
||||
using Refit; |
||||
|
||||
namespace ErsatzTV.Infrastructure.GitHub; |
||||
|
||||
public class GitHubApiClient : IGitHubApiClient |
||||
{ |
||||
public async Task<Either<BaseError, string>> GetLatestReleaseNotes(CancellationToken cancellationToken) |
||||
{ |
||||
try |
||||
{ |
||||
IGitHubApi service = RestService.For<IGitHubApi>("https://api.github.com"); |
||||
return await service.GetReleases(cancellationToken).Map(releases => releases.Head().Body); |
||||
} |
||||
catch (Exception ex) |
||||
{ |
||||
return BaseError.New(ex.ToString()); |
||||
} |
||||
} |
||||
|
||||
public async Task<Either<BaseError, string>> GetReleaseNotes(string tag, CancellationToken cancellationToken) |
||||
{ |
||||
try |
||||
{ |
||||
IGitHubApi service = RestService.For<IGitHubApi>("https://api.github.com"); |
||||
return await service.GetTag(tag, cancellationToken).Map(t => t.Body); |
||||
} |
||||
catch (Exception ex) |
||||
{ |
||||
return BaseError.New(ex.ToString()); |
||||
} |
||||
} |
||||
} |
||||
@ -1,14 +0,0 @@
@@ -1,14 +0,0 @@
|
||||
using ErsatzTV.Infrastructure.GitHub.Models; |
||||
using Refit; |
||||
|
||||
namespace ErsatzTV.Infrastructure.GitHub; |
||||
|
||||
[Headers("Accept: application/vnd.github.v3+json", "User-Agent: ErsatzTV/ErsatzTV")] |
||||
public interface IGitHubApi |
||||
{ |
||||
[Get("/repos/ErsatzTV/ErsatzTV/releases")] |
||||
Task<List<GitHubTag>> GetReleases(CancellationToken cancellationToken); |
||||
|
||||
[Get("/repos/ErsatzTV/ErsatzTV/releases/tags/{tag}")] |
||||
Task<GitHubTag> GetTag(string tag, CancellationToken cancellationToken); |
||||
} |
||||
@ -1,6 +0,0 @@
@@ -1,6 +0,0 @@
|
||||
namespace ErsatzTV.Infrastructure.GitHub.Models; |
||||
|
||||
public class GitHubTag |
||||
{ |
||||
public string Body { get; set; } |
||||
} |
||||
@ -1,69 +0,0 @@
@@ -1,69 +0,0 @@
|
||||
using Ganss.Xss; |
||||
using Markdig; |
||||
using Microsoft.AspNetCore.Components; |
||||
using Microsoft.JSInterop; |
||||
|
||||
namespace ErsatzTV.Shared; |
||||
|
||||
public partial class MarkdownView |
||||
{ |
||||
private MarkupString? _markupContent; |
||||
|
||||
[Inject] |
||||
public IHtmlSanitizer HtmlSanitizer { get; set; } |
||||
|
||||
[Inject] |
||||
public IJSRuntime JsRuntime { get; set; } |
||||
|
||||
[Parameter] |
||||
public string Content { get; set; } |
||||
|
||||
public MarkupString? HtmlContent |
||||
{ |
||||
get |
||||
{ |
||||
if (string.IsNullOrWhiteSpace(Content)) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
return _markupContent ?? (_markupContent = ConvertStringToMarkupString(Content)).Value; |
||||
} |
||||
} |
||||
|
||||
private MarkupString ConvertStringToMarkupString(string value) |
||||
{ |
||||
if (!string.IsNullOrWhiteSpace(value)) |
||||
{ |
||||
// Convert markdown string to HTML
|
||||
string html = Markdown.ToHtml( |
||||
value, |
||||
new MarkdownPipelineBuilder() |
||||
.UseAdvancedExtensions() |
||||
.UseSoftlineBreakAsHardlineBreak() |
||||
.Build()); |
||||
|
||||
// Sanitize HTML before rendering
|
||||
string sanitizedHtml = HtmlSanitizer.Sanitize(html); |
||||
|
||||
// Return sanitized HTML as a MarkupString that Blazor can render
|
||||
return new MarkupString(sanitizedHtml); |
||||
} |
||||
|
||||
return new MarkupString(); |
||||
} |
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender) |
||||
{ |
||||
try |
||||
{ |
||||
await JsRuntime.InvokeVoidAsync("styleMarkdown"); |
||||
} |
||||
catch (Exception) |
||||
{ |
||||
// ignored
|
||||
} |
||||
|
||||
await base.OnAfterRenderAsync(true); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue