Skip to content

Commit

Permalink
Updates to storage provider
Browse files Browse the repository at this point in the history
  • Loading branch information
rxtur committed Feb 15, 2022
1 parent 46507bc commit abede59
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 17 deletions.
9 changes: 2 additions & 7 deletions README.md
Expand Up @@ -7,8 +7,8 @@

<h3 align="center">Blogifier</h3>
<p align="center">
Blogifier is an open-source publishing platform written in ASP.NET and Blazor WebAssembly.<br>
Right now with Blogifier, you can make a personal blog, and more features are under development.<br><br>
Blogifier is self hosted open source publishing platform written in ASP.NET and Blazor WebAssembly.<br>
Right now Blogifier can be used as a personal or group blog, and more features are under development.<br><br>
<a href="https://blogifier.net/"><b>Official Website »</b></a>
&nbsp;&nbsp;
<a href="https://demo.blogifier.net/"><b>Live Demo »</b></a>
Expand All @@ -21,12 +21,7 @@
</p>

<br><br>
> **Blogifier is under development** <br>
Code in the main branch is under development and some features are not yet implemented and may not work as expected.
If you are looking for a stable application, please use [latest release](https://github.com/blogifierdotnet/Blogifier/releases).
The latest stable source code is in the [master branch](https://github.com/blogifierdotnet/Blogifier/tree/5c9bab69788a1f7a0bd82c6a864e159eff5b1b72). Please note that newest code uses Blazor Web Assembly and not compatible with previous versions.

<br><br>
## Installation

This version is built and compiled, and ready to use:
Expand Down
12 changes: 10 additions & 2 deletions src/Blogifier.Admin/Components/Blog/CategoriesComponent.razor
@@ -1,7 +1,15 @@
@inject HttpClient _http
@inject IStringLocalizer<Resource> _localizer
<style>
.bf-test { color: red !important }
.editor-add-category {
color: #FFF;
overflow: hidden;
background-color: transparent;
border: none;
outline: none;
font-weight: 600;
font-size: 0.95em;
}
</style>
<div class="d-flex">
@if (PostCategories != null)
Expand All @@ -16,7 +24,7 @@
</div>
}
}
<input type="text" id="add_category_control" class="bf-test" @bind="Tag" @onkeyup="KeyPressed" name="tagItem" placeholder="@_localizer["add-category"]" />
<input type="text" id="add_category_control" class="editor-add-category" @bind="Tag" @onkeyup="KeyPressed" name="tagItem" placeholder="@_localizer["add-category"]" />
</div>

@code {
Expand Down
4 changes: 2 additions & 2 deletions src/Blogifier.Core/Blogifier.Core.csproj
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>2.9.1.5</Version>
<Version>2.9.2.0</Version>
<Authors>blogifierdotnet</Authors>
<Description>Blogifier is an open-source publishing platform Written in .NET 5.0 and Blazor WebAssembly.</Description>
<Description>Blogifier is an open-source publishing platform Written in ASP.NET and Blazor WebAssembly.</Description>
<Copyright>Blogifier.Net</Copyright>
<PackageProjectUrl>https://blogifier.net</PackageProjectUrl>
<RepositoryUrl>https://github.com/blogifierdotnet/Blogifier</RepositoryUrl>
Expand Down
26 changes: 23 additions & 3 deletions src/Blogifier.Core/Providers/StorageProvider.cs
Expand Up @@ -107,10 +107,21 @@ public async Task<bool> UploadFormFile(IFormFile file, string path = "")
Path.Combine(_storageRoot, fileName) :
Path.Combine(_storageRoot, path + _slash + fileName);

using (var fileStream = new FileStream(filePath, FileMode.Create))
Serilog.Log.Information($"Storage root: {_storageRoot}");
Serilog.Log.Information($"Uploading file: {filePath}");
try
{
using (var fileStream = new FileStream(filePath, FileMode.Create))
{
await file.CopyToAsync(fileStream);
Serilog.Log.Information($"Uploaded file: {filePath}");
}
}
catch (Exception ex)
{
await file.CopyToAsync(fileStream);
Serilog.Log.Error($"Error uploading file: {ex.Message}");
}

return true;
}

Expand Down Expand Up @@ -178,19 +189,28 @@ private string ContentRoot
string testsDirectory = $"tests{_slash}Blogifier.Tests";
string appDirectory = $"src{_slash}Blogifier";

Serilog.Log.Information($"Current directory path: {path}");

// development unit test run
if (path.LastIndexOf(testsDirectory) > 0)
{
path = path.Substring(0, path.LastIndexOf(testsDirectory));
Serilog.Log.Information($"Unit test path: {path}src{_slash}Blogifier");
return $"{path}src{_slash}Blogifier";
}

// development debug run
// this needed to make sure we have correct data directory
// when running in debug mode in Visual Studio
// so instead of debug (src/Blogifier/bin/Debug..)
// will be used src/Blogifier/wwwroot/data
// !! this can mess up installs that have "src/Blogifier" in the path !!
if (path.LastIndexOf(appDirectory) > 0)
{
path = path.Substring(0, path.LastIndexOf(appDirectory));
Serilog.Log.Information($"Development debug path: {path}src{_slash}Blogifier");
return $"{path}src{_slash}Blogifier";
}
Serilog.Log.Information($"Final path: {path}");
return path;
}
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Blogifier.Tests/Blogifier.Tests.csproj
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PackageReference Include="coverlet.collector" Version="3.1.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down

0 comments on commit abede59

Please sign in to comment.