Initial commit
This commit is contained in:
commit
5d5ec9253b
|
|
@ -0,0 +1,37 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30011.22
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blog3000.Shared", "Blog3000\Shared\Blog3000.Shared.csproj", "{63465B40-6DB2-4AD4-87FD-E36285CBA87B}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blog3000.Server", "Blog3000\Server\Blog3000.Server.csproj", "{BE0FC579-82AD-4E9D-A417-BE093F05CB50}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blog3000.Client", "Blog3000\Client\Blog3000.Client.csproj", "{3BD237CB-928A-4611-8B00-0EBD0A79E9A0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{63465B40-6DB2-4AD4-87FD-E36285CBA87B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{63465B40-6DB2-4AD4-87FD-E36285CBA87B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{63465B40-6DB2-4AD4-87FD-E36285CBA87B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{63465B40-6DB2-4AD4-87FD-E36285CBA87B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BE0FC579-82AD-4E9D-A417-BE093F05CB50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BE0FC579-82AD-4E9D-A417-BE093F05CB50}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BE0FC579-82AD-4E9D-A417-BE093F05CB50}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BE0FC579-82AD-4E9D-A417-BE093F05CB50}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3BD237CB-928A-4611-8B00-0EBD0A79E9A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3BD237CB-928A-4611-8B00-0EBD0A79E9A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3BD237CB-928A-4611-8B00-0EBD0A79E9A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3BD237CB-928A-4611-8B00-0EBD0A79E9A0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {585CF7CC-6E5D-44AA-8DA1-E10C11A8479D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<Router AppAssembly="@typeof(Program).Assembly">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p>Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<RazorLangVersion>3.0</RazorLangVersion>
|
||||
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
|
||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||
<PackageId>Blog3000.Client</PackageId>
|
||||
<Authors>Blog3000.Client</Authors>
|
||||
<Product>Blog3000.Client</Product>
|
||||
|
||||
<ServiceWorkerCacheVersion>1</ServiceWorkerCacheVersion>
|
||||
<ServiceWorkerForce>true</ServiceWorkerForce>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Resources\**" />
|
||||
<Content Remove="Resources\**" />
|
||||
<EmbeddedResource Remove="Resources\**" />
|
||||
<None Remove="Resources\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Services\BlogDb.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="3.0.0" />
|
||||
<PackageReference Include="Markdig" Version="0.20.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.1" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.1" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.2.0-preview2.20160.5" />
|
||||
<PackageReference Include="System.Linq.Async" Version="4.1.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Shared\Blog3000.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- When publishing, swap service-worker.published.js in place of service-worker.js -->
|
||||
<ItemGroup Condition="'$(DesignTimeBuild)' != 'true'">
|
||||
<Content Remove="wwwroot\service-worker.js" />
|
||||
<Content Update="wwwroot\service-worker.published.js" Link="wwwroot\service-worker.js" />
|
||||
</ItemGroup>
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
<Exec Command="cmd.exe /c echo namespace Blog3000.Client { > "$(ProjectDir)\BuildVersion.cs"
cmd.exe /c echo public static class BuildVersion { >> "$(ProjectDir)\BuildVersion.cs"
cmd.exe /c echo public static string BUILD_DATE="%25date%25 %25time%25"; >> "$(ProjectDir)\BuildVersion.cs"
cmd.exe /c echo } }>> "$(ProjectDir)\BuildVersion.cs"" />
|
||||
</Target>
|
||||
<ProjectExtensions><VisualStudio><UserProperties wwwroot_4manifest_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ActiveDebugProfile>Blog3000</ActiveDebugProfile>
|
||||
<ShowAllFiles>false</ShowAllFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
namespace Blog3000.Client {
|
||||
public static class BuildVersion {
|
||||
public static string BUILD_DATE="03.10.2020 20:24:05,60";
|
||||
} }
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Blog3000.Client
|
||||
{
|
||||
public class MainConfig
|
||||
{
|
||||
public string Title { get; set; }
|
||||
|
||||
public string DefaultMailAddress { get; set; }
|
||||
|
||||
public string[] TopTopics { get; set; }
|
||||
|
||||
public Dictionary<string, string> SocialLinks { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
@page "/counterXXXX"
|
||||
|
||||
<h1>Counter</h1>
|
||||
|
||||
<p>Current count: @currentCount</p>
|
||||
|
||||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
|
||||
|
||||
@code {
|
||||
private int currentCount = 0;
|
||||
|
||||
private void IncrementCount()
|
||||
{
|
||||
currentCount++;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
@page "/"
|
||||
@using Blog3000.Shared
|
||||
|
||||
|
||||
<PostFinder @ref="postFinder" />
|
||||
|
||||
<div class="top-topics index-page">
|
||||
<hr />
|
||||
<TopTopics OnTopicClick="TopicClickHandler" />
|
||||
</div>
|
||||
|
||||
|
||||
<div class="topic-cloud index-page">
|
||||
<hr />
|
||||
<TopicCloud OnTopicClick="TopicClickHandler"/>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Blog3000.Client.Shared;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Blog3000.Client.Pages
|
||||
{
|
||||
public partial class Index
|
||||
{
|
||||
|
||||
[Parameter]
|
||||
public int StartIdx {get;set ;}
|
||||
|
||||
private PostFinder postFinder;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void TopicClickHandler(string topic)
|
||||
{
|
||||
//System.Diagnostics.Debug.WriteLine($"Got {topic} ");
|
||||
postFinder.StartSearch(topic);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
@page "/PublicDl/{Filename}"
|
||||
@inject IJSRuntime jsRuntime
|
||||
|
||||
<div>
|
||||
@if (FinalUrl == null) {
|
||||
<h3>Preparing @Filename...</h3>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h3>Downloading <a href="@FinalUrl">@Filename</a> ...</h3>
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Blog3000.Client.Pages
|
||||
{
|
||||
public partial class PublicDl
|
||||
{
|
||||
|
||||
/* Download within the url-space the blog
|
||||
* Authors can Download from /PublicDl/myfile
|
||||
* Server will be asked for actual url and the
|
||||
* and the download will be initiated from this url.
|
||||
* Server may anonymously count downloads, or create
|
||||
* one-time-urls for protected DLs.
|
||||
* Download-counting could be readlized with <a href.... ping=myserver" as well
|
||||
*
|
||||
* The download-server should have another domain than the blog currently,
|
||||
* since otherwise the blogs router may take over and display a not found.
|
||||
*
|
||||
* Otherwise we would need a own javascript based downloader, which may
|
||||
* be excessive work currently
|
||||
*
|
||||
*/
|
||||
|
||||
[Parameter]
|
||||
public string Filename
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string FinalUrl;
|
||||
|
||||
[Inject]
|
||||
private HttpClient HttpClient { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
FinalUrl = await HttpClient.GetStringAsync($"PublicDl/{Filename}/getredirurl");
|
||||
this.StateHasChanged();
|
||||
|
||||
await jsRuntime.InvokeVoidAsync("downloadURI", $"{FinalUrl}", ""); ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
@page "/viewer/{Id}"
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>@CurrentPost?.Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="viewer">
|
||||
<h1>@CurrentPost?.Title </h1>
|
||||
@if (CurrentPost?.Abstract != null)
|
||||
{
|
||||
<hr />
|
||||
<i>Abstract: @CurrentPost?.Abstract</i>
|
||||
<hr />
|
||||
}
|
||||
@if (CurrentPost == null)
|
||||
{
|
||||
<p>@Status...</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MarkdownViewer Markdown="@CurrentPost.Text" ImgRefRewriter="@imgRefRewriter" />
|
||||
}
|
||||
<hr />
|
||||
@{
|
||||
var x = CurrentPost?.Revisions?.LastOrDefault();
|
||||
var ca = x?.ChangedAt.ToString() ?? "Unknown";
|
||||
}
|
||||
<div>
|
||||
@if (@viewCount > 25)
|
||||
{
|
||||
<span>Last update: @ca UTC by @x?.Author (@x?.Description), ~@viewCount view(s)</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>Last update: @ca UTC by @x?.Author (@x?.Description)</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using Blog3000.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Blog3000.Client.Pages
|
||||
{
|
||||
public partial class Viewer: IDisposable
|
||||
{
|
||||
|
||||
|
||||
|
||||
[Parameter]
|
||||
public string Id
|
||||
{
|
||||
get { return _id; }
|
||||
set
|
||||
{
|
||||
if (_id != value)
|
||||
{
|
||||
_id = value;
|
||||
idChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
private string _id;
|
||||
|
||||
[Inject]
|
||||
private BlogDb BlogDb { get; set; }
|
||||
|
||||
|
||||
[Inject]
|
||||
private ViewStats ViewStats { get; set; }
|
||||
|
||||
private BlogPost CurrentPost { get; set; }
|
||||
|
||||
private string Status { get; set; }
|
||||
|
||||
private int viewCount = 0;
|
||||
|
||||
private event EventHandler idChanged;
|
||||
|
||||
private Shared.MarkdownViewer.ImgRefRewriterDelegate imgRefRewriter;
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
idChanged -= Viewer_idChanged;
|
||||
}
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await RefreshData();
|
||||
idChanged += Viewer_idChanged;
|
||||
}
|
||||
|
||||
|
||||
private async void Viewer_idChanged(object sender, EventArgs e)
|
||||
{
|
||||
await RefreshData();
|
||||
this.StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task RefreshData() {
|
||||
imgRefRewriter = (a, b) => {
|
||||
System.Diagnostics.Debug.WriteLine($"Rewrting {a}/{b}");
|
||||
try
|
||||
{
|
||||
//var s = blogDb.FetchImage(Id, a);
|
||||
//return "data:image/jpeg;base64, " + s;
|
||||
return $"BlogPosts/{Id}/imgref/{a}";
|
||||
}
|
||||
catch(IOException ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"Error rewriting url {a}/{b}", ex);
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
||||
Status = "Loading...";
|
||||
var (post, res) = await BlogDb.GetCachedPostAsync(Id, true, true);
|
||||
|
||||
if (res == BlogDb.FetchStatus.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
viewCount = await ViewStats.GetPostViewCount(Id);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"Can't get viewCount: ${ex.ToString()}");
|
||||
viewCount = -1;
|
||||
|
||||
}
|
||||
|
||||
_ = ViewStats.AddPostView(Id);
|
||||
|
||||
CurrentPost = post;
|
||||
Status = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentPost = null;
|
||||
Status = res switch
|
||||
{
|
||||
BlogDb.FetchStatus.NotFound => "Not found",
|
||||
BlogDb.FetchStatus.NetError => "network error",
|
||||
BlogDb.FetchStatus.Offline => "not cached local and network offline",
|
||||
_ => "Unknown error"
|
||||
};
|
||||
Status = "Cannot view requested document: " + Status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Blazored.LocalStorage;
|
||||
using Ganss.XSS;
|
||||
using Blog3000.Client.Services;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace Blog3000.Client
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
builder.RootComponents.Add<App>("app");
|
||||
|
||||
builder.Services.AddScoped<HttpClient, HttpClient>(x => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
|
||||
builder.Services.AddBlazoredLocalStorage();
|
||||
|
||||
builder.Services.AddScoped<IHtmlSanitizer, HtmlSanitizer>(x =>
|
||||
{
|
||||
var s = new HtmlSanitizer();
|
||||
s.AllowedAttributes.Add("class");
|
||||
return s;
|
||||
});
|
||||
|
||||
builder.Services.AddScoped<NetworkStatus>();
|
||||
builder.Services.AddScoped<ImgCacheStorage>();
|
||||
builder.Services.AddScoped<Config>();
|
||||
builder.Services.AddScoped<BlogDb>();
|
||||
builder.Services.AddScoped<ViewStats>();
|
||||
|
||||
|
||||
await builder.Build().RunAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:57461",
|
||||
"sslPort": 44396
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"Blog3000": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "--allow-search-devbot --visible-url-prefix=https://localhost:5001 --public-dl-uri=https://cdn.mh3000.net/blogdl",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:5001;http://localhost:5000"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,430 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using Blazored.LocalStorage;
|
||||
using Blog3000.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using Markdig.Extensions.Tables;
|
||||
using Blog3000.Client.Services;
|
||||
using System.Security.Cryptography;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Blog3000.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// TODO: Add all localStorage Ops regarding BlogsPosts here
|
||||
/// - Updater
|
||||
/// - Topic-Fetcher
|
||||
/// - ...
|
||||
/// </summary>
|
||||
public class BlogDb: IDisposable
|
||||
{
|
||||
public static string DBKEY_PREFIX_HDR = "blogdbhdr-";
|
||||
public static string DBKEY_PREFIX_CONF = "blogdbconf-";
|
||||
public static string DBKEY_PREFIX_BLOGCACHE = "blogcache-";
|
||||
public static string DBKEY_PREFIX_IMGCACHE = "imgcached-";
|
||||
|
||||
public event EventHandler BlogPostsChanged;
|
||||
|
||||
private readonly ILocalStorageService localStorage;
|
||||
private readonly ISyncLocalStorageService syncLocalStorage;
|
||||
private readonly NetworkStatus networkStatus;
|
||||
private readonly HttpClient httpClient;
|
||||
private readonly ImgCacheStorage cache;
|
||||
|
||||
|
||||
|
||||
public BlogDb(ILocalStorageService ls, ISyncLocalStorageService sls, ImgCacheStorage cache, NetworkStatus ns, HttpClient http)
|
||||
{
|
||||
this.localStorage = ls;
|
||||
this.syncLocalStorage = sls;
|
||||
this.networkStatus = ns;
|
||||
this.cache = cache;
|
||||
this.httpClient = http;
|
||||
|
||||
localStorage.Changed += LocalStorage_Changed;
|
||||
}
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
localStorage.Changed -= LocalStorage_Changed;
|
||||
}
|
||||
|
||||
|
||||
public enum FetchStatus
|
||||
{
|
||||
OK,
|
||||
NotFound,
|
||||
NetError,
|
||||
Offline
|
||||
}
|
||||
|
||||
|
||||
|
||||
private bool? _isEagerLoading = null;
|
||||
|
||||
public async Task<bool> IsEagerLoading()
|
||||
{
|
||||
if (_isEagerLoading != null) return _isEagerLoading == true;
|
||||
_isEagerLoading = await localStorage.GetItemAsync<bool?>($"{DBKEY_PREFIX_CONF}IsEagerLoading") == true;
|
||||
return _isEagerLoading == true;
|
||||
}
|
||||
|
||||
|
||||
public void SetEagerLoading(bool enabled)
|
||||
{
|
||||
_isEagerLoading = enabled;
|
||||
localStorage.SetItemAsync<bool?>($"{DBKEY_PREFIX_CONF}IsEagerLoading", enabled);
|
||||
}
|
||||
|
||||
|
||||
public async Task<bool> AreImagesCached(string postId)
|
||||
{
|
||||
var imgsLoaded = await localStorage.GetItemAsync<bool?>($"{DBKEY_PREFIX_IMGCACHE}{postId}");
|
||||
|
||||
if (imgsLoaded != null && true == imgsLoaded)
|
||||
{
|
||||
// Seems to have loaded once, check if still in cache
|
||||
var bh = await GetHeaderAsync(postId);
|
||||
if (bh == null) return false; // Should not occur but in case
|
||||
if (bh.ImageRefs != null) {
|
||||
var urls = new List<string>();
|
||||
foreach (var img in bh.ImageRefs)
|
||||
{
|
||||
// Images are cached by their id
|
||||
var url = $"BlogPosts/{postId}/imgref/{img.Key}";
|
||||
urls.Add(url);
|
||||
}
|
||||
var s = await cache.AreCached(urls.ToArray());
|
||||
System.Diagnostics.Debug.WriteLine($"ImageCacheCheck: Found {s} for {postId}");
|
||||
// Not in cache (anymore)?
|
||||
if (!s) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get headers of all posts available (previously copied to localStorage)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async IAsyncEnumerable<BlogPostHeader> GetHeadersAsync()
|
||||
{
|
||||
var res = await localStorage.GetItemAsync<List<BlogPostHeader>>(BlogDb.DBKEY_PREFIX_HDR + "remotePosts");
|
||||
if (res != null)
|
||||
{
|
||||
foreach (var b in res)
|
||||
{
|
||||
yield return b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get a header of posts available (previously copied to localStorage)
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<BlogPostHeader> GetHeaderAsync(string id)
|
||||
{
|
||||
if (id != null)
|
||||
{
|
||||
var res = await localStorage.GetItemAsync<List<BlogPostHeader>>(BlogDb.DBKEY_PREFIX_HDR + "remotePosts");
|
||||
if (res != null)
|
||||
{
|
||||
foreach (var b in res)
|
||||
{
|
||||
if (id.Equals(b.Id)) return b;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get headers from locally cached posts
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async IAsyncEnumerable<BlogPostHeader> GetHeadersFromCachedPostsAsync()
|
||||
{
|
||||
int n = await localStorage.LengthAsync();
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
var key = await localStorage.KeyAsync(i);
|
||||
if (key != null && key.StartsWith(BlogDb.DBKEY_PREFIX_BLOGCACHE))
|
||||
{
|
||||
var bpt = await localStorage.GetItemAsync<BlogPost>(key);
|
||||
if (bpt != null)
|
||||
{
|
||||
var bp = bpt.ToBlogPost();
|
||||
yield return bp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get a locally cached post. Optionally fetch images from remote. Optionally fetch post from remote.
|
||||
/// </summary>
|
||||
/// <param name="postId"></param>
|
||||
/// <param name="tryCacheImgs"></param>
|
||||
/// <param name="tryRemote">when true try loading uncached post, or in non-eager-loading mode refresh cached post, which has been changed TBD!! </param>
|
||||
/// <returns></returns>
|
||||
public async Task<(BlogPost, FetchStatus)> GetCachedPostAsync(string postId, bool tryCacheImgs, bool tryRemote = false)
|
||||
{
|
||||
var res = await localStorage.GetItemAsync<BlogPost>($"{DBKEY_PREFIX_BLOGCACHE}{postId}");
|
||||
bool needsSync = false;
|
||||
|
||||
if (!(await IsEagerLoading()) && tryRemote && res != null && networkStatus.IsOnline /* makes no sense if offline */)
|
||||
{
|
||||
var bph = await GetHeaderAsync(postId);
|
||||
if (bph != null)
|
||||
{
|
||||
if (! String.Equals(bph.Checksum, res.Checksum))
|
||||
{
|
||||
// Invalidate the result
|
||||
System.Diagnostics.Debug.WriteLine("Post has been changed, and not refresh via auto-eagerloading, so forceing sync");
|
||||
needsSync = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!needsSync)
|
||||
{
|
||||
//
|
||||
// This check is only needed, when the post is cached, since syncing
|
||||
// includeds the images anyway if tryCacheImgs==true
|
||||
//
|
||||
var imgsLoaded = await AreImagesCached(postId);
|
||||
if (!imgsLoaded && tryCacheImgs)
|
||||
{
|
||||
if (networkStatus.IsOnline)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("Images not chached, forcing sync");
|
||||
needsSync = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("Images not chached, but offline, so not forcing sync");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var status = FetchStatus.OK;
|
||||
|
||||
if (needsSync || res == null)
|
||||
{
|
||||
if (!tryRemote)
|
||||
{
|
||||
status = FetchStatus.NotFound;
|
||||
}
|
||||
else
|
||||
{
|
||||
var (sb, sres) = await SyncPost(postId, tryCacheImgs, false);
|
||||
switch (sres)
|
||||
{
|
||||
case SyncStatus.OK: res = sb; break;
|
||||
case SyncStatus.NetError: status = FetchStatus.NetError; break;
|
||||
case SyncStatus.Offline: status = FetchStatus.Offline; break;
|
||||
case SyncStatus.NotFound: status = FetchStatus.NotFound; break;
|
||||
default:
|
||||
throw new InvalidOperationException("unknown result");
|
||||
}
|
||||
|
||||
if (status == FetchStatus.NotFound)
|
||||
{
|
||||
// When remote say not-found, ensure we won't handout cached data anymore
|
||||
res = null;
|
||||
}
|
||||
else if (status != FetchStatus.OK && res != null)
|
||||
{
|
||||
// We can use the cached version, so return a Offline-Status event in Net-Error-case
|
||||
status = FetchStatus.Offline;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (res, status);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get locally cached posts withText
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async IAsyncEnumerable<BlogPost> GetCachedPostsAsync()
|
||||
{
|
||||
int n = await localStorage.LengthAsync();
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
var key = await localStorage.KeyAsync(i);
|
||||
if (key != null && key.StartsWith(BlogDb.DBKEY_PREFIX_BLOGCACHE))
|
||||
{
|
||||
var bpt = await localStorage.GetItemAsync<BlogPost>(key);
|
||||
yield return bpt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public enum SyncStatus
|
||||
{
|
||||
OK,
|
||||
Offline,
|
||||
NotFound,
|
||||
NetError
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sync a remote post with the local cache
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="includeImgs"></param>
|
||||
/// <param name="removeOld"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<(BlogPost, SyncStatus)> SyncPost(string id, bool includeImgs, bool removeOld=true)
|
||||
{
|
||||
var status = SyncStatus.OK;
|
||||
BlogPost res = null;
|
||||
|
||||
if (networkStatus.IsOnline)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (removeOld)
|
||||
{
|
||||
//var oldPost = await localStorage.GetItemAsync<BlogPostWithText>($"{DBKEY_PREFIX}{id}");
|
||||
//if (oldPost != null)
|
||||
//{
|
||||
|
||||
// if (oldPost.ImageRefs != null)
|
||||
// {
|
||||
// foreach (var k in oldPost.ImageRefs.Keys)
|
||||
// {
|
||||
// await localStorage.RemoveItemAsync($"{DBKEY_IMG_PREFIX}{id}-{k}");
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
var urls = await cache.MatchAll($"BlogPosts/{id}/imgref");
|
||||
if (urls != null)
|
||||
{
|
||||
foreach (var u in urls)
|
||||
{
|
||||
await cache.Delete(u);
|
||||
}
|
||||
}
|
||||
await Task.Yield();
|
||||
await localStorage.RemoveItemAsync($"{DBKEY_PREFIX_IMGCACHE}{id}");
|
||||
await localStorage.RemoveItemAsync($"{DBKEY_PREFIX_BLOGCACHE}{id}");
|
||||
}
|
||||
|
||||
System.Diagnostics.Debug.WriteLine($"Syncing post {id}");
|
||||
var newPost = await httpClient.GetJsonAsync<BlogPost>($"BlogPosts/{id}");
|
||||
await Task.Yield(); // Any effect after non-localhost-network-awaits?
|
||||
if (newPost != null)
|
||||
{
|
||||
if (includeImgs)
|
||||
{
|
||||
if ((newPost.ImageRefs?.Count ?? 0) > 0)
|
||||
{
|
||||
|
||||
//foreach (var k in newPost.ImageRefs.Keys)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// System.Diagnostics.Debug.WriteLine($"Fetching {k} for {id}");
|
||||
// var f = await httpClient.GetByteArrayAsync($"BlogPosts/{id}/imgref/{k}");
|
||||
// await localStorage.SetItemAsync($"{BlogDb.DBKEY_IMG_PREFIX}{id}-{k}", f);
|
||||
// }
|
||||
// catch (HttpRequestException ex)
|
||||
// {
|
||||
// System.Diagnostics.Debug.WriteLine($"BlogPosts: error fetching img {ex.GetStatusCode()} from remote");
|
||||
// }
|
||||
//}
|
||||
|
||||
var urls = new List<string>();
|
||||
foreach (var k in newPost.ImageRefs.Keys)
|
||||
{
|
||||
var u = $"BlogPosts/{id}/imgref/{k}";
|
||||
urls.Add(u);
|
||||
}
|
||||
System.Diagnostics.Debug.WriteLine($"BlogPosts: caching {urls.Count} imgs from remote... ");
|
||||
await cache.AddAll(urls.ToArray());
|
||||
await Task.Yield();
|
||||
System.Diagnostics.Debug.WriteLine($".... done");
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"BlogPosts: no images to cache done");
|
||||
}
|
||||
await localStorage.SetItemAsync($"{BlogDb.DBKEY_PREFIX_IMGCACHE}{id}", true);
|
||||
}
|
||||
|
||||
await localStorage.SetItemAsync(BlogDb.DBKEY_PREFIX_BLOGCACHE + id, newPost);
|
||||
System.Diagnostics.Debug.WriteLine($"BlogPosts: fetched {id} from remote");
|
||||
res= newPost;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = SyncStatus.NotFound;
|
||||
}
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"BlogPosts: error fetching {ex.GetStatusCode()} from remote");
|
||||
// TODO: Find better way to extract statuscode
|
||||
if (("" + ex.ToString()).Contains("404")) status = SyncStatus.NotFound;
|
||||
else status = SyncStatus.NetError;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = SyncStatus.Offline;
|
||||
}
|
||||
|
||||
return (res, status);
|
||||
}
|
||||
|
||||
|
||||
private void LocalStorage_Changed(object sender, ChangedEventArgs e)
|
||||
{
|
||||
// Notify if a cached posts were changed
|
||||
if (e.Key.StartsWith(BlogDb.DBKEY_PREFIX_BLOGCACHE)) Task.Run(() => {
|
||||
System.Diagnostics.Debug.WriteLine("LocalStorage CachedPosts updated event -> emitting blogDbChanged Event");
|
||||
BlogPostsChanged?.Invoke(this, EventArgs.Empty);
|
||||
});
|
||||
|
||||
|
||||
// Notify if header-list was changed
|
||||
if (e.Key.StartsWith(BlogDb.DBKEY_PREFIX_HDR)) Task.Run(() =>
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("LocalStorage Headers updated event -> emitting blogDbChanged Event");
|
||||
BlogPostsChanged?.Invoke(this, EventArgs.Empty);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
using Microsoft.JSInterop;
|
||||
using Blog3000.Client.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Blog3000.Client
|
||||
{
|
||||
public abstract class CacheStorage
|
||||
{
|
||||
private readonly string cacheId;
|
||||
private readonly IJSRuntime jsRuntime;
|
||||
private Task<bool> initedTask;
|
||||
|
||||
|
||||
public CacheStorage(IJSRuntime jsRuntime)
|
||||
{
|
||||
this.jsRuntime = jsRuntime;
|
||||
this.cacheId = GetCacheId();
|
||||
|
||||
initedTask = jsRuntime.InvokePromise<bool>($"MyCacheStorage.Create", new object[] { cacheId });
|
||||
System.Diagnostics.Debug.WriteLine("CacheStorage init started");
|
||||
}
|
||||
|
||||
|
||||
public async Task Add(string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
await initedTask;
|
||||
await Task.Yield(); // Migitate 'Entry not found' problem?
|
||||
await jsRuntime.InvokePromiseAsync<bool>($"{cacheId}.Add", url);
|
||||
System.Diagnostics.Debug.WriteLine("Cache.Add done");
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
if (!ex.ToString().Contains("Entry was not found"))
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
else System.Diagnostics.Debug.WriteLine("Cache.Add: Ignoring Entry not found problem!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task AddAll(string[] urls)
|
||||
{
|
||||
// Work around bug in edge erroreneuosly reporting "Entry was not found" sometimge
|
||||
// although successful, Therefore we must request each file single
|
||||
|
||||
foreach (var u in urls)
|
||||
{
|
||||
await Task.Yield();
|
||||
await Add(u);
|
||||
}
|
||||
|
||||
//await Task.Yield();
|
||||
//await jsRuntime.InvokePromiseAsync<bool>($"{cacheId}.AddAll", urls);
|
||||
//System.Diagnostics.Debug.WriteLine("Cache.AddAll done");
|
||||
|
||||
}
|
||||
|
||||
|
||||
public async Task Delete(string url)
|
||||
{
|
||||
await initedTask;
|
||||
await jsRuntime.InvokePromiseAsync<bool>($"{cacheId}.Delete", url);
|
||||
System.Diagnostics.Debug.WriteLine("Cache.Delete done");
|
||||
}
|
||||
|
||||
|
||||
public async Task<bool> AreCached(string[] filters)
|
||||
{
|
||||
await initedTask;
|
||||
var res = await jsRuntime.InvokePromiseAsync<bool>($"{cacheId}.AreCached", filters);
|
||||
System.Diagnostics.Debug.WriteLine($"Cache.AreCached {res} done");
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<string[]> MatchAll(string filter)
|
||||
{
|
||||
await initedTask;
|
||||
var res = await jsRuntime.InvokePromiseAsync<string[]>($"{cacheId}.MatchAll", filter);
|
||||
System.Diagnostics.Debug.WriteLine($"Cache.MatchAll {res?.Length ?? -1} done");
|
||||
return res;
|
||||
}
|
||||
|
||||
protected abstract string GetCacheId();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using Blazored.LocalStorage;
|
||||
using Blog3000.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Blog3000.Client
|
||||
{
|
||||
|
||||
public class Config: IDisposable
|
||||
{
|
||||
public static string DBKEY_PREFIX="config-";
|
||||
|
||||
public MainConfig Main { get; private set; }
|
||||
|
||||
public event EventHandler ConfigChanged;
|
||||
|
||||
private readonly NetworkStatus networkStatus;
|
||||
private readonly ILocalStorageService localStorage;
|
||||
private readonly HttpClient httpClient;
|
||||
|
||||
private bool configLoadedOnce = false;
|
||||
|
||||
public Config(ILocalStorageService ls, NetworkStatus networkStatus, HttpClient http)
|
||||
{
|
||||
this.localStorage = ls;
|
||||
this.networkStatus = networkStatus;
|
||||
this.httpClient = http;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
networkStatus.StatusChanged -= NetworkStatus_StatusChanged;
|
||||
}
|
||||
|
||||
|
||||
public async Task FetchAsync()
|
||||
{
|
||||
var config = await localStorage.GetItemAsync<MainConfig>($"{DBKEY_PREFIX}main.json");
|
||||
if (config == null)
|
||||
{
|
||||
await ReloadConfigFromRemote();
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("Using cached config");
|
||||
Main = config;
|
||||
ConfigChanged?.Invoke(this, EventArgs.Empty);
|
||||
configLoadedOnce = false;
|
||||
_ = ReloadConfigFromRemote();
|
||||
}
|
||||
|
||||
if (Main == null) throw new Exception("Can't load config");
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void NetworkStatus_StatusChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!configLoadedOnce && networkStatus.IsOnline)
|
||||
{
|
||||
// Ensure config will be reloaded event when started offline!
|
||||
_ = ReloadConfigFromRemote();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async Task ReloadConfigFromRemote()
|
||||
{
|
||||
if (networkStatus.IsOnline)
|
||||
{
|
||||
var json = await httpClient.GetStringAsync("config.json?" + DateTime.Now.Ticks);
|
||||
//Log += json;
|
||||
if (String.IsNullOrEmpty(json)) throw new Exception("Can't load config from server");
|
||||
|
||||
var res = System.Text.Json.JsonSerializer.Deserialize<MainConfig>(json, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true });
|
||||
await localStorage.SetItemAsync($"{DBKEY_PREFIX}main.json", res);
|
||||
Main = res;
|
||||
configLoadedOnce = true;
|
||||
ConfigChanged?.Invoke(this, EventArgs.Empty);
|
||||
System.Diagnostics.Debug.WriteLine($"Config reloaded from server");
|
||||
//System.Diagnostics.Debug.WriteLine(res.Title);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("Config not reloading, offline");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Transactions;
|
||||
|
||||
namespace Blog3000.Client.Services
|
||||
{
|
||||
public class ImgCacheStorage : CacheStorage
|
||||
{
|
||||
public ImgCacheStorage(IJSRuntime j) : base(j) { }
|
||||
|
||||
protected override string GetCacheId() => "ImgCache";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Blog3000.Client
|
||||
{
|
||||
public class NetworkStatus
|
||||
{
|
||||
public event EventHandler StatusChanged;
|
||||
|
||||
|
||||
public NetworkStatus(IJSRuntime jsRuntime)
|
||||
=> jsRuntime.InvokeVoidAsync("Network.Init", DotNetObjectReference.Create(this));
|
||||
|
||||
|
||||
[JSInvokable("Network.StatusChanged")]
|
||||
public void OnStatusChanged(bool isOnline)
|
||||
{
|
||||
if (IsOnline != isOnline)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"New net state ${isOnline}");
|
||||
IsOnline = isOnline;
|
||||
StatusChanged ?.Invoke(this,EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool IsOnline { get; protected set; } = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using Blazored.LocalStorage;
|
||||
using Blog3000.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using Markdig.Extensions.Tables;
|
||||
using Blog3000.Client.Services;
|
||||
using System.Security.Cryptography;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Net.Security;
|
||||
|
||||
namespace Blog3000.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// TODO: Add all localStorage Ops regarding BlogsPosts here
|
||||
/// - Updater
|
||||
/// - Topic-Fetcher
|
||||
/// - ...
|
||||
/// </summary>
|
||||
public class ViewStats : IDisposable
|
||||
{
|
||||
public static string DBKEY_PREFIX = "viewstats-";
|
||||
|
||||
private readonly ILocalStorageService localStorage;
|
||||
private readonly NetworkStatus networkStatus;
|
||||
private readonly HttpClient httpClient;
|
||||
|
||||
public ViewStats(ILocalStorageService ls, NetworkStatus ns, HttpClient http)
|
||||
{
|
||||
this.localStorage = ls;
|
||||
this.networkStatus = ns;
|
||||
this.httpClient = http;
|
||||
|
||||
localStorage.Changed += LocalStorage_Changed;
|
||||
}
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
localStorage.Changed -= LocalStorage_Changed;
|
||||
}
|
||||
|
||||
|
||||
public async Task AddPostView(string postId)
|
||||
{
|
||||
var unsentStats = await localStorage.GetItemAsync<Dictionary<string, int>>($"{DBKEY_PREFIX}local");
|
||||
unsentStats ??= new Dictionary<string, int>();
|
||||
unsentStats.Remove(postId);
|
||||
unsentStats.Add(postId, 1);
|
||||
await localStorage.SetItemAsync($"{DBKEY_PREFIX}local", unsentStats);
|
||||
_ = SyncViewStats();
|
||||
}
|
||||
|
||||
public async Task<int> GetPostViewCount(string postId)
|
||||
{
|
||||
var remoteStats = await localStorage.GetItemAsync<Dictionary<string, int>>($"{DBKEY_PREFIX}remote");
|
||||
var unsentStats = await localStorage.GetItemAsync<Dictionary<string, int>>($"{DBKEY_PREFIX}local");
|
||||
|
||||
int remoteCount = 0;
|
||||
remoteStats?.TryGetValue(postId, out remoteCount);
|
||||
int localCount = 0;
|
||||
unsentStats?.TryGetValue(postId, out localCount);
|
||||
|
||||
return localCount + remoteCount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetch a locally cached post. Optionally fetch images from remote. Optionally fetch post from remote.
|
||||
/// </summary>
|
||||
/// <param name="postId"></param>
|
||||
/// <param name="tryCacheImgs"></param>
|
||||
/// <param name="tryRemote"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> SyncViewStats()
|
||||
{
|
||||
if (!networkStatus.IsOnline)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("SyncViewStats: Offline, not syncing");
|
||||
return false;
|
||||
}
|
||||
|
||||
var unsentStats = await localStorage.GetItemAsync<Dictionary<string, int>>($"{DBKEY_PREFIX}local");
|
||||
if ((unsentStats?.Count ?? 0) > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
var newData = await httpClient.PostJsonAsync<Dictionary<string, int>>($"ViewStats", unsentStats);
|
||||
await localStorage.RemoveItemAsync($"{DBKEY_PREFIX}local");
|
||||
await localStorage.SetItemAsync<Dictionary<string, int>>($"{DBKEY_PREFIX}remote", newData);
|
||||
System.Diagnostics.Debug.WriteLine("SyncViewStats: Stats synced");
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"SyncViewStats: Sync failed: {ex.ToString()}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("SyncViewStats: UnsetStats empty, not sending, only fetching");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var newData = await httpClient.GetJsonAsync<Dictionary<string, int>>($"ViewStats");
|
||||
await localStorage.SetItemAsync<Dictionary<string, int>>($"{DBKEY_PREFIX}remote", newData);
|
||||
System.Diagnostics.Debug.WriteLine("SyncViewStats: Stats fetched");
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"SyncViewStats: Fetch failed: {ex.ToString()}");
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void LocalStorage_Changed(object sender, ChangedEventArgs e)
|
||||
{
|
||||
if (e.Key.StartsWith(ViewStats.DBKEY_PREFIX)) Task.Run(() => {
|
||||
//
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
@using Blog3000.Client.Shared
|
||||
@inherits LayoutComponentBase
|
||||
@implements IDisposable
|
||||
@inject Config CurrConfig
|
||||
@inject IJSRuntime JSRuntime
|
||||
|
||||
|
||||
<div class="sidebar">
|
||||
<NavMenu />
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="main">
|
||||
<!-- div class="top-row px-4">
|
||||
<a href="http://blazor.net" target="_blank" class="ml-md-auto">About</a>
|
||||
</div-->
|
||||
<div class="updater">
|
||||
<span><Updater /></span>
|
||||
</div>
|
||||
|
||||
<div class="content px-4">
|
||||
@Body
|
||||
</div>
|
||||
<hr />
|
||||
|
||||
@if (defaultMailAddress != null)
|
||||
{
|
||||
<div class="blog-contact"><a href="@defaultMailAddress">@defaultMailAddressTxt</a></div>
|
||||
}
|
||||
<div class="blog-powered-by">Powered by blog3000 (C) M. Höß, Version 0.1 PreAlpha Build @build, powered by C#, ASP.NetCore, Blazor and Gentoo-Linux :)</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
private string build;
|
||||
private string defaultMailAddress;
|
||||
private string defaultMailAddressTxt;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
CurrConfig.ConfigChanged -= ConfigChanged;
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
build = Blog3000.Client.BuildVersion.BUILD_DATE;
|
||||
|
||||
CurrConfig.ConfigChanged += ConfigChanged;
|
||||
_ = CurrConfig.FetchAsync();
|
||||
Refresh();
|
||||
|
||||
}
|
||||
|
||||
private void ConfigChanged(object sender, EventArgs e)
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void Refresh()
|
||||
{
|
||||
defaultMailAddress = CurrConfig?.Main?.DefaultMailAddress != null ? $"mailto:{CurrConfig.Main.DefaultMailAddress}" : null;
|
||||
defaultMailAddressTxt = CurrConfig?.Main?.DefaultMailAddress != null ? $"Send a comment to {CurrConfig.Main.DefaultMailAddress}" : null;
|
||||
|
||||
if (CurrConfig?.Main?.Title != null)
|
||||
{
|
||||
JSRuntime.InvokeVoidAsync("window.setTitle", CurrConfig.Main.Title);
|
||||
}
|
||||
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
|
||||
@if (HtmlContent.Value == null)
|
||||
{
|
||||
<span>Please wait while rendering...</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<article class="markdown-body">
|
||||
@HtmlContent
|
||||
</article>
|
||||
}
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
using Ganss.XSS;
|
||||
using Markdig;
|
||||
using Markdig.Syntax;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Blog3000.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Blog3000.Client.Shared
|
||||
{
|
||||
public partial class MarkdownViewer: IDisposable
|
||||
{
|
||||
|
||||
public delegate string ImgRefRewriterDelegate(string imgKey, string currentUrl);
|
||||
|
||||
[Parameter]
|
||||
public string Markdown
|
||||
{
|
||||
get
|
||||
{
|
||||
return _markdown;
|
||||
}
|
||||
set
|
||||
{
|
||||
_markdown = value;
|
||||
MarkdownChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
private string _markdown;
|
||||
|
||||
|
||||
|
||||
[Parameter]
|
||||
public ImgRefRewriterDelegate ImgRefRewriter{ get; set; }
|
||||
|
||||
|
||||
[Inject]
|
||||
private IHtmlSanitizer htmlSanitizer { get; set; }
|
||||
|
||||
private MarkupString HtmlContent { get; set; }
|
||||
|
||||
private event EventHandler MarkdownChanged;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
MarkdownChanged -= MarkdownViewer_MarkdownChanged;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
|
||||
});
|
||||
HtmlContent = await FromMarkdown(Markdown);
|
||||
MarkdownChanged += MarkdownViewer_MarkdownChanged;
|
||||
}
|
||||
|
||||
private async void MarkdownViewer_MarkdownChanged(object sender, EventArgs e)
|
||||
{
|
||||
HtmlContent = await FromMarkdown(Markdown);
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task<MarkupString> FromMarkdown(string markdown)
|
||||
{
|
||||
var mdPipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
|
||||
|
||||
var mdoc = Markdig.Markdown.Parse(markdown, mdPipeline);
|
||||
|
||||
|
||||
Dictionary<string, string> imgGeysByUrls = null;
|
||||
if (ImgRefRewriter != null)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"*** Rewriter active");
|
||||
imgGeysByUrls ??= new Dictionary<string, string>();
|
||||
foreach (var r in mdoc.GetLinkReferenceDefinitions().Links)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"Found {r.Key} => {r.Value.Url}");
|
||||
if (r.Value != null && r.Value.Url != null)
|
||||
{
|
||||
imgGeysByUrls.Add(r.Value.Url, r.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//var html = Markdig.Markdown.ToHtml(markdown, mdPipeline);
|
||||
|
||||
var writer = new StringWriter();
|
||||
var renderer = new Markdig.Renderers.HtmlRenderer(writer);
|
||||
if (ImgRefRewriter != null)
|
||||
{
|
||||
renderer.LinkRewriter += (a) =>
|
||||
{
|
||||
string imgKey;
|
||||
if (imgGeysByUrls.TryGetValue(a, out imgKey))
|
||||
{
|
||||
return ImgRefRewriter(imgKey, a);
|
||||
}
|
||||
return a;
|
||||
};
|
||||
}
|
||||
mdPipeline.Setup(renderer);
|
||||
renderer.Render(mdoc);
|
||||
var html = writer.ToString();
|
||||
//System.Diagnostics.Debug.WriteLine(html);
|
||||
html = htmlSanitizer.Sanitize(html);
|
||||
return new MarkupString(html);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
@inject Config config
|
||||
|
||||
<div class="top-row pl-4 navbar navbar-dark">
|
||||
<a class="navbar-brand" href="">@{var t = config?.Main?.Title ?? "Blog3000 instance";}@t</a>
|
||||
|
||||
<div class="social-links">
|
||||
@if (config?.Main?.SocialLinks != null)
|
||||
{
|
||||
@foreach (var item in config.Main.SocialLinks)
|
||||
{
|
||||
<div class="social-link">
|
||||
<svg alt="More" width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-arrow-right-short" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" d="M4 8a.5.5 0 0 1 .5-.5h5.793L8.146 5.354a.5.5 0 1 1 .708-.708l3 3a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708-.708L10.293 8.5H4.5A.5.5 0 0 1 4 8z" />
|
||||
</svg><a class=".btn-link" href="@item.Value">@item.Key</a>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
<button class="navbar-toggler" @onclick="ToggleNavMenu">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
|
||||
<ul class="nav flex-column">
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
|
||||
<span class="oi oi-home" aria-hidden="true"></span> Home
|
||||
</NavLink>
|
||||
</li>
|
||||
<StickyNavLinks />
|
||||
<!-- li class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="/legal" Match="NavLinkMatch.All">
|
||||
<span class="oi oi-eject" aria-hidden="true"></span>Impressum, DSGVO
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="fetchdata">
|
||||
<span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data
|
||||
</NavLink>
|
||||
</li -->
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
|
||||
protected override void OnInitialized() {
|
||||
config.ConfigChanged += (s, e) => {
|
||||
this.StateHasChanged();
|
||||
};
|
||||
}
|
||||
|
||||
private bool collapseNavMenu = true;
|
||||
|
||||
private string NavMenuCssClass => collapseNavMenu ? "collapse" : null;
|
||||
|
||||
private void ToggleNavMenu()
|
||||
{
|
||||
collapseNavMenu = !collapseNavMenu;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
@using Blog3000.Shared;
|
||||
|
||||
|
||||
<div class="post-finder" >
|
||||
<div class="searchbox" @ref="ScrollAnchorElement">
|
||||
<input type="text" id="SearchBox" class="form-control search" maxlength="32" @bind="SearchText" placeholder="Search...">
|
||||
<button type="button" class="searchbut btn btn-primary oi oi-arrow-right" @onclick="UpdateSearch" title="Start search" />
|
||||
<button type="button" class="searchbut btn btn-primary oi oi-x" @onclick="ClearSearch" title="Clear search" />
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@if (errorMsg != null)
|
||||
{
|
||||
<div class="error-msg">@errorMsg</div>
|
||||
}
|
||||
|
||||
<div class="section-title">Showing result for: "@dispMode"</div>
|
||||
<div class="navbar">
|
||||
<button type="button" alt="First" title="Goto first result" @onclick="GotoFirst" class="first btn btn-primary oi oi-media-step-backward"></button>
|
||||
<button type="button" alt="Go back" title="Go back one page" @onclick="GotoPrev" class="second btn btn-primary oi oi-caret-left"></button>
|
||||
<span class="showing">Showing @PageInfo</span>
|
||||
<button type="button" alt="Next" title="Goto next page" @onclick="GotoNext" class="third btn btn-primary oi oi-caret-right"></button>
|
||||
</div>
|
||||
<ul>
|
||||
@foreach (var b in selectedPosts)
|
||||
{
|
||||
var x = "viewer/" + @b.Id;
|
||||
|
||||
<li style="text-wrap: none">
|
||||
|
||||
@{
|
||||
var r = b.Revisions?.Latest();
|
||||
var a = r?.Author ?? b.Author;
|
||||
var t = (r?.ChangedAt?.ToShortDateString() ?? "???")
|
||||
+ ", "
|
||||
+ (r?.ChangedAt?.ToShortTimeString() ?? "???");
|
||||
}
|
||||
|
||||
<NavLink class="nav-link" href="@x">
|
||||
@b.Title
|
||||
<abstract>@b.Abstract</abstract>
|
||||
<small>(@a, @t UTC)</small>
|
||||
</NavLink>
|
||||
|
||||
</li>
|
||||
|
||||
}
|
||||
</ul>
|
||||
<div class="navbar">
|
||||
<button type="button" alt="First" @onclick="GotoFirst" class="first btn btn-primary oi oi-media-step-backward"></button>
|
||||
<button type="button" alt="Go back" @onclick="GotoPrev" class="second btn btn-primary oi oi-caret-left"></button>
|
||||
<span class="showing">Showing @PageInfo</span>
|
||||
<button type="button" alt="Next" @onclick="GotoNext" class="third btn btn-primary oi oi-caret-right"></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,265 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using Blog3000.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace Blog3000.Client.Shared
|
||||
{
|
||||
public partial class PostFinder : IDisposable
|
||||
{
|
||||
|
||||
public class State
|
||||
{
|
||||
public int StartIdx;
|
||||
public string Search;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Could be use with dict/startIdKey for use on different pages
|
||||
/// </summary>
|
||||
private static State CurrentState = new State();
|
||||
|
||||
|
||||
|
||||
[Inject]
|
||||
private BlogDb BlogDb { get; set; }
|
||||
|
||||
[Inject]
|
||||
private NetworkStatus NetworkStatus { get; set; }
|
||||
|
||||
[Inject]
|
||||
private HttpClient Http { get; set; }
|
||||
|
||||
[Inject]
|
||||
private IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
private string errorMsg { get; set; }
|
||||
private string dispMode { get; set; }
|
||||
|
||||
private string PageInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
var res = $"{StartIdx + 1}-{StartIdx + 0 + pageSize} ";
|
||||
if (totalPostsFound != null)
|
||||
{
|
||||
if (totalPostsFound == 1)
|
||||
{
|
||||
res += $"(of 1)";
|
||||
}
|
||||
else if (totalPostsFound > 1)
|
||||
{
|
||||
res += $"(of {totalPostsFound})";
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
private ElementReference ScrollAnchorElement;
|
||||
|
||||
private string SearchText { get; set; }
|
||||
|
||||
private int StartIdx
|
||||
{
|
||||
get
|
||||
{
|
||||
return startIdx;
|
||||
}
|
||||
set
|
||||
{
|
||||
startIdx = value;
|
||||
OnStartIdxChanged();
|
||||
}
|
||||
}
|
||||
private int startIdx = 0;
|
||||
|
||||
private int pageSize = 6;
|
||||
|
||||
private int pageMaxSize = 6;
|
||||
|
||||
private int? totalPostsFound = null;
|
||||
|
||||
private List<BlogPostHeader> selectedPosts = new List<BlogPostHeader>();
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
BlogDb.BlogPostsChanged -= BlogDb_BlogPostsChanged;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public async void StartSearch(string searchString)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"Got searchstring {searchString}");
|
||||
SearchText = searchString;
|
||||
// await SelectPosts();
|
||||
// StateHasChanged();
|
||||
UpdateSearch();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
StartIdx = CurrentState.StartIdx;
|
||||
SearchText = CurrentState.Search;
|
||||
|
||||
BlogDb.BlogPostsChanged += BlogDb_BlogPostsChanged;
|
||||
|
||||
await SelectPosts();
|
||||
}
|
||||
|
||||
private async void BlogDb_BlogPostsChanged(object sender, EventArgs e)
|
||||
{
|
||||
await SelectPosts();
|
||||
this.StateHasChanged();
|
||||
}
|
||||
|
||||
private void GotoFirst()
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("Goto first");
|
||||
StartIdx = 0;
|
||||
}
|
||||
|
||||
private void GotoNext()
|
||||
{
|
||||
StartIdx += pageMaxSize;
|
||||
}
|
||||
|
||||
private void GotoPrev()
|
||||
{
|
||||
StartIdx -= pageMaxSize;
|
||||
}
|
||||
|
||||
|
||||
private async void ClearSearch()
|
||||
{
|
||||
errorMsg = null;
|
||||
SearchText = "";
|
||||
startIdx = 0;
|
||||
totalPostsFound = null;
|
||||
await SelectPosts();
|
||||
StateHasChanged();
|
||||
CurrentState.StartIdx = StartIdx;
|
||||
CurrentState.Search = "";
|
||||
}
|
||||
|
||||
private async void UpdateSearch()
|
||||
{
|
||||
errorMsg = null;
|
||||
startIdx = 0;
|
||||
totalPostsFound = null;
|
||||
await SelectPosts();
|
||||
StateHasChanged();
|
||||
CurrentState.StartIdx = StartIdx;
|
||||
CurrentState.Search = SearchText;
|
||||
_ = JSRuntime.InvokeVoidAsync("scrollElmIntoView", ScrollAnchorElement);
|
||||
}
|
||||
|
||||
|
||||
private async void OnStartIdxChanged()
|
||||
{
|
||||
if (startIdx < 0) startIdx = 0;
|
||||
await SelectPosts();
|
||||
if (selectedPosts.Count == 0 && startIdx > 0)
|
||||
{
|
||||
// Too far, go back one page
|
||||
StartIdx -= pageMaxSize;
|
||||
await SelectPosts();
|
||||
|
||||
// Bad input? instruct DB to find last page
|
||||
if (selectedPosts.Count == 0 && startIdx > 0)
|
||||
{
|
||||
await SelectPosts(true);
|
||||
}
|
||||
}
|
||||
StateHasChanged();
|
||||
CurrentState.StartIdx = StartIdx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private async Task SelectPosts(bool findLastPage = false)
|
||||
{
|
||||
|
||||
bool fulltextIsLocallyAvail = await BlogDb.IsEagerLoading();
|
||||
bool isOnline = NetworkStatus.IsOnline;
|
||||
|
||||
var bps = new BlogPostSearch(() => BlogDb.GetCachedPostsAsync(), () => BlogDb.GetHeadersAsync(), SearchText);
|
||||
|
||||
if (!bps.IsNonEmptyTerm)
|
||||
{
|
||||
dispMode = "Last posts";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Brutal fulltext search.. Should be good for the first 100 articles or so...
|
||||
dispMode = "Search";
|
||||
}
|
||||
|
||||
if (!bps.IsNonEmptyTerm)
|
||||
{
|
||||
var res = await bps.ExecAsync(startIdx, pageMaxSize, findLastPage);
|
||||
pageSize = res.Count;
|
||||
totalPostsFound = await BlogDb.GetHeadersAsync()
|
||||
.Where(a => "PUBLIC".Equals(a.Access))
|
||||
.Where(p => (p.StickyMenuPos ?? -1) < 0)
|
||||
.CountAsync();
|
||||
|
||||
selectedPosts = res;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool needsFullText = bps.RequiresFullText;
|
||||
|
||||
if (!fulltextIsLocallyAvail && needsFullText)
|
||||
{
|
||||
if (!isOnline)
|
||||
{
|
||||
errorMsg = "Offline, search not possible";
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
var url = $"/BlogPosts/search?searchTerm={System.Net.WebUtility.UrlEncode(SearchText)}&startIdx={startIdx}&pageMaxSize={pageMaxSize}&findLastPage={findLastPage}";
|
||||
var ids = await Http.GetJsonAsync<List<String>>(url);
|
||||
var res = new List<BlogPostHeader>();
|
||||
foreach (var id in ids)
|
||||
{
|
||||
var bp = await BlogDb.GetHeaderAsync(id);
|
||||
if (bp != null)
|
||||
{
|
||||
res.Add(bp);
|
||||
}
|
||||
await Task.Yield();
|
||||
}
|
||||
pageSize = res.Count;
|
||||
selectedPosts = res;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"Exception during search: {ex}");
|
||||
errorMsg = $"Error during search: {ex.Message}";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var efetch = BlogDb.GetCachedPostsAsync();
|
||||
var res = await bps.ExecAsync(startIdx, pageMaxSize, findLastPage);
|
||||
pageSize = res.Count;
|
||||
selectedPosts = res;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
@using Blog3000.Shared;
|
||||
|
||||
@foreach (var b in @selectedPosts)
|
||||
{
|
||||
var x = "viewer/" + @b.Id;
|
||||
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="@x" Match="NavLinkMatch.All">
|
||||
@b.Title
|
||||
</NavLink>
|
||||
</li>
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using Blog3000.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Blog3000.Client.Shared
|
||||
{
|
||||
public partial class StickyNavLinks: IDisposable
|
||||
{
|
||||
|
||||
[Inject]
|
||||
private BlogDb BlogDb { get; set; }
|
||||
|
||||
|
||||
private List<BlogPostHeader> selectedPosts = new List<BlogPostHeader>();
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
BlogDb.BlogPostsChanged -= BlogDb_BlogPostsChanged;
|
||||
}
|
||||
|
||||
private async void BlogDb_BlogPostsChanged(object sender, EventArgs e)
|
||||
{
|
||||
selectedPosts = await SelectPosts();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
BlogDb.BlogPostsChanged += BlogDb_BlogPostsChanged;
|
||||
selectedPosts = await SelectPosts();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async Task<List<BlogPostHeader>> SelectPosts()
|
||||
{
|
||||
var r = await BlogDb.GetHeadersAsync()
|
||||
.Where(c => (c.StickyMenuPos ?? -1) >= 0)
|
||||
.OrderBy(c => c.StickyMenuPos)
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
return r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
|
||||
<h3 class="section-title">Top-Topics</h3>
|
||||
|
||||
@foreach (var t in topics.OrderBy(c => c.DispId))
|
||||
{
|
||||
<TopicContent Topic="@t" Owner="@this"/>
|
||||
}
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using Blog3000.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Blog3000.Client.Shared
|
||||
{
|
||||
public partial class TopTopics: IDisposable
|
||||
{
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> OnTopicClick { get; set; }
|
||||
|
||||
|
||||
[Inject]
|
||||
private BlogDb BlogDb { get; set; }
|
||||
|
||||
[Inject]
|
||||
private Config Config { get; set; }
|
||||
|
||||
public class Topic {
|
||||
public string DispId;
|
||||
public List<BlogPostHeader> Posts = new List<BlogPostHeader>();
|
||||
}
|
||||
|
||||
|
||||
private List<Topic> topics = new List<Topic>();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
BlogDb.BlogPostsChanged -= BlogDb_BlogPostsChanged;
|
||||
Config.ConfigChanged -= Config_ConfigChanged;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
topics = await UpdateTopicsAsync();
|
||||
BlogDb.BlogPostsChanged += BlogDb_BlogPostsChanged;
|
||||
Config.ConfigChanged += Config_ConfigChanged; ;
|
||||
}
|
||||
|
||||
|
||||
private async void BlogDb_BlogPostsChanged(object sender, EventArgs e)
|
||||
{
|
||||
await RefreshAsync();
|
||||
}
|
||||
|
||||
|
||||
private async void Config_ConfigChanged(object sender, EventArgs e)
|
||||
{
|
||||
await RefreshAsync();
|
||||
}
|
||||
|
||||
|
||||
private async Task RefreshAsync()
|
||||
{
|
||||
topics = new List<Topic>(); // Clear to force rebuild
|
||||
StateHasChanged();
|
||||
topics = await UpdateTopicsAsync();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
||||
private async Task<List<Topic>> UpdateTopicsAsync()
|
||||
{
|
||||
var dict = new Dictionary<string, Topic>();
|
||||
|
||||
foreach (var bp in await BlogDb.GetHeadersAsync().ToListAsync()) /*FromCachedPosts*/
|
||||
{
|
||||
if (bp != null && bp.Topics != null)
|
||||
{
|
||||
foreach (var t in bp.Topics)
|
||||
{
|
||||
foreach (var tt in Config?.Main?.TopTopics ?? new string[] { })
|
||||
{
|
||||
if (String.Equals(tt, t))
|
||||
{
|
||||
Topic tp;
|
||||
if (!dict.TryGetValue(t, out tp))
|
||||
{
|
||||
tp = new Topic();
|
||||
tp.DispId = t;
|
||||
dict.Add(tp.DispId, tp);
|
||||
}
|
||||
tp.Posts.Add(bp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new List<Topic>(dict.Values);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<h3 class="section-title">Topic-Overview</h3>
|
||||
|
||||
<div class="topic-cloud">
|
||||
@foreach (var t in topics)
|
||||
{
|
||||
<span class="topic-items topic-quick-link" @onclick="@(e => TopicClicked(t.DispId))">
|
||||
<span>@t.DispId</span><span>(@t.Count)</span>
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Blog3000.Client.Shared
|
||||
{
|
||||
public partial class TopicCloud: IDisposable
|
||||
{
|
||||
public class Topic
|
||||
{
|
||||
public string DispId;
|
||||
public int Count;
|
||||
}
|
||||
|
||||
|
||||
[Inject]
|
||||
private BlogDb BlogDb { get; set; }
|
||||
|
||||
private List<Topic> topics = new List<Topic>();
|
||||
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> OnTopicClick { get; set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
BlogDb.BlogPostsChanged -= BlogDb_BlogPostsChanged;
|
||||
}
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
topics = await UpdateTopicsAsync();
|
||||
BlogDb.BlogPostsChanged += BlogDb_BlogPostsChanged;
|
||||
}
|
||||
|
||||
|
||||
private async void BlogDb_BlogPostsChanged(object sender, EventArgs e)
|
||||
{
|
||||
topics = await UpdateTopicsAsync();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void TopicClicked(string topic)
|
||||
{
|
||||
//System.Diagnostics.Debug.WriteLine(topic);
|
||||
OnTopicClick.InvokeAsync(topic);
|
||||
}
|
||||
|
||||
|
||||
private async Task<List<Topic>> UpdateTopicsAsync()
|
||||
{
|
||||
var dict = new Dictionary<string, Topic>();
|
||||
|
||||
foreach (var bp in await BlogDb.GetHeadersAsync().ToListAsync())
|
||||
{
|
||||
if (bp != null && bp.Topics != null)
|
||||
{
|
||||
foreach (var t in bp.Topics)
|
||||
{
|
||||
Topic tp;
|
||||
if (!dict.TryGetValue(t, out tp))
|
||||
{
|
||||
tp = new Topic();
|
||||
tp.DispId = t;
|
||||
dict.Add(tp.DispId, tp);
|
||||
}
|
||||
tp.Count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new List<Topic>(dict.Values
|
||||
.OrderByDescending(t => t.Count)
|
||||
.OrderBy(t => t.DispId)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
@using Blog3000.Shared;
|
||||
|
||||
<div class="card topic-content">
|
||||
|
||||
<div class="card-title"><span class="topic-quick-link" @onclick="@(e => TopicClicked(Topic.DispId))">@Topic.DispId</span></div>
|
||||
<div class="card-body">
|
||||
<ul>
|
||||
@foreach (var i in sortedPosts)
|
||||
{
|
||||
var x = "viewer/" + @i.Id;
|
||||
|
||||
<li style="text-wrap: none">
|
||||
<NavLink class="nav-link" href="@x">
|
||||
@i.Title <small>
|
||||
(@{
|
||||
var r = i.Revisions?.Latest();
|
||||
var a = r?.Author ?? i.Author;
|
||||
var t = (r?.ChangedAt?.ToShortDateString() ?? "???")
|
||||
+ ", "
|
||||
+ (r?.ChangedAt?.ToShortTimeString() ?? "???");
|
||||
}@a, @t UTC)
|
||||
</small>
|
||||
</NavLink>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using Blog3000.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
namespace Blog3000.Client.Shared
|
||||
{
|
||||
public partial class TopicContent
|
||||
{
|
||||
|
||||
[Parameter]
|
||||
public TopTopics.Topic Topic { get; set; }
|
||||
|
||||
|
||||
[Parameter]
|
||||
public TopTopics Owner { get; set; }
|
||||
|
||||
|
||||
private List<BlogPostHeader> sortedPosts;
|
||||
|
||||
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
var s = new List<BlogPostHeader>(Topic?.Posts);
|
||||
s.Sort((a, b) => DateTime.Compare(
|
||||
b.Revisions?.Latest()?.ChangedAt ?? DateTime.MinValue,
|
||||
a.Revisions?.Latest()?.ChangedAt ?? DateTime.MinValue));
|
||||
sortedPosts = s.Take(5).ToList();
|
||||
}
|
||||
|
||||
|
||||
private void TopicClicked(string topic)
|
||||
{
|
||||
//System.Diagnostics.Debug.WriteLine(topic);
|
||||
Owner?.OnTopicClick.InvokeAsync(topic);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ILocalStorageService localStorage
|
||||
|
||||
<div>
|
||||
Updater
|
||||
<span>
|
||||
<a href="#" class="oi oi-reload" title="Force update" @onclick="ForceUpdate"></a>|<span title="Networkstatus">@netStatus</span>|Install|
|
||||
<span class="lnk" title="Offline Caching" @onclick="ToggleLoadingMode"><span>OfflineCache:</span>
|
||||
@if (isEagerLoading)
|
||||
{
|
||||
<span>ON</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>OFF</span>
|
||||
}
|
||||
</span>
|
||||
</span>
|
||||
<!--span>
|
||||
<input type="checkbox" class="custom-control-input" id="eagerImgLoad">
|
||||
<label class="custom-control-label" for="eagerImgLoad">Preload imgs</label>
|
||||
<span -->
|
||||
<div>Status: @Status</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,225 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using Blog3000.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Blog3000.Client.Shared
|
||||
{
|
||||
public partial class Updater
|
||||
{
|
||||
|
||||
[Inject]
|
||||
public NetworkStatus NetworkStatus { get; set; }
|
||||
|
||||
[Inject]
|
||||
private BlogDb BlogDb { get; set; }
|
||||
|
||||
|
||||
[Inject]
|
||||
private Config Config{ get; set; }
|
||||
|
||||
[Inject]
|
||||
private ViewStats ViewStats { get; set; }
|
||||
|
||||
[Inject]
|
||||
private Services.ImgCacheStorage Cache { get; set; }
|
||||
|
||||
private int postsLoaded = 0;
|
||||
|
||||
private string _status;
|
||||
private string Status {
|
||||
get { return _status; }
|
||||
set { _status = value; StateHasChanged(); }
|
||||
}
|
||||
|
||||
private string netStatus = "";
|
||||
|
||||
private bool isEagerLoading = false;
|
||||
private bool isUpdating = false;
|
||||
private bool updateRequested = false;
|
||||
private System.Timers.Timer updateTimer;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
updateTimer?.Dispose();
|
||||
updateTimer = null;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
updateRequested = true;
|
||||
NetworkStatus.StatusChanged += NetworkStatus_Changed;
|
||||
NetworkStatus_Changed(this, EventArgs.Empty);
|
||||
// Already run by NetworkStatusChanged! await RunUpdateAsync();
|
||||
|
||||
//await Cache.Add("/");
|
||||
|
||||
isEagerLoading = await BlogDb.IsEagerLoading();
|
||||
|
||||
updateTimer = new System.Timers.Timer(900 * 1000);
|
||||
updateTimer.AutoReset = true;
|
||||
updateTimer.Elapsed += Timer_Elapsed;
|
||||
updateTimer.Start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Forces update. If offline update will be delayed until it comes online
|
||||
/// </summary>
|
||||
private void ForceUpdate()
|
||||
{
|
||||
updateRequested = true;
|
||||
_ = RunUpdateAsync();
|
||||
//_ = Config.FetchAsync();
|
||||
}
|
||||
|
||||
|
||||
private void ToggleLoadingMode()
|
||||
{
|
||||
isEagerLoading = !isEagerLoading;
|
||||
BlogDb.SetEagerLoading(isEagerLoading);
|
||||
if (isEagerLoading) ForceUpdate();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
||||
private void NetworkStatus_Changed(object sender, EventArgs e)
|
||||
{
|
||||
if (NetworkStatus.IsOnline && updateRequested)
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("Network came online");
|
||||
try
|
||||
{
|
||||
await RunUpdateAsync();
|
||||
}
|
||||
finally
|
||||
{
|
||||
updateRequested = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var ns = NetworkStatus.IsOnline ? "Online" : "Offline";
|
||||
if (!ns.Equals(netStatus))
|
||||
{
|
||||
netStatus = ns;
|
||||
this.StateHasChanged();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("Update timer elappsed");
|
||||
ForceUpdate() ;
|
||||
}
|
||||
|
||||
private async Task<bool> RunUpdateAsync()
|
||||
{
|
||||
// TODO: Move most to this to BlogDb
|
||||
|
||||
if (this.isUpdating)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("Udpdater: already running, abort");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("Updater: start");
|
||||
this.isUpdating = true;
|
||||
|
||||
if (!NetworkStatus.IsOnline)
|
||||
{
|
||||
Status = "Updater: Network offline";
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Status = "Syncing stats...";
|
||||
System.Diagnostics.Debug.WriteLine($"Updater: Syncing stats...");
|
||||
await ViewStats.SyncViewStats();
|
||||
|
||||
int changes = 0;
|
||||
BlogPostHeader[] blogPosts = await Http.GetJsonAsync<BlogPostHeader[]>("BlogPosts");
|
||||
postsLoaded = blogPosts.Length;
|
||||
|
||||
System.Diagnostics.Debug.WriteLine($"Updater: Total remote blogPosts: {blogPosts.Length}");
|
||||
Status = $"{blogPosts.Length} verfügbar";
|
||||
|
||||
await localStorage.SetItemAsync(BlogDb.DBKEY_PREFIX_HDR + "remotePosts", blogPosts);
|
||||
|
||||
var dict = new Dictionary<string, bool>();
|
||||
|
||||
foreach (var b in blogPosts)
|
||||
{
|
||||
dict.Add(b.Id, true);
|
||||
if (isEagerLoading)
|
||||
{
|
||||
var storedPost = await localStorage.GetItemAsync<BlogPost>(BlogDb.DBKEY_PREFIX_BLOGCACHE + b.Id);
|
||||
|
||||
bool forceSync = false;
|
||||
if (/* TODO: eagerCaching || isInstalled */storedPost != null && (storedPost.ImageRefs?.Count ?? 0) > 0)
|
||||
{
|
||||
forceSync = !await BlogDb.AreImagesCached(b.Id);
|
||||
if (forceSync) System.Diagnostics.Debug.WriteLine($"BlogPosts: forcing sync of {b.Id} due to missing img");
|
||||
}
|
||||
|
||||
if ((forceSync) || (storedPost == null) || !((b.Checksum ?? "").Equals(storedPost.Checksum)))
|
||||
{
|
||||
Status = $"Hole '{b.Title}'...";
|
||||
await BlogDb.SyncPost(b.Id, true);
|
||||
System.Diagnostics.Debug.WriteLine($"BlogPosts: 1 neuer geholt {b.Id}, Update of {storedPost?.Id ?? "new"}");
|
||||
changes++;
|
||||
}
|
||||
await Task.Delay(50);
|
||||
}
|
||||
}
|
||||
|
||||
int storedN = await localStorage.LengthAsync();
|
||||
for (var i = 0; i < storedN; i++)
|
||||
{
|
||||
string id = await localStorage.KeyAsync(i);
|
||||
if (id != null && id.StartsWith(BlogDb.DBKEY_PREFIX_BLOGCACHE))
|
||||
{
|
||||
var oid = id.Substring(BlogDb.DBKEY_PREFIX_BLOGCACHE.Length);
|
||||
if (!dict.ContainsKey(oid))
|
||||
{
|
||||
Status = $"Entferne {oid}...";
|
||||
this.StateHasChanged();
|
||||
await localStorage.RemoveItemAsync(id);
|
||||
System.Diagnostics.Debug.WriteLine($"BlogPosts: 1 alter entfernt: {oid}");
|
||||
changes++;
|
||||
}
|
||||
}
|
||||
await Task.Yield();
|
||||
}
|
||||
|
||||
|
||||
Status = $"{DateTime.Now}: {dict.Count} post(s) in store, {changes} changes";
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("Error updating blogPots", ex);
|
||||
Status = $"Updater failed {ex.Message}";
|
||||
}
|
||||
finally
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("Updater end");
|
||||
this.isUpdating = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Blog3000.Client.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// See this for more infos on await promises:
|
||||
/// https://toddlittlejohn.com/2019/09/15/blazor-javascript-interoperability/
|
||||
/// </summary>
|
||||
public static class PromiseInvoker
|
||||
{
|
||||
public class PromiseInvokerCallback<T>
|
||||
{
|
||||
public readonly TaskCompletionSource<T> tcs = new TaskCompletionSource<T>();
|
||||
|
||||
[JSInvokable("SetResult")]
|
||||
public void SetResult(T o)
|
||||
{
|
||||
tcs.SetResult(o);
|
||||
}
|
||||
|
||||
|
||||
[JSInvokable("SetException")]
|
||||
public void SetException(string s)
|
||||
{
|
||||
tcs.SetException(new InvalidOperationException(s));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static async Task<T> InvokePromiseAsync<T>(this IJSRuntime jsRuntime, string funcName, params object[] prms)
|
||||
{
|
||||
var cb = new PromiseInvokerCallback<T>();
|
||||
object[] fp = new object[(prms?.Length ?? 0) + 1];
|
||||
fp[0] = DotNetObjectReference.Create(cb);
|
||||
if (prms != null && prms.Length > 0)
|
||||
{
|
||||
Array.Copy(prms, 0, fp, 1, prms.Length);
|
||||
}
|
||||
_ = jsRuntime.InvokeAsync<T>(funcName, fp);
|
||||
return await cb.tcs.Task;
|
||||
|
||||
//return await InvokePromise<T>(jsRuntime, funcName, prms);
|
||||
}
|
||||
|
||||
|
||||
public static Task<T> InvokePromise<T>(this IJSRuntime jsRuntime, string funcName, params object[] prms)
|
||||
{
|
||||
var cb = new PromiseInvokerCallback<T>();
|
||||
object[] fp = new object[(prms?.Length ?? 0) + 1];
|
||||
fp[0] = DotNetObjectReference.Create(cb);
|
||||
if (prms != null && prms.Length > 0)
|
||||
{
|
||||
Array.Copy(prms, 0, fp, 1, prms.Length);
|
||||
}
|
||||
jsRuntime.InvokeAsync<T>(funcName, fp);
|
||||
return cb.tcs.Task;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
@using System.Net.Http
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using Microsoft.JSInterop
|
||||
@using Blog3000.Client
|
||||
@using Blog3000.Client.Shared
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
|
@ -0,0 +1,111 @@
|
|||
@font-face {
|
||||
font-family: 'Source Code Pro';
|
||||
font-weight: 200;
|
||||
font-style: normal;
|
||||
font-stretch: normal;
|
||||
src: url('./WOFF2/TTF/SourceCodePro-ExtraLight.ttf.woff2') format('woff2'), url('./WOFF/OTF/SourceCodePro-ExtraLight.otf.woff') format('woff'), url('./OTF/SourceCodePro-ExtraLight.otf') format('opentype'), url('./TTF/SourceCodePro-ExtraLight.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Source Code Pro';
|
||||
font-weight: 200;
|
||||
font-style: italic;
|
||||
font-stretch: normal;
|
||||
src: url('./WOFF2/TTF/SourceCodePro-ExtraLightIt.ttf.woff2') format('woff2'), url('./WOFF/OTF/SourceCodePro-ExtraLightIt.otf.woff') format('woff'), url('./OTF/SourceCodePro-ExtraLightIt.otf') format('opentype'), url('./TTF/SourceCodePro-ExtraLightIt.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Source Code Pro';
|
||||
font-weight: 300;
|
||||
font-style: normal;
|
||||
font-stretch: normal;
|
||||
src: url('./WOFF2/TTF/SourceCodePro-Light.ttf.woff2') format('woff2'), url('./WOFF/OTF/SourceCodePro-Light.otf.woff') format('woff'), url('./OTF/SourceCodePro-Light.otf') format('opentype'), url('./TTF/SourceCodePro-Light.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Source Code Pro';
|
||||
font-weight: 300;
|
||||
font-style: italic;
|
||||
font-stretch: normal;
|
||||
src: url('./WOFF2/TTF/SourceCodePro-LightIt.ttf.woff2') format('woff2'), url('./WOFF/OTF/SourceCodePro-LightIt.otf.woff') format('woff'), url('./OTF/SourceCodePro-LightIt.otf') format('opentype'), url('./TTF/SourceCodePro-LightIt.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Source Code Pro';
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
font-stretch: normal;
|
||||
src: url('./WOFF2/TTF/SourceCodePro-Regular.ttf.woff2') format('woff2'), url('./WOFF/OTF/SourceCodePro-Regular.otf.woff') format('woff'), url('./OTF/SourceCodePro-Regular.otf') format('opentype'), url('./TTF/SourceCodePro-Regular.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Source Code Pro';
|
||||
font-weight: 400;
|
||||
font-style: italic;
|
||||
font-stretch: normal;
|
||||
src: url('./WOFF2/TTF/SourceCodePro-It.ttf.woff2') format('woff2'), url('./WOFF/OTF/SourceCodePro-It.otf.woff') format('woff'), url('./OTF/SourceCodePro-It.otf') format('opentype'), url('./TTF/SourceCodePro-It.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Source Code Pro';
|
||||
font-weight: 500;
|
||||
font-style: normal;
|
||||
font-stretch: normal;
|
||||
src: url('./WOFF2/TTF/SourceCodePro-Medium.ttf.woff2') format('woff2'), url('./WOFF/OTF/SourceCodePro-Medium.otf.woff') format('woff'), url('./OTF/SourceCodePro-Medium.otf') format('opentype'), url('./TTF/SourceCodePro-Medium.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Source Code Pro';
|
||||
font-weight: 500;
|
||||
font-style: italic;
|
||||
font-stretch: normal;
|
||||
src: url('./WOFF2/TTF/SourceCodePro-MediumIt.ttf.woff2') format('woff2'), url('./WOFF/OTF/SourceCodePro-MediumIt.otf.woff') format('woff'), url('./OTF/SourceCodePro-MediumIt.otf') format('opentype'), url('./TTF/SourceCodePro-MediumIt.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Source Code Pro';
|
||||
font-weight: 600;
|
||||
font-style: normal;
|
||||
font-stretch: normal;
|
||||
src: url('./WOFF2/TTF/SourceCodePro-Semibold.ttf.woff2') format('woff2'), url('./WOFF/OTF/SourceCodePro-Semibold.otf.woff') format('woff'), url('./OTF/SourceCodePro-Semibold.otf') format('opentype'), url('./TTF/SourceCodePro-Semibold.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Source Code Pro';
|
||||
font-weight: 600;
|
||||
font-style: italic;
|
||||
font-stretch: normal;
|
||||
src: url('./WOFF2/TTF/SourceCodePro-SemiboldIt.ttf.woff2') format('woff2'), url('./WOFF/OTF/SourceCodePro-SemiboldIt.otf.woff') format('woff'), url('./OTF/SourceCodePro-SemiboldIt.otf') format('opentype'), url('./TTF/SourceCodePro-SemiboldIt.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Source Code Pro';
|
||||
font-weight: 700;
|
||||
font-style: normal;
|
||||
font-stretch: normal;
|
||||
src: url('./WOFF2/TTF/SourceCodePro-Bold.ttf.woff2') format('woff2'), url('./WOFF/OTF/SourceCodePro-Bold.otf.woff') format('woff'), url('./OTF/SourceCodePro-Bold.otf') format('opentype'), url('./TTF/SourceCodePro-Bold.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Source Code Pro';
|
||||
font-weight: 700;
|
||||
font-style: italic;
|
||||
font-stretch: normal;
|
||||
src: url('./WOFF2/TTF/SourceCodePro-BoldIt.ttf.woff2') format('woff2'), url('./WOFF/OTF/SourceCodePro-BoldIt.otf.woff') format('woff'), url('./OTF/SourceCodePro-BoldIt.otf') format('opentype'), url('./TTF/SourceCodePro-BoldIt.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Source Code Pro';
|
||||
font-weight: 900;
|
||||
font-style: normal;
|
||||
font-stretch: normal;
|
||||
src: url('./WOFF2/TTF/SourceCodePro-Black.ttf.woff2') format('woff2'), url('./WOFF/OTF/SourceCodePro-Black.otf.woff') format('woff'), url('./OTF/SourceCodePro-Black.otf') format('opentype'), url('./TTF/SourceCodePro-Black.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Source Code Pro';
|
||||
font-weight: 900;
|
||||
font-style: italic;
|
||||
font-stretch: normal;
|
||||
src: url('./WOFF2/TTF/SourceCodePro-BlackIt.ttf.woff2') format('woff2'), url('./WOFF/OTF/SourceCodePro-BlackIt.otf.woff') format('woff'), url('./OTF/SourceCodePro-BlackIt.otf') format('opentype'), url('./TTF/SourceCodePro-BlackIt.ttf') format('truetype');
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,86 @@
|
|||
SIL OPEN FONT LICENSE Version 1.1
|
||||
|
||||
Copyright (c) 2014 Waybury
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Waybury
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
[Open Iconic v1.1.1](http://useiconic.com/open)
|
||||
===========
|
||||
|
||||
### Open Iconic is the open source sibling of [Iconic](http://useiconic.com). It is a hyper-legible collection of 223 icons with a tiny footprint—ready to use with Bootstrap and Foundation. [View the collection](http://useiconic.com/open#icons)
|
||||
|
||||
|
||||
|
||||
## What's in Open Iconic?
|
||||
|
||||
* 223 icons designed to be legible down to 8 pixels
|
||||
* Super-light SVG files - 61.8 for the entire set
|
||||
* SVG sprite—the modern replacement for icon fonts
|
||||
* Webfont (EOT, OTF, SVG, TTF, WOFF), PNG and WebP formats
|
||||
* Webfont stylesheets (including versions for Bootstrap and Foundation) in CSS, LESS, SCSS and Stylus formats
|
||||
* PNG and WebP raster images in 8px, 16px, 24px, 32px, 48px and 64px.
|
||||
|
||||
|
||||
## Getting Started
|
||||
|
||||
#### For code samples and everything else you need to get started with Open Iconic, check out our [Icons](http://useiconic.com/open#icons) and [Reference](http://useiconic.com/open#reference) sections.
|
||||
|
||||
### General Usage
|
||||
|
||||
#### Using Open Iconic's SVGs
|
||||
|
||||
We like SVGs and we think they're the way to display icons on the web. Since Open Iconic are just basic SVGs, we suggest you display them like you would any other image (don't forget the `alt` attribute).
|
||||
|
||||
```
|
||||
<img src="/open-iconic/svg/icon-name.svg" alt="icon name">
|
||||
```
|
||||
|
||||
#### Using Open Iconic's SVG Sprite
|
||||
|
||||
Open Iconic also comes in a SVG sprite which allows you to display all the icons in the set with a single request. It's like an icon font, without being a hack.
|
||||
|
||||
Adding an icon from an SVG sprite is a little different than what you're used to, but it's still a piece of cake. *Tip: To make your icons easily style able, we suggest adding a general class to the* `<svg>` *tag and a unique class name for each different icon in the* `<use>` *tag.*
|
||||
|
||||
```
|
||||
<svg class="icon">
|
||||
<use xlink:href="open-iconic.svg#account-login" class="icon-account-login"></use>
|
||||
</svg>
|
||||
```
|
||||
|
||||
Sizing icons only needs basic CSS. All the icons are in a square format, so just set the `<svg>` tag with equal width and height dimensions.
|
||||
|
||||
```
|
||||
.icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
```
|
||||
|
||||
Coloring icons is even easier. All you need to do is set the `fill` rule on the `<use>` tag.
|
||||
|
||||
```
|
||||
.icon-account-login {
|
||||
fill: #f00;
|
||||
}
|
||||
```
|
||||
|
||||
To learn more about SVG Sprites, read [Chris Coyier's guide](http://css-tricks.com/svg-sprites-use-better-icon-fonts/).
|
||||
|
||||
#### Using Open Iconic's Icon Font...
|
||||
|
||||
|
||||
##### …with Bootstrap
|
||||
|
||||
You can find our Bootstrap stylesheets in `font/css/open-iconic-bootstrap.{css, less, scss, styl}`
|
||||
|
||||
|
||||
```
|
||||
<link href="/open-iconic/font/css/open-iconic-bootstrap.css" rel="stylesheet">
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
<span class="oi oi-icon-name" title="icon name" aria-hidden="true"></span>
|
||||
```
|
||||
|
||||
##### …with Foundation
|
||||
|
||||
You can find our Foundation stylesheets in `font/css/open-iconic-foundation.{css, less, scss, styl}`
|
||||
|
||||
```
|
||||
<link href="/open-iconic/font/css/open-iconic-foundation.css" rel="stylesheet">
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
<span class="fi-icon-name" title="icon name" aria-hidden="true"></span>
|
||||
```
|
||||
|
||||
##### …on its own
|
||||
|
||||
You can find our default stylesheets in `font/css/open-iconic.{css, less, scss, styl}`
|
||||
|
||||
```
|
||||
<link href="/open-iconic/font/css/open-iconic.css" rel="stylesheet">
|
||||
```
|
||||
|
||||
```
|
||||
<span class="oi" data-glyph="icon-name" title="icon name" aria-hidden="true"></span>
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
### Icons
|
||||
|
||||
All code (including SVG markup) is under the [MIT License](http://opensource.org/licenses/MIT).
|
||||
|
||||
### Fonts
|
||||
|
||||
All fonts are under the [SIL Licensed](http://scripts.sil.org/cms/scripts/page.php?item_id=OFL_web).
|
||||
1
Blog3000/Client/wwwroot/css/open-iconic/font/css/open-iconic-bootstrap.min.css
vendored
Normal file
1
Blog3000/Client/wwwroot/css/open-iconic/font/css/open-iconic-bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,543 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||
<!--
|
||||
2014-7-1: Created.
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata>
|
||||
Created by FontForge 20120731 at Tue Jul 1 20:39:22 2014
|
||||
By P.J. Onori
|
||||
Created by P.J. Onori with FontForge 2.0 (http://fontforge.sf.net)
|
||||
</metadata>
|
||||
<defs>
|
||||
<font id="open-iconic" horiz-adv-x="800" >
|
||||
<font-face
|
||||
font-family="Icons"
|
||||
font-weight="400"
|
||||
font-stretch="normal"
|
||||
units-per-em="800"
|
||||
panose-1="2 0 5 3 0 0 0 0 0 0"
|
||||
ascent="800"
|
||||
descent="0"
|
||||
bbox="-0.5 -101 802 800.126"
|
||||
underline-thickness="50"
|
||||
underline-position="-100"
|
||||
unicode-range="U+E000-E0DE"
|
||||
/>
|
||||
<missing-glyph />
|
||||
<glyph glyph-name="" unicode=""
|
||||
d="M300 700h500v-700h-500v100h400v500h-400v100zM400 500l200 -150l-200 -150v100h-400v100h400v100z" />
|
||||
<glyph glyph-name="1" unicode=""
|
||||
d="M300 700h500v-700h-500v100h400v500h-400v100zM200 500v-100h400v-100h-400v-100l-200 150z" />
|
||||
<glyph glyph-name="2" unicode=""
|
||||
d="M350 700c193 0 350 -157 350 -350v-50h100l-200 -200l-200 200h100v50c0 138 -112 250 -250 250s-250 -112 -250 -250c0 193 157 350 350 350z" />
|
||||
<glyph glyph-name="3" unicode=""
|
||||
d="M450 700c193 0 350 -157 350 -350c0 138 -112 250 -250 250s-250 -112 -250 -250v-50h100l-200 -200l-200 200h100v50c0 193 157 350 350 350z" />
|
||||
<glyph glyph-name="4" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM100 500h600v-100h-600v100zM0 300h800v-100h-800v100zM100 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="5" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM0 500h600v-100h-600v100zM0 300h800v-100h-800v100zM0 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="6" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM200 500h600v-100h-600v100zM0 300h800v-100h-800v100zM200 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="7" unicode=""
|
||||
d="M400 700c75 0 146 -23 206 -59l-75 -225l-322 234c57 31 122 50 191 50zM125 588l191 -138l-310 -222c-4 24 -6 47 -6 72c0 114 49 215 125 288zM688 575c69 -72 112 -168 112 -275c0 -35 -8 -68 -16 -100h-218zM216 253l112 -347c-128 23 -232 109 -287 222zM372 100
|
||||
h372c-64 -109 -177 -185 -310 -197z" />
|
||||
<glyph glyph-name="8" unicode="" horiz-adv-x="600"
|
||||
d="M200 800h100v-500h200l-247 -300l-253 300h200v500z" />
|
||||
<glyph glyph-name="9" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM300 700v-300h-200l300 -300l300 300h-200v300h-200z" />
|
||||
<glyph glyph-name="a" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700l-300 -300l300 -300v200h300v200h-300v200z" />
|
||||
<glyph glyph-name="b" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700v-200h-300v-200h300v-200l300 300z" />
|
||||
<glyph glyph-name="c" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700l-300 -300h200v-300h200v300h200z" />
|
||||
<glyph glyph-name="d" unicode=""
|
||||
d="M300 600v-200h500v-100h-500v-200l-300 247z" />
|
||||
<glyph glyph-name="e" unicode=""
|
||||
d="M500 600l300 -247l-300 -253v200h-500v100h500v200z" />
|
||||
<glyph glyph-name="f" unicode="" horiz-adv-x="600"
|
||||
d="M200 800h200v-500h200l-297 -300l-303 300h200v500z" />
|
||||
<glyph glyph-name="10" unicode=""
|
||||
d="M300 700v-200h500v-200h-500v-200l-300 297z" />
|
||||
<glyph glyph-name="11" unicode=""
|
||||
d="M500 700l300 -297l-300 -303v200h-500v200h500v200z" />
|
||||
<glyph glyph-name="12" unicode="" horiz-adv-x="600"
|
||||
d="M297 800l303 -300h-200v-500h-200v500h-200z" />
|
||||
<glyph glyph-name="13" unicode="" horiz-adv-x="600"
|
||||
d="M247 800l253 -300h-200v-500h-100v500h-200z" />
|
||||
<glyph glyph-name="14" unicode=""
|
||||
d="M400 800h100v-800h-100v800zM200 700h100v-600h-100v600zM600 600h100v-400h-100v400zM0 500h100v-200h-100v200z" />
|
||||
<glyph glyph-name="15" unicode=""
|
||||
d="M116 600l72 -72c-54 -54 -88 -126 -88 -209s34 -159 88 -213l-72 -72c-72 72 -116 175 -116 285s44 209 116 281zM684 600c72 -72 116 -171 116 -281s-44 -213 -116 -285l-72 72c54 54 88 130 88 213s-34 155 -88 209zM259 460l69 -72c-18 -18 -28 -41 -28 -69
|
||||
s10 -54 28 -72l-69 -72c-36 36 -59 89 -59 144s23 105 59 141zM541 459c36 -36 59 -85 59 -140s-23 -108 -59 -144l-69 72c18 18 28 44 28 72s-10 51 -28 69z" />
|
||||
<glyph glyph-name="16" unicode="" horiz-adv-x="400"
|
||||
d="M200 800c110 0 200 -90 200 -200s-90 -200 -200 -200s-200 90 -200 200s90 200 200 200zM100 319c31 -11 65 -19 100 -19s68 8 100 19v-319l-100 100l-100 -100v319z" />
|
||||
<glyph glyph-name="17" unicode=""
|
||||
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300c0 -66 21 -126 56 -175l419 419c-49 35 -109 56 -175 56zM644 575l-419 -419c49 -35 109 -56 175 -56c166 0 300 134 300 300
|
||||
c0 66 -21 126 -56 175z" />
|
||||
<glyph glyph-name="18" unicode=""
|
||||
d="M0 700h100v-600h700v-100h-800v700zM500 700h200v-500h-200v500zM200 500h200v-300h-200v300z" />
|
||||
<glyph glyph-name="19" unicode=""
|
||||
d="M397 800c13 1 23 -4 34 -13c2 -2 214 -254 241 -287h128v-100h-100v-366c0 -18 -16 -34 -34 -34h-532c-18 0 -34 16 -34 34v366h-100v100h128l234 281c9 11 22 18 35 19zM400 672l-144 -172h288zM250 300c-28 0 -50 -22 -50 -50v-100c0 -28 22 -50 50 -50s50 22 50 50
|
||||
v100c0 28 -22 50 -50 50zM550 300c-28 0 -50 -22 -50 -50v-100c0 -28 22 -50 50 -50s50 22 50 50v100c0 28 -22 50 -50 50z" />
|
||||
<glyph glyph-name="1a" unicode=""
|
||||
d="M9 700h682c6 0 9 -4 9 -10v-190h100v-200h-100v-191c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v582c0 6 3 9 9 9zM100 600v-400h500v400h-500z" />
|
||||
<glyph glyph-name="1b" unicode=""
|
||||
d="M9 700h682c6 0 9 -4 9 -10v-190h100v-200h-100v-191c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v582c0 6 3 9 9 9z" />
|
||||
<glyph glyph-name="1c" unicode=""
|
||||
d="M92 650c0 23 19 50 45 50h3h5h5h500c28 0 50 -22 50 -50s-22 -50 -50 -50h-50v-141c9 -17 120 -231 166 -309c16 -26 34 -61 34 -106c0 -39 -15 -77 -41 -103h-3c-26 -25 -62 -41 -100 -41h-512c-39 0 -77 15 -103 41s-41 64 -41 103c0 46 18 80 34 106
|
||||
c46 78 157 292 166 309v141h-50c-2 0 -6 -1 -8 -1c-28 0 -50 23 -50 51zM500 600h-200v-162l-6 -10s-63 -123 -119 -228h450c-56 105 -119 228 -119 228l-6 10v162z" />
|
||||
<glyph glyph-name="1d" unicode=""
|
||||
d="M400 800c110 0 200 -90 200 -200c0 -104 52 -198 134 -266c41 -34 66 -82 66 -134h-800c0 52 25 100 66 134c82 68 134 162 134 266c0 110 90 200 200 200zM300 100h200c0 -55 -45 -100 -100 -100s-100 45 -100 100z" />
|
||||
<glyph glyph-name="1e" unicode="" horiz-adv-x="600"
|
||||
d="M150 800h50l350 -250l-225 -147l225 -153l-350 -250h-50v250l-75 -75l-75 75l150 150l-150 150l75 75l75 -75v250zM250 650v-200l150 100zM250 350v-200l150 100z" />
|
||||
<glyph glyph-name="1f" unicode=""
|
||||
d="M0 800h500c110 0 200 -90 200 -200c0 -47 -17 -91 -44 -125c85 -40 144 -125 144 -225c0 -138 -112 -250 -250 -250h-550v100c55 0 100 45 100 100v400c0 55 -45 100 -100 100v100zM300 700v-200h100c55 0 100 45 100 100s-45 100 -100 100h-100zM300 400v-300h150
|
||||
c83 0 150 67 150 150s-67 150 -150 150h-150z" />
|
||||
<glyph glyph-name="20" unicode="" horiz-adv-x="600"
|
||||
d="M300 800v-300h200l-300 -500v300h-200z" />
|
||||
<glyph glyph-name="21" unicode=""
|
||||
d="M100 800h300v-300l100 100l100 -100v300h50c28 0 50 -22 50 -50v-550h-550c-28 0 -50 -22 -50 -50s22 -50 50 -50h550v-100h-550c-83 0 -150 67 -150 150v550l3 19c8 39 39 70 78 78z" />
|
||||
<glyph glyph-name="22" unicode="" horiz-adv-x="400"
|
||||
d="M0 800h400v-800l-200 200l-200 -200v800z" />
|
||||
<glyph glyph-name="23" unicode=""
|
||||
d="M0 800h800v-100h-800v100zM0 600h300v-103h203v103h297v-591c0 -6 -3 -9 -9 -9h-782c-6 0 -9 3 -9 9v591z" />
|
||||
<glyph glyph-name="24" unicode=""
|
||||
d="M300 800h200c55 0 100 -45 100 -100v-100h191c6 0 9 -3 9 -9v-241c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v241c0 6 3 9 9 9h191v100c0 55 45 100 100 100zM300 700v-100h200v100h-200zM0 209c16 -6 32 -9 50 -9h700c18 0 34 3 50 9v-200c0 -6 -3 -9 -9 -9h-782
|
||||
c-6 0 -9 3 -9 9v200z" />
|
||||
<glyph glyph-name="25" unicode="" horiz-adv-x="600"
|
||||
d="M300 800c58 0 110 -16 147 -53s53 -89 53 -147h-100c0 39 -11 61 -25 75s-36 25 -75 25c-35 0 -55 -10 -72 -31s-28 -55 -28 -94c0 -51 20 -107 28 -175h172v-100h-178c-14 -60 -49 -127 -113 -200h491v-100h-600v122l16 12c69 69 95 121 106 166h-122v100h125
|
||||
c-8 50 -25 106 -25 175c0 58 16 114 50 156c34 43 88 69 150 69z" />
|
||||
<glyph glyph-name="26" unicode=""
|
||||
d="M34 700h4h3h4h5h700c28 0 50 -22 50 -50v-700c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v700v2c0 20 15 42 34 48zM150 600c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50zM350 600c-28 0 -50 -22 -50 -50s22 -50 50 -50h300c28 0 50 22 50 50
|
||||
s-22 50 -50 50h-300zM100 400v-400h600v400h-600z" />
|
||||
<glyph glyph-name="27" unicode=""
|
||||
d="M744 797l6 -3l44 -44c4 -4 3 -8 0 -12l-266 -375l-15 -13l-25 -12c-23 72 -78 127 -150 150l12 25l13 15l375 266zM266 400c74 0 134 -60 134 -134c0 -147 -119 -266 -266 -266c-48 0 -95 12 -134 34c80 46 134 133 134 232c0 74 58 134 132 134z" />
|
||||
<glyph glyph-name="28" unicode=""
|
||||
d="M9 451c0 23 19 50 46 50c8 0 19 -3 26 -7l131 -66l29 22c-79 81 -1 250 118 250s197 -167 119 -250l28 -22l131 66c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-115 -56c9 -16 19 -33 25 -50h68c28 0 50 -22 50 -50s-22 -50 -50 -50h-50
|
||||
c0 -23 -2 -45 -6 -66l78 -40c21 -5 37 -28 37 -49c0 -28 -22 -50 -50 -50c-10 0 -23 5 -31 11l-65 35c-24 -46 -62 -86 -103 -110c-35 19 -60 45 -60 72v135v4v5v6v5v5v87c0 28 -22 50 -50 50c-24 0 -45 -17 -50 -40c1 -3 1 -8 1 -11s0 -8 -1 -11v-82v-4v-5v-144
|
||||
c0 -28 -24 -53 -59 -72c-41 25 -79 64 -103 110l-66 -35c-8 -6 -21 -11 -31 -11c-28 0 -50 22 -50 50c0 21 16 44 37 49l78 40c-4 21 -6 43 -6 66h-50h-5c-28 0 -50 22 -50 50c0 26 22 50 50 50h5h69c6 17 16 34 25 50l-116 56c-16 7 -28 27 -28 45z" />
|
||||
<glyph glyph-name="29" unicode=""
|
||||
d="M600 700h91c6 0 9 -3 9 -9v-582c0 -6 -3 -9 -9 -9h-91v600zM210 503l290 147v-500l-250 125v-3c-15 0 -25 -8 -28 -22l75 -178c11 -25 0 -58 -25 -69s-58 0 -69 25l-103 272h-91c-6 0 -9 3 -9 9v182c0 6 3 9 9 9h182z" />
|
||||
<glyph glyph-name="2a" unicode=""
|
||||
d="M9 800h682c6 0 9 -3 9 -9v-782c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v782c0 6 3 9 9 9zM100 700v-200h500v200h-500zM100 400v-100h100v100h-100zM300 400v-100h100v100h-100zM500 400v-300h100v300h-100zM100 200v-100h100v100h-100zM300 200v-100h100v100h-100z" />
|
||||
<glyph glyph-name="2b" unicode=""
|
||||
d="M0 800h700v-200h-700v200zM0 500h700v-491c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v491zM100 400v-100h100v100h-100zM300 400v-100h100v100h-100zM500 400v-100h100v100h-100zM100 200v-100h100v100h-100zM300 200v-100h100v100h-100z" />
|
||||
<glyph glyph-name="2c" unicode=""
|
||||
d="M409 800h182c6 0 10 -4 12 -9l94 -182c2 -5 6 -9 12 -9h82c6 0 9 -3 9 -9v-582c0 -6 -3 -9 -9 -9h-782c-6 0 -9 3 -9 9v441c0 83 67 150 150 150h141c6 0 10 4 12 9l94 182c2 5 6 9 12 9zM150 500c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z
|
||||
M500 500c-110 0 -200 -90 -200 -200s90 -200 200 -200s200 90 200 200s-90 200 -200 200zM500 400c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100s45 100 100 100z" />
|
||||
<glyph glyph-name="2d" unicode=""
|
||||
d="M0 600h800l-400 -400z" />
|
||||
<glyph glyph-name="2e" unicode="" horiz-adv-x="400"
|
||||
d="M400 800v-800l-400 400z" />
|
||||
<glyph glyph-name="2f" unicode="" horiz-adv-x="400"
|
||||
d="M0 800l400 -400l-400 -400v800z" />
|
||||
<glyph glyph-name="30" unicode=""
|
||||
d="M400 600l400 -400h-800z" />
|
||||
<glyph glyph-name="31" unicode=""
|
||||
d="M0 550c0 23 20 50 46 50h3h5h4h200c17 0 37 -13 44 -28l38 -72h444c14 0 19 -12 15 -25l-81 -250c-4 -13 -21 -25 -35 -25h-350c-14 0 -30 12 -34 25c-27 83 -54 167 -81 250l-10 25h-150c-2 0 -5 -1 -7 -1c-28 0 -51 23 -51 51zM358 100c28 0 50 -22 50 -50
|
||||
s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM658 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
|
||||
<glyph glyph-name="32" unicode=""
|
||||
d="M0 700h500v-100h-300v-300h-100l-100 -100v500zM300 500h500v-500l-100 100h-400v400z" />
|
||||
<glyph glyph-name="33" unicode=""
|
||||
d="M641 700l143 -141l-493 -493c-71 76 -146 148 -219 222l-72 71l141 141c50 -51 101 -101 153 -150c116 117 234 231 347 350z" />
|
||||
<glyph glyph-name="34" unicode=""
|
||||
d="M150 600l250 -250l250 250l150 -150l-400 -400l-400 400z" />
|
||||
<glyph glyph-name="35" unicode="" horiz-adv-x="600"
|
||||
d="M400 800l150 -150l-250 -250l250 -250l-150 -150l-400 400z" />
|
||||
<glyph glyph-name="36" unicode="" horiz-adv-x="600"
|
||||
d="M150 800l400 -400l-400 -400l-150 150l250 250l-250 250z" />
|
||||
<glyph glyph-name="37" unicode=""
|
||||
d="M400 600l400 -400l-150 -150l-250 250l-250 -250l-150 150z" />
|
||||
<glyph glyph-name="38" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM600 622l-250 -250l-100 100l-72 -72l172 -172l322 322z" />
|
||||
<glyph glyph-name="39" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM250 622l-72 -72l150 -150l-150 -150l72 -72l150 150l150 -150l72 72l-150 150l150 150l-72 72l-150 -150z" />
|
||||
<glyph glyph-name="3a" unicode=""
|
||||
d="M350 800c28 0 50 -22 50 -50v-50h75c14 0 25 -11 25 -25v-75h-300v75c0 14 11 25 25 25h75v50c0 28 22 50 50 50zM25 700h75v-200h500v200h75c14 0 25 -11 25 -25v-650c0 -14 -11 -25 -25 -25h-650c-14 0 -25 11 -25 25v650c0 14 11 25 25 25z" />
|
||||
<glyph glyph-name="3b" unicode=""
|
||||
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM350 600h100v-181c23 -24 47 -47 72 -69l-72 -72c-27 30 -55 59 -84 88l-16 12
|
||||
v222z" />
|
||||
<glyph glyph-name="3c" unicode=""
|
||||
d="M450 800c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -18 -3 -34 -9 -50h-191v50c0 83 -67 150 -150 150s-150 -67 -150 -150v-50h-272c-17 30 -28 63 -28 100c0 110 90 200 200 200c23 114 129 200 250 200zM434 400h3h4c3 0 6 1 9 1c28 0 50 -22 50 -50v-1
|
||||
v-150h150l-200 -200l-200 200h150v150v2c0 20 15 42 34 48z" />
|
||||
<glyph glyph-name="3d" unicode=""
|
||||
d="M450 800c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -18 -3 -34 -9 -50h-141l-200 200l-200 -200h-222c-17 30 -28 63 -28 100c0 110 90 200 200 200c23 114 129 200 250 200zM450 350l250 -250h-200v-50c0 -28 -22 -50 -50 -50s-50 22 -50 50v50h-200z" />
|
||||
<glyph glyph-name="3e" unicode=""
|
||||
d="M450 700c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -83 -67 -150 -150 -150h-450c-110 0 -200 90 -200 200s90 200 200 200c23 114 129 200 250 200z" />
|
||||
<glyph glyph-name="3f" unicode=""
|
||||
d="M250 800c82 0 154 -40 200 -100c-143 0 -270 -85 -325 -209c-36 -10 -70 -25 -100 -47c-16 33 -25 67 -25 106c0 138 112 250 250 250zM450 600c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -83 -67 -150 -150 -150h-450c-110 0 -200 90 -200 200
|
||||
s90 200 200 200c23 114 129 200 250 200z" />
|
||||
<glyph glyph-name="40" unicode=""
|
||||
d="M500 700h100l-300 -600h-100zM100 600h100l-100 -200l100 -200h-100l-100 200zM600 600h100l100 -200l-100 -200h-100l100 200z" />
|
||||
<glyph glyph-name="41" unicode=""
|
||||
d="M350 800h100l50 -119l28 -12l119 50l72 -72l-50 -119l12 -28l119 -50v-100l-119 -50l-12 -28l50 -119l-72 -72l-119 50l-28 -12l-50 -119h-100l-50 119l-28 12l-119 -50l-72 72l50 119l-12 28l-119 50v100l119 50l12 28l-50 119l72 72l119 -50l28 12zM400 550
|
||||
c-83 0 -150 -67 -150 -150s67 -150 150 -150s150 67 150 150s-67 150 -150 150z" />
|
||||
<glyph glyph-name="42" unicode=""
|
||||
d="M0 800h800v-200h-800v200zM200 500h400l-200 -200zM0 100h800v-100h-800v100z" />
|
||||
<glyph glyph-name="43" unicode=""
|
||||
d="M0 800h100v-800h-100v800zM600 800h200v-800h-200v800zM500 600v-400l-200 200z" />
|
||||
<glyph glyph-name="44" unicode=""
|
||||
d="M0 800h200v-800h-200v800zM700 800h100v-800h-100v800zM300 600l200 -200l-200 -200v400z" />
|
||||
<glyph glyph-name="45" unicode=""
|
||||
d="M0 800h800v-100h-800v100zM400 500l200 -200h-400zM0 200h800v-200h-800v200z" />
|
||||
<glyph glyph-name="46" unicode=""
|
||||
d="M150 700c83 0 150 -67 150 -150v-50h100v50c0 83 67 150 150 150s150 -67 150 -150s-67 -150 -150 -150h-50v-100h50c83 0 150 -67 150 -150s-67 -150 -150 -150s-150 67 -150 150v50h-100v-50c0 -83 -67 -150 -150 -150s-150 67 -150 150s67 150 150 150h50v100h-50
|
||||
c-83 0 -150 67 -150 150s67 150 150 150zM150 600c-28 0 -50 -22 -50 -50s22 -50 50 -50h50v50c0 28 -22 50 -50 50zM550 600c-28 0 -50 -22 -50 -50v-50h50c28 0 50 22 50 50s-22 50 -50 50zM300 400v-100h100v100h-100zM150 200c-28 0 -50 -22 -50 -50s22 -50 50 -50
|
||||
s50 22 50 50v50h-50zM500 200v-50c0 -28 22 -50 50 -50s50 22 50 50s-22 50 -50 50h-50z" />
|
||||
<glyph glyph-name="47" unicode=""
|
||||
d="M0 791c0 5 4 9 9 9h782c6 0 9 -4 9 -10v-790l-200 200h-591c-6 0 -9 3 -9 9v582z" />
|
||||
<glyph glyph-name="48" unicode=""
|
||||
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM600 600l-100 -300l-300 -100l100 300zM400 450c-28 0 -50 -22 -50 -50
|
||||
s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
|
||||
<glyph glyph-name="49" unicode=""
|
||||
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700v-600c166 0 300 134 300 300s-134 300 -300 300z" />
|
||||
<glyph glyph-name="4a" unicode=""
|
||||
d="M0 800h800v-100h-800v100zM0 600h500v-100h-500v100zM0 300h800v-100h-800v100zM0 100h600v-100h-600v100zM750 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
|
||||
<glyph glyph-name="4b" unicode=""
|
||||
d="M25 700h750c14 0 25 -11 25 -25v-75h-800v75c0 14 11 25 25 25zM0 500h800v-375c0 -14 -11 -25 -25 -25h-750c-14 0 -25 11 -25 25v375zM100 300v-100h100v100h-100zM300 300v-100h100v100h-100z" />
|
||||
<glyph glyph-name="4c" unicode=""
|
||||
d="M100 800h100v-100h450l100 100l50 -50l-100 -100v-450h100v-100h-100v-100h-100v100h-500v500h-100v100h100v100zM200 600v-350l350 350h-350zM600 550l-350 -350h350v350z" />
|
||||
<glyph glyph-name="4d" unicode=""
|
||||
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM400 600c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z
|
||||
M200 452c0 20 15 42 34 48h3h3h8c12 0 28 -7 36 -16l91 -90l25 6c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100l6 25l-90 91c-9 8 -16 24 -16 36zM550 500c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
|
||||
<glyph glyph-name="4e" unicode=""
|
||||
d="M300 800h200v-300h200l-300 -300l-300 300h200v300zM0 100h800v-100h-800v100z" />
|
||||
<glyph glyph-name="4f" unicode=""
|
||||
d="M0 800h800v-100h-800v100zM400 600l300 -300h-200v-300h-200v300h-200z" />
|
||||
<glyph glyph-name="50" unicode=""
|
||||
d="M200 700h600v-600h-600l-200 300zM350 622l-72 -72l150 -150l-150 -150l72 -72l150 150l150 -150l72 72l-150 150l150 150l-72 72l-150 -150z" />
|
||||
<glyph glyph-name="51" unicode=""
|
||||
d="M400 700c220 0 400 -180 400 -400h-100c0 166 -134 300 -300 300s-300 -134 -300 -300h-100c0 220 180 400 400 400zM341 491l59 -88l59 88c81 -25 141 -101 141 -191c0 -110 -90 -200 -200 -200s-200 90 -200 200c0 90 60 166 141 191z" />
|
||||
<glyph glyph-name="52" unicode=""
|
||||
d="M0 800h300v-400h400v-400h-700v800zM400 800l300 -300h-300v300zM100 600v-100h100v100h-100zM100 400v-100h100v100h-100zM100 200v-100h400v100h-400z" />
|
||||
<glyph glyph-name="53" unicode="" horiz-adv-x="600"
|
||||
d="M200 700h100v-100h75c30 0 58 -6 81 -22s44 -44 44 -78v-100h-100v94c-4 3 -13 6 -25 6h-250c-14 0 -25 -11 -25 -25v-50c0 -15 20 -40 34 -44l257 -65c66 -16 109 -73 109 -141v-50c0 -68 -57 -125 -125 -125h-75v-100h-100v100h-75c-30 0 -58 6 -81 22s-44 44 -44 78
|
||||
v100h100v-94c4 -3 13 -6 25 -6h250c14 0 25 11 25 25v50c0 15 -20 40 -34 44l-257 65c-66 16 -109 73 -109 141v50c0 68 57 125 125 125h75v100z" />
|
||||
<glyph glyph-name="54" unicode=""
|
||||
d="M0 700h300v-300l-300 -300v600zM500 700h300v-300l-300 -300v600z" />
|
||||
<glyph glyph-name="55" unicode=""
|
||||
d="M300 700v-600h-300v300zM800 700v-600h-300v300z" />
|
||||
<glyph glyph-name="56" unicode=""
|
||||
d="M300 700v-100c-111 0 -200 -89 -200 -200h200v-300h-300v300c0 165 135 300 300 300zM800 700v-100c-111 0 -200 -89 -200 -200h200v-300h-300v300c0 165 135 300 300 300z" />
|
||||
<glyph glyph-name="57" unicode=""
|
||||
d="M0 700h300v-300c0 -165 -135 -300 -300 -300v100c111 0 200 89 200 200h-200v300zM500 700h300v-300c0 -165 -135 -300 -300 -300v100c111 0 200 89 200 200h-200v300z" />
|
||||
<glyph glyph-name="58" unicode="" horiz-adv-x="600"
|
||||
d="M300 800l34 -34c11 -11 266 -270 266 -488c0 -165 -135 -300 -300 -300s-300 135 -300 300c0 218 255 477 266 488zM150 328c-28 0 -50 -22 -50 -50c0 -110 90 -200 200 -200c28 0 50 22 50 50s-22 50 -50 50c-55 0 -100 45 -100 100c0 28 -22 50 -50 50z" />
|
||||
<glyph glyph-name="59" unicode=""
|
||||
d="M400 800l400 -500h-800zM0 200h800v-200h-800v200z" />
|
||||
<glyph glyph-name="5a" unicode="" horiz-adv-x="600"
|
||||
d="M300 800l300 -300h-600zM0 300h600l-300 -300z" />
|
||||
<glyph glyph-name="5b" unicode=""
|
||||
d="M0 500h200v-200h-200v200zM300 500h200v-200h-200v200zM600 500h200v-200h-200v200z" />
|
||||
<glyph glyph-name="5c" unicode=""
|
||||
d="M0 700h800v-100l-400 -200l-400 200v100zM0 500l400 -200l400 200v-400h-800v400z" />
|
||||
<glyph glyph-name="5d" unicode=""
|
||||
d="M400 800l400 -200v-600h-800v600zM400 688l-300 -150v-188l300 -150l300 150v188zM200 500h400v-100l-200 -100l-200 100v100z" />
|
||||
<glyph glyph-name="5e" unicode=""
|
||||
d="M600 700c69 0 134 -19 191 -50l-16 -106c-49 35 -109 56 -175 56c-131 0 -240 -84 -281 -200h331l-16 -100h-334c0 -36 8 -68 19 -100h297l-16 -100h-222c55 -61 133 -100 222 -100c78 0 147 30 200 78v-122c-59 -35 -127 -56 -200 -56c-147 0 -274 82 -344 200h-256
|
||||
l19 100h197c-8 32 -16 66 -16 100h-200l25 100h191c45 172 198 300 384 300z" />
|
||||
<glyph glyph-name="5f" unicode=""
|
||||
d="M0 700h700v-100h-700v100zM0 500h500v-100h-500v100zM0 300h800v-100h-800v100zM0 100h100v-100h-100v100zM200 100h100v-100h-100v100zM400 100h100v-100h-100v100z" />
|
||||
<glyph glyph-name="60" unicode=""
|
||||
d="M0 800h800v-100h-800v100zM200 600h400l-200 -200zM0 200h800v-200h-800v200z" />
|
||||
<glyph glyph-name="61" unicode=""
|
||||
d="M0 800h100v-800h-100v800zM600 800h200v-800h-200v800zM200 600l200 -200l-200 -200v400z" />
|
||||
<glyph glyph-name="62" unicode=""
|
||||
d="M0 800h200v-800h-200v800zM700 800h100v-800h-100v800zM600 600v-400l-200 200z" />
|
||||
<glyph glyph-name="63" unicode=""
|
||||
d="M0 800h800v-200h-800v200zM400 400l200 -200h-400zM0 100h800v-100h-800v100z" />
|
||||
<glyph glyph-name="64" unicode=""
|
||||
d="M0 800h200v-100h-100v-600h600v100h100v-200h-800v800zM400 800h400v-400l-150 150l-250 -250l-100 100l250 250z" />
|
||||
<glyph glyph-name="65" unicode=""
|
||||
d="M403 700c247 0 397 -300 397 -300s-150 -300 -397 -300c-253 0 -403 300 -403 300s150 300 403 300zM400 600c-110 0 -200 -90 -200 -200s90 -200 200 -200s200 90 200 200s-90 200 -200 200zM400 500c10 0 19 -3 28 -6c-16 -8 -28 -24 -28 -44c0 -28 22 -50 50 -50
|
||||
c20 0 36 12 44 28c3 -9 6 -18 6 -28c0 -55 -45 -100 -100 -100s-100 45 -100 100s45 100 100 100z" />
|
||||
<glyph glyph-name="66" unicode="" horiz-adv-x="900"
|
||||
d="M331 700h3h3c3 1 7 1 10 1c12 0 29 -8 37 -17l94 -93l66 65c57 57 155 57 212 0c58 -58 58 -154 0 -212l-65 -66l93 -94c10 -8 18 -25 18 -38c0 -28 -22 -50 -50 -50c-13 0 -32 9 -40 20l-62 65l-381 -381h-269v272l375 381l-63 63c-9 8 -16 24 -16 36c0 20 16 42 35 48z
|
||||
M447 481l-313 -315l128 -132l316 316z" />
|
||||
<glyph glyph-name="67" unicode=""
|
||||
d="M0 800h300v-400h400v-400h-700v800zM400 800l300 -300h-300v300z" />
|
||||
<glyph glyph-name="68" unicode=""
|
||||
d="M200 800c0 0 200 -100 200 -300s-298 -302 -200 -500c0 0 -200 100 -200 300s300 300 200 500zM500 500c0 0 200 -100 200 -300c0 -150 -60 -200 -100 -200h-300c0 200 300 300 200 500z" />
|
||||
<glyph glyph-name="69" unicode=""
|
||||
d="M0 800h100v-800h-100v800zM200 800h300v-100h300l-200 -203l200 -197h-400v100h-200v400z" />
|
||||
<glyph glyph-name="6a" unicode="" horiz-adv-x="400"
|
||||
d="M150 800h150l-100 -200h200l-150 -300h150l-300 -300l-100 300h134l66 200h-200z" />
|
||||
<glyph glyph-name="6b" unicode=""
|
||||
d="M0 800h300v-100h500v-100h-800v200zM0 500h800v-450c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v450z" />
|
||||
<glyph glyph-name="6c" unicode=""
|
||||
d="M150 800c83 0 150 -67 150 -150c0 -66 -41 -121 -100 -141v-118c15 5 33 9 50 9h200c28 0 50 22 50 50v59c-59 20 -100 75 -100 141c0 83 67 150 150 150s150 -67 150 -150c0 -66 -41 -121 -100 -141v-59c0 -82 -68 -150 -150 -150h-200c-14 0 -25 -7 -34 -16
|
||||
c50 -24 84 -74 84 -134c0 -83 -67 -150 -150 -150s-150 67 -150 150c0 66 41 121 100 141v218c-59 20 -100 75 -100 141c0 83 67 150 150 150z" />
|
||||
<glyph glyph-name="6d" unicode=""
|
||||
d="M0 800h400l-150 -150l150 -150l-100 -100l-150 150l-150 -150v400zM500 400l150 -150l150 150v-400h-400l150 150l-150 150z" />
|
||||
<glyph glyph-name="6e" unicode=""
|
||||
d="M100 800l150 -150l150 150v-400h-400l150 150l-150 150zM400 400h400l-150 -150l150 -150l-100 -100l-150 150l-150 -150v400z" />
|
||||
<glyph glyph-name="6f" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700c-56 0 -108 -17 -153 -44l22 -19c33 -18 13 -48 -13 -59c-30 -13 -77 10 -65 -41c13 -55 -27 -3 -47 -15c-42 -26 49 -152 31 -156l-59 34c-8 0 -13 -5 -16 -10
|
||||
c1 -30 10 -57 19 -84c28 -11 77 -2 100 -25c47 -28 97 -115 75 -159c34 -13 68 -22 106 -22c101 0 193 48 247 125c3 24 -8 44 -50 44c-69 0 -156 13 -153 97c2 46 101 108 66 143c-30 30 12 39 12 66c0 37 -65 32 -69 50s20 36 41 56c-30 10 -60 19 -94 19zM631 591
|
||||
c-38 -11 -94 -35 -87 -53c6 -15 52 -1 65 -13c11 -10 16 -59 44 -31l22 22v3c-11 26 -26 50 -44 72z" />
|
||||
<glyph glyph-name="70" unicode=""
|
||||
d="M703 800l97 -100l-400 -400l-100 100l-200 -203l-100 100l300 303l100 -100zM0 100h800v-100h-800v100z" />
|
||||
<glyph glyph-name="71" unicode=""
|
||||
d="M0 700h100v-100h-100v100zM200 700h100v-100h-100v100zM400 700h100v-100h-100v100zM600 700h100v-100h-100v100zM0 500h100v-100h-100v100zM200 500h100v-100h-100v100zM400 500h100v-100h-100v100zM600 500h100v-100h-100v100zM0 300h100v-100h-100v100zM200 300h100
|
||||
v-100h-100v100zM400 300h100v-100h-100v100zM600 300h100v-100h-100v100zM0 100h100v-100h-100v100zM200 100h100v-100h-100v100zM400 100h100v-100h-100v100zM600 100h100v-100h-100v100z" />
|
||||
<glyph glyph-name="72" unicode=""
|
||||
d="M0 800h200v-200h-200v200zM300 800h200v-200h-200v200zM600 800h200v-200h-200v200zM0 500h200v-200h-200v200zM300 500h200v-200h-200v200zM600 500h200v-200h-200v200zM0 200h200v-200h-200v200zM300 200h200v-200h-200v200zM600 200h200v-200h-200v200z" />
|
||||
<glyph glyph-name="73" unicode=""
|
||||
d="M0 800h300v-300h-300v300zM500 800h300v-300h-300v300zM0 300h300v-300h-300v300zM500 300h300v-300h-300v300z" />
|
||||
<glyph glyph-name="74" unicode=""
|
||||
d="M19 800h662c11 0 19 -8 19 -19v-331c0 -28 -22 -50 -50 -50h-600c-28 0 -50 22 -50 50v331c0 11 8 19 19 19zM0 309c16 -6 32 -9 50 -9h600c18 0 34 3 50 9v-290c0 -11 -8 -19 -19 -19h-662c-11 0 -19 8 -19 19v290zM550 200c-28 0 -50 -22 -50 -50s22 -50 50 -50
|
||||
s50 22 50 50s-22 50 -50 50z" />
|
||||
<glyph glyph-name="75" unicode=""
|
||||
d="M0 700h300v-100h-50c-28 0 -50 -22 -50 -50v-150h300v150c0 28 -22 50 -50 50h-50v100h300v-100h-50c-28 0 -50 -22 -50 -50v-400c0 -28 22 -50 50 -50h50v-100h-300v100h50c28 0 50 22 50 50v150h-300v-150c0 -28 22 -50 50 -50h50v-100h-300v100h50c28 0 50 22 50 50
|
||||
v400c0 28 -22 50 -50 50h-50v100z" />
|
||||
<glyph glyph-name="76" unicode=""
|
||||
d="M400 700c165 0 300 -135 300 -300v-100h50c28 0 50 -22 50 -50v-200c0 -28 -22 -50 -50 -50h-100c-28 0 -50 22 -50 50v350c0 111 -89 200 -200 200s-200 -89 -200 -200v-350c0 -28 -22 -50 -50 -50h-100c-28 0 -50 22 -50 50v200c0 28 22 50 50 50h50v100
|
||||
c0 165 135 300 300 300z" />
|
||||
<glyph glyph-name="77" unicode=""
|
||||
d="M0 500c0 109 91 200 200 200s200 -91 200 -200c0 109 91 200 200 200s200 -91 200 -200c0 -55 -23 -105 -59 -141l-341 -340l-341 340c-36 36 -59 86 -59 141z" />
|
||||
<glyph glyph-name="78" unicode=""
|
||||
d="M400 700l400 -300l-100 3v-403h-200v200h-200v-200h-200v400h-100z" />
|
||||
<glyph glyph-name="79" unicode=""
|
||||
d="M0 800h800v-800h-800v800zM100 700v-300l100 100l400 -400h100v100l-200 200l100 100l100 -100v300h-600z" />
|
||||
<glyph glyph-name="7a" unicode=""
|
||||
d="M19 800h762c11 0 19 -8 19 -19v-762c0 -11 -8 -19 -19 -19h-762c-11 0 -19 8 -19 19v762c0 11 8 19 19 19zM100 600v-300h100l100 -100h200l100 100h100v300h-600z" />
|
||||
<glyph glyph-name="7b" unicode=""
|
||||
d="M200 600c80 0 142 -56 200 -122c58 66 119 122 200 122c131 0 200 -101 200 -200s-69 -200 -200 -200c-81 0 -142 56 -200 122c-58 -66 -121 -122 -200 -122c-131 0 -200 101 -200 200s69 200 200 200zM200 500c-74 0 -100 -54 -100 -100s26 -100 100 -100
|
||||
c42 0 88 47 134 100c-46 53 -92 100 -134 100zM600 500c-43 0 -88 -47 -134 -100c46 -53 91 -100 134 -100c74 0 100 54 100 100s-26 100 -100 100z" />
|
||||
<glyph glyph-name="7c" unicode="" horiz-adv-x="400"
|
||||
d="M300 800c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100s45 100 100 100zM150 550c83 0 150 -69 150 -150c0 -66 -100 -214 -100 -250c0 -28 22 -50 50 -50s50 22 50 50h100c0 -83 -67 -150 -150 -150s-150 64 -150 150s100 222 100 250s-22 50 -50 50
|
||||
s-50 -22 -50 -50h-100c0 83 67 150 150 150z" />
|
||||
<glyph glyph-name="7d" unicode=""
|
||||
d="M200 800h500v-100h-122c-77 -197 -156 -392 -234 -588l-6 -12h162v-100h-500v100h122c77 197 156 392 234 588l7 12h-163v100z" />
|
||||
<glyph glyph-name="7e" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM0 500h800v-100h-800v100zM0 300h800v-100h-800v100zM100 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="7f" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM0 500h800v-100h-800v100zM0 300h800v-100h-800v100zM0 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="80" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM0 500h800v-100h-800v100zM0 300h800v-100h-800v100zM200 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="81" unicode=""
|
||||
d="M550 800c138 0 250 -112 250 -250s-112 -250 -250 -250c-16 0 -32 0 -47 3l-3 -3v-100h-200v-200h-300v200l303 303c-3 15 -3 31 -3 47c0 138 112 250 250 250zM600 700c-55 0 -100 -45 -100 -100s45 -100 100 -100s100 45 100 100s-45 100 -100 100z" />
|
||||
<glyph glyph-name="82" unicode=""
|
||||
d="M134 600h3h4h4h5h500c28 0 50 -22 50 -50v-350h100v-150c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v150h100v350v2c0 20 15 42 34 48zM200 500v-300h100v-100h200v100h100v300h-400z" />
|
||||
<glyph glyph-name="83" unicode=""
|
||||
d="M0 800h400v-400h-400v400zM500 600h100v-400h-400v100h300v300zM700 400h100v-400h-400v100h300v300z" />
|
||||
<glyph glyph-name="84" unicode="" horiz-adv-x="600"
|
||||
d="M337 694c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-300 -150c-8 -6 -21 -11 -31 -11c-28 0 -50 22 -50 50c0 21 16 44 37 49zM437 544c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-400 -200c-8 -6 -21 -11 -31 -11c-28 0 -50 22 -50 50
|
||||
c0 21 16 44 37 49zM437 344c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-106 -56c24 -4 43 -26 43 -50c0 -28 -23 -51 -51 -51c-2 0 -6 1 -8 1h-200c-26 1 -48 24 -48 50c0 16 12 36 26 44zM151 -50c0 23 20 50 46 50h3h4h5h100c28 0 50 -22 50 -50
|
||||
s-22 -50 -50 -50h-100c-2 0 -6 -1 -8 -1c-28 0 -50 23 -50 51z" />
|
||||
<glyph glyph-name="85" unicode=""
|
||||
d="M199 800h100v-200h-200v100h100v100zM586 797h1c18 1 38 1 56 -3c36 -8 69 -26 97 -54c78 -78 78 -203 0 -281l-150 -150c-8 -13 -28 -24 -43 -24c-28 0 -50 22 -50 50c0 15 11 35 24 43l150 150c40 40 39 105 0 144c-41 41 -110 34 -144 0l-44 -44
|
||||
c-8 -13 -27 -24 -42 -24c-28 0 -50 22 -50 50c0 15 11 35 24 43l43 44c32 33 72 53 128 56zM208 490c4 5 14 16 22 16h3c2 0 6 1 8 1c28 0 50 -22 50 -50c0 -11 -6 -27 -14 -35l-150 -150c-40 -40 -39 -105 0 -144c41 -41 110 -34 144 0l44 44c8 13 27 24 42 24
|
||||
c28 0 50 -22 50 -50c0 -15 -11 -35 -24 -43l-43 -44c-22 -22 -48 -37 -75 -47c-70 -25 -151 -9 -207 47c-78 78 -78 203 0 281zM499 200h200v-100h-100v-100h-100v200z" />
|
||||
<glyph glyph-name="86" unicode=""
|
||||
d="M586 797c18 1 39 1 57 -3c36 -8 69 -26 97 -54c78 -78 78 -203 0 -281l-150 -150c-62 -62 -132 -81 -182 -78s-69 17 -84 25s-26 27 -26 44c0 28 22 51 50 51c8 0 19 -3 26 -7c0 0 15 -11 41 -13s62 3 106 47l150 150c40 40 39 105 0 144c-41 41 -110 34 -144 0
|
||||
c-8 -13 -28 -24 -43 -24c-28 0 -50 22 -50 50c0 15 11 35 24 43c32 33 72 53 128 56zM386 566c50 -2 64 -17 85 -22s37 -28 37 -49c0 -28 -22 -50 -50 -50c-10 0 -23 5 -31 11c0 0 -19 9 -47 10s-63 -4 -103 -44l-150 -150c-40 -40 -39 -105 0 -144c41 -41 110 -34 144 0
|
||||
c8 13 27 24 42 24c28 0 50 -22 50 -50c0 -15 -10 -35 -23 -43c-22 -22 -48 -37 -75 -47c-70 -25 -151 -9 -207 47c-78 78 -78 203 0 281l150 150c60 60 128 78 178 76z" />
|
||||
<glyph glyph-name="87" unicode=""
|
||||
d="M0 700h300v-300h-300v300zM400 700h400v-100h-400v100zM400 500h300v-100h-300v100zM0 300h300v-300h-300v300zM400 300h400v-100h-400v100zM400 100h300v-100h-300v100z" />
|
||||
<glyph glyph-name="88" unicode=""
|
||||
d="M50 700c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM200 700h600v-100h-600v100zM50 500c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM200 500h600v-100h-600v100zM50 300c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50
|
||||
s22 50 50 50zM200 300h600v-100h-600v100zM50 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM200 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="89" unicode=""
|
||||
d="M800 800l-400 -800l-100 300l-300 100z" />
|
||||
<glyph glyph-name="8a" unicode="" horiz-adv-x="600"
|
||||
d="M300 700c110 0 200 -90 200 -200v-100h100v-400h-600v400h100v100c0 110 90 200 200 200zM300 600c-56 0 -100 -44 -100 -100v-100h200v100c0 56 -44 100 -100 100z" />
|
||||
<glyph glyph-name="8b" unicode="" horiz-adv-x="600"
|
||||
d="M300 800c110 0 200 -90 200 -200v-200h100v-400h-600v400h400v200c0 56 -44 100 -100 100s-100 -44 -100 -100h-100c0 110 90 200 200 200z" />
|
||||
<glyph glyph-name="8c" unicode=""
|
||||
d="M400 700v-100c-111 0 -200 -89 -200 -200h100l-150 -200l-150 200h100c0 165 135 300 300 300zM650 600l150 -200h-100c0 -165 -135 -300 -300 -300v100c111 0 200 89 200 200h-100z" />
|
||||
<glyph glyph-name="8d" unicode=""
|
||||
d="M100 800h600v-300h100l-150 -250l-150 250h100v200h-400v-100h-100v200zM150 550l150 -250h-100v-200h400v100h100v-200h-600v300h-100z" />
|
||||
<glyph glyph-name="8e" unicode=""
|
||||
d="M600 700l200 -150l-200 -150v100h-500v-100h-100v100c0 55 45 100 100 100h500v100zM200 300v-100h500v100h100v-100c0 -55 -45 -100 -100 -100h-500v-100l-200 150z" />
|
||||
<glyph glyph-name="8f" unicode="" horiz-adv-x="900"
|
||||
d="M350 800c193 0 350 -157 350 -350c0 -60 -17 -117 -44 -166c5 -3 12 -8 16 -12l100 -100c16 -16 30 -49 30 -72c0 -56 -46 -102 -102 -102c-23 0 -56 14 -72 30l-100 100c-4 3 -9 9 -12 13c-49 -26 -107 -41 -166 -41c-193 0 -350 157 -350 350s157 350 350 350zM350 200
|
||||
c142 0 250 108 250 250c0 139 -111 250 -250 250s-250 -111 -250 -250s111 -250 250 -250z" />
|
||||
<glyph glyph-name="90" unicode="" horiz-adv-x="600"
|
||||
d="M300 800c166 0 300 -134 300 -300c0 -200 -300 -500 -300 -500s-300 300 -300 500c0 166 134 300 300 300zM300 700c-110 0 -200 -90 -200 -200s90 -200 200 -200s200 90 200 200s-90 200 -200 200z" />
|
||||
<glyph glyph-name="91" unicode="" horiz-adv-x="900"
|
||||
d="M0 800h800v-541c1 -3 1 -8 1 -11s0 -7 -1 -10v-238h-800v800zM495 250c0 26 22 50 50 50h5h150v400h-600v-600h600v100h-150h-5c-28 0 -50 22 -50 50zM350 600c83 0 150 -67 150 -150c0 -100 -150 -250 -150 -250s-150 150 -150 250c0 83 67 150 150 150zM350 500
|
||||
c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
|
||||
<glyph glyph-name="92" unicode="" horiz-adv-x="600"
|
||||
d="M0 700h200v-600h-200v600zM400 700h200v-600h-200v600z" />
|
||||
<glyph glyph-name="93" unicode="" horiz-adv-x="600"
|
||||
d="M0 700l600 -300l-600 -300v600z" />
|
||||
<glyph glyph-name="94" unicode="" horiz-adv-x="600"
|
||||
d="M300 700c166 0 300 -134 300 -300s-134 -300 -300 -300s-300 134 -300 300s134 300 300 300z" />
|
||||
<glyph glyph-name="95" unicode=""
|
||||
d="M400 700v-600l-400 300zM400 400l400 300v-600z" />
|
||||
<glyph glyph-name="96" unicode=""
|
||||
d="M0 700l400 -300l-400 -300v600zM400 100v600l400 -300z" />
|
||||
<glyph glyph-name="97" unicode=""
|
||||
d="M0 700h200v-600h-200v600zM200 400l500 300v-600z" />
|
||||
<glyph glyph-name="98" unicode=""
|
||||
d="M0 700l500 -300l-500 -300v600zM500 100v600h200v-600h-200z" />
|
||||
<glyph glyph-name="99" unicode="" horiz-adv-x="600"
|
||||
d="M0 700h600v-600h-600v600z" />
|
||||
<glyph glyph-name="9a" unicode=""
|
||||
d="M200 800h400v-200h200v-400h-200v-200h-400v200h-200v400h200v200z" />
|
||||
<glyph glyph-name="9b" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM0 403h800v-100h-800v100zM0 103h800v-100h-800v100z" />
|
||||
<glyph glyph-name="9c" unicode="" horiz-adv-x="600"
|
||||
d="M278 700c7 2 13 4 22 4c55 0 100 -45 100 -100v-4v-200c0 -55 -45 -100 -100 -100s-100 45 -100 100v200v2c0 44 35 88 78 98zM34 500h4h3c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-50c0 -111 89 -200 200 -200s200 89 200 200v50c0 28 22 50 50 50s50 -22 50 -50v-50
|
||||
c0 -148 -109 -270 -250 -294v-106h50c55 0 100 -45 100 -100h-400c0 55 45 100 100 100h50v106c-141 24 -250 146 -250 294v50v2c0 20 15 42 34 48z" />
|
||||
<glyph glyph-name="9d" unicode=""
|
||||
d="M0 500h800v-200h-800v200z" />
|
||||
<glyph glyph-name="9e" unicode=""
|
||||
d="M34 700h4h3h4h5h700c28 0 50 -22 50 -50v-500c0 -28 -22 -50 -50 -50h-250v-100h100c55 0 100 -45 100 -100h-600c0 55 45 100 100 100h100v100h-250c-28 0 -50 22 -50 50v500v2c0 20 15 42 34 48zM100 600v-400h600v400h-600z" />
|
||||
<glyph glyph-name="9f" unicode=""
|
||||
d="M272 700c-14 -40 -22 -83 -22 -128c0 -221 179 -400 400 -400c45 0 88 8 128 22c-53 -158 -202 -272 -378 -272c-221 0 -400 179 -400 400c0 176 114 325 272 378z" />
|
||||
<glyph glyph-name="a0" unicode=""
|
||||
d="M350 700l150 -150h-100v-150h150v100l150 -150l-150 -150v100h-150v-150h100l-150 -150l-150 150h100v150h-150v-100l-150 150l150 150v-100h150v150h-100z" />
|
||||
<glyph glyph-name="a1" unicode=""
|
||||
d="M800 800v-550c0 -83 -67 -150 -150 -150s-150 67 -150 150s67 150 150 150c17 0 35 -4 50 -9v206c-201 -6 -327 -27 -400 -50v-397c0 -83 -67 -150 -150 -150s-150 67 -150 150s67 150 150 150c17 0 35 -4 50 -9v409s100 100 600 100z" />
|
||||
<glyph glyph-name="a2" unicode="" horiz-adv-x="700"
|
||||
d="M499 700c51 0 102 -20 141 -59c78 -78 78 -203 0 -281l-250 -244c-48 -48 -127 -48 -175 0s-48 127 0 175l96 97l69 -69l-90 -94l-7 -3c-10 -10 -10 -28 0 -38s28 -10 38 0l250 247c37 40 39 102 0 141s-104 40 -144 0l-278 -275c-66 -69 -68 -179 0 -247
|
||||
c69 -69 181 -69 250 0l9 12l116 113l69 -69l-125 -125c-107 -107 -281 -107 -388 0s-107 281 0 388l278 272c39 39 90 59 141 59z" />
|
||||
<glyph glyph-name="a3" unicode=""
|
||||
d="M600 800l200 -200l-100 -100l-200 200zM400 600l200 -200l-400 -400h-200v200z" />
|
||||
<glyph glyph-name="a4" unicode=""
|
||||
d="M550 800c83 0 150 -90 150 -200s-67 -200 -150 -200c-22 0 -40 8 -59 19c6 26 9 52 9 81c0 84 -27 158 -72 212c27 52 71 88 122 88zM250 700c83 0 150 -90 150 -200s-67 -200 -150 -200s-150 90 -150 200s67 200 150 200zM725 384c44 -22 75 -66 75 -118v-166h-200v66
|
||||
c0 50 -17 96 -44 134c66 2 126 33 169 84zM75 284c45 -53 106 -84 175 -84s130 31 175 84c44 -22 75 -66 75 -118v-166h-500v166c0 52 31 96 75 118z" />
|
||||
<glyph glyph-name="a5" unicode=""
|
||||
d="M400 800c110 0 200 -112 200 -250s-90 -250 -200 -250s-200 112 -200 250s90 250 200 250zM191 300c54 -61 128 -100 209 -100s155 39 209 100c106 -5 191 -92 191 -200v-100h-800v100c0 108 85 195 191 200z" />
|
||||
<glyph glyph-name="a6" unicode="" horiz-adv-x="600"
|
||||
d="M19 800h462c11 0 19 -8 19 -19v-762c0 -11 -8 -19 -19 -19h-462c-11 0 -19 8 -19 19v762c0 11 8 19 19 19zM100 700v-500h300v500h-300zM250 150c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
|
||||
<glyph glyph-name="a7" unicode=""
|
||||
d="M350 800c17 0 34 -1 50 -3v-397l-297 297c63 64 150 103 247 103zM500 694c169 -25 300 -168 300 -344c0 -193 -157 -350 -350 -350c-85 0 -161 31 -222 81l272 272v341zM91 562l237 -234l-212 -212c-70 55 -116 138 -116 234c0 84 35 158 91 212z" />
|
||||
<glyph glyph-name="a8" unicode=""
|
||||
d="M92 650c0 23 20 50 46 50h3h4h5h400c28 0 50 -22 50 -50s-22 -50 -50 -50h-50v-200h100c55 0 100 -45 100 -100h-300v-300l-56 -100l-44 100v300h-300c0 55 45 100 100 100h100v200h-50c-2 0 -6 -1 -8 -1c-28 0 -50 23 -50 51z" />
|
||||
<glyph glyph-name="a9" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM300 600v-400l300 200z" />
|
||||
<glyph glyph-name="aa" unicode=""
|
||||
d="M300 800h200v-300h300v-200h-300v-300h-200v300h-300v200h300v300z" />
|
||||
<glyph glyph-name="ab" unicode=""
|
||||
d="M300 800h100v-400h-100v400zM172 656l62 -78l-40 -31c-58 -46 -94 -117 -94 -197c0 -139 111 -250 250 -250s250 111 250 250c0 80 -39 151 -97 197l-37 31l62 78l38 -31c82 -64 134 -164 134 -275c0 -193 -157 -350 -350 -350s-350 157 -350 350c0 111 53 211 134 275z
|
||||
" />
|
||||
<glyph glyph-name="ac" unicode=""
|
||||
d="M200 800h400v-200h-400v200zM9 500h782c6 0 9 -3 9 -9v-282c0 -6 -3 -9 -9 -9h-91v200h-600v-200h-91c-6 0 -9 3 -9 9v282c0 6 3 9 9 9zM200 300h400v-300h-400v300z" />
|
||||
<glyph glyph-name="ad" unicode=""
|
||||
d="M0 700h100v-700h-100v700zM700 700h100v-700h-100v700zM200 600h200v-100h-200v100zM300 400h200v-100h-200v100zM400 200h200v-100h-200v100z" />
|
||||
<glyph glyph-name="ae" unicode=""
|
||||
d="M325 700c42 -141 87 -280 131 -419c29 74 59 148 88 222c30 -57 58 -114 87 -172h169v-100h-231l-13 28c-37 -92 -74 -184 -112 -275c-38 129 -79 257 -119 385c-42 -133 -83 -267 -125 -400c-28 88 -56 175 -84 262h-116v100h188l9 -34l3 -6c42 137 83 273 125 409z" />
|
||||
<glyph glyph-name="af" unicode=""
|
||||
d="M200 600c0 57 43 100 100 100s100 -43 100 -100c0 -28 -18 -48 -28 -72c-3 -6 -3 -16 -3 -28h231v-231c12 0 22 0 28 3c24 10 44 28 72 28c57 0 100 -43 100 -100s-43 -100 -100 -100c-28 0 -48 18 -72 28c-6 3 -16 3 -28 3v-231h-231c0 12 0 22 3 28c10 24 28 44 28 72
|
||||
c0 57 -43 100 -100 100s-100 -43 -100 -100c0 -28 18 -48 28 -72c3 -6 3 -16 3 -28h-231v600h231c0 12 0 22 -3 28c-10 24 -28 44 -28 72z" />
|
||||
<glyph glyph-name="b0" unicode="" horiz-adv-x="500"
|
||||
d="M247 700c84 0 148 -20 191 -59s59 -93 59 -141c0 -117 -69 -181 -119 -225s-81 -67 -81 -150v-25h-100v25c0 117 65 181 115 225s85 67 85 150c0 25 -8 48 -28 66s-56 34 -122 34s-97 -18 -116 -37s-27 -43 -31 -69l-100 12c5 38 19 88 59 128s103 66 188 66zM197 0h100
|
||||
v-100h-100v100z" />
|
||||
<glyph glyph-name="b1" unicode=""
|
||||
d="M450 800c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -69 -48 -127 -112 -144c-22 55 -75 94 -138 94c-20 0 -39 -5 -56 -12c-17 64 -75 112 -144 112s-127 -48 -144 -112c-17 7 -36 12 -56 12c-37 0 -71 -12 -97 -34c-33 36 -53 82 -53 134
|
||||
c0 110 90 200 200 200c23 114 129 200 250 200zM334 300h4h3c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-200c0 -28 -22 -50 -50 -50s-50 22 -50 50v200v2c0 20 15 42 34 48zM134 200h4h3c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-100c0 -28 -22 -50 -50 -50s-50 22 -50 50v100v2
|
||||
c0 20 15 42 34 48zM534 200h3h4c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-100c0 -28 -22 -50 -50 -50s-50 22 -50 50v100v2c0 20 15 42 34 48z" />
|
||||
<glyph glyph-name="b2" unicode=""
|
||||
d="M600 800l200 -150l-200 -150v100h-50l-153 -191l175 -206l6 -3h22v100l200 -150l-200 -150v100h-25c-35 0 -56 12 -78 38l-166 190l-153 -190c-22 -27 -43 -38 -78 -38h-100v100h100l166 206l-163 191l-3 3h-100v100h100c34 0 56 -12 78 -38l153 -178l141 178
|
||||
c22 27 43 38 78 38h50v100z" />
|
||||
<glyph glyph-name="b3" unicode=""
|
||||
d="M400 800c110 0 209 -47 281 -119l119 119v-300h-300l109 109c-54 55 -126 91 -209 91c-166 0 -300 -134 -300 -300s134 -300 300 -300c83 0 158 34 212 88l72 -72c-72 -72 -174 -116 -284 -116c-220 0 -400 180 -400 400s180 400 400 400z" />
|
||||
<glyph glyph-name="b4" unicode=""
|
||||
d="M400 800h400v-400l-166 166l-400 -400l166 -166h-400v400l166 -166l400 400z" />
|
||||
<glyph glyph-name="b5" unicode="" horiz-adv-x="600"
|
||||
d="M250 800l250 -300h-200v-200h200l-250 -300l-250 300h200v200h-200z" />
|
||||
<glyph glyph-name="b6" unicode=""
|
||||
d="M300 600v-200h200v200l300 -250l-300 -250v200h-200v-200l-300 250z" />
|
||||
<glyph glyph-name="b7" unicode=""
|
||||
d="M0 800c441 0 800 -359 800 -800h-200c0 333 -267 600 -600 600v200zM0 500c275 0 500 -225 500 -500h-200c0 167 -133 300 -300 300v200zM0 200c110 0 200 -90 200 -200h-200v200z" />
|
||||
<glyph glyph-name="b8" unicode=""
|
||||
d="M100 800c386 0 700 -314 700 -700h-100c0 332 -268 600 -600 600v100zM100 600c276 0 500 -224 500 -500h-100c0 222 -178 400 -400 400v100zM100 400c165 0 300 -135 300 -300h-100c0 111 -89 200 -200 200v100zM100 200c55 0 100 -45 100 -100s-45 -100 -100 -100
|
||||
s-100 45 -100 100s45 100 100 100z" />
|
||||
<glyph glyph-name="b9" unicode=""
|
||||
d="M300 800h400c55 0 100 -45 100 -100v-200h-400v150c0 28 -22 50 -50 50s-50 -22 -50 -50v-250h400v-300c0 -55 -45 -100 -100 -100h-500c-55 0 -100 45 -100 100v200h100v-150c0 -28 22 -50 50 -50s50 22 50 50v550c0 55 45 100 100 100z" />
|
||||
<glyph glyph-name="ba" unicode=""
|
||||
d="M75 700h225v-100h-200v-500h400v100h100v-125c0 -41 -34 -75 -75 -75h-450c-41 0 -75 34 -75 75v550c0 41 34 75 75 75zM600 700l200 -200l-200 -200v100h-200c-94 0 -173 -65 -194 -153c23 199 189 353 394 353v100z" />
|
||||
<glyph glyph-name="bb" unicode=""
|
||||
d="M500 700l300 -284l-300 -316v200h-100c-200 0 -348 -102 -400 -300c0 295 100 500 500 500v200z" />
|
||||
<glyph glyph-name="bc" unicode=""
|
||||
d="M381 791l19 9l19 -9c127 -53 253 -108 381 -160v-31c0 -166 -67 -313 -147 -419c-40 -53 -83 -97 -125 -128s-82 -53 -128 -53s-86 22 -128 53s-85 75 -125 128c-80 107 -147 253 -147 419v31c128 52 254 107 381 160zM400 100v591l-294 -122c8 -126 58 -243 122 -328
|
||||
c35 -46 73 -86 106 -110s62 -31 66 -31z" />
|
||||
<glyph glyph-name="bd" unicode=""
|
||||
d="M600 800h100v-800h-100v800zM400 700h100v-700h-100v700zM200 500h100v-500h-100v500zM0 300h100v-300h-100v300z" />
|
||||
<glyph glyph-name="be" unicode=""
|
||||
d="M300 800h100v-200h200l100 -100l-100 -100h-200v-400h-100v500h-200l-100 100l100 100h200v100z" />
|
||||
<glyph glyph-name="bf" unicode=""
|
||||
d="M200 800h100v-600h200l-250 -200l-250 200h200v600zM400 800h200v-100h-200v100zM400 600h300v-100h-300v100zM400 400h400v-100h-400v100z" />
|
||||
<glyph glyph-name="c0" unicode=""
|
||||
d="M200 800h100v-600h200l-250 -200l-250 200h200v600zM400 800h400v-100h-400v100zM400 600h300v-100h-300v100zM400 400h200v-100h-200v100z" />
|
||||
<glyph glyph-name="c1" unicode=""
|
||||
d="M75 700h650c41 0 75 -34 75 -75v-550c0 -41 -34 -75 -75 -75h-650c-41 0 -75 34 -75 75v550c0 41 34 75 75 75zM100 600v-100h100v100h-100zM300 600v-100h400v100h-400zM100 400v-100h100v100h-100zM300 400v-100h400v100h-400zM100 200v-100h100v100h-100zM300 200
|
||||
v-100h400v100h-400z" />
|
||||
<glyph glyph-name="c2" unicode=""
|
||||
d="M400 800l100 -300h300l-250 -200l100 -300l-250 200l-250 -200l100 300l-250 200h300z" />
|
||||
<glyph glyph-name="c3" unicode=""
|
||||
d="M400 800c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM150 700c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM650 700c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM400 600c110 0 200 -90 200 -200
|
||||
s-90 -200 -200 -200s-200 90 -200 200s90 200 200 200zM50 450c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM750 450c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM150 200c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50
|
||||
s22 50 50 50zM650 200c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM400 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
|
||||
<glyph glyph-name="c4" unicode=""
|
||||
d="M34 800h632c18 0 34 -16 34 -34v-732c0 -18 -16 -34 -34 -34h-632c-18 0 -34 16 -34 34v732c0 18 16 34 34 34zM100 700v-500h500v500h-500zM350 150c-38 0 -63 -42 -44 -75s69 -33 88 0s-6 75 -44 75z" />
|
||||
<glyph glyph-name="c5" unicode=""
|
||||
d="M0 800h300l500 -500l-300 -300l-500 500v300zM200 700c-55 0 -100 -45 -100 -100s45 -100 100 -100s100 45 100 100s-45 100 -100 100z" />
|
||||
<glyph glyph-name="c6" unicode=""
|
||||
d="M0 600h200l300 -300l-200 -200l-300 300v200zM340 600h160l300 -300l-200 -200l-78 78l119 122zM150 500c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
|
||||
<glyph glyph-name="c7" unicode=""
|
||||
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM400 600c110 0 200 -90 200 -200s-90 -200 -200 -200s-200 90 -200 200
|
||||
s90 200 200 200zM400 500c-56 0 -100 -44 -100 -100s44 -100 100 -100s100 44 100 100s-44 100 -100 100z" />
|
||||
<glyph glyph-name="c8" unicode=""
|
||||
d="M0 700h559l-100 -100h-359v-500h500v159l100 100v-359h-700v700zM700 700l100 -100l-400 -400l-200 200l100 100l100 -100z" />
|
||||
<glyph glyph-name="c9" unicode=""
|
||||
d="M9 800h782c6 0 9 -3 9 -9v-782c0 -6 -3 -9 -9 -9h-782c-6 0 -9 3 -9 9v782c0 6 3 9 9 9zM150 722l-72 -72l100 -100l-100 -100l72 -72l172 172zM400 500v-100h300v100h-300z" />
|
||||
<glyph glyph-name="ca" unicode=""
|
||||
d="M0 800h800v-200h-50c0 55 -45 100 -100 100h-150v-550c0 -28 22 -50 50 -50h50v-100h-400v100h50c28 0 50 22 50 50v550h-150c-55 0 -100 -45 -100 -100h-50v200z" />
|
||||
<glyph glyph-name="cb" unicode=""
|
||||
d="M0 700h100v-400h-100v400zM200 700h350c21 0 39 -13 47 -31c0 0 103 -291 103 -319s-22 -50 -50 -50h-150c-28 0 -50 -25 -50 -50s39 -158 47 -184s-5 -55 -31 -63s-52 5 -66 31s-109 219 -128 238s-44 28 -72 28v400z" />
|
||||
<glyph glyph-name="cc" unicode=""
|
||||
d="M400 666c10 19 28 32 47 34l19 -3c26 -8 39 -37 31 -63s-47 -159 -47 -184s22 -50 50 -50h150c28 0 50 -22 50 -50s-103 -319 -103 -319c-8 -18 -26 -31 -47 -31h-350v400c28 0 53 9 72 28s114 212 128 238zM0 400h100v-400h-100v400z" />
|
||||
<glyph glyph-name="cd" unicode=""
|
||||
d="M200 700h300v-100h-100v-6c25 -4 50 -8 72 -16l-34 -94c-28 11 -58 16 -88 16c-139 0 -250 -111 -250 -250s111 -250 250 -250s250 111 250 250c0 31 -5 60 -16 88l91 37c14 -38 25 -81 25 -125c0 -193 -157 -350 -350 -350s-350 157 -350 350c0 176 130 323 300 347v3
|
||||
h-100v100zM700 584c0 0 -296 -348 -316 -368s-48 -20 -68 0s-20 48 0 68s384 300 384 300z" />
|
||||
<glyph glyph-name="ce" unicode=""
|
||||
d="M600 700l200 -150l-200 -150v100h-600v100h600v100zM200 300v-100h600v-100h-600v-100l-200 150z" />
|
||||
<glyph glyph-name="cf" unicode=""
|
||||
d="M300 800h100c55 0 100 -45 100 -100h100c55 0 100 -45 100 -100h-700c0 55 45 100 100 100h100c0 55 45 100 100 100zM100 500h100v-350c0 -28 22 -50 50 -50s50 22 50 50v350h100v-350c0 -28 22 -50 50 -50s50 22 50 50v350h100v-481c0 -11 -8 -19 -19 -19h-462
|
||||
c-11 0 -19 8 -19 19v481z" />
|
||||
<glyph glyph-name="d0" unicode=""
|
||||
d="M100 800h200v-400c0 -55 45 -100 100 -100s100 45 100 100v400h100v-400c0 -110 -90 -200 -200 -200h-50c-138 0 -250 90 -250 200v400zM0 100h700v-100h-700v100z" />
|
||||
<glyph glyph-name="d1" unicode=""
|
||||
d="M9 700h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v482c0 6 3 9 9 9zM609 700h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v482c0 6 3 9 9 9zM309 500h182c6 0 9 -3 9 -9v-282c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v282
|
||||
c0 6 3 9 9 9zM0 100h800v-100h-800v100z" />
|
||||
<glyph glyph-name="d2" unicode=""
|
||||
d="M10 700h181c6 0 9 -3 9 -9v-191h-200v191c0 6 4 9 10 9zM610 700h181c6 0 9 -3 9 -9v-191h-200v191c0 6 5 9 10 9zM310 600h181c6 0 9 -3 9 -9v-91h-200v91c0 6 4 9 10 9zM0 400h800v-100h-800v100zM0 200h200v-191c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v191zM300 200
|
||||
h200v-91c0 -6 -3 -9 -9 -9h-181c-6 0 -10 3 -10 9v91zM600 200h200v-191c0 -6 -3 -9 -9 -9h-181c-6 0 -10 3 -10 9v191z" />
|
||||
<glyph glyph-name="d3" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM9 500h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v482c0 6 3 9 9 9zM309 500h182c6 0 9 -3 9 -9v-282c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v282c0 6 3 9 9 9zM609 500h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182
|
||||
c-6 0 -9 3 -9 9v482c0 6 3 9 9 9z" />
|
||||
<glyph glyph-name="d4" unicode=""
|
||||
d="M50 600h500c28 0 50 -22 50 -50v-150l100 100h100v-300h-100l-100 100v-150c0 -28 -22 -50 -50 -50h-500c-28 0 -50 22 -50 50v400c0 28 22 50 50 50z" />
|
||||
<glyph glyph-name="d5" unicode=""
|
||||
d="M334 800h66v-800h-66l-134 200h-200v400h200zM500 600v100c26 0 52 -4 75 -10c130 -33 225 -150 225 -290s-95 -258 -225 -291h-3c-23 -6 -47 -9 -72 -9v100c17 0 34 2 50 6c86 22 150 100 150 194s-64 172 -150 194c-16 4 -33 6 -50 6zM500 500l25 -3
|
||||
c44 -11 75 -51 75 -97s-32 -86 -75 -97l-25 -3v200z" />
|
||||
<glyph glyph-name="d6" unicode="" horiz-adv-x="600"
|
||||
d="M334 800h66v-800h-66l-134 200h-200v400h200zM500 500l25 -3c44 -11 75 -51 75 -97s-32 -86 -75 -97l-25 -3v200z" />
|
||||
<glyph glyph-name="d7" unicode="" horiz-adv-x="400"
|
||||
d="M334 800h66v-800h-66l-134 200h-200v400h200z" />
|
||||
<glyph glyph-name="d8" unicode=""
|
||||
d="M309 800h82c6 0 10 -4 12 -9l294 -682l3 -19v-81c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v81l3 19l294 682c2 5 6 9 12 9zM300 500v-200h100v200h-100zM300 200v-100h100v100h-100z" />
|
||||
<glyph glyph-name="d9" unicode=""
|
||||
d="M375 800c138 0 269 -39 378 -109l-53 -82c-93 60 -205 91 -325 91c-119 0 -229 -32 -322 -91l-53 82c109 70 237 109 375 109zM375 500c78 0 154 -23 216 -62l-53 -85c-46 30 -104 47 -163 47c-60 0 -112 -17 -159 -47l-54 85c62 40 134 62 213 62zM375 200
|
||||
c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100s45 100 100 100z" />
|
||||
<glyph glyph-name="da" unicode="" horiz-adv-x="900"
|
||||
d="M551 800c16 0 32 0 47 -3l-97 -97v-200h200l97 97c3 -15 3 -31 3 -47c0 -138 -112 -250 -250 -250c-32 0 -62 8 -90 19l-288 -291c-20 -20 -46 -28 -72 -28s-52 8 -72 28c-39 39 -39 105 0 144l291 287c-11 28 -19 59 -19 91c0 138 112 250 250 250zM101 150
|
||||
c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
|
||||
<glyph glyph-name="db" unicode=""
|
||||
d="M141 700c84 -84 169 -167 253 -250c82 83 167 165 247 250l143 -141l-253 -253c84 -82 167 -166 253 -247l-143 -143c-81 86 -165 169 -247 253l-253 -253l-141 143c85 80 167 164 250 247c-83 84 -166 169 -250 253z" />
|
||||
<glyph glyph-name="dc" unicode=""
|
||||
d="M0 800h100l231 -300h38l231 300h100l-225 -300h225v-100h-300v-100h300v-100h-300v-200h-100v200h-300v100h300v100h-300v100h225z" />
|
||||
<glyph glyph-name="dd" unicode="" horiz-adv-x="900"
|
||||
d="M350 800c193 0 350 -157 350 -350c0 -61 -17 -119 -44 -169c4 -2 10 -6 13 -9l103 -100c16 -16 30 -49 30 -72c0 -56 -46 -102 -102 -102c-23 0 -56 14 -72 30l-100 103c-3 3 -7 9 -9 13c-50 -28 -108 -44 -169 -44c-193 0 -350 157 -350 350s157 350 350 350zM350 700
|
||||
c-139 0 -250 -111 -250 -250s111 -250 250 -250c62 0 119 23 163 60c7 11 19 25 31 31l3 3c34 43 53 97 53 156c0 139 -111 250 -250 250zM300 600h100v-100h100v-100h-100v-100h-100v100h-100v100h100v100z" />
|
||||
<glyph glyph-name="de" unicode="" horiz-adv-x="900"
|
||||
d="M350 800c193 0 350 -157 350 -350c0 -61 -17 -119 -44 -169c4 -2 10 -6 13 -9l103 -100c16 -16 30 -49 30 -72c0 -56 -46 -102 -102 -102c-23 0 -56 14 -72 30l-100 103c-3 3 -7 9 -9 13c-50 -28 -108 -44 -169 -44c-193 0 -350 157 -350 350s157 350 350 350zM350 700
|
||||
c-139 0 -250 -111 -250 -250s111 -250 250 -250c62 0 119 23 163 60c7 11 19 25 31 31l3 3c34 43 53 97 53 156c0 139 -111 250 -250 250zM200 500h300v-100h-300v100z" />
|
||||
</font>
|
||||
</defs></svg>
|
||||
|
After Width: | Height: | Size: 54 KiB |
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,561 @@
|
|||
@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');
|
||||
|
||||
@import url('fonts/source-code-pro.css');
|
||||
|
||||
:root {
|
||||
--back-color: black;
|
||||
--back-box-color: #080b3e;
|
||||
--text-color: lightgreen;
|
||||
--text-hi-color: yellow;
|
||||
--sub-text-color: #149d14;
|
||||
--status-text-color: #0a810a;
|
||||
--error--text-color: red;
|
||||
--link-color: #8eceff;
|
||||
--link--hov-color: #7e7dff;
|
||||
--input-color: #e07b00;
|
||||
--input-back-color: #042d57;
|
||||
--input-back-focus-color: #255d98;
|
||||
--toggle-width: 768px;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'clacon';
|
||||
src: url('./fonts/Inconsolata-VariableFont_ww.ttf') format("truetype-variations");
|
||||
font-weight: 400 999;
|
||||
font-stretch: 75% 200%;
|
||||
}
|
||||
|
||||
html, body {
|
||||
//font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
//font-family: 'Source Code Pro', Courier, monospace;
|
||||
font-family: clacon, Consolas, Courier, monospace;
|
||||
//font-family: Georgia, 'Times New Roman', Times, serif;
|
||||
//zoom: 1.00; /* For Times New Roman, consolas */
|
||||
|
||||
background: var(--back-color);
|
||||
color: var(--text-color);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
a, .btn-link {
|
||||
color: var(--link-color);
|
||||
}
|
||||
|
||||
a:hover, .btn-link:hover {
|
||||
color: var(--link--hov-color);
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
|
||||
.searchbox > input.search {
|
||||
color: var(--input-color);
|
||||
background: var(--input-back-color);
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
|
||||
.searchbox > input.search:focus {
|
||||
background: var(--input-back-focus-color);
|
||||
}
|
||||
|
||||
app {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.top-row {
|
||||
min-height: 3.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.main {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.main .top-row {
|
||||
background-color: #f7f7f7;
|
||||
border-bottom: 1px solid #d6d5d5;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.main .top-row > a, .main .top-row .btn-link {
|
||||
white-space: nowrap;
|
||||
margin-left: 1.5rem;
|
||||
}
|
||||
|
||||
.main .top-row a:first-child {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
//background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
|
||||
background-color: var(--back-box-color);
|
||||
color: var(--text-hi-color);
|
||||
}
|
||||
|
||||
.sidebar .top-row {
|
||||
//background-color: rgba(0,0,0,0.4);
|
||||
background-color: var(--back-box-color);
|
||||
border-bottom-color: yellow;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: dotted;
|
||||
}
|
||||
|
||||
.sidebar .navbar-brand {
|
||||
font-size: 1.3rem;
|
||||
color: var(--text-hi-color);
|
||||
}
|
||||
|
||||
.sidebar .oi {
|
||||
width: 2rem;
|
||||
font-size: 1.3rem;
|
||||
vertical-align: text-top;
|
||||
top: -2px;
|
||||
}
|
||||
|
||||
.sidebar .nav-item {
|
||||
font-size: 1.1rem;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.sidebar .nav-item:first-of-type {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
.sidebar .nav-item:last-of-type {
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
.sidebar .nav-item a {
|
||||
color: var(--text-hi-color);
|
||||
border-radius: 4px;
|
||||
height: 3rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: 3rem;
|
||||
}
|
||||
|
||||
.sidebar .nav-item a.active {
|
||||
background-color: rgba(255,255,255,0.25);
|
||||
//color: white;
|
||||
color: var(--text-hi-color);
|
||||
}
|
||||
|
||||
.sidebar .nav-item a:hover {
|
||||
background-color: rgba(255,255,255,0.1);
|
||||
//color: white;
|
||||
color: var(--text-hi-color);
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-top: 1.1rem;
|
||||
padding-left: 0.6rem !important;
|
||||
padding-right: 0.6rem !important;
|
||||
}
|
||||
|
||||
.navbar-toggler {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.navbar .social-links {
|
||||
font-size: 87%;
|
||||
}
|
||||
|
||||
.navbar .social-link {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.navbar .social-link a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
.navbar .social-link > * {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.navbar .social-link {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.navbar .social-link {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.navbar .social-links {
|
||||
margin-left: auto;
|
||||
margin-right: 0.7rem;
|
||||
font-stretch: condensed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.valid.modified:not([type=checkbox]) {
|
||||
outline: 1px solid #26b050;
|
||||
}
|
||||
|
||||
.invalid {
|
||||
outline: 1px solid red;
|
||||
}
|
||||
|
||||
.validation-message {
|
||||
color: red;
|
||||
}
|
||||
|
||||
#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: 0.75rem;
|
||||
top: 0.5rem;
|
||||
}
|
||||
|
||||
|
||||
/* own styles */
|
||||
.updater {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 3.2em;
|
||||
color: var(--status-text-color);
|
||||
background: var(--back-box-color);
|
||||
font-size: 0.85em;
|
||||
padding-left: 0.6rem;
|
||||
padding-right: 0.6rem;
|
||||
padding-top: 0.2em;
|
||||
}
|
||||
|
||||
.updater .lnk {
|
||||
text-decoration: underline;
|
||||
color: var(--link-color);
|
||||
font-style: italic;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
h3.section-title {
|
||||
font-size: 1.6em;
|
||||
font-weight: bold
|
||||
}
|
||||
|
||||
|
||||
/* index page */
|
||||
@media (max-width: 30em) {
|
||||
.topic-list.index-page {
|
||||
visibility: hidden;
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.top-topics.index-page {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.top-cloud.index-page {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
/* post-finder */
|
||||
|
||||
.post-finder {
|
||||
font-size: 14pt;
|
||||
}
|
||||
|
||||
|
||||
.post-finder .searchbox {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.post-finder .searchbox > input {
|
||||
margin-right: 0.25em;
|
||||
}
|
||||
|
||||
.post-finder .searchbox .searchbut {
|
||||
margin-left: 0.25em;
|
||||
}
|
||||
|
||||
.post-finder .searchbox > * {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.post-finder .error-msg {
|
||||
color: var(--error--text-color);
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
.post-finder .section-title {
|
||||
font-weight: bold;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.post-finder .navbar {
|
||||
font-size: 90%;
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
color: yellow;
|
||||
margin-top: 0.7em;
|
||||
margin-bottom: 0.9em;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.post-finder .navbar .showing {
|
||||
background-color: blue;
|
||||
flex-grow: 1;
|
||||
margin-right: 0.3em;
|
||||
padding-top: 0.3rem;
|
||||
padding-left: 0.2rem;
|
||||
font-stretch: semi-condensed;
|
||||
}
|
||||
|
||||
.post-finder .navbar button.btn-primary {
|
||||
cursor: pointer;
|
||||
margin-right: 0.3em;
|
||||
width: 3em;
|
||||
}
|
||||
|
||||
|
||||
.post-finder ul {
|
||||
line-height: initial;
|
||||
}
|
||||
|
||||
.post-finder li {
|
||||
margin-top: 0.85rem;
|
||||
}
|
||||
|
||||
.post-finder li .nav-link > * {
|
||||
color: var(--sub-text-color);
|
||||
}
|
||||
|
||||
.post-finder li abstract {
|
||||
font-size: 75%;
|
||||
display: block;
|
||||
clear: left;
|
||||
margin-left: 1rem;
|
||||
//margin-top: 0.2rem;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.post-finder li small {
|
||||
font-size: 75%;
|
||||
font-style: italic;
|
||||
display: block;
|
||||
clear: left;
|
||||
margin-left: 1rem;
|
||||
//margin-top: -0.3rem;
|
||||
}
|
||||
|
||||
.post-finder ul {
|
||||
padding-inline-start: 20px;
|
||||
}
|
||||
|
||||
.post-finder .nav-link {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
.topic-quick-link {
|
||||
text-decoration: underline;
|
||||
color: var(--link-color);
|
||||
font-style: italic;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.topic-cloud {
|
||||
font-size: 1.0em;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
|
||||
.topic-cloud .topic-items {
|
||||
margin-right: 0.5em;
|
||||
padding: 0.5em;
|
||||
background-color: var(--back-box-color);
|
||||
border-radius: 0.5em;
|
||||
margin-right: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
padding: 0.5em;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
|
||||
/* top-topics-list / topic-content */
|
||||
|
||||
|
||||
.topic-content {
|
||||
font-size: 0.99em;
|
||||
line-height: initial;
|
||||
display: inline-block;
|
||||
background: var(--back-box-color);
|
||||
margin: 0.5rem;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
width: 19em;
|
||||
vertical-align: top
|
||||
}
|
||||
|
||||
.topic-content small {
|
||||
font-size: 0.85em;
|
||||
font-style: italic;
|
||||
display: block;
|
||||
clear: left;
|
||||
}
|
||||
|
||||
.topic-content .card-title {
|
||||
font-weight: bold;
|
||||
margin-bottom: 0.4em;
|
||||
}
|
||||
|
||||
.topic-content .card-body {
|
||||
padding: 0.15rem;
|
||||
}
|
||||
|
||||
.topic-content ul {
|
||||
padding-inline-start: 20px;
|
||||
}
|
||||
|
||||
.topic-content li {
|
||||
margin-top: 0.6em;
|
||||
}
|
||||
|
||||
.topic-content li small {
|
||||
margin-top: 0.1rem;
|
||||
color: var(--sub-text-color);
|
||||
}
|
||||
|
||||
.topic-content .nav-link {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.viewer {
|
||||
background: black;
|
||||
color: lightgreen;
|
||||
padding: 3px;
|
||||
// Would be cool https://css-tricks.com/old-timey-terminal-styling/
|
||||
}
|
||||
|
||||
.viewer h1 {
|
||||
font-stretch: condensed;
|
||||
font-weight: 600;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
. viewer h2 {
|
||||
font-weight: 600;
|
||||
font-stretch: condensed;
|
||||
}
|
||||
|
||||
.viewer img {
|
||||
overflow-x: scroll;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.blog-powered-by {
|
||||
font-size: 80%;
|
||||
font-style: italic;
|
||||
text-align: right;
|
||||
width: 100%;
|
||||
padding-left: 0.3em;
|
||||
padding-right: 0.3em;
|
||||
color: var(--status-text-color)
|
||||
}
|
||||
|
||||
|
||||
.blog-contact {
|
||||
font-size: 90%;
|
||||
font-style: italic;
|
||||
text-align: right;
|
||||
width: 100%;
|
||||
padding-left: 0.3em;
|
||||
padding-right: 0.3em;
|
||||
color: var(--status-text-color)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* media dependant styles */
|
||||
|
||||
|
||||
@media (max-width: 767.98px) {
|
||||
.main .top-row:not(.auth) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.main .top-row.auth {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.main .top-row a, .main .top-row .btn-link {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.updater {
|
||||
font-stretch: condensed;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
app {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 250px;
|
||||
height: 100vh;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.main .top-row {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.main > div {
|
||||
padding-left: 2rem !important;
|
||||
padding-right: 1.5rem !important;
|
||||
}
|
||||
|
||||
.navbar-toggler {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sidebar .collapse {
|
||||
/* Never collapse the sidebar for wide screens */
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
|
|
@ -0,0 +1,253 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<title>blog3000 powered blog</title>
|
||||
<base href="/" />
|
||||
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="css/site.css" rel="stylesheet" />
|
||||
<link href="css/github-stylesheet.css" rel="stylesheet" />
|
||||
<link href="manifest.json" rel="manifest" />
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<app>Loading page (blazor-app, modern browser required for this to work)...</app>
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
An unhandled error has occurred.
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
<script src="_framework/blazor.webassembly.js"></script>
|
||||
<script>navigator.serviceWorker.register('service-worker.js');</script>
|
||||
<script>
|
||||
window.Network = {
|
||||
Init: function (interop) {
|
||||
function handler() {
|
||||
interop.invokeMethodAsync("Network.StatusChanged", navigator.onLine);
|
||||
}
|
||||
|
||||
window.addEventListener('online', handler);
|
||||
window.addEventListener('offline', handler);
|
||||
|
||||
if (!navigator.onLine) {
|
||||
handler(navigator.onLine);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class MyCacheStorage {
|
||||
|
||||
// TODO: Improve SetException, pass object instead of string?
|
||||
|
||||
static async Create(cbObject, cacheId) {
|
||||
try {
|
||||
let i = new MyCacheStorage();
|
||||
i.cacheId = cacheId;
|
||||
i.myCache = await caches.open(cacheId);
|
||||
window[cacheId] = i;
|
||||
if (!await caches.has(cacheId)) {
|
||||
//Should not occurr on a healthy system, was probably a red herring during debugging
|
||||
/*
|
||||
console.warn("Cache NOT " + cacheId + " created, retry in 1000ms");
|
||||
setTimeout(() => {
|
||||
caches.open(cacheId).then((c) => {
|
||||
caches.has(cacheId).then((b) => {
|
||||
if (!b) {
|
||||
console.warn("Cache NOT " + cacheId + "created, giving up");
|
||||
cbObject.invokeMethodAsync("SetResult", false);
|
||||
}
|
||||
else {
|
||||
console.log("Cache: " + cacheId + " created");
|
||||
cbObject.invokeMethodAsync("SetResult", true);
|
||||
}
|
||||
})
|
||||
});
|
||||
}, 1000);*/
|
||||
console.log("Cache" + cacheId + " NOT created");
|
||||
cbObject.invokeMethodAsync("SetResult", false);
|
||||
}
|
||||
else {
|
||||
console.log("Cache: " + cacheId + " created");
|
||||
cbObject.invokeMethodAsync("SetResult", true);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
console.warn(e);
|
||||
cbObject.invokeMethodAsync("SetException", "" + e);
|
||||
}
|
||||
}
|
||||
|
||||
async CheckCache() {
|
||||
if (!await caches.has(this.cacheId)) {
|
||||
// Should only occur on cache reset e.g. during debugging!
|
||||
console.log("Cache" + this.cacheId + " NOT found, reopening");
|
||||
this.myCache = await caches.open(this.cacheId);
|
||||
if (!await caches.has(this.cacheId)) {
|
||||
console.log("Cache " + this.cacheId + " still NOT found, failing");
|
||||
throw new ("Cache " + this.cacheId + " not openable/creatable");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async Add(cbObject, url) {
|
||||
try {
|
||||
await this.CheckCache();
|
||||
await this.myCache.add(url);
|
||||
//console.log("my-cache added to", url);
|
||||
cbObject.invokeMethodAsync("SetResult", true);
|
||||
}
|
||||
catch (e) {
|
||||
console.warn(e);
|
||||
cbObject.invokeMethodAsync("SetException", "" + e);
|
||||
}
|
||||
}
|
||||
|
||||
async AddAll(cbObject, urls) {
|
||||
try {
|
||||
if (typeof (urls) === "string") urls = [urls];
|
||||
|
||||
await this.CheckCache();
|
||||
await this.myCache.addAll(urls);
|
||||
//console.log("my-cache added all to", urls);
|
||||
cbObject.invokeMethodAsync("SetResult", true);
|
||||
}
|
||||
catch (e) {
|
||||
console.warn(e, urls);
|
||||
cbObject.invokeMethodAsync("SetException", "" + e);
|
||||
}
|
||||
}
|
||||
|
||||
async Delete(cbObject, url) {
|
||||
try {
|
||||
await this.CheckCache();
|
||||
await this.myCache.delete(url);
|
||||
//console.log("my-cache added to");
|
||||
cbObject.invokeMethodAsync("SetResult", true);
|
||||
}
|
||||
catch (e) {
|
||||
console.warn(e);
|
||||
cbObject.invokeMethodAsync("SetException", "" + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async MatchAll(cbObject, filter) {
|
||||
try {
|
||||
// filter does not do contains-match, uri in cache
|
||||
// includes host-part etc, therefore built in filtering can't be used
|
||||
await this.CheckCache();
|
||||
var responses = await this.myCache.matchAll(/*filter*/);
|
||||
var matches = [];
|
||||
responses.forEach(function (element, index, array) {
|
||||
if (element.url.includes(filter)) {
|
||||
matches.push(element.url);
|
||||
}
|
||||
});
|
||||
|
||||
//console.log(filter, matches);
|
||||
cbObject.invokeMethodAsync("SetResult", matches);
|
||||
}
|
||||
catch (e) {
|
||||
console.warn(e);
|
||||
cbObject.invokeMethodAsync("SetException", "" + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* check if all given "filters" are in cache
|
||||
* @param cbObject
|
||||
* @param filters
|
||||
*/
|
||||
async AreCached(cbObject, filters) {
|
||||
try {
|
||||
if (typeof (filters) === "string") filters = [filters];
|
||||
|
||||
// filter does not do contains-match, uri in cache
|
||||
// includes host-part etc, therefore built in filtering can't be used
|
||||
|
||||
let res = true;
|
||||
await this.CheckCache();
|
||||
var responses = await this.myCache.matchAll(/*filter*/);
|
||||
if (responses && filters) {
|
||||
let match = null;
|
||||
filters.forEach(f => {
|
||||
responses.forEach(function (element, index, array) {
|
||||
if (element.url.includes(f)) {
|
||||
match = element.url;
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (!match) {
|
||||
res = false;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
console.log(filters, res);
|
||||
cbObject.invokeMethodAsync("SetResult", res);
|
||||
}
|
||||
catch (e) {
|
||||
console.warn(e);
|
||||
cbObject.invokeMethodAsync("SetException", "" + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
window.MyCacheStorage = MyCacheStorage;
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
/**
|
||||
*
|
||||
* @param uri
|
||||
* @param name optional, only works for same-origin attributes, otherwise server will override
|
||||
*/
|
||||
window.downloadURI = function (uri, name) {
|
||||
console.log("Preparing download of " + uri);
|
||||
setTimeout(() => {
|
||||
var link = document.createElement("a");
|
||||
// If you don't know the name or want to use
|
||||
// the webserver default set name = ''
|
||||
if (name) {
|
||||
link.setAttribute('download', name);
|
||||
}
|
||||
link.href = uri;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
link.remove();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
|
||||
window.scrollElmIntoView = function (element) {
|
||||
//console.log("YY", element);
|
||||
if (element) {
|
||||
var rect = element.getBoundingClientRect();
|
||||
|
||||
// Scroll only when not in view!
|
||||
if (!(
|
||||
rect.top >= 0 &&
|
||||
rect.left >= 0 &&
|
||||
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
|
||||
rect.right <= (window.innerWidth || document.documentElement.clientWidth)
|
||||
)) element.scrollIntoView();
|
||||
}
|
||||
}
|
||||
|
||||
window.setTitle = function(txt) {
|
||||
document.title = txt;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"name": "mh's-Blog",
|
||||
"short_name": "blog.mh3000.net",
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"background_color": "#ffffff",
|
||||
"theme_color": "#03173d",
|
||||
"icons": [
|
||||
{
|
||||
"src": "icon2.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
// In development, always fetch from the network and do not enable offline support.
|
||||
// This is because caching would make development more difficult (changes would not
|
||||
// be reflected on the first load after each change).
|
||||
self.addEventListener('fetch', () => { });
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
// Caution! Be sure you understand the caveats before publishing an application with
|
||||
// offline support. See https://aka.ms/blazor-offline-considerations
|
||||
|
||||
self.importScripts('./service-worker-assets.js');
|
||||
self.addEventListener('install', event => event.waitUntil(onInstall(event)));
|
||||
self.addEventListener('activate', event => event.waitUntil(onActivate(event)));
|
||||
self.addEventListener('fetch', event => event.respondWith(onFetch(event)));
|
||||
|
||||
|
||||
const cacheNamePrefix = 'offline-cache-';
|
||||
const cacheName = `${cacheNamePrefix}${self.assetsManifest.version}`;
|
||||
const offlineAssetsInclude = [ /\.dll$/, /\.pdb$/, /\.wasm/, /\.html/, /\.js$/, /\.json$/, /\.css$/, /\.woff$/, /\.png$/, /\.jpe?g$/, /\.gif$/, /\.ico$/ ];
|
||||
const offlineAssetsExclude = [/^service-worker\.js$/, /config\.json/];
|
||||
|
||||
async function onInstall(event) {
|
||||
console.info('Service worker: Install');
|
||||
|
||||
// Fetch and cache all matching items from the assets manifest
|
||||
const assetsRequests = self.assetsManifest.assets
|
||||
.filter(asset => offlineAssetsInclude.some(pattern => pattern.test(asset.url)))
|
||||
.filter(asset => !offlineAssetsExclude.some(pattern => pattern.test(asset.url)))
|
||||
.map(asset => new Request(asset.url, { integrity: asset.hash }));
|
||||
await caches.open(cacheName).then(cache => cache.addAll(assetsRequests));
|
||||
}
|
||||
|
||||
async function onActivate(event) {
|
||||
console.info('Service worker: Activate');
|
||||
|
||||
// Delete unused caches
|
||||
const cacheKeys = await caches.keys();
|
||||
await Promise.all(cacheKeys
|
||||
.filter(key => key.startsWith(cacheNamePrefix) && key !== cacheName)
|
||||
.map(key => caches.delete(key)));
|
||||
}
|
||||
|
||||
async function onFetch(event) {
|
||||
let cachedResponse = null;
|
||||
if (event.request.method === 'GET') {
|
||||
// For all navigation requests, try to serve index.html from cache
|
||||
// If you need some URLs to be server-rendered, edit the following check to exclude those URLs
|
||||
const shouldServeIndexHtml = event.request.mode === 'navigate';
|
||||
|
||||
const request = shouldServeIndexHtml ? 'index.html' : event.request;
|
||||
const cache = await caches.open(cacheName);
|
||||
cachedResponse = await cache.match(request);
|
||||
}
|
||||
|
||||
return cachedResponse || fetch(event.request);
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"dotnet-ef": {
|
||||
"version": "3.1.3",
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<DisableImplicitComponentsAnalyzers>true</DisableImplicitComponentsAnalyzers>
|
||||
<PackageId>Blog3000.Server</PackageId>
|
||||
<Authors>Blog3000.Server</Authors>
|
||||
<Product>Blog3000.Server</Product>
|
||||
<StartupObject></StartupObject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="app_data\hello-world.md" />
|
||||
<None Remove="app_data\posts\mh\legal.md" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AspNetCoreRateLimit" Version="3.0.5" />
|
||||
<PackageReference Include="Markdig" Version="0.20.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="3.2.1" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
|
||||
<PackageReference Include="Syslog.Framework.Logging" Version="2.2.0" />
|
||||
<PackageReference Include="TweetinviAPI" Version="5.0.0-alpha-6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Client\Blog3000.Client.csproj" />
|
||||
<ProjectReference Include="..\Shared\Blog3000.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="app_data\posts\mh\legal.md">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="app_data\posts\mh\hello-world.md">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="wwwroot\-config.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
<Exec Command="cmd.exe /c echo namespace Blog3000.Server { > "$(ProjectDir)\BuildVersion.cs"
cmd.exe /c echo public static class BuildVersion { >> "$(ProjectDir)\BuildVersion.cs"
cmd.exe /c echo public static string BUILD_DATE="%25date%25 %25time%25"; >> "$(ProjectDir)\BuildVersion.cs"
cmd.exe /c echo }} >> "$(ProjectDir)\BuildVersion.cs"" />
|
||||
</Target>
|
||||
|
||||
<ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions>
|
||||
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Blog3000.Server
|
||||
{
|
||||
public class BlogEnv
|
||||
{
|
||||
private readonly IWebHostEnvironment env;
|
||||
private readonly ILogger logger;
|
||||
|
||||
public BlogEnv(ILogger<BlogEnv> logger, IWebHostEnvironment env)
|
||||
{
|
||||
this.env = env;
|
||||
this.logger = logger;
|
||||
|
||||
// Determin path, set in AppDomain-var (for legacy)
|
||||
AppDataPath = BuildAppDataPath();
|
||||
|
||||
System.AppDomain.CurrentDomain.SetData("AppDataPath", AppDataPath);
|
||||
|
||||
logger.LogInformation($"Set AppDataPath={AppDataPath}");
|
||||
}
|
||||
|
||||
|
||||
public string AppDataPath { get; private set; }
|
||||
|
||||
|
||||
private BlogConfigJson _configJson;
|
||||
public BlogConfigJson BlogConfig
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_configJson == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
//var path = env.WebRootFileProvider.GetFileInfo("config.json")?.PhysicalPath;
|
||||
_configJson = LoadConfig();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//logger.LogWarning($"Error reading wwwroot/config.json {ex}");
|
||||
logger.LogWarning($"Error reading blogconfig.json {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
return _configJson;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static BlogConfigJson LoadConfig()
|
||||
{
|
||||
Console.WriteLine($"Loading blogconfig.json {GetCfgFilePath()}");
|
||||
var txt = System.IO.File.ReadAllText(GetCfgFilePath());
|
||||
return JsonConvert.DeserializeObject<BlogConfigJson>(txt);
|
||||
}
|
||||
|
||||
|
||||
public static void SaveConfig(BlogConfigJson c)
|
||||
{
|
||||
var txt = JsonConvert.SerializeObject(c, Formatting.Indented);
|
||||
System.IO.File.WriteAllText(GetCfgFilePath(), txt);
|
||||
}
|
||||
|
||||
|
||||
private static string BuildAppDataPath()
|
||||
{
|
||||
// Determin path, set in AppDomain-var (for legacy)
|
||||
if (Program.blogDataPath == null)
|
||||
{
|
||||
//logger.LogInformation($"CurrentDir->{Environment.CurrentDirectory}");
|
||||
//AppDataPath = System.IO.Path.Combine(env.ContentRootPath, "app_data");
|
||||
return System.IO.Path.Combine(Environment.CurrentDirectory, "app_data");
|
||||
}
|
||||
else
|
||||
{
|
||||
return Program.blogDataPath;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static string GetCfgFilePath()
|
||||
{
|
||||
return System.IO.Path.Combine(BuildAppDataPath(), "blogconfig.json");
|
||||
}
|
||||
|
||||
|
||||
public class BlogConfigJson: ClientConfigJson
|
||||
{
|
||||
public ClientConfigJson ToClientConfig()
|
||||
{
|
||||
return new ClientConfigJson
|
||||
{
|
||||
Title = Title,
|
||||
DefaultEMailAddress = DefaultEMailAddress,
|
||||
AuthorFullnames = AuthorFullnames,
|
||||
TopTopics = TopTopics,
|
||||
SocialLinks = SocialLinks
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public bool AllowSearchBots { get; set; }
|
||||
|
||||
public bool AllowSearchDevBot { get; set; }
|
||||
|
||||
public string SyslogAppName { get; set; }
|
||||
|
||||
public string PublicDlUri { get; set; }
|
||||
|
||||
public int? ListenPort { get; set; }
|
||||
|
||||
public string VisibleUrlPrefix { get; set; }
|
||||
|
||||
//
|
||||
|
||||
public ProtectedConfig Protected { get; set; }
|
||||
|
||||
public bool TwitterEnabled { get; set; }
|
||||
|
||||
public bool TwitterTestMode { get; set; }
|
||||
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class ProtectedConfig
|
||||
{
|
||||
public string TwitterAPIKey { get; set; }
|
||||
public string TwitterAPISecret { get; set; }
|
||||
public string TwitterAccessToken { get; set; }
|
||||
public string TwitterAccessSecret { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class ClientConfigJson
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string DefaultEMailAddress { get; set; }
|
||||
|
||||
public Dictionary<string, string> AuthorFullnames { get; set; }
|
||||
|
||||
public Dictionary<string, string> SocialLinks { get; set; }
|
||||
|
||||
public string[] TopTopics { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,711 @@
|
|||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Blog3000.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using Blog3000.Server.MiddleWares;
|
||||
using System.Text.Json;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
|
||||
namespace Blog3000.Server
|
||||
{
|
||||
public class BlogPostRepo
|
||||
{
|
||||
public event EventHandler BlogPostsChanged;
|
||||
|
||||
private static object updateLock = new object();
|
||||
private static object idLock = new object();
|
||||
private static long lastUsedTs;
|
||||
|
||||
private static int CACHETIMEOUTMINS = 5;
|
||||
private static string BLOGPOSTKEY = "blog-posts-cache-key";
|
||||
private static string BLOGPOSTUPDTIMEKEY = "blog-posts-upd-time-keycache-key";
|
||||
|
||||
private bool forceCacheUpdate = false;
|
||||
|
||||
private Dictionary<string, string> checksumsById = null;
|
||||
|
||||
private readonly string _blogPostPath;
|
||||
private readonly string checksumCacheFile;
|
||||
|
||||
private readonly ILogger<BlogPostRepo> logger;
|
||||
private readonly IMemoryCache cache;
|
||||
|
||||
public BlogPostRepo(ILogger<BlogPostRepo> logger, BlogEnv config, IMemoryCache cache)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.cache = cache;
|
||||
|
||||
this._blogPostPath = System.IO.Path.Combine(
|
||||
//(string)AppDomain.CurrentDomain.GetData("AppDataPath"),
|
||||
config.AppDataPath,
|
||||
"posts");
|
||||
|
||||
this.checksumCacheFile = System.IO.Path.Combine(
|
||||
//(string)AppDomain.CurrentDomain.GetData("AppDataPath"),
|
||||
config.AppDataPath,
|
||||
"checksumcache.json");
|
||||
|
||||
UpdateCache();
|
||||
}
|
||||
|
||||
|
||||
public string BlogPostRoot { get { return _blogPostPath; } }
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// CreateId based on timestamp + author.
|
||||
/// - Time no allowed to go backwards, especially when Service not running
|
||||
/// - Not multiinstance/multihosts aware
|
||||
/// </summary>
|
||||
public static void CreateId(BlogPostHeader b)
|
||||
{
|
||||
if (String.IsNullOrEmpty(b.Id) && !String.IsNullOrEmpty(b.Author))
|
||||
{
|
||||
lock (idLock)
|
||||
{
|
||||
var span = DateTime.UtcNow - new DateTime(2001, 1, 1);
|
||||
long ts = (long)(span.TotalMilliseconds / 10); // 1/10ms resolution
|
||||
if (ts <= lastUsedTs) // Time went backwards
|
||||
{
|
||||
ts = lastUsedTs + 1;
|
||||
}
|
||||
lastUsedTs = ts;
|
||||
b.Id = CreateId(b.Author, ts);
|
||||
System.Threading.Thread.Sleep(10);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("Id already set or author missing");
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearCache()
|
||||
{
|
||||
forceCacheUpdate = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns>cached list of posts</returns>
|
||||
public List<BlogPostHeader> GetHeaders()
|
||||
{
|
||||
List<BlogPostHeader> res = GetHeaderFromCache();
|
||||
if (res == null)
|
||||
{
|
||||
res = UpdateCache();
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
public string GetSafeFilePath(BlogPostHeader b)
|
||||
{
|
||||
return GetSafeFilePath(b.Author, b.Filename);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public DateTime? GetFileModDate(BlogPostHeader b)
|
||||
{
|
||||
try
|
||||
{
|
||||
var p = GetSafeFilePath(b);
|
||||
var res = System.IO.File.GetLastWriteTimeUtc(p);
|
||||
return res;
|
||||
}
|
||||
catch (IOException ioex)
|
||||
{
|
||||
logger.LogWarning("Error gettime writetime of file", ioex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public string GetText(BlogPostHeader b)
|
||||
{
|
||||
var p = GetSafeFilePath(b);
|
||||
var sb = new StringBuilder();
|
||||
|
||||
bool skipMode = true;
|
||||
try
|
||||
{
|
||||
foreach (var s in System.IO.File.ReadAllLines(p))
|
||||
{
|
||||
if (skipMode && !s.StartsWith("@")) skipMode = false;
|
||||
if (!skipMode)
|
||||
{
|
||||
sb.AppendLine(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (System.IO.IOException fex)
|
||||
{
|
||||
logger.LogWarning("Error reading file", fex);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
return sb
|
||||
.Replace("$PUBLICDL$", "PublicDl")
|
||||
.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Images for a given blogfn.md must reside in folder "blogfn-without-ext/fn"
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="imgRef"></param>
|
||||
/// <returns></returns>
|
||||
public string GetImgPath(BlogPostHeader b, string imgRef)
|
||||
{
|
||||
string imgRelPath = null;
|
||||
if (b.ImageRefs == null || !b.ImageRefs.TryGetValue(imgRef, out imgRelPath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var p = GetSafeImgFilePath(b.Author, b.Filename, System.IO.Path.GetFileName(imgRelPath));
|
||||
try
|
||||
{
|
||||
//var bytes = System.IO.File.ReadAllBytes(p);
|
||||
//return bytes;
|
||||
if (System.IO.File.Exists(p))
|
||||
{
|
||||
return p;
|
||||
}
|
||||
}
|
||||
catch (System.IO.IOException fex)
|
||||
{
|
||||
logger.LogWarning("Error reading file", fex);
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private BlogPostHeader FromFile(string f)
|
||||
{
|
||||
BlogPostHeader res = null;
|
||||
|
||||
if (f != null)
|
||||
{
|
||||
bool isDraft = false;
|
||||
|
||||
using (var stream = System.IO.File.OpenText(f))
|
||||
{
|
||||
string s = null;
|
||||
|
||||
while ((s = stream.ReadLine()) != null)
|
||||
{
|
||||
if (s.StartsWith("@")) // Meta-headers without parameter
|
||||
{
|
||||
var parts = s.Split(':', 2);
|
||||
if (parts.Length == 1)
|
||||
{
|
||||
switch (parts[0])
|
||||
{
|
||||
case "@Draft":
|
||||
isDraft = true;
|
||||
break;
|
||||
case "@NoSocialMediaInfo":
|
||||
res.NoSocialMediaInfo = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (parts.Length == 2) // Meta-Headers with parameters
|
||||
{
|
||||
if (res == null) res = new BlogPostHeader();
|
||||
res.Filename = System.IO.Path.GetFileName(f);
|
||||
|
||||
switch (parts[0])
|
||||
{
|
||||
case "@Draft":
|
||||
isDraft = true;
|
||||
break;
|
||||
case "@Id":
|
||||
res.Id = parts[1];
|
||||
break;
|
||||
case "@Lang":
|
||||
var rr = parts[1];
|
||||
if (!String.IsNullOrEmpty(rr))
|
||||
{
|
||||
res.Lang = rr.ToLowerInvariant();
|
||||
}
|
||||
break;
|
||||
case "@Title":
|
||||
res.Title = parts[1];
|
||||
break;
|
||||
case "@Author":
|
||||
res.Author = parts[1];
|
||||
break;
|
||||
case "@Abstract":
|
||||
res.Abstract = parts[1];
|
||||
break;
|
||||
case "@Access":
|
||||
res.Access = parts[1];
|
||||
break;
|
||||
case "@StickyMenuPos":
|
||||
int pos;
|
||||
if (Int32.TryParse(parts[1], out pos))
|
||||
{
|
||||
res.StickyMenuPos = pos;
|
||||
}
|
||||
break;
|
||||
case "@Topics":
|
||||
res.Topics = new List<string>((parts[1] ?? "").Split("|"));
|
||||
break;
|
||||
case "@Revision":
|
||||
var p = (parts[1] ?? "").Split("|");
|
||||
try
|
||||
{
|
||||
Revision r = new Revision();
|
||||
if (p.Length >= 1)
|
||||
{
|
||||
DateTime dt;
|
||||
if (DateTime.TryParse(p[0], out dt))
|
||||
{
|
||||
r.ChangedAt = dt;
|
||||
}
|
||||
}
|
||||
r.Description = p.Length > 1 ? p[1] : null;
|
||||
r.Author = p.Length > 2 ? p[2] : null;
|
||||
res.Revisions ??= new List<Revision>();
|
||||
res.Revisions.Add(r);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
logger.LogWarning($"Error parsing Revision on file {f}");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s.StartsWith("[")) // ImageRefs
|
||||
{
|
||||
var match = Regex.Match(s, @"\[(.+)\]:(.+)");
|
||||
if (match.Success && match.Groups.Count > 2)
|
||||
{
|
||||
res.ImageRefs ??= new Dictionary<String, String>();
|
||||
res.ImageRefs.Add(match.Groups[1].Value.Trim(), match.Groups[2].Value.Trim());
|
||||
}
|
||||
//
|
||||
}
|
||||
else if (!String.IsNullOrWhiteSpace(s)) // Non-empty string
|
||||
{
|
||||
// End of header+imagerefs
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isDraft)
|
||||
{
|
||||
bool rewriteRevisions = false;
|
||||
if ((res.Revisions?.Count ?? 0) == 0)
|
||||
{
|
||||
res.Revisions ??= new List<Revision>();
|
||||
var r = new Revision();
|
||||
r.Description = "Initial";
|
||||
res.Revisions.Add(r);
|
||||
}
|
||||
|
||||
foreach (var r in res.Revisions)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(r.Author) && (!String.IsNullOrWhiteSpace(res.Author)))
|
||||
{
|
||||
r.Author = res.Author;
|
||||
rewriteRevisions = true;
|
||||
}
|
||||
|
||||
if (r.ChangedAt == null)
|
||||
{
|
||||
r.ChangedAt ??= DateTime.UtcNow;
|
||||
rewriteRevisions = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool rewriteId = false;
|
||||
if (String.IsNullOrEmpty(res.Id) && !String.IsNullOrWhiteSpace(res.Author))
|
||||
{
|
||||
CreateId(res);
|
||||
rewriteId = true;
|
||||
}
|
||||
|
||||
if (rewriteId || rewriteRevisions)
|
||||
{
|
||||
var lines = new List<string>(System.IO.File.ReadAllLines(f));
|
||||
var outlines = new List<string>();
|
||||
outlines.Add($"@Id:{res.Id}");
|
||||
foreach (var r in res.Revisions)
|
||||
{
|
||||
outlines.Add($"@Revision:{r.ChangedAt}|{r.Description}|{r.Author}");
|
||||
}
|
||||
bool outOfHeader = false;
|
||||
foreach (var ln in lines)
|
||||
{
|
||||
if (!outOfHeader)
|
||||
{
|
||||
if (ln.StartsWith("@Id") || (ln.StartsWith("@Revision"))) continue;
|
||||
if (!ln.StartsWith("@")) outOfHeader = true;
|
||||
}
|
||||
outlines.Add(ln);
|
||||
}
|
||||
System.IO.File.WriteAllLines(f, outlines, Encoding.UTF8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!isDraft && BlogPostHeader.IsUsable(res))
|
||||
{
|
||||
res.Checksum = CalcCheckSum(res);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = null;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
#region Caching stuff
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns content of cache, updates cache if required
|
||||
/// </summary>
|
||||
private List<BlogPostHeader> GetHeaderFromCache()
|
||||
{
|
||||
List<BlogPostHeader> res = null;
|
||||
|
||||
if (forceCacheUpdate)
|
||||
{
|
||||
lock(updateLock)
|
||||
{
|
||||
if (forceCacheUpdate) // Cache still needs update?
|
||||
{
|
||||
UpdateCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cache.TryGetValue(BLOGPOSTKEY, out res))
|
||||
{
|
||||
if (IsCacheExpired())
|
||||
{
|
||||
lock (updateLock)
|
||||
{
|
||||
// Recheck if cache is still expired after we acquired lock
|
||||
if (IsCacheExpired())
|
||||
{
|
||||
res = UpdateCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
private bool IsCacheExpired()
|
||||
{
|
||||
DateTime dt;
|
||||
if (cache.TryGetValue(BLOGPOSTUPDTIMEKEY, out dt))
|
||||
{
|
||||
if (dt != null && dt.AddMinutes(CACHETIMEOUTMINS).CompareTo(DateTime.UtcNow) < 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns>The new data</returns>
|
||||
internal List<BlogPostHeader> UpdateCache()
|
||||
{
|
||||
lock (updateLock)
|
||||
{
|
||||
logger.LogWarning($"Updating BlogPostCache");
|
||||
var res = new List<BlogPostHeader>();
|
||||
|
||||
foreach (var s in System.IO.Directory.GetFiles(
|
||||
BlogPostRoot,
|
||||
"*.md",
|
||||
System.IO.SearchOption.AllDirectories)
|
||||
)
|
||||
{
|
||||
var be = FromFile(s);
|
||||
if (be != null)
|
||||
{
|
||||
res.Add(be);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogWarning($"Post {s} not usable");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cache.Set(BLOGPOSTKEY, res);
|
||||
cache.Set(BLOGPOSTUPDTIMEKEY, DateTime.UtcNow);
|
||||
forceCacheUpdate = false;
|
||||
|
||||
// Compare with cached checksum for changes
|
||||
bool hasChanges = false;
|
||||
bool newChache = false;
|
||||
|
||||
if (checksumsById == null)
|
||||
{
|
||||
checksumsById = LoadCheckSumsById();
|
||||
if (checksumsById == null)
|
||||
{
|
||||
checksumsById = new Dictionary<string, string>();
|
||||
newChache = true;
|
||||
}
|
||||
}
|
||||
|
||||
var dcCopy = new Dictionary<string, string>(checksumsById ?? new Dictionary<string, string>());
|
||||
foreach (var bp in res)
|
||||
{
|
||||
string cs = null;
|
||||
if (dcCopy.TryGetValue(bp.Id, out cs))
|
||||
{
|
||||
if (!String.Equals(cs, bp.Checksum))
|
||||
{
|
||||
hasChanges = true;
|
||||
break;
|
||||
}
|
||||
dcCopy.Remove(bp.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
hasChanges = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dcCopy.Count > 0)
|
||||
{
|
||||
hasChanges = true;
|
||||
}
|
||||
|
||||
// Write new id/checksum dict
|
||||
var dc = new Dictionary<string, string>();
|
||||
foreach (var bp in res)
|
||||
{
|
||||
dc.Add(bp.Id, bp.Checksum);
|
||||
}
|
||||
checksumsById = dc;
|
||||
SaveCheckSumsById(checksumsById);
|
||||
|
||||
// Notify listenera about changes
|
||||
if (hasChanges)
|
||||
{
|
||||
if (newChache)
|
||||
{
|
||||
logger.LogWarning("BlogPosts changed, but new or bad cache, not notifying listeners");
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogInformation("BlogPosts changed, notifying listeners");
|
||||
BlogPostsChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogInformation("BlogPosts not changed, not notifying listeners");
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region File+Path utils
|
||||
|
||||
private string GetSafeFilePath(string author, string filename)
|
||||
{
|
||||
|
||||
var at = CheckPathPart(author);
|
||||
var fn = CheckPathPart(filename);
|
||||
|
||||
return System.IO.Path.Combine(BlogPostRoot, at, fn);
|
||||
}
|
||||
|
||||
private string GetSafeImgFilePath(string author, string blogFilenmame, string imgFilename)
|
||||
{
|
||||
var at = CheckPathPart(author);
|
||||
var bt = System.IO.Path.GetFileNameWithoutExtension(CheckPathPart(blogFilenmame));
|
||||
var it = CheckPathPart(imgFilename);
|
||||
|
||||
return System.IO.Path.Combine(BlogPostRoot, at, bt, it);
|
||||
}
|
||||
|
||||
|
||||
private static string CheckPathPart(string part)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(part))
|
||||
{
|
||||
throw new ArgumentException($"null or empty?");
|
||||
}
|
||||
|
||||
var pt = System.IO.Path.GetFileName(part.Trim());
|
||||
if (!String.Equals(part, pt))
|
||||
{
|
||||
throw new ArgumentException($"contains invalid path-information?");
|
||||
}
|
||||
return pt;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
private string CalcCheckSum(BlogPostHeader b)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(b.Id ?? "");
|
||||
sb.Append("|");
|
||||
sb.Append(b.Filename ?? "");
|
||||
sb.Append("|");
|
||||
//sb.Append(res.Title ?? "");
|
||||
//sb.Append("|");
|
||||
//sb.Append(res.Author ?? "");
|
||||
//sb.Append("|");
|
||||
//sb.Append(res.Access ?? "");
|
||||
//sb.Append("|");
|
||||
//res.Topics.ForEach(t => sb.Append(t + ","));
|
||||
//sb.Append(res.Revisions?.Count ?? 0);
|
||||
//sb.Append("|");
|
||||
//sb.Append(res.Abstract ?? "");
|
||||
//sb.Append("|");
|
||||
//sb.Append(res.StickyMenuPos ?? -1);
|
||||
//sb.Append("|");
|
||||
if (b.ImageRefs != null)
|
||||
{
|
||||
foreach (var fn in b.ImageRefs.Values.OrderBy(s => s))
|
||||
{
|
||||
var fno = System.IO.Path.GetFileName(fn);
|
||||
var rfp = GetSafeImgFilePath(b.Author, b.Filename, fno);
|
||||
var bytes = new byte[] { };
|
||||
try
|
||||
{
|
||||
bytes = System.IO.File.ReadAllBytes(rfp);
|
||||
}
|
||||
catch (System.IO.IOException ex)
|
||||
{
|
||||
logger.LogWarning($"ImgFile {rfp} not readable");
|
||||
}
|
||||
var sha = System.Convert.ToBase64String(
|
||||
System.Security.Cryptography.SHA256.Create().ComputeHash(bytes)
|
||||
);
|
||||
sb.Append(sha);
|
||||
sb.Append(";");
|
||||
}
|
||||
}
|
||||
|
||||
var f = GetSafeFilePath(b.Author, b.Filename);
|
||||
sb.Append(System.IO.File.ReadAllText(f));
|
||||
|
||||
return
|
||||
System.Convert.ToBase64String(
|
||||
System.Security.Cryptography.SHA256.Create().ComputeHash(
|
||||
System.Text.Encoding.UTF8.GetBytes(sb.ToString())
|
||||
)
|
||||
); ;
|
||||
}
|
||||
|
||||
|
||||
private Dictionary<string, string> LoadCheckSumsById()
|
||||
{
|
||||
Dictionary<string, string> res = null;
|
||||
try
|
||||
{
|
||||
if (System.IO.File.Exists(checksumCacheFile))
|
||||
{
|
||||
var text = System.IO.File.ReadAllText(checksumCacheFile);
|
||||
res = JsonSerializer.Deserialize<Dictionary<string, string>>(text);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogWarning(ex, $"Error reading checksumcache file ${checksumCacheFile}");
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private bool SaveCheckSumsById(Dictionary<string, string> cbcById)
|
||||
{
|
||||
cbcById ??= new Dictionary<string, string>();
|
||||
|
||||
try
|
||||
{
|
||||
var text = JsonSerializer.Serialize(cbcById);
|
||||
System.IO.File.WriteAllText(checksumCacheFile, text);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogWarning(ex, $"Error writing checksumCache file ${checksumCacheFile}");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private static string CreateId(string author, long ts)
|
||||
{
|
||||
const string radixChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefhijklmnopqrstuvwxyz";
|
||||
|
||||
|
||||
string res = "";
|
||||
|
||||
void radixer(long l, ref string res)
|
||||
{
|
||||
do
|
||||
{
|
||||
var r = l % radixChars.Length;
|
||||
res = radixChars[(int)r] + res;
|
||||
l = (l - r) / radixChars.Length;
|
||||
|
||||
}
|
||||
while (l > 0);
|
||||
}
|
||||
|
||||
radixer(ts, ref res);
|
||||
|
||||
var authorPrefixBytes = System.Text.Encoding.UTF8.GetBytes(author);
|
||||
foreach (var b in authorPrefixBytes)
|
||||
{
|
||||
radixer(b, ref res);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
namespace Blog3000.Server {
|
||||
public static class BuildVersion {
|
||||
public static string BUILD_DATE="03.10.2020 20:24:15,77";
|
||||
}}
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
using Blog3000.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.StaticFiles;
|
||||
|
||||
namespace Blog3000.Server.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class BlogPostsController : ControllerBase
|
||||
{
|
||||
|
||||
private readonly ILogger<BlogPostsController> logger;
|
||||
private readonly BlogPostRepo blogPostRepo;
|
||||
|
||||
public BlogPostsController(ILogger<BlogPostsController> logger, BlogPostRepo blogPostRepo)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.blogPostRepo = blogPostRepo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult<IEnumerable<BlogPostHeader>> GetHeaders()
|
||||
{
|
||||
logger.LogInformation($"BlogPosts|{HttpContext.Connection.RemoteIpAddress}|GetHeaders");
|
||||
|
||||
var res = blogPostRepo.GetHeaders();
|
||||
|
||||
return new ActionResult<IEnumerable<BlogPostHeader>>(res.Where(s => "PUBLIC".Equals(s.Access)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpGet("{id}")]
|
||||
public ActionResult<BlogPost> GetPost(String id)
|
||||
{
|
||||
logger.LogInformation($"BlogPosts|{HttpContext.Connection.RemoteIpAddress}|GetHeader|{id}");
|
||||
|
||||
if (String.IsNullOrWhiteSpace(id))
|
||||
{
|
||||
return BadRequest("id");
|
||||
}
|
||||
var posts = blogPostRepo.GetHeaders();
|
||||
|
||||
// Check accessibilty
|
||||
var post = posts
|
||||
.Where(s => "PUBLIC".Equals(s.Access))
|
||||
.Where(s => id.Equals(s.Id))
|
||||
.FirstOrDefault();
|
||||
|
||||
if (post == null)
|
||||
{
|
||||
return NotFound("id");
|
||||
}
|
||||
|
||||
var res = blogPostRepo.GetText(post);
|
||||
if (res == null)
|
||||
{
|
||||
return NotFound("id/text");
|
||||
}
|
||||
|
||||
var bpt = BlogPost.FromBlogPost(post);
|
||||
bpt.Text = res;
|
||||
|
||||
return bpt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[HttpGet("{id}/imgref/{imgRef}")]
|
||||
public ActionResult<byte[]> GetImage(String id, String imgRef)
|
||||
{
|
||||
logger.LogInformation($"BlogPosts|{HttpContext.Connection.RemoteIpAddress}|GetImage|{id}|{imgRef}");
|
||||
|
||||
if (String.IsNullOrWhiteSpace(id))
|
||||
{
|
||||
return BadRequest("id");
|
||||
}
|
||||
|
||||
if (String.IsNullOrWhiteSpace(imgRef))
|
||||
{
|
||||
return BadRequest("imgRef");
|
||||
}
|
||||
var posts = blogPostRepo.GetHeaders();
|
||||
|
||||
// Check accessibilty
|
||||
var post = posts
|
||||
.Where(s => "PUBLIC".Equals(s.Access))
|
||||
.Where(s => id.Equals(s.Id))
|
||||
.FirstOrDefault();
|
||||
|
||||
if (post == null)
|
||||
{
|
||||
return NotFound("id");
|
||||
}
|
||||
|
||||
var pp = blogPostRepo.GetImgPath(post, imgRef);
|
||||
|
||||
if (pp == null)
|
||||
{
|
||||
return NotFound("id/ref");
|
||||
}
|
||||
var fn = System.IO.Path.GetFileName(pp)?.ToLowerInvariant();
|
||||
//sring mimeType = MimeMapping.GetMimeMapping(fileName) ?? "image/jpeg";
|
||||
string mime;
|
||||
new FileExtensionContentTypeProvider().TryGetContentType(fn, out mime);
|
||||
|
||||
//var ext = System.IO.Path.GetExtension(pp)?.ToLowerInvariant();
|
||||
//var mime = "image/jpeg";
|
||||
//if ((ext != null) && !(".jpg".Equals(ext))) {
|
||||
// mime = "image/"+ext.Substring(1);
|
||||
//}
|
||||
return PhysicalFile(pp, $"{mime}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpGet("search")]
|
||||
public async Task<ActionResult<List<string>>> SearchAsync(string searchTerm, int startIdx=0, int pageMaxSize=20, bool findLastPage=false)
|
||||
{
|
||||
logger.LogInformation($"BlogPosts|{HttpContext.Connection.RemoteIpAddress}|Search|{searchTerm}");
|
||||
|
||||
async IAsyncEnumerable<BlogPostHeader> GetHeaders()
|
||||
{
|
||||
foreach(var p in blogPostRepo.GetHeaders())
|
||||
{
|
||||
await Task.Yield();
|
||||
yield return p;
|
||||
}
|
||||
}
|
||||
|
||||
async IAsyncEnumerable<BlogPost> GetPosts()
|
||||
{
|
||||
foreach (var p in blogPostRepo.GetHeaders())
|
||||
{
|
||||
|
||||
await Task.Yield();
|
||||
var bt = BlogPost.FromBlogPost(p);
|
||||
bt.Text = blogPostRepo.GetText(p);
|
||||
yield return bt;
|
||||
}
|
||||
}
|
||||
|
||||
var bps = new BlogPostSearch(() => GetPosts(), () => GetHeaders(), searchTerm);
|
||||
var posts = await bps.ExecAsync(startIdx, pageMaxSize, findLastPage);
|
||||
return posts.Select(c => c.Id).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
using Blog3000.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.StaticFiles;
|
||||
using static Blog3000.Server.BlogEnv;
|
||||
|
||||
namespace Blog3000.Server.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("/config.json")]
|
||||
public class ConfigController : ControllerBase
|
||||
{
|
||||
|
||||
private readonly ILogger<BlogPostsController> logger;
|
||||
private readonly BlogEnv config;
|
||||
|
||||
public ConfigController(ILogger<BlogPostsController> logger, BlogEnv config)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult<ClientConfigJson> Get()
|
||||
{
|
||||
logger.LogInformation($"Config|{HttpContext.Connection.RemoteIpAddress}|Get");
|
||||
|
||||
var r= config.BlogConfig.ToClientConfig();
|
||||
return r;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
using Blog3000.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.StaticFiles;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using Blog3000.Client;
|
||||
using System.Text.Json;
|
||||
using System.Xml.Linq;
|
||||
using System.Threading;
|
||||
|
||||
namespace Blog3000.Server.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class PublicDlController : ControllerBase
|
||||
{
|
||||
|
||||
private readonly ILogger<BlogEnv> blogEnv;
|
||||
private readonly ILogger<BlogPostsController> logger;
|
||||
|
||||
private readonly string redirectPrefix;
|
||||
//private readonly string dlPath;
|
||||
|
||||
private static readonly SemaphoreSlim myLock = new SemaphoreSlim(1);
|
||||
|
||||
public PublicDlController(ILogger<BlogPostsController> logger, BlogEnv blogEnv)
|
||||
{
|
||||
this.logger = logger;
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(blogEnv.BlogConfig.PublicDlUri))
|
||||
{
|
||||
try
|
||||
{
|
||||
Uri u = new Uri(blogEnv.BlogConfig.PublicDlUri);
|
||||
//if ("file".Equals(u.Scheme))
|
||||
//{
|
||||
// dlPath = u.AbsolutePath;
|
||||
//}
|
||||
//else
|
||||
{
|
||||
redirectPrefix = blogEnv.BlogConfig.PublicDlUri;
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
logger.LogWarning("Error parsing Program.publicDlUrl: " + ex.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("{file}")]
|
||||
public async Task<ActionResult<Dictionary<string, int>>> GetAsync(string file)
|
||||
{
|
||||
logger.LogInformation($"PublicDl|{HttpContext.Connection.RemoteIpAddress}|GetAsync|{file}");
|
||||
|
||||
// TODO: Implmenent download counter
|
||||
|
||||
try
|
||||
{
|
||||
var fn = System.IO.Path.GetFileName(file);
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(redirectPrefix))
|
||||
{
|
||||
// TODO: How to prevent logging bad file requests (logging unknown files, etc)
|
||||
// -> Check if in Db, otherwise probe target url (range-dl 1 byte, modified?)
|
||||
return Redirect($"{redirectPrefix}/{fn}");
|
||||
}
|
||||
//else if (!String.IsNullOrWhiteSpace(dlPath))
|
||||
//{
|
||||
// var path = System.IO.Path.Combine(dlPath, fn);
|
||||
// var stream = System.IO.File.OpenRead(path);
|
||||
// // File exists, can be logged
|
||||
|
||||
// return new FileStreamResult(stream, "application/octect-stream")
|
||||
// {
|
||||
// FileDownloadName = fn
|
||||
// };
|
||||
//}
|
||||
else
|
||||
{
|
||||
logger.LogWarning($"PublicDl|{HttpContext.Connection.RemoteIpAddress}|Local download not ^configured");
|
||||
return StatusCode(500);
|
||||
}
|
||||
}
|
||||
catch(IOException ioex)
|
||||
{
|
||||
logger.LogWarning($"PublicDl|{HttpContext.Connection.RemoteIpAddress}|{ioex.Message}");
|
||||
return StatusCode(400);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpGet("{file}/getredirurl")]
|
||||
public ActionResult<string> Get(string file)
|
||||
{
|
||||
logger.LogInformation($"PublicDlGetUrl|{HttpContext.Connection.RemoteIpAddress}|GetAsync|{file}");
|
||||
|
||||
// TODO: Implmenent download counter
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(redirectPrefix))
|
||||
{
|
||||
// TODO: How to prevent logging bad file requests (logging unknown files, etc)
|
||||
// -> Check if in Db, otherwise probe target url (range-dl 1 byte, modified?)
|
||||
var fn = System.IO.Path.GetFileName(file);
|
||||
return $"{redirectPrefix}/{fn}";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogWarning($"PublicDlGetUrl|{HttpContext.Connection.RemoteIpAddress}|Local download not ^configured");
|
||||
return StatusCode(500);
|
||||
}
|
||||
}
|
||||
catch (IOException ioex)
|
||||
{
|
||||
logger.LogWarning($"PublicDlGetUrl|{HttpContext.Connection.RemoteIpAddress}|{ioex.Message}");
|
||||
return StatusCode(400);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
using Blog3000.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.StaticFiles;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using Blog3000.Client;
|
||||
using System.Text.Json;
|
||||
using System.Xml.Linq;
|
||||
using System.Threading;
|
||||
|
||||
namespace Blog3000.Server.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class ViewStatsController : ControllerBase
|
||||
{
|
||||
|
||||
private readonly ILogger<BlogPostsController> logger;
|
||||
private readonly BlogPostRepo blogPostRepo;
|
||||
|
||||
private readonly string statsFile;
|
||||
|
||||
private static readonly SemaphoreSlim myLock = new SemaphoreSlim(1);
|
||||
|
||||
public ViewStatsController(ILogger<BlogPostsController> logger, BlogPostRepo blogPostRepo)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.blogPostRepo = blogPostRepo;
|
||||
|
||||
statsFile = System.IO.Path.Combine(
|
||||
(string)AppDomain.CurrentDomain.GetData("AppDataPath"),
|
||||
"stats.json");
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<Dictionary<string, int>>> GetAsync()
|
||||
{
|
||||
logger.LogInformation($"ViewStats|{HttpContext.Connection.RemoteIpAddress}|GetAsync");
|
||||
|
||||
await myLock.WaitAsync();
|
||||
try
|
||||
{
|
||||
var res = await LoadAsync();
|
||||
return res;
|
||||
}
|
||||
finally
|
||||
{
|
||||
myLock.Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public async Task <ActionResult<Dictionary<string, int>>> PostAsync(Dictionary<string, int> newStats)
|
||||
{
|
||||
// Only add 1 view for each read post to prevent user manipulating stats to much
|
||||
// Ignoew unknwon posts
|
||||
|
||||
logger.LogInformation($"ViewStats|{HttpContext.Connection.RemoteIpAddress}|PostAsync");
|
||||
await myLock.WaitAsync();
|
||||
try
|
||||
{
|
||||
var stats = await LoadAsync();
|
||||
foreach (var k in newStats.Keys)
|
||||
{
|
||||
if (blogPostRepo.GetHeaders().FirstOrDefault(p => p.Id.Equals(k)) != null)
|
||||
{
|
||||
int nv;
|
||||
stats.TryGetValue(k, out nv);
|
||||
nv++;
|
||||
stats.Remove(k);
|
||||
stats.Add(k, nv);
|
||||
}
|
||||
}
|
||||
await SaveAsync(stats);
|
||||
return stats;
|
||||
}
|
||||
finally
|
||||
{
|
||||
myLock.Release();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<Dictionary<String, int>> LoadAsync()
|
||||
{
|
||||
Dictionary<string, int> res = null;
|
||||
|
||||
try
|
||||
{
|
||||
if (System.IO.File.Exists(statsFile))
|
||||
{
|
||||
var text = await System.IO.File.ReadAllTextAsync(statsFile);
|
||||
res = JsonSerializer.Deserialize<Dictionary<string, int>>(text);
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
logger.LogWarning(ex, $"Error reading stats file ${statsFile}");
|
||||
}
|
||||
|
||||
return res ?? new Dictionary<string, int>();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private async Task<bool> SaveAsync(Dictionary<string, int> stats)
|
||||
{
|
||||
stats ??= new Dictionary<string, int>();
|
||||
|
||||
try
|
||||
{
|
||||
var text = JsonSerializer.Serialize(stats);
|
||||
await System.IO.File.WriteAllTextAsync(statsFile, text);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogWarning(ex, $"Error writing stats file ${statsFile}");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
//using NanoBlog.Shared;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Threading.Tasks;
|
||||
//using Microsoft.AspNetCore.Mvc;
|
||||
//using Microsoft.Extensions.Logging;
|
||||
|
||||
//namespace NanoBlog.Server.Controllers
|
||||
//{
|
||||
// [ApiController]
|
||||
// [Route("[controller]")]
|
||||
// public class WeatherForecastController : ControllerBase
|
||||
// {
|
||||
// private static readonly string[] Summaries = new[]
|
||||
// {
|
||||
// "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
// };
|
||||
|
||||
// private readonly ILogger<WeatherForecastController> logger;
|
||||
|
||||
// public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
// {
|
||||
// this.logger = logger;
|
||||
// }
|
||||
|
||||
// [HttpGet]
|
||||
// public IEnumerable<WeatherForecast> Get()
|
||||
// {
|
||||
// var rng = new Random();
|
||||
// return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
// {
|
||||
// Date = DateTime.Now.AddDays(index),
|
||||
// TemperatureC = rng.Next(-20, 55),
|
||||
// Summary = Summaries[rng.Next(Summaries.Length)]
|
||||
// })
|
||||
// .ToArray();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Blog3000.Server
|
||||
{
|
||||
|
||||
|
||||
internal class BlogPostRepoUpdater : IHostedService, IDisposable
|
||||
{
|
||||
|
||||
private readonly ILogger logger;
|
||||
private readonly BlogPostRepo repo;
|
||||
|
||||
private Timer timer;
|
||||
|
||||
public BlogPostRepoUpdater(ILogger<BlogPostRepoUpdater> logger, BlogPostRepo repo)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.repo = repo;
|
||||
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
timer?.Dispose();
|
||||
}
|
||||
|
||||
|
||||
public Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
logger.LogInformation("BlogPostRepoUpdater Service starting...");
|
||||
|
||||
// Time so cache should never be expired, when a request comes in
|
||||
timer = new Timer(DoWork, null, TimeSpan.Zero, TimeSpan.FromSeconds(5*60-30));
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
logger.LogInformation("BlogPostRepoUpdater Service stopping.");
|
||||
|
||||
timer?.Dispose();
|
||||
timer = null;
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private void DoWork(object state)
|
||||
{
|
||||
logger.LogInformation("BlogPostRepoUpdater updating BlogPostRepo");
|
||||
|
||||
repo.UpdateCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Blog3000.Server.MiddleWares
|
||||
{
|
||||
public class NoCacheHeaderAdder
|
||||
{
|
||||
private string[] urls;
|
||||
|
||||
public NoCacheHeaderAdder(string[] urls)
|
||||
{
|
||||
this.urls = urls;
|
||||
}
|
||||
|
||||
public void Process(HttpContext context)
|
||||
{
|
||||
var p = context.Request.Path.ToString().ToLowerInvariant();
|
||||
|
||||
bool noCache = false;
|
||||
foreach (var u in urls)
|
||||
{
|
||||
if (p.StartsWith(u))
|
||||
{
|
||||
noCache = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (noCache)
|
||||
{
|
||||
context.Response.Headers.Add("Pragma", "no-cache"); // HTTP1.0
|
||||
context.Response.Headers.Add("Cache-Control", "no-cache, must-revalidate"); // HTTP1.1
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,360 @@
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Ganss.XSS;
|
||||
using System.IO;
|
||||
using Markdig;
|
||||
using Markdig.Syntax;
|
||||
using Blog3000.Shared;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using AngleSharp;
|
||||
using System.Net.Http;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using Blog3000.Client;
|
||||
|
||||
namespace Blog3000.Server.MiddleWares
|
||||
{
|
||||
public class SEOMgr: IDisposable
|
||||
{
|
||||
private readonly ILogger logger;
|
||||
private readonly BlogEnv blogEnv;
|
||||
private readonly BlogPostRepo blogPostRepo;
|
||||
|
||||
private readonly string urlPrefix;
|
||||
|
||||
private readonly static object siteMapLock = new object();
|
||||
private readonly string sitemapCacheFile;
|
||||
private string siteMapCache;
|
||||
|
||||
//
|
||||
// Update when SEO-Output changes
|
||||
//
|
||||
private static DateTime MINSEODATE = new DateTime(2020, 07, 03);
|
||||
|
||||
public SEOMgr(ILogger<SEOMgr> logger, BlogEnv blogEnv, BlogPostRepo blogPostRepo)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.blogEnv = blogEnv;
|
||||
this.blogPostRepo = blogPostRepo;
|
||||
this.urlPrefix = blogEnv.BlogConfig.VisibleUrlPrefix;
|
||||
|
||||
this.sitemapCacheFile = System.IO.Path.Combine(
|
||||
(string)AppDomain.CurrentDomain.GetData("AppDataPath"),
|
||||
"sitemapcache.xml");
|
||||
|
||||
blogPostRepo.BlogPostsChanged += BlogPostRepo_BlogPostsChanged;
|
||||
BlogPostRepo_BlogPostsChanged(null, null);
|
||||
}
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
blogPostRepo.BlogPostsChanged -= BlogPostRepo_BlogPostsChanged;
|
||||
}
|
||||
|
||||
|
||||
public string GetSiteMap()
|
||||
{
|
||||
if (siteMapCache == null)
|
||||
{
|
||||
UpdateSiteMap();
|
||||
}
|
||||
|
||||
return siteMapCache;
|
||||
}
|
||||
|
||||
|
||||
public StringBuilder BuildBlogPostOutput(BlogPostHeader bp)
|
||||
{
|
||||
string markdown = blogPostRepo.GetText(bp);
|
||||
|
||||
var title = InputSanitizer.Default.SanitizeText(bp.Title, true);
|
||||
var keywords = "";
|
||||
if (bp.Topics != null)
|
||||
{
|
||||
foreach (var t in bp.Topics)
|
||||
{
|
||||
keywords += (t.Replace("'", "").Replace("#", "")) + ","; // TODO
|
||||
}
|
||||
}
|
||||
keywords = InputSanitizer.Default.SanitizeText(keywords);
|
||||
|
||||
var abstr = "" + bp.Abstract;
|
||||
abstr = InputSanitizer.Default.SanitizeText(abstr, true).Replace("'", ""); // TODO
|
||||
|
||||
string author = null;
|
||||
if (!String.IsNullOrEmpty(bp.Author))
|
||||
{
|
||||
blogEnv.BlogConfig?.AuthorFullnames?.TryGetValue(bp.Author, out author);
|
||||
author = InputSanitizer.Default.SanitizeText(author, true);
|
||||
}
|
||||
|
||||
|
||||
var mdPipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
|
||||
var mdoc = Markdig.Markdown.Parse(markdown, mdPipeline);
|
||||
|
||||
|
||||
// Extract imagerefs for rewriting
|
||||
Dictionary<string, string> imgGeysByUrls = new Dictionary<string, string>();
|
||||
foreach (var r in mdoc.GetLinkReferenceDefinitions().Links)
|
||||
{
|
||||
if (r.Value != null && r.Value.Url != null)
|
||||
{
|
||||
imgGeysByUrls.Add(r.Value.Url, r.Key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Render markdown, rewrite image-urls
|
||||
var writer = new StringWriter();
|
||||
var renderer = new Markdig.Renderers.HtmlRenderer(writer);
|
||||
renderer.LinkRewriter += (a) =>
|
||||
{
|
||||
string imgKey;
|
||||
if (imgGeysByUrls.TryGetValue(a, out imgKey))
|
||||
{
|
||||
return $"BlogPosts/{bp.Id}/imgref/{a}";
|
||||
}
|
||||
return a;
|
||||
};
|
||||
mdPipeline.Setup(renderer);
|
||||
renderer.Render(mdoc);
|
||||
|
||||
// Create sanitzed html
|
||||
var html = writer.ToString();
|
||||
html = InputSanitizer.Default.SanitizeHtml(html);
|
||||
|
||||
var lang = "en";
|
||||
if (!String.IsNullOrEmpty(bp.Lang))
|
||||
{
|
||||
lang = InputSanitizer.Default.SanitizeText(bp.Lang);
|
||||
}
|
||||
|
||||
// Build final document
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("");
|
||||
sb.AppendLine($"<html lang='{lang}'>");
|
||||
sb.AppendLine("<head>");
|
||||
sb.AppendLine($"<title>{title}</title>");
|
||||
sb.AppendLine("<meta charset='UTF-8'/>");
|
||||
sb.AppendLine("<meta name='viewport' content='width=device-width, initial-scale=1.0'>");
|
||||
sb.AppendLine($"<meta name='generator' content='blog3000 build:{BuildVersion.BUILD_DATE}'>");
|
||||
sb.AppendLine($"<meta name='description' content='{abstr}'></meta>");
|
||||
sb.AppendLine($"<meta name='keywords' content='{keywords}'></meta>");
|
||||
if (!String.IsNullOrEmpty(author))
|
||||
{
|
||||
sb.AppendLine($"<meta name='author' content='{author}'></meta>");
|
||||
}
|
||||
sb.AppendLine("</head>");
|
||||
sb.AppendLine("<body>");
|
||||
sb.AppendLine($"<h1>{title}</h1>");
|
||||
sb.AppendLine($"<hr/>");
|
||||
sb.AppendLine($"<div><i>Abstract: {abstr}</i></div>");
|
||||
if (!String.IsNullOrEmpty(author))
|
||||
{
|
||||
sb.AppendLine($"<div><i>Author: {author}</i></div>");
|
||||
}
|
||||
sb.AppendLine("<hr/>");
|
||||
sb.AppendLine(html);
|
||||
sb.AppendLine("</body></html>");
|
||||
|
||||
return sb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private string CreateSitemap()
|
||||
{
|
||||
// Create list with blogpost-links
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||
sb.AppendLine("<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">");
|
||||
|
||||
DateTime? latestTime = null;
|
||||
|
||||
// Articles
|
||||
foreach (var p in blogPostRepo.GetHeaders().Where(x => "PUBLIC".Equals(x.Access)).OrderBy(x => x.Id))
|
||||
{
|
||||
sb.AppendLine(" <url>");
|
||||
sb.AppendLine($" <loc>{urlPrefix}/viewer/{p.Id}</loc>");
|
||||
var dt = blogPostRepo.GetFileModDate(p);
|
||||
if (dt != null)
|
||||
{
|
||||
if (MINSEODATE.CompareTo(dt) > 0) dt = MINSEODATE;
|
||||
sb.AppendLine($" <lastmod>{((DateTime)dt).ToString("o")}</lastmod>");
|
||||
if (latestTime == null) latestTime = dt;
|
||||
else if (dt.Value.CompareTo(latestTime) > 0) latestTime = dt;
|
||||
}
|
||||
|
||||
sb.AppendLine(" <changefreq>weekly</changefreq>");
|
||||
sb.AppendLine(" </url>");
|
||||
}
|
||||
|
||||
// Index page
|
||||
sb.AppendLine(" <url>");
|
||||
sb.AppendLine($" <loc>{urlPrefix}/</loc>");
|
||||
sb.AppendLine(" <changefreq>weekly</changefreq>");
|
||||
sb.AppendLine(" <priority>0.1</priority>");
|
||||
if (latestTime != null)
|
||||
{
|
||||
sb.AppendLine($" <lastmod>{((DateTime)latestTime).ToString("o")}</lastmod>");
|
||||
}
|
||||
sb.AppendLine(" </url>");
|
||||
|
||||
|
||||
// Done
|
||||
sb.AppendLine("</urlset>");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
|
||||
private bool isUpdatingSitemap = false;
|
||||
private void UpdateSiteMap()
|
||||
{
|
||||
lock (siteMapLock)
|
||||
{
|
||||
// Check if this thread is already rebuilding the sidemap and skip.
|
||||
// (Most importang skips dual-notifiy of crawlers)
|
||||
// C#-lock can be reentered by the thread keeping the lock.
|
||||
// This may occurr here, when the BlogPostRepo calls changed, which
|
||||
// is triggered by accessing the BlogPostRepo during the
|
||||
// Sitemap-creation.
|
||||
if (!isUpdatingSitemap)
|
||||
{
|
||||
isUpdatingSitemap = true;
|
||||
try
|
||||
{
|
||||
var oldSm = siteMapCache;
|
||||
if (String.IsNullOrEmpty(oldSm))
|
||||
{
|
||||
oldSm = LoadSitemapCache();
|
||||
}
|
||||
|
||||
logger.LogInformation("Rebuilding Sitemap");
|
||||
var sm = CreateSitemap();
|
||||
siteMapCache = sm;
|
||||
SaveSitemapCache(sm);
|
||||
|
||||
if (!String.Equals(sm, oldSm))
|
||||
{
|
||||
logger.LogInformation("Sitemap changed");
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await PingCrawlersAsync();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogInformation("Sitemap not changed");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
isUpdatingSitemap = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogInformation("Already rebuilding Sitemap. Skip");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private async Task<bool> PingCrawlersAsync()
|
||||
{
|
||||
if (blogEnv.BlogConfig.AllowSearchBots || blogEnv.BlogConfig.AllowSearchDevBot)
|
||||
{
|
||||
// Notify google
|
||||
var n1 = Task.Run(async () =>
|
||||
{
|
||||
using (var httpClient = new HttpClient())
|
||||
{
|
||||
/*WebUtility.UrlEncode*/
|
||||
var u = Uri.EscapeUriString($"http://www.google.com/ping?sitemap={(urlPrefix + "/sitemap.xml")}");
|
||||
logger.LogInformation($"Notifying crawlers: Google ({u})");
|
||||
using (var response = httpClient.GetAsync(u))
|
||||
{
|
||||
string code = response.Result.StatusCode.ToString();
|
||||
string apiResponse = await response.Result.Content.ReadAsStringAsync();
|
||||
logger.LogInformation($"Google responded: {code} / {apiResponse}");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Notify bing
|
||||
var n2 = Task.Run(async () =>
|
||||
{
|
||||
using (var httpClient = new HttpClient())
|
||||
{
|
||||
/*WebUtility.UrlEncode*/
|
||||
var u = Uri.EscapeUriString($"http://www.bing.com/ping?sitemap={(urlPrefix + "/sitemap.xml")}");
|
||||
logger.LogInformation($"Notifying crawlers: Bing ({u})");
|
||||
using (var response = httpClient.GetAsync(u))
|
||||
{
|
||||
string code = response.Result.StatusCode.ToString();
|
||||
string apiResponse = await response.Result.Content.ReadAsStringAsync();
|
||||
logger.LogInformation($"Bing responded: {code} / {apiResponse}");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
await Task.WhenAll(n1, n2);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private string LoadSitemapCache()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (System.IO.File.Exists(sitemapCacheFile))
|
||||
{
|
||||
return System.IO.File.ReadAllText(sitemapCacheFile);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogWarning(ex, $"Error reading sitemapCacheFile ${sitemapCacheFile}");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private bool SaveSitemapCache(string sitemap)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.IO.File.WriteAllText(sitemapCacheFile, sitemap);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogWarning(ex, $"Error writing sitemapCacheFile file ${sitemapCacheFile}");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void BlogPostRepo_BlogPostsChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdateSiteMap();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,230 @@
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Ganss.XSS;
|
||||
using System.IO;
|
||||
using Markdig;
|
||||
using Markdig.Syntax;
|
||||
using Blog3000.Shared;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Blog3000.Server.MiddleWares
|
||||
{
|
||||
public class SearchBotHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Default no SEO is allowed.
|
||||
/// Two-Folded strategy: Prohibit via static robots.txt and http headers
|
||||
/// On valid bots indexing may be allowed. The synthetics index + blosts are created, which
|
||||
/// match the uri-scheme of the blazor-viewer on the client
|
||||
/// </summary>
|
||||
/// <param name="allowIndexing">allow valid bots like bing+google</param>
|
||||
/// <param name="allowDevBot">allow a dev-test-box 'xx-testbot-xx'</param>
|
||||
/// <returns></returns>
|
||||
|
||||
private readonly string blogName;
|
||||
private readonly bool allowIndexing;
|
||||
private readonly bool allowDevBot;
|
||||
|
||||
private readonly ILogger logger;
|
||||
private readonly SEOMgr seoMgr;
|
||||
|
||||
public SearchBotHandler(ILogger<SearchBotHandler> logger, BlogEnv blogEnv, SEOMgr seoMgr)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.seoMgr = seoMgr;
|
||||
this.blogName = blogEnv?.BlogConfig?.Title ?? "Blog3000 Instance";
|
||||
this.allowIndexing = blogEnv.BlogConfig.AllowSearchBots;
|
||||
this.allowDevBot = blogEnv.BlogConfig.AllowSearchDevBot;
|
||||
}
|
||||
|
||||
|
||||
public async Task<bool> Process(HttpContext context)
|
||||
{
|
||||
string robotsTag = "noindex, nofollow";
|
||||
StringValues uas;
|
||||
bool isAllowedRobot = false;
|
||||
bool allowForAll = false;
|
||||
bool res = false; // Allow passing the pipeline
|
||||
|
||||
// Check if it an allowed robot first
|
||||
if (context.Request.Headers.TryGetValue("User-Agent", out uas))
|
||||
{
|
||||
//logger.LogInformation($"User-Agent|{uas}");
|
||||
|
||||
foreach (var ua in uas)
|
||||
{
|
||||
var lua = ua?.ToLowerInvariant() ?? "";
|
||||
if ((allowIndexing) && (lua.Contains("googlebot"))
|
||||
|| ((allowIndexing) && (lua.Contains("bingbot")))
|
||||
|| ((allowDevBot) && (lua.Contains("xx-testbot-xx")))
|
||||
)
|
||||
{
|
||||
logger.LogInformation($"Robot detected|{context.Connection.RemoteIpAddress}|{lua}");
|
||||
robotsTag = "noarchive, noimageindex, max-image-preview:none, max-snippet:50";
|
||||
isAllowedRobot = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if (context.Request.Path.ToString().Equals("/sitemap.xml"))
|
||||
//{
|
||||
// logger.LogInformation($"Sitemap request|{context.Connection.RemoteIpAddress}|Allowing for all useragents, now: {uas}");
|
||||
// allowForAll = true;
|
||||
//}
|
||||
|
||||
if (!isAllowedRobot && !allowForAll)
|
||||
{
|
||||
|
||||
//if ((allowIndexing || allowDevBot) && (context.Request.Path.ToString().Equals("/")))
|
||||
//{
|
||||
// logger.LogInformation($"Allow index for / for all UA |{context.Connection.RemoteIpAddress}|Useragent {uas}");
|
||||
// res = false;
|
||||
//}
|
||||
//else if ((allowIndexing || allowDevBot) && (context.Request.Path.ToString().Equals("/robots.txt")))
|
||||
//{
|
||||
// logger.LogInformation($"Suppressing negative robots for all UA|{context.Connection.RemoteIpAddress}|Useragent {uas}");
|
||||
// context.Response.StatusCode = 404;
|
||||
// res = true;
|
||||
//}
|
||||
//else
|
||||
{
|
||||
context.Response.Headers.Add("X-Robots-Tag", robotsTag);
|
||||
res = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (context.Request.Path.ToString().StartsWith("/robots.txt"))
|
||||
{
|
||||
logger.LogInformation($"Robot robots.txt output|{context.Connection.RemoteIpAddress}");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("User-Agent: *"); // Can be wildcard, since we create this only for allowed robots anyway
|
||||
sb.AppendLine("Allow: *");
|
||||
|
||||
// TODO: Use from Program.visibleUrlPrefix?
|
||||
sb.AppendLine($"Sitemap: {(context.Request.IsHttps ? "https" : "http")}://{context.Request.Host}/sitemap.xml");
|
||||
|
||||
context.Response.ContentType = "text/xml";
|
||||
context.Response.Headers.Add("Encoding", "UTF-8");
|
||||
context.Response.StatusCode = 200;
|
||||
|
||||
await context.Response.WriteAsync(sb.ToString());
|
||||
//context.Response.StatusCode = 404;
|
||||
res = true;
|
||||
}
|
||||
else if (context.Request.Path.ToString().Equals("/"))
|
||||
{
|
||||
// TODO: Move to SEOMgr
|
||||
|
||||
logger.LogInformation($"Robot index output|{context.Connection.RemoteIpAddress}");
|
||||
|
||||
//// Dont index syntetic start page
|
||||
// robotsTag = "noindex";
|
||||
|
||||
context.Response.ContentType = "text/html";
|
||||
context.Response.Headers.Add("Encoding", "UTF-8");
|
||||
context.Response.Headers.Add("X-Robots-Tag", robotsTag);
|
||||
context.Response.StatusCode = 200;
|
||||
|
||||
var repo = context.RequestServices.GetService<BlogPostRepo>();
|
||||
|
||||
// Create list with blogpost-links
|
||||
|
||||
|
||||
StringBuilder csb = new StringBuilder();
|
||||
|
||||
//
|
||||
// Stick items first, may contain important legal stuff
|
||||
// Which should no be seen by enduser but who knows
|
||||
//
|
||||
foreach (var p in repo.GetHeaders().Where(x => "PUBLIC".Equals(x.Access))
|
||||
.Where(x => x.StickyMenuPos >= 0)
|
||||
.OrderBy(c => c.StickyMenuPos)
|
||||
.ThenBy(c => c.Title))
|
||||
{
|
||||
csb.AppendLine($"<li><a href='viewer/{p.Id}'>{InputSanitizer.Default.SanitizeText(p.Title, true)}</a>");
|
||||
}
|
||||
|
||||
//
|
||||
// Now the articles them selfes
|
||||
//
|
||||
foreach (var p in repo.GetHeaders().Where(x => "PUBLIC".Equals(x.Access)).OrderBy(c => c.Title))
|
||||
{
|
||||
csb.AppendLine($"<li><a href='viewer/{p.Id}'>{InputSanitizer.Default.SanitizeText(p.Title, true)}</a>");
|
||||
}
|
||||
|
||||
var htmlSanitizer = new HtmlSanitizer();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("");
|
||||
sb.AppendLine("");
|
||||
sb.AppendLine("<html>");
|
||||
sb.AppendLine("<head>");
|
||||
sb.AppendLine($"<title>{blogName} - Mainpage</title>");
|
||||
sb.AppendLine($"<meta name='description' content='Index page of blog'></meta>");
|
||||
sb.AppendLine($"<meta name='keywords' content='MainPage,Index,Content'></meta>");
|
||||
sb.AppendLine("</head>");
|
||||
sb.AppendLine("<body><h1>Welcome to my blog</h1><hr>Site contents / current articles:<ul>");
|
||||
sb.AppendLine(htmlSanitizer.Sanitize(csb.ToString()));
|
||||
sb.AppendLine("</ul></body>");
|
||||
sb.AppendLine("</html>");
|
||||
|
||||
// Create final output
|
||||
await context.Response.WriteAsync(sb.ToString());
|
||||
res = true;
|
||||
}
|
||||
else if (context.Request.Path.ToString().Equals("/sitemap.xml"))
|
||||
{
|
||||
// Dont index syntetic start page
|
||||
logger.LogInformation($"Robot sitemap.xml|{context.Connection.RemoteIpAddress}");
|
||||
robotsTag = "";
|
||||
|
||||
context.Response.ContentType = "text/xml";
|
||||
context.Response.Headers.Add("Encoding", "UTF-8");
|
||||
//context.Response.Headers.Add("X-Robots-Tag", robotsTag);
|
||||
context.Response.StatusCode = 200;
|
||||
|
||||
var sm = seoMgr.GetSiteMap();
|
||||
|
||||
|
||||
await context.Response.WriteAsync(sm);
|
||||
res = true;
|
||||
}
|
||||
else if (context.Request.Path.ToString().StartsWith("/viewer/"))
|
||||
{
|
||||
var repo = context.RequestServices.GetService<BlogPostRepo>();
|
||||
var id = context.Request.Path.ToString().Split("/").Last();
|
||||
|
||||
logger.LogInformation($"Robot post output|{context.Connection.RemoteIpAddress}|{id}");
|
||||
|
||||
var bp = repo.GetHeaders().Where(x => "PUBLIC".Equals(x.Access) && String.Equals(id, x.Id)).FirstOrDefault();
|
||||
if (bp == null)
|
||||
{
|
||||
// Not found or no access
|
||||
context.Response.StatusCode = 404;
|
||||
}
|
||||
else
|
||||
{
|
||||
context.Response.Headers.Add("X-Robots-Tag", robotsTag);
|
||||
context.Response.StatusCode = 200;
|
||||
context.Response.ContentType = "text/html";
|
||||
context.Response.Headers.Add("Encoding", "UTF-8");
|
||||
|
||||
StringBuilder sb = seoMgr.BuildBlogPostOutput(bp);
|
||||
await context.Response.WriteAsync(sb.ToString());
|
||||
}
|
||||
res = true;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,445 @@
|
|||
using AngleSharp.Css.Dom;
|
||||
using Blog3000.Server.Utils;
|
||||
using Blog3000.Shared;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tweetinvi;
|
||||
using Tweetinvi.Core.Models;
|
||||
using Tweetinvi.Exceptions;
|
||||
using Tweetinvi.Models;
|
||||
|
||||
namespace Blog3000.Server
|
||||
{
|
||||
|
||||
|
||||
internal class UpdateTweeter : IHostedService, IDisposable
|
||||
{
|
||||
|
||||
private readonly ILogger logger;
|
||||
private readonly BlogPostRepo repo;
|
||||
|
||||
private readonly string tweetStatusFn;
|
||||
private readonly SemaphoreSlim sema = new SemaphoreSlim(1);
|
||||
|
||||
private readonly string uriPrefix;
|
||||
private readonly bool enabled;
|
||||
private readonly bool testMode;
|
||||
private readonly string apiKey;
|
||||
private readonly string apiSecret;
|
||||
private readonly string accessToken;
|
||||
private readonly string accessTokenSecret;
|
||||
|
||||
private bool needsRescan = true;
|
||||
private Timer timer;
|
||||
private Dictionary<string, TweetStatus> tweetStati;
|
||||
|
||||
public UpdateTweeter(ILogger<UpdateTweeter> logger, BlogPostRepo repo, BlogEnv blogEnv)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.repo = repo;
|
||||
|
||||
this.enabled = blogEnv.BlogConfig.TwitterEnabled;
|
||||
this.uriPrefix = blogEnv.BlogConfig.VisibleUrlPrefix;
|
||||
this.testMode = blogEnv.BlogConfig.TwitterTestMode;
|
||||
this.apiKey = DataProtect.Static.Unprotect(blogEnv.BlogConfig.Protected.TwitterAPIKey);
|
||||
this.apiSecret = DataProtect.Static.Unprotect(blogEnv.BlogConfig.Protected.TwitterAPISecret);
|
||||
this.accessToken = DataProtect.Static.Unprotect(blogEnv.BlogConfig.Protected.TwitterAccessToken);
|
||||
this.accessTokenSecret= DataProtect.Static.Unprotect(blogEnv.BlogConfig.Protected.TwitterAccessSecret);
|
||||
|
||||
tweetStatusFn = System.IO.Path.Combine(
|
||||
(string)AppDomain.CurrentDomain.GetData("AppDataPath"),
|
||||
"tweetstatus.json");
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
timer?.Dispose();
|
||||
repo.BlogPostsChanged -= Repo_BlogPostsChanged;
|
||||
}
|
||||
|
||||
|
||||
public Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
if (enabled) {
|
||||
logger.LogInformation("Service starting...");
|
||||
|
||||
|
||||
timer = new Timer(RunSenderAsync, null, TimeSpan.Zero, TimeSpan.FromSeconds(1 * 60 * (testMode ? 2 : 1)));
|
||||
repo.BlogPostsChanged += Repo_BlogPostsChanged;
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogInformation("Twitter not enabled...");
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
||||
public Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
logger.LogInformation("Service stopping.");
|
||||
|
||||
timer?.Dispose();
|
||||
timer = null;
|
||||
|
||||
repo.BlogPostsChanged -= Repo_BlogPostsChanged;
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
||||
private void Repo_BlogPostsChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoRescan();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogWarning($"Error while rescanning blogpots from event: {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async void RunSenderAsync(object state)
|
||||
{
|
||||
if (needsRescan)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoRescan();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogWarning($"Error while rescanning blogpots from sender-task: {ex}");
|
||||
}
|
||||
needsRescan = false;
|
||||
}
|
||||
|
||||
if (sema.Wait(2000))
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var e in tweetStati.Values.OrderBy(c => c.ErrCount).ThenBy(c => c.PostId))
|
||||
{
|
||||
if (e.NeedsUpdate || e.NeedsDeletion)
|
||||
{
|
||||
logger.LogInformation($"Tweeting for {e.PostId} on update, new={e.InitialTweetId == null}");
|
||||
try
|
||||
{
|
||||
if (e.NeedsDeletion)
|
||||
{
|
||||
logger.LogInformation($"Deleting tweets for removed posts {e.PostId}");
|
||||
|
||||
if (e.InitialTweetId != null)
|
||||
{
|
||||
await DeleteAsync((long)e.InitialTweetId);
|
||||
}
|
||||
|
||||
if (e.UpdateTweetId != null)
|
||||
{
|
||||
await DeleteAsync((long)e.UpdateTweetId);
|
||||
}
|
||||
|
||||
e.InitialTweetId = null;
|
||||
e.UpdateTweetId = null;
|
||||
e.NeedsDeletion = false;
|
||||
tweetStati.Remove(e.PostId);
|
||||
}
|
||||
else if (e.NeedsUpdate)
|
||||
{
|
||||
var bp = repo.GetHeaders().Where(p => Object.Equals(p.Id, e.PostId)).FirstOrDefault();
|
||||
if (bp == null)
|
||||
{
|
||||
logger.LogInformation($"{e.PostId} not found in repo!");
|
||||
e.NeedsUpdate = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e.InitialTweetId == null)
|
||||
{
|
||||
string txt = BuildTweet(bp, true);
|
||||
logger.LogInformation($"Tweeting about new post {e.PostId}: {txt}");
|
||||
|
||||
// Initial post
|
||||
var tweet = await PostAsync(txt);
|
||||
e.InitialTweetId = tweet.Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e.UpdateTweetId != null)
|
||||
{
|
||||
logger.LogInformation($"Deleting old tweet for for {e.PostId}");
|
||||
await DeleteAsync((long)e.UpdateTweetId);
|
||||
}
|
||||
|
||||
string txt = BuildTweet(bp, false);
|
||||
logger.LogInformation($"Tweeting about updated post {e.PostId}: {txt}");
|
||||
|
||||
// Update post
|
||||
var tweet = await PostAsync(txt);
|
||||
e.UpdateTweetId = tweet.Id;
|
||||
}
|
||||
e.LastPostChecksum = bp.Checksum;
|
||||
e.TweetTime = DateTime.UtcNow;
|
||||
e.NeedsUpdate = false;
|
||||
}
|
||||
// e.TweetTime = DateTime.UTCNow;
|
||||
}
|
||||
e.ErrCount = 0;
|
||||
e.LastErr = null;
|
||||
}
|
||||
catch(Exception twx)
|
||||
{
|
||||
e.LastErr = twx.ToString();
|
||||
e.ErrCount++;
|
||||
}
|
||||
Save(tweetStati);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
sema.Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void DoRescan()
|
||||
{
|
||||
needsRescan = true;
|
||||
try
|
||||
{
|
||||
if (sema.Wait(1000))
|
||||
{
|
||||
try
|
||||
{
|
||||
logger.LogInformation("Rescanning for changed posts");
|
||||
bool hasChanges = false;
|
||||
|
||||
tweetStati ??= Load();
|
||||
|
||||
var existingPostId = new Dictionary<string, bool>();
|
||||
foreach (var p in repo.GetHeaders())
|
||||
{
|
||||
if (p.NoSocialMediaInfo)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
existingPostId[p.Id] = true;
|
||||
TweetStatus ts;
|
||||
if (!tweetStati.TryGetValue(p.Id, out ts))
|
||||
{
|
||||
ts = new TweetStatus();
|
||||
ts.PostId = p.Id;
|
||||
ts.NeedsUpdate = true;
|
||||
tweetStati[p.Id] = ts;
|
||||
hasChanges = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ts.LastPostChecksum == null || (String.Compare(ts.LastPostChecksum, p.Checksum) != 0))
|
||||
{
|
||||
bool lastUpdateLongEnoughAgo = ts.TweetTime.HasValue && ts.TweetTime.Value.AddHours(18).CompareTo(DateTime.UtcNow) < 0;
|
||||
bool newRevisionSinceLastUpdate = (p.Revisions?.Latest()?.ChangedAt?.CompareTo(ts.TweetTime.GetValueOrDefault(DateTime.MinValue)) ?? 0) > 0;
|
||||
|
||||
if (/* Not yet tweeted yet */
|
||||
(ts.InitialTweetId == null) ||
|
||||
|
||||
/* Update required because new revision, and long enough since last tweet */
|
||||
(ts.InitialTweetId != null && lastUpdateLongEnoughAgo && newRevisionSinceLastUpdate)
|
||||
)
|
||||
{
|
||||
ts.NeedsUpdate = true;
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var ts in tweetStati.Values)
|
||||
{
|
||||
if (ts.PostId != null)
|
||||
{
|
||||
if (!existingPostId.ContainsKey(ts.PostId))
|
||||
{
|
||||
ts.NeedsDeletion = true;
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Program.xCleanTweets)
|
||||
{
|
||||
foreach (var ts in tweetStati.Values)
|
||||
{
|
||||
ts.NeedsDeletion = true;
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasChanges)
|
||||
{
|
||||
logger.LogInformation("Posts detected for tweet-updates...");
|
||||
Save(tweetStati);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
sema.Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
needsRescan = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region TweetTextBuilder
|
||||
|
||||
|
||||
private string BuildTweet(BlogPostHeader bh, bool isNew)
|
||||
{
|
||||
const int maxLen = 280;
|
||||
|
||||
string hdr = (testMode ? "[TEST!]": "") + (isNew ? "New post: " : "Post updated: ");
|
||||
string url = $"{uriPrefix}/viewer/{bh.Id}";
|
||||
string tags = "";
|
||||
string tit = bh.Title;
|
||||
|
||||
|
||||
if (bh.Topics != null)
|
||||
{
|
||||
foreach (var t in bh.Topics)
|
||||
{
|
||||
tags += t + " ";
|
||||
if (tags.Length > 80) break;
|
||||
}
|
||||
}
|
||||
|
||||
int clen = tit.Length + hdr.Length + url.Length + tags.Length + 2 + 2; // spaces + ""
|
||||
int remain = maxLen - clen;
|
||||
if (remain < 0)
|
||||
{
|
||||
tit = tit.Substring(0, tit.Length - remain - "...".Length)+"...";
|
||||
}
|
||||
return $"{hdr}'{tit}' {tags}{url}";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region StatusData + Persistence
|
||||
|
||||
protected class TweetStatus
|
||||
{
|
||||
public string PostId { get; set; }
|
||||
public string LastPostChecksum { get; set; }
|
||||
public DateTime? TweetTime { get; set; }
|
||||
public long? InitialTweetId { get; set; }
|
||||
public long? UpdateTweetId { get; set; }
|
||||
public bool NeedsDeletion { get; set; } = false;
|
||||
public bool NeedsUpdate { get; set; } = false;
|
||||
public string LastErr { get; set; }
|
||||
public int ErrCount { get; set; } = 0;
|
||||
}
|
||||
|
||||
private Dictionary<string, TweetStatus> Load()
|
||||
{
|
||||
Dictionary<string, TweetStatus> res = null;
|
||||
|
||||
try
|
||||
{
|
||||
if (System.IO.File.Exists(tweetStatusFn))
|
||||
{
|
||||
var text = System.IO.File.ReadAllText(tweetStatusFn);
|
||||
res = JsonSerializer.Deserialize<Dictionary<string, TweetStatus>>(text);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogWarning(ex, $"Error reading tweetstatus file ${tweetStatusFn}");
|
||||
}
|
||||
|
||||
return res ?? new Dictionary<string, TweetStatus>();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private bool Save(Dictionary<string, TweetStatus> tweetStati)
|
||||
{
|
||||
tweetStati ??= new Dictionary<string, TweetStatus>();
|
||||
|
||||
try
|
||||
{
|
||||
var text = JsonSerializer.Serialize(tweetStati);
|
||||
System.IO.File.WriteAllText(tweetStatusFn, text);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogWarning(ex, $"Error writing tweetstatus file ${tweetStatusFn}");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Auth-Config
|
||||
|
||||
|
||||
public async Task<ITweet> PostAsync(string txt)
|
||||
{
|
||||
// Get a AuthenticatedUser from a specific set of credentials
|
||||
var creds = new TwitterCredentials(apiKey, apiSecret, accessToken, accessTokenSecret);
|
||||
var cln = new TwitterClient(creds);
|
||||
return await cln.Tweets.PublishTweetAsync(txt);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="tweetId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> DeleteAsync(long tweetId)
|
||||
{
|
||||
// Get a AuthenticatedUser from a specific set of credentials
|
||||
try
|
||||
{
|
||||
var creds = new TwitterCredentials(apiKey, apiSecret, accessToken, accessTokenSecret);
|
||||
var cln = new TwitterClient(creds);
|
||||
await cln.Tweets.DestroyTweetAsync(tweetId);
|
||||
return true;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
logger.LogWarning(ex, $"Error deleteing ${tweetId}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,239 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using AspNetCoreRateLimit;
|
||||
using Blog3000.Client;
|
||||
using Blog3000.Server.Utils;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Syslog.Framework.Logging;
|
||||
|
||||
namespace Blog3000.Server
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
|
||||
public static string blogDataPath = null;
|
||||
|
||||
|
||||
public static bool xCleanTweets = false;
|
||||
|
||||
private static string syslogAppName;
|
||||
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
Console.WriteLine($"Blog3000 0.1 Build {Blog3000.Server.BuildVersion.BUILD_DATE}");
|
||||
|
||||
//if (args.Length == 0)
|
||||
//{
|
||||
// ShowHelp();
|
||||
// Environment.Exit(1);
|
||||
//}
|
||||
|
||||
foreach (var a in args)
|
||||
{
|
||||
Console.WriteLine($"Processing parameter {a}");
|
||||
|
||||
if (a.StartsWith("--help") || a.StartsWith("-h") || a.StartsWith("-?") || a.StartsWith("(/h") || a.StartsWith("/?"))
|
||||
{
|
||||
ShowHelp();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
/*if (a.StartsWith("--port="))
|
||||
{
|
||||
revProxyMode = a.Substring("--port=".Length);
|
||||
}
|
||||
else if (a.StartsWith("--visible-url-prefix="))
|
||||
{
|
||||
visibleUrlPrefix= a.Substring("--visible-url-prefix=".Length);
|
||||
}
|
||||
|
||||
else*/ if (a.StartsWith("--blog-data-path="))
|
||||
{
|
||||
blogDataPath = a.Substring("--blog-data-path=".Length);
|
||||
}
|
||||
/*else if (a.StartsWith("--public-dl-uri="))
|
||||
{
|
||||
publicDlUri = a.Substring("--public-dl-uri=".Length);
|
||||
}
|
||||
else if (a.StartsWith("--allow-search-bots"))
|
||||
{
|
||||
allowSearchBots = true;
|
||||
}
|
||||
else if (a.StartsWith("--allow-search-devbot"))
|
||||
{
|
||||
allowSearchDevBot = true;
|
||||
}
|
||||
else if (a.StartsWith("--x-clean-tweets"))
|
||||
{
|
||||
xCleanTweets = true;
|
||||
}*/
|
||||
}
|
||||
|
||||
Console.WriteLine($"Active parameters");
|
||||
/*Console.WriteLine($"- Blog data path: {blogDataPath}");
|
||||
Console.WriteLine($"- PublicDlUri: {publicDlUri}");
|
||||
Console.WriteLine($"- Vislble url-prefix: {visibleUrlPrefix}");
|
||||
Console.WriteLine($"- Using port: {revProxyMode}");
|
||||
Console.WriteLine($"- Allow search bots: {allowSearchBots}");
|
||||
Console.WriteLine($"- Allow search-devbot: {allowSearchDevBot} ('xx-testbot-xx')");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine($"- Clean tweets/disable: {xCleanTweets} ");*/
|
||||
|
||||
|
||||
foreach (var a in args)
|
||||
{
|
||||
if (a.StartsWith("--set-protected="))
|
||||
{
|
||||
SetConfig(a.Substring("--set-protected=".Length), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//if (String.IsNullOrWhiteSpace(visibleUrlPrefix))
|
||||
//{
|
||||
// Console.Error.WriteLine("Paramter --visible-url-prefix missing. Abort");
|
||||
// Environment.Exit(1);
|
||||
//}
|
||||
|
||||
var env = BlogEnv.LoadConfig();
|
||||
if (String.IsNullOrWhiteSpace(env.VisibleUrlPrefix))
|
||||
{
|
||||
Console.Error.WriteLine("Parameter VisibleUrlPrefix missing in blogconfig.json. Abort");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
|
||||
syslogAppName = env.SyslogAppName;
|
||||
|
||||
//Console.WriteLine(env.ToString());
|
||||
Console.WriteLine($"- Blog data path: {blogDataPath ?? "<AppDataPath>"}");
|
||||
Console.WriteLine($"- PublicDlUri: {env.PublicDlUri}");
|
||||
Console.WriteLine($"- Vislble url-prefix: {env.VisibleUrlPrefix}");
|
||||
Console.WriteLine($"- Using port: {env.ListenPort ?? 5001}{(env.ListenPort != null ? "NonSSL" : "SSL")}");
|
||||
Console.WriteLine($"- Allow search bots: {env.AllowSearchBots}");
|
||||
Console.WriteLine($"- Allow search-devbot: {env.AllowSearchDevBot} ('xx-testbot-xx')");
|
||||
Console.WriteLine($"- Log to syslog: {env.SyslogAppName ?? "<disabled>"}");
|
||||
|
||||
|
||||
Console.WriteLine("Starting ASP.Net webhost...");
|
||||
|
||||
var webHost = CreateHostBuilder(args).Build();
|
||||
|
||||
// For IP RateLimiting
|
||||
using (var scope = webHost.Services.CreateScope())
|
||||
{
|
||||
// get the IpPolicyStore instance
|
||||
var ipPolicyStore = scope.ServiceProvider.GetRequiredService<IIpPolicyStore>();
|
||||
|
||||
// seed IP data from appsettings
|
||||
await ipPolicyStore.SeedAsync();
|
||||
}
|
||||
|
||||
webHost.Run();
|
||||
}
|
||||
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureLogging((hostingContext, logging) =>
|
||||
{
|
||||
logging.ClearProviders();
|
||||
if (syslogAppName == null || System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
logging.AddConsole(options => options.IncludeScopes = false);
|
||||
}
|
||||
|
||||
//logging.AddDebug();
|
||||
if (syslogAppName != null)
|
||||
{
|
||||
var settings = new SyslogLoggerSettings();
|
||||
settings.FacilityType = FacilityType.Local0;
|
||||
settings.HeaderType = SyslogHeaderType.Rfc5424v1;
|
||||
settings.MessageTransportProtocol = Syslog.Framework.Logging.TransportProtocols.TransportProtocol.UnixSocket;
|
||||
//logging.AddSyslog(new ILoggingBuilder( settings);
|
||||
logging.AddProvider(new MySyslogLoggerProvider(settings, syslogAppName, System.Environment.MachineName, LogLevel.Debug));
|
||||
}
|
||||
})
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
var cfg = BlogEnv.LoadConfig();
|
||||
|
||||
webBuilder
|
||||
//.UseUrls(revProxyMode != null ? $"http://127.0.0.1:{revProxyMode}" : "https://0.0.0.0:5001")
|
||||
.UseUrls(cfg?.ListenPort != null ? $"http://127.0.0.1:{cfg.ListenPort}" : "https://0.0.0.0:5001")
|
||||
.UseStartup<Startup>();
|
||||
});
|
||||
|
||||
|
||||
|
||||
private static void SetConfig(string parm, bool prot)
|
||||
{
|
||||
Console.WriteLine("Set Config");
|
||||
var bg = BlogEnv.LoadConfig();
|
||||
bg.Protected ??= new BlogEnv.ProtectedConfig();
|
||||
if (prot)
|
||||
{
|
||||
if ("twitter-api-key".Equals(parm))
|
||||
{
|
||||
Console.Write("Twitter API-Key> ");
|
||||
var s = Console.ReadLine();
|
||||
bg.Protected.TwitterAPIKey = Utils.DataProtect.Static.Protect(s);
|
||||
}
|
||||
else if ("twitter-api-secret".Equals(parm))
|
||||
{
|
||||
Console.Write("Twitter API-Secret> ");
|
||||
var s = Console.ReadLine();
|
||||
bg.Protected.TwitterAPISecret = Utils.DataProtect.Static.Protect(s);
|
||||
}
|
||||
else if ("twitter-access-token".Equals(parm))
|
||||
{
|
||||
Console.Write("Twitter Access-Token> ");
|
||||
var s = Console.ReadLine();
|
||||
bg.Protected.TwitterAccessToken = Utils.DataProtect.Static.Protect(s);
|
||||
}
|
||||
else if ("twitter-access-secret".Equals(parm))
|
||||
{
|
||||
Console.Write("Twitter Access-Secret> ");
|
||||
var s = Console.ReadLine();
|
||||
bg.Protected.TwitterAccessSecret = Utils.DataProtect.Static.Protect(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Bad params");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
BlogEnv.SaveConfig(bg);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
Console.WriteLine("Bad params");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
|
||||
private static void ShowHelp()
|
||||
{
|
||||
Console.WriteLine($"Available Parameters: ");
|
||||
Console.WriteLine($" --blog-data-path= [default app-data-path]");
|
||||
//Console.WriteLine($" --visible-url-prefix=https://mydemoblog.com (prefix for blogpost-links e.g in sitemap");
|
||||
//Console.WriteLine($" --port= [default 5001]");
|
||||
|
||||
//Console.WriteLine($" --public-dl-uri= [default null]");
|
||||
//Console.WriteLine($" --allow-search-bots [default false]");
|
||||
//Console.WriteLine($" --allow-search-devbot [default false]");
|
||||
//Console.WriteLine();
|
||||
//Console.WriteLine($" --x-clean-tweets [default false], ");
|
||||
//Console.WriteLine(" tweets reappear on false if was true (user-annoyance)!");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Special interactive ops: ");
|
||||
Console.WriteLine(" --set-protected=");
|
||||
Console.WriteLine(" twitter-api-key,twitter-api-secret,");
|
||||
Console.WriteLine(" twitter-access-token,twitter-access-key");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Diese Datei wird vom Veröffentlichungs-/Paketierungsprozess Ihres Webprojekts verwendet. Sie können das Verhalten dieses Prozesses anpassen,
|
||||
indem Sie diese MSBuild-Datei bearbeiten. Weitere Informationen hierzu finden Sie unter https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||
<PublishProvider>FileSystem</PublishProvider>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<SiteUrlToLaunchAfterPublish />
|
||||
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
|
||||
<ExcludeApp_Data>False</ExcludeApp_Data>
|
||||
<ProjectGuid>552ab8ae-71cf-4167-8313-7c2a7193725c</ProjectGuid>
|
||||
<publishUrl>bin\Release\netcoreapp3.1\publish\</publishUrl>
|
||||
<DeleteExistingFiles>False</DeleteExistingFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Diese Datei wird vom Veröffentlichungs-/Paketierungsprozess Ihres Webprojekts verwendet. Sie können das Verhalten dieses Prozesses anpassen,
|
||||
indem Sie diese MSBuild-Datei bearbeiten. Weitere Informationen hierzu finden Sie unter https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||
<PublishProvider>FileSystem</PublishProvider>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<SiteUrlToLaunchAfterPublish />
|
||||
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
|
||||
<ExcludeApp_Data>False</ExcludeApp_Data>
|
||||
<ProjectGuid>552ab8ae-71cf-4167-8313-7c2a7193725c</ProjectGuid>
|
||||
<publishUrl>\\ZEUS\blog_mh3000_net\exe</publishUrl>
|
||||
<DeleteExistingFiles>True</DeleteExistingFiles>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<SelfContained>false</SelfContained>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"XuseWebAssemblyDebugging": true,
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:57461",
|
||||
"sslPort": 44396
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"Blog3000.Server": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:5001;http://localhost:5000",
|
||||
"XinspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
# Blog3000
|
||||
|
||||
_Alpha Prototype software_
|
||||
|
||||
Simple blog software with(out) following features
|
||||
|
||||
- Written in .Net core
|
||||
- Using blazor on the client (C# instead of javascript!!!!)
|
||||
- Using ASP.NEt Core on server
|
||||
- Caches all blog-data in the browser for offline use.
|
||||
- Installable PWA
|
||||
- Simple view-stats
|
||||
- Serverside Search-Robot-Support for bing/google
|
||||
- BlogPosts are stored as MarkDown. Images are supported. Can
|
||||
be edited by blogger directly on server. Markdown is enahanced
|
||||
with tags in the first lines "@" providing metadata and id
|
||||
|
||||
#### Install / Configure
|
||||
|
||||
TODO
|
||||
|
||||
#### Markdown header format
|
||||
|
||||
TODO
|
||||
|
||||
### Parameters
|
||||
|
||||
Start Server without parameters to get a parameter list/help
|
||||
|
||||
|
||||
|
||||
### Runing on Linux (Gentoo)
|
||||
|
||||
#### Config
|
||||
|
||||
Use blogconfig.json from www-root as template and copy to your blog-data-path.
|
||||
Modify as neeed. To Set value in protected start server without parameters
|
||||
to see commandline-parameters therefore.
|
||||
|
||||
|
||||
#### Init-script
|
||||
|
||||
```
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 1999-2016 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
depend() {
|
||||
need net
|
||||
use dns logger
|
||||
after apache2
|
||||
}
|
||||
|
||||
configtest() {
|
||||
ebegin "Checking ${SVCNAME} configuration"
|
||||
eend $?
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting ${SVCNAME}"
|
||||
|
||||
nohup -- su -s /bin/bash blogmh3000 -c "(cd /var/www/blog-mh3000-net/server/exe && /opt/dotnet31/dotnet Blog3000.Server.dll --blog-data-path=/var/www/blog-mh3000-net/server/data | logger -t blogmh3000 )" > /dev/null &
|
||||
|
||||
eend ${retval}
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping ${SVCNAME}"
|
||||
kill `ps ax | grep Blog3000 | grep " /opt/dotnet31" | grep -v "bash" | cut -b 1-5` || exit ß
|
||||
}
|
||||
```
|
||||
|
||||
### Syslog-ng
|
||||
|
||||
Add this somewhere before the log(message)-lines.
|
||||
|
||||
```
|
||||
# Blog
|
||||
filter f_blogmh3000 { program(blogmh3000); };
|
||||
destination dest_blog3000 { file("/var/log/blogmh3000.log"); };
|
||||
log { source(src); filter(f_blogmh3000); destination(dest_blog3000); flags(final);};
|
||||
```
|
||||
|
||||
Rename according to your own names. Note: the `program()` filter equals the `| logger -t [PROGRAM]` in the initscript above.
|
||||
|
||||
### Logrotate
|
||||
|
||||
Add as /etc/logrotate.d/blogmh3000:
|
||||
```
|
||||
/var/log/blogmh3000.log {
|
||||
missingok
|
||||
notifempty
|
||||
sharedscripts
|
||||
postrotate
|
||||
/etc/init.d/syslog-ng reload > /dev/null 2>&1 || true
|
||||
endscript
|
||||
}
|
||||
```
|
||||
|
||||
As before, rename according to your own names.
|
||||
|
||||
|
||||
## Further notes
|
||||
|
||||
#### Downloads
|
||||
|
||||
Currently a _very rough_ feature for offering downloads from the blog is available:
|
||||
The authors can put files on a cdn/ftp/public website, and reference them via
|
||||
the "/PublicDl". The server then is called with the filename and returns the actual
|
||||
url to the actual download site. This would allow download-counting or one-time url
|
||||
for protected downlodas in the future.
|
||||
|
||||
No sub-folder are supported at the moment.
|
||||
|
||||
Downloads may not reside in the same domain, otherwise router-module of the blog-app
|
||||
may take over and return 404.
|
||||
|
||||
Perhabs in the future a javascript base downloader may resolve this issue and allow
|
||||
file living in the blogs url-space for more easness.
|
||||
|
||||
#### Testing SEO output
|
||||
|
||||
with testbox enabled e.g. use wget
|
||||
|
||||
```
|
||||
wget -O - --header="User-Agent: xx-testbot-xx" --no-check-certificate https://local-ip:5001/
|
||||
```
|
||||
|
||||
|
||||
_(C) 2020 Michael Hoess, MIT-License_
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.HttpsPolicy;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.ResponseCompression;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using System.Buffers;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.DataProtection.Repositories;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Razor.Language;
|
||||
using Blog3000.Server.MiddleWares;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using AspNetCoreRateLimit;
|
||||
using Blog3000.Server.Controllers;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Blog3000.Server
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IConfiguration configuration)
|
||||
{
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddOptions(); // Read from appsettings.json, ForRateLimit
|
||||
services.AddControllersWithViews();
|
||||
services.AddMemoryCache(); // For BlogPostRepo, RateLimit
|
||||
services.AddDataProtection(); // ASP.Net-Core variant of DPAPI
|
||||
|
||||
// Next block sole for IP-Rate-Limiter
|
||||
|
||||
//load rules from appsettings.json
|
||||
services.Configure<IpRateLimitOptions>(Configuration.GetSection("IpRateLimiting"));
|
||||
services.Configure<IpRateLimitPolicies>(Configuration.GetSection("IpRateLimitPolicies"));
|
||||
// inject counter and rules stores
|
||||
services.AddSingleton<IIpPolicyStore, MemoryCacheIpPolicyStore>();
|
||||
services.AddSingleton<IRateLimitCounterStore, MemoryCacheRateLimitCounterStore>();
|
||||
// https://github.com/aspnet/Hosting/issues/793
|
||||
// the IHttpContextAccessor service is not registered by default.
|
||||
// the clientId/clientIp resolvers use it.
|
||||
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||
// configuration (resolvers, counter key builders)
|
||||
services.AddSingleton<IRateLimitConfiguration, RateLimitConfiguration>();
|
||||
|
||||
|
||||
// Now add own services
|
||||
|
||||
services.AddSingleton(typeof(BlogEnv));
|
||||
services.AddSingleton(typeof(BlogPostRepo));
|
||||
services.AddHostedService<BlogPostRepoUpdater>();
|
||||
services.AddHostedService<UpdateTweeter>();
|
||||
services.AddSingleton<SEOMgr>();
|
||||
services.AddSingleton(typeof(SearchBotHandler));
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
|
||||
app.UseIpRateLimiting();
|
||||
|
||||
|
||||
app.UseForwardedHeaders(new ForwardedHeadersOptions
|
||||
{
|
||||
//ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
|
||||
ForwardedHeaders = ForwardedHeaders.All
|
||||
});
|
||||
|
||||
|
||||
// Add our custom headers
|
||||
app.Use(async (context, next) =>
|
||||
{
|
||||
// ForwardedHeaders won't set this even for X-Forward-For: https//... ?
|
||||
// (because of proxied to http://localhost ??)
|
||||
// Therefore force to true now. So it won't break url-generation in sitemap etc..
|
||||
// Perhaps make this configurable like "--publicUrl=...."
|
||||
context.Request.IsHttps = true;
|
||||
|
||||
|
||||
context.Response.Headers.Add("X-Blog3000-Build", Blog3000.Server.BuildVersion.BUILD_DATE);
|
||||
await next.Invoke();
|
||||
});
|
||||
|
||||
|
||||
// No Cache
|
||||
var cp = new NoCacheHeaderAdder(new string[] { "/robots.txt", "/config.json", "/manifest.json", "/favicon.ico" });
|
||||
app.Use(async (context, next) =>
|
||||
{
|
||||
cp.Process(context);
|
||||
await next.Invoke();
|
||||
});
|
||||
|
||||
|
||||
// Handle SearchBot requests
|
||||
app.Use(async (context, next) =>
|
||||
{
|
||||
|
||||
var sbh = context.RequestServices.GetService<SearchBotHandler>();
|
||||
var res = await sbh.Process(context);
|
||||
if (res) return; // Request completly handling by SEO
|
||||
|
||||
await next.Invoke();
|
||||
});
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
app.UseWebAssemblyDebugging();
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseExceptionHandler("/Error");
|
||||
// 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.UseBlazorFrameworkFiles();
|
||||
app.UseRouting();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllerRoute(
|
||||
name: "config",
|
||||
pattern: "/config.json",
|
||||
defaults: new { controller = "Config", action = "Get" }
|
||||
);
|
||||
endpoints.MapControllers();
|
||||
endpoints.MapFallbackToFile("index.html");
|
||||
});
|
||||
|
||||
app.UseStaticFiles();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
|
||||
X Non-offlien-mode: check if cached article has changed since last download on view, download before view if online
|
||||
X Cache problem
|
||||
X Search article count includes articles not in list
|
||||
|
||||
- Show Articles TOPICS in Viewer
|
||||
|
||||
- MarkDown with source codes looks upgly
|
||||
- Fixed with fonts? Blocksatz?
|
||||
|
||||
|
||||
- add storage to top-topics
|
||||
|
||||
- Log - Console Output auch nach SysLog wenn enabled
|
||||
|
||||
- Twitter Url unten anzeigen
|
||||
|
||||
- Abbruch ohne DataPath und nicht vorhanden, vor config-set
|
||||
|
||||
|
||||
|
||||
- "$IMAGES$"
|
||||
- User-notify on new articles
|
||||
- AppSettings-Feature instad on config.json (config should not be override by deployment!)
|
||||
- File-Change-Date in Revision?
|
||||
|
||||
- DlCounter/Checker
|
||||
|
||||
VNext:
|
||||
- Config/ConfigJson reread after 1 min
|
||||
- Install improvement / Offline-Mode / Search auch remote
|
||||
- Login
|
||||
- Private articles
|
||||
- Edit-articlesöö
|
||||
- Comments
|
||||
- Nur wenn online edit + view
|
||||
- Manuelles freischalten
|
||||
|
||||
- Houdglass bei Postfinder?
|
||||
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Blog3000.Server.Utils
|
||||
{
|
||||
public class DataProtect
|
||||
{
|
||||
private static DataProtect _static;
|
||||
|
||||
public static DataProtect Static
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_static == null)
|
||||
{
|
||||
var serviceCollection = new ServiceCollection();
|
||||
serviceCollection.AddDataProtection();
|
||||
var services = serviceCollection.BuildServiceProvider();
|
||||
|
||||
// create an instance of MyClass using the service provider
|
||||
_static = ActivatorUtilities.CreateInstance<DataProtect>(services);
|
||||
|
||||
}
|
||||
return _static;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly IDataProtector protector;
|
||||
private readonly IDataProtectionProvider provider;
|
||||
|
||||
public DataProtect(IDataProtectionProvider provider)
|
||||
{
|
||||
this.provider = provider;
|
||||
this.protector = provider.CreateProtector(this.GetType().FullName + "$GLOBAL");
|
||||
}
|
||||
|
||||
public string Protect(string value)
|
||||
{
|
||||
return protector.Protect(value);
|
||||
}
|
||||
|
||||
public string Unprotect(string pv)
|
||||
{
|
||||
var r = protector.Unprotect(pv);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
using Microsoft.Extensions.Logging;
|
||||
|
||||
using Syslog.Framework.Logging;
|
||||
using Syslog.Framework.Logging.TransportProtocols;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Transactions;
|
||||
|
||||
namespace Blog3000.Server.Utils
|
||||
{
|
||||
public class MySyslog5424v1Logger: Syslog5424v1Logger
|
||||
{
|
||||
|
||||
private readonly string appName;
|
||||
private readonly SyslogLoggerSettings settings;
|
||||
|
||||
public MySyslog5424v1Logger(string name, SyslogLoggerSettings settings, string appName, string host, LogLevel lvl, IMessageSender messageSender)
|
||||
: base(name, settings, host, lvl, messageSender)
|
||||
{
|
||||
this.settings = settings;
|
||||
this.appName = appName;
|
||||
}
|
||||
|
||||
// Duplicated due to visibility limitations
|
||||
internal enum SeverityType { Emergency, Alert, Critical, Error, Warning, Notice, Informational, Debug };
|
||||
|
||||
protected override string FormatMessage(int priority, DateTime now, string host, string name, int? procid, int msgid, string message)
|
||||
{
|
||||
|
||||
int level = priority - ((int)settings.FacilityType * 8);
|
||||
string flag = "-";
|
||||
switch(level)
|
||||
{
|
||||
case (int)SeverityType.Alert:
|
||||
case (int)SeverityType.Critical:
|
||||
case (int)SeverityType.Error:
|
||||
flag = "!";
|
||||
break;
|
||||
case (int)SeverityType.Warning:
|
||||
flag = "?";
|
||||
break;
|
||||
case (int)SeverityType.Notice:
|
||||
flag = "*";
|
||||
break;
|
||||
case (int)SeverityType.Debug:
|
||||
case (int)SeverityType.Informational:
|
||||
flag = "-";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//System.IO.File.AppendAllText("/tmp/D", $"....{message}....\n");
|
||||
return base.FormatMessage(priority, now, host, appName, procid, msgid, $"{flag} {(name??"").Replace("Blog3000.Server.", "")}: {message}"/* message*/);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Syslog.Framework.Logging;
|
||||
using Syslog.Framework.Logging.TransportProtocols;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace Blog3000.Server.Utils
|
||||
{
|
||||
public class MySyslogLoggerProvider: ILoggerProvider
|
||||
{
|
||||
private readonly SyslogLoggerSettings _settings;
|
||||
private readonly string _appName;
|
||||
private readonly string _hostName;
|
||||
private readonly LogLevel _logLevel;
|
||||
private readonly IDictionary<string, ILogger> _loggers;
|
||||
private readonly IMessageSender _messageSender;
|
||||
|
||||
public MySyslogLoggerProvider(SyslogLoggerSettings settings, string appName, string hostName, LogLevel logLevel)
|
||||
{
|
||||
_appName = appName;
|
||||
_settings = settings;
|
||||
_hostName = hostName;
|
||||
_logLevel = logLevel;
|
||||
_messageSender = settings.CustomMessageSender ?? new Syslog.Framework.Logging.TransportProtocols.UnixSockets.UnixSocketMessageSender(settings.UnixSocketPath);
|
||||
_loggers = new Dictionary<string, ILogger>();
|
||||
}
|
||||
|
||||
public ILogger CreateLogger(string name)
|
||||
{
|
||||
if (!_loggers.ContainsKey(name))
|
||||
_loggers[name] = new MySyslog5424v1Logger(name, _settings, _appName, _hostName, _logLevel, _messageSender);
|
||||
|
||||
return _loggers[name];
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_loggers.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"Protected": {
|
||||
"TwitterAPIKey": "CfDJ8Lcd8ISBjudOkVhTjUBVmCpHmof5a6dBh8hYk6qwVvTpIX4Rp1CwBAEXQhsahtX_YlG6YA-zx1ZjfV9N4umwS89WhXCV7gvwnWt72mWyJhjNx7M1pHutyy8eBo_W_Pa74qfKERhtfT_AYbSFFXQO4QU",
|
||||
"TwitterAPISecret": "CfDJ8Lcd8ISBjudOkVhTjUBVmCrk_bMRGTPr6sTOgbC2yjwwpdnIMLk5I75nmCLCwthMa1xCjJp3m4CT1qqEodS91Z2h1blcalvv_J7XBLz7E57Se0IxTHLEjFsHK6ilPr7rsOYdskZknSz7iVkcNMnH2J3X_nnH0veusO0FLQV_iBdzperRZqv99MrYB239-e0k6A",
|
||||
"TwitterAccessToken": "CfDJ8Lcd8ISBjudOkVhTjUBVmCpGlciAw4J99-w-SJxNrSrnahyTHsv7p2qsXYYhE2kTSluZh5jlY5rY_uCUdNfHCwaYxddfV656_OlyQz1SRnMHn0DuGaoqtL2BNec9cP3-EHflpljqGsAyH-jOMOOw7flWct9IE_Dl6x-c1NUgQ4WF14yu1ffJ-jm6vTfAuZaJIw",
|
||||
"TwitterAccessSecret": "CfDJ8Lcd8ISBjudOkVhTjUBVmCpn-7jMaHfrY9bLYS_Uq_JGW6O08FKXEwuexr1W45bSVvCsHozPJoMbMfkazchYKRxzyPbC3j6RujShD1USz82m8ZurniJD13WudkxwXkgW0xK0S5GnrLi_x9bVvCfwy0voMujGvVuhlvyAW7Azxz6Y"
|
||||
},
|
||||
"TwitterEnabled": false,
|
||||
"TwitterTestMode": false,
|
||||
"EnableSyslog": false,
|
||||
"PublicDlUri": "https://cdn.mh3000.net/blogdl",
|
||||
"AllowSearchBots": false,
|
||||
"AllowSearchDevBot": true,
|
||||
"VisibleUrlPrefix": "https://localhost:5001",
|
||||
"XListenPort": 5001,
|
||||
"Title": "blog.mh3000.net",
|
||||
"DefaultEMailAddress": "hoess@gmx.net",
|
||||
"AuthorFullnames": {
|
||||
"mh": "Michael Höß"
|
||||
},
|
||||
"SocialLinks": {
|
||||
"My Git": "https://gitea.mh3000.net"
|
||||
},
|
||||
"TopTopics": [
|
||||
"#BLOG",
|
||||
"#LINUX",
|
||||
"#NETCORE",
|
||||
"#NETWORK",
|
||||
"#WINDOWS",
|
||||
"#VOIP"
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"1i1n1BMmusP":"RR8PT2neqSJeCclX7aigPcvVNge6ZI8Wurwret5vCFQ=","1i1n1BMmusS":"kHpDUuPSbtAEYuDxkw8NHfz4roC7Nn6vMTqjHgnPCCg=","1i1n1BMmusU":"/qoqCfqgr36blV\u002B1xhgeQCvuUgD\u002BqHgTbQpRvhNXhVw=","1i1n1BMmusW":"W5e3YmPG/YgHnvW3g1PQ8vrwUhSy7JWHoC8d\u002BSARPSY=","1i1n1BMmusY":"OihKAPm\u002Bma7T2MJ0YRrJeWUS/1FGkFaFCnMH/YRa8Wc=","1i1n1BMmusa":"trux1I548o6M0fzmVbhAPyOFdkDshVzOHuR3I4bnWZE=","1i1n1BMmusc":"a2ZCKKBV\u002BwLcRrySVEv1uYYXmyedDXfTQvg0Zsr3Hy0=","1i1n1BMmuse":"ZGUy0vCDVzmIYtzsYcDlh/SQhWjhUuJU97XURl/1BzQ=","1i1n1BMmush":"tRb0s3OwKdgyus7n23f41NaWlLNx61wCTPtdpWT5KZk=","1i1n1BMmusj":"bvZpleYzMtWGz1QLlmUTSdrDfgqyTCtI31W/0E54qpY=","1i1n1BMmusl":"0yzW6JVA61SAXVSU8jpBGnkgSEIc3mdMadZAWfIyd9A=","1i1n1BMmusn":"k6XL\u002BnNh3f6yNS6GeGq73aBY\u002BRisyyN4jNyig/R5C24=","1i1n1BMmusp":"10r86/NdGinjNtn/MsbZLkpw60uz9bxDDXbaMRCV6kY=","1i1n1BMmusr":"hrAnrFdVi6X8Nqp74MByQyglgDySa\u002B8I1Q4mSq/3n5k=","1i1n1BMmust":"CR8ICQJG715x\u002BctDDXDB8XvBmAmmIYZ0nSk1IGJxUJs=","1i1n1BDwtO6":"G\u002Bf6WXFouQnSDCEF47vpGzJDm6itTuOl6huh3D/eR24=","1i1n1BKuvCw":"x04AQ\u002BPxTDvun07NFtnIWd10x7nBWi\u002BVb81pjqCMUtI="}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
@Id:1i1n1BKuejL
|
||||
@Revision:19.05.2020 19:09:37|Desc|mh
|
||||
@Author:mh
|
||||
@Title:Hello world!!
|
||||
@Abstract:
|
||||
@Access:
|
||||
@Topics:#
|
||||
@StickMenuPos:-1
|
||||
@Draft
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
@Id:1i1n1BMmusP
|
||||
@Revision:19.05.2020 19:04:30|Initial|mh
|
||||
@Author:mh
|
||||
@Title:A1
|
||||
@Abstract:A1
|
||||
@Access:PUBLIC
|
||||
@Topics:#BLOG|#GENTOO|#NETCORE|#BLAZOR
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
@Id:1i1n1BMmusS
|
||||
@Revision:19.05.2020 19:04:30|Initial|mh
|
||||
@Author:mh
|
||||
@Title:A10
|
||||
@Abstract:A10
|
||||
@Access:PUBLIC
|
||||
@Topics:#BLOG|#GENTOO|#NETCORE|#BLAZOR
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
@Id:1i1n1BMmusU
|
||||
@Revision:19.05.2020 19:04:30|Initial|mh
|
||||
@Author:mh
|
||||
@Title:A11
|
||||
@Abstract:A11
|
||||
@Access:PUBLIC
|
||||
@Topics:#BLOG|#GENTOO|#NETCORE|#BLAZOR
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
@Id:1i1n1BMmusW
|
||||
@Revision:19.05.2020 19:04:30|Initial|mh
|
||||
@Author:mh
|
||||
@Title:A12
|
||||
@Abstract:A12
|
||||
@Access:PUBLIC
|
||||
@Topics:#BLOG|#GENTOO|#NETCORE|#BLAZOR
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
@Id:1i1n1BMmusY
|
||||
@Revision:19.05.2020 19:04:30|Initial|mh
|
||||
@Author:mh
|
||||
@Title:A13
|
||||
@Abstract:A13
|
||||
@Lang:de
|
||||
@Access:PUBLIC
|
||||
@Topics:#BLOG|#GENTOO|#NETCORE|#BLAZOR
|
||||
|
||||
|
||||
Update2!!!
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
@Id:1i1n1BMmusa
|
||||
@Revision:19.05.2020 19:04:30|Initial|mh
|
||||
@Author:mh
|
||||
@Title:A14DFXX
|
||||
@Abstract:A14
|
||||
@Access:PUBLIC
|
||||
@Topics:#BLOG|#GENTOO|#NETCORE|#BLAZOR
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
@Id:1i1n1BMmusc
|
||||
@Revision:19.05.2020 19:04:30|Initial|mh
|
||||
@Author:mh
|
||||
@Title:A15
|
||||
@Abstract:A15
|
||||
@Access:PUBLIC
|
||||
@Topics:#BLOG|#GENTOO|#NETCORE|#BLAZOR
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
@Id:1i1n1BMmuse
|
||||
@Revision:19.05.2020 19:05:47|Initial|mh
|
||||
@Revision:19.05.2020 19:09:37|Desc|mh
|
||||
@Author:mh
|
||||
@Title:A2
|
||||
@Abstract:A2 Abstract lorem ipsum
|
||||
@Access:PUBLIC
|
||||
@Topics:#BLOG|#GENTOO|#NETCORE|#BLAZOR
|
||||
|
||||
|
||||
# Lorem
|
||||
|
||||
Lorem ipsum
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue