-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Templates are now defined in main configuration rather then different structure files - Posts may have a template, "{NAME}" can be used for id tags - Data / export directories can now be configured and empty presets were removed - Updated README and Swagger documentation - Update version to 0.2.0
- Loading branch information
Showing
57 changed files
with
507 additions
and
906 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
NanoBlog.Test/Services/MimeTypes/MimeTypeProvider/ProvideMimeTypeAsyncByFileName.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
bin | ||
obj | ||
*.Development.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,75 @@ | ||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global | ||
// ReSharper disable MemberCanBePrivate.Global | ||
|
||
namespace NanoBlog; | ||
|
||
public class Configuration : IConfiguration | ||
{ | ||
public bool UsePagination { get; init; } = IConfiguration.DEFAULT_USE_PAGINATION; | ||
public int PageSize { get; init; } = IConfiguration.DEFAULT_PAGE_SIZE; | ||
public string Language { get; init; } = IConfiguration.DEFAULT_LANGUAGE; | ||
public string BlogRootServerDirectory { get; init; } = IConfiguration.DEFAULT_BLOG_ROOT_SERVER_DIRECTORY; | ||
public ICollection<string> ExportKeepFileNames { get; } = new List<string>(); | ||
public string PagePlaceholderPosts { get; init; } = string.Empty; | ||
public string PagePlaceholderNavigation { get; init; } = string.Empty; | ||
public string PostPlaceholderContent { get; init; } = string.Empty; | ||
public string PostPlaceholderName { get; init; } = string.Empty; | ||
|
||
public static DirectoryInfo GetStageAssetsDirectoryInfo() | ||
public bool UsePagination { get; init; } = false; | ||
public string PageTemplate { get; init; } = string.Empty; | ||
public string PostTemplate { get; init; } = string.Empty; | ||
public int? PageSize { get; init; } = null; | ||
|
||
public string PostDirectory { get; init; } = string.Empty; | ||
public string AssetDirectory { get; init; } = string.Empty; | ||
|
||
public string ExportDirectory { get; init; } = string.Empty; | ||
|
||
public ICollection<string> KeepExportFiles { get; init; } = []; | ||
|
||
public DirectoryInfo GetAssetsDirectoryInfo() | ||
{ | ||
EnsureNotEmpty(AssetDirectory); | ||
return EnsureExisting(Path.Combine(Directory.GetCurrentDirectory(), AssetDirectory)); | ||
} | ||
|
||
public DirectoryInfo GetPostsDirectoryInfo() | ||
{ | ||
EnsureNotEmpty(PostDirectory); | ||
return EnsureExisting(Path.Combine(Directory.GetCurrentDirectory(), PostDirectory)); | ||
} | ||
|
||
public DirectoryInfo GetExportDirectoryInfo() | ||
{ | ||
EnsureNotEmpty(ExportDirectory); | ||
return EnsureExisting(Path.Combine(Directory.GetCurrentDirectory(), ExportDirectory)); | ||
} | ||
|
||
public DirectoryInfo GetExportAssetsDirectoryInfo() | ||
{ | ||
return new DirectoryInfo( | ||
Path.Combine(Directory.GetCurrentDirectory(), IConfiguration.STAGE_ASSETS_DIRECTORY_NAME) | ||
); | ||
EnsureNotEmpty(ExportDirectory); | ||
return EnsureExisting(Path.Combine(Directory.GetCurrentDirectory(), ExportDirectory, "assets")); | ||
} | ||
|
||
public static DirectoryInfo GetStagePostsDirectoryInfo() | ||
public DirectoryInfo GetExportArchiveDirectoryInfo() | ||
{ | ||
return new DirectoryInfo( | ||
Path.Combine(Directory.GetCurrentDirectory(), IConfiguration.STAGE_POSTS_DIRECTORY_NAME) | ||
); | ||
EnsureNotEmpty(ExportDirectory); | ||
return EnsureExisting(Path.Combine(Directory.GetCurrentDirectory(), ExportDirectory, "archive")); | ||
} | ||
|
||
public static DirectoryInfo GetStageStructureDirectoryInfo() | ||
private static DirectoryInfo EnsureExisting(string path) | ||
{ | ||
return new DirectoryInfo( | ||
Path.Combine(Directory.GetCurrentDirectory(), IConfiguration.STAGE_STRUCTURE_DIRECTORY_NAME) | ||
); | ||
var directoryInfo = new DirectoryInfo(path); | ||
|
||
if (!directoryInfo.Exists) | ||
{ | ||
directoryInfo.Create(); | ||
} | ||
|
||
return directoryInfo.EnsureSecureMode(); | ||
} | ||
|
||
public static DirectoryInfo GetExportDirectoryInfo() | ||
private static void EnsureNotEmpty(string path) | ||
{ | ||
return new DirectoryInfo( | ||
Path.Combine(Directory.GetCurrentDirectory(), IConfiguration.EXPORT_DIRECTORY_NAME) | ||
); | ||
if (!string.IsNullOrWhiteSpace(path)) | ||
{ | ||
return; | ||
} | ||
|
||
throw new Exception("Path not configured"); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,4 @@ namespace NanoBlog.Containers; | |
|
||
public record PostExcerpt( | ||
string Name, | ||
string Excerpt | ||
); | ||
string Excerpt); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.