GithubHelp home page GithubHelp logo

dystudio / moonglade Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ediwang/moonglade

0.0 1.0 0.0 5.7 MB

The .NET Core blog system of https://edi.wang

License: GNU General Public License v3.0

PowerShell 0.06% C# 46.96% HTML 33.35% CSS 17.14% JavaScript 2.49%

moonglade's Introduction

Project "Moonglade"

Build status

This is the new blog system for https://edi.wang, Moonglade is the successor of project "Nordrassil", which was the .NET Framework version of the blog system. Moonglade is a complete rewrite of the old system using .NET Core, optimized for cloud-based hosting.

image

Features

Basic: Post, Comment, Category, Archive, Tag, Friendlink

Misc: Pingback, RSS/Atom/OPML, Open Search, Reader View

Caveats

This is NOT a general purpose blog system like WordPress or other CMS. Currently it contains content "hard coded" for https://edi.wang.

To make it yours, you will need to change a certain amount of code.

I am looking into generalize the system in the long term. But there are no specific plans and scopes for the currently. You are welcomed to raise PR to move out the "edi.wang" specific code.

不是一个通用博客系统,目前代码里还有和 https://edi.wang 网站相关的页面,因此如果你想使用这套代码自建博客,需要一定量的修改。

Build and Run

Current code is not so setup-friendly, it is very complicated comparing to other blog or CMS systems, I am consider improving the setup steps.

Tools

Prepare Azure AD

This blog is using Azure AD to sign in to admin portal. Local authentication provider is not implmented yet.

Register an App in Azure Active Directory

  • Set Redirection URI to "https://localhost:5001/signin-oidc"
  • Add Redirection URI for your other domain names if needed.
  • Copy "appId" to set as AzureAd:ClientId in appsettings.[env].json file

Example Reply URL Configuration

"replyUrlsWithType": [
{
	"url": "https://localhost/signin-oidc",
	"type": "Web"
},
{
	"url": "https://ediwang-web-staging.azurewebsites.net/signinoidc",
	"type": "Web"
},
{
	"url": "https://localhost:5001/signin-oidc",
	"type": "Web"
},
{
	"url": "https://edi.wang/signin-oidc",
	"type": "Web"
}
],

Setup Database

  1. Create a SQL Server 2017+ database or Azure SQL Database, execute script "Database\1.schema-mssql-140.sql"

  2. Execute "Database\2.init-configuration.sql"

You may need to grant permission to the database for your machine or service account depends on your server configuration

Build Source

  1. Create a "appsettings.Development.json" under "src\Moonglade.Web", this file defines development time settings such as accounts, db connections, keys, etc. It is by default ignored by git, so you will need to manange it on your own.

  2. Update the connection string "MoongladeDatabase" in appsettings.[env].json according to your database configuration.

  3. Build and run Moonglade.sln, startup project is Moonglade.Web

Configuration

Email Password Encryption

Encryption controls the IV and Key for encrypted email passwords in database.

IMPORTANT: This must be set first before first run of the application!

In runtime, to generate a new pair of IV and Key, access URL "/admin/settings/generate-new-aes-keys".

See Edi.Net.AesEncryption project for more information.

Image Storage

AppSettings:ImageStorage controls how blog post images are stored. There are 2 built in options:

  1. Azure Blob: You need to create an Azure Storage Account with a blob container.
"Provider": "AzureStorageImageProvider"
"AzureStorageSettings": {
  "ConnectionString": "YOUR CONNECTION STRING",
  "ContainerName": "YOUR CONTAINER NAME"
},
  1. File System: Set provider to FileSystemImageProvider
"Provider": "FileSystemImageProvider",
"FileSystemSettings": {
  "Path": "${basedir}\\UploadedImages"
}

The Path can be relative or absolute. "${basedir}" represents the website's current directory. Storing images files under website directory is not recommended.

Robots.txt

This blog generates robots.txt based on configuration. However, if there are a physical file named "robots.txt" under "wwwroot" directory, it will override the configuration based robots.txt generation.

To customize robots.txt, modify the configuration under RobotsTxt section.

Others

Key Description
CaptchaSettings:ImageWidth Pixel Width of Captcha Image
CaptchaSettings.ImageHeight Pixel Height of Captcha Image
TimeZone The blog owner's current time zone (relative to UTC)
HotTagAmount How many tags to show on the side bar
PostListPageSize How may posts listed per page
PostSummaryWords How may words to show in post list summary
ImageCacheSlidingExpirationMinutes Time for cached images to expire
EnableImageLazyLoad Use lazy load to show images when user scrolls the page
UsePictureInsteadOfNotFoundResult Show a friendly 404 picture or not
EnablePingBackReceive Can blog receive pingback requests
EnablePingBackSend Can blog send pingback to another blog
EnableHarmonizor Filter bad words (in order to live in China)
EnableReward Show WeChat reward button and QR Code image
RecentCommentsListSize How many comments to show on side bar
EnforceHttps Force website use HTTPS
DisableEmailSendingInDevelopment When debugging locally, do not send email for real

Host on Server

You can host Moonglade on public internet.

Server Requirments

  • Windows or Linux Servers that supports .NET Core 2.2
  • A Microsoft Azure subscription, for setup Azure AD Authentication

Web Server Configuration

SSL

To use https, set EnforceHttps: true in AppSettings.

To get a free SSL certificate, visit https://freessl.cn/

Email Notification

To enable email notifications such as new comments, pingback requests, set up in the blog admin portal.

Optional Recommendations

  • Microsoft Azure DNS Zones
  • Microsoft Azure App Service
  • Microsoft Azure SQL Database
  • Microsoft Azure Blob Storage

moonglade's People

Contributors

ediwang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.