-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
69 changed files
with
2,940 additions
and
23,192 deletions.
There are no files selected for viewing
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,2 @@ | ||
REACT_APP_ROOT=/ | ||
REACT_APP_LANG=en-US |
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,3 +1,25 @@ | ||
node_modules | ||
sessions | ||
package-lock.json | ||
# Backend | ||
package-lock.json | ||
|
||
# React | ||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
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 |
---|---|---|
@@ -1,184 +1,97 @@ | ||
# Hexo Node Admin | ||
|
||
A [Hexo](https://hexo.io/) management tool with UI designed to make it easier for you to compose, inspired by [hexo-admin](https://github.com/jaredly/hexo-admin). | ||
A [Hexo](https://hexo.io/) management tool with UI designed to make it easier for you to compose and manage your posts and pages. If you like it, do not forget to Star. Many thanks. | ||
|
||
## Next steps! | ||
|
||
[April 2020] A revamp is coming soon. Features more modern UI and addresses history issues. | ||
|
||
## Hexo Version | ||
|
||
Works with `4.x`, `3.x`, not sure if it works with `2.x` or `1.x`, you can give it a try :D. | ||
|
||
## Features | ||
## Screenshots | ||
|
||
- **Full** control over your Hexo workspace with **adding**, **editing**, ***deleting*** your posts and pages. | ||
- Supports `post_asset_folder` setting of Hexo with **uploading**, **deleting**, **referencing** your corresponding assets like **images** and any other attachments. | ||
- Supports **Hexo command** `hexo generate`, `hexo deploy` and `hexo clean`. You only need several clicks to get your things going. | ||
- Using powerful markdown editor [SimpleMDE](https://simplemde.com/) with **Auto-saving** function. | ||
- Supports **password authentication** for admin pages. | ||
- Supports both Hexo default deploy settings and **custom shell scripts** (like executing some `cp` commands). | ||
- Supports multiple languages. Currently supports `en_US` and `zh_CN` (简体中文), you can contribute to localization by editing language packs in `lang` folder. | ||
![](./docs/dashboard.png) | ||
![](./docs/editor.png) | ||
|
||
## Browse | ||
## Migrate from v0 to v1 | ||
|
||
- [**Quickstart**](#quickstart) | ||
- [**Screenshots**](#screenshots) | ||
- [**Password**](#password) | ||
- [**Auto-saving**](#auto-saving) | ||
- [**Language**](#language) | ||
- [**Assets**](#assets) | ||
- [**Deploy**](#deploy) | ||
- [**Contribute**](#contribute) | ||
- [**Donate**](#donate) | ||
Follow the Quick Start section and you should be good. | ||
|
||
**Make sure you have the permissions on the Hexo folder and files.** | ||
## Hexo Version | ||
|
||
**You'd better read through this README, especially about [Auto-saving](#auto-saving) to understand the behavior of the editor.** | ||
Works with `4.x`, `3.x`, not sure if it works with `2.x` or `1.x`, you can give it a try :D. | ||
|
||
## Quickstart | ||
## Quick Start | ||
|
||
### 1. Clone this repository to wherever you like and enter it. (Or download as a zip file and unzip it into your hexo folder.) | ||
1. Clone this repository or download from [Release](https://github.com/quincyyhuang/hexo-node-admin/releases) | ||
|
||
``` | ||
git clone https://github.com/quincyyhuang/hexo-node-admin | ||
cd hexo-node-admin | ||
``` | ||
|
||
### 2. Install dependencies using NPM or Yarn | ||
2. Install dependencies. | ||
|
||
``` | ||
// NPM | ||
npm install | ||
// Yarn | ||
yarn | ||
``` | ||
|
||
### 3. Add your absolute path to hexo to `config.json` | ||
3. Set up `config.json`. | ||
|
||
``` | ||
{ | ||
"root": "/", | ||
"host": "localhost", | ||
"port": 4001, | ||
"hexo_dir": "", // Change this to the path to your hexo root folder, can be relative path, relative to hexo-node-admin folder | ||
"admin": { | ||
"username": "test", | ||
"password": "test", | ||
"plain": true | ||
"plain": true, | ||
"username": "test", // Change username | ||
"password": "test" // Change password | ||
}, | ||
"hexo_dir": "/absolute/path/to/hexo", // Change this to your ABSOLUTE PATH to hexo, leave it blank if it is the current folder. | ||
"deploy": { | ||
"type": "default", | ||
"script": "" | ||
}, | ||
"lang": "en_US" | ||
"lang": "en-US", | ||
"jwt_secret": "" | ||
} | ||
``` | ||
|
||
### 4. Go! | ||
4. Start Hexo Node Admin and go to `http://localhost:4001`. | ||
|
||
``` | ||
// Using NPM | ||
npm start | ||
// Using Yarn | ||
yarn start | ||
// Or just Node.js | ||
node index.js | ||
``` | ||
|
||
### 5. See what you got! | ||
|
||
`open http://localhost:4001`, your default username is `test` and password is `test`. You can change them [later](#password). | ||
|
||
## Why not a module? | ||
|
||
Because `hexo-node-admin` is not actually a module or a Hexo plugin. It's more like a standalone backend that operates on Hexo resources. | ||
|
||
## Screenshots | ||
|
||
![login](docs/login.png) | ||
|
||
![dashboard](docs/dashboard.png) | ||
|
||
![posts](docs/posts.png) | ||
|
||
![editor](docs/editor.png) | ||
|
||
## Password | ||
|
||
By default, your password is saved in plain text. To encrypt your password, follow the steps. | ||
|
||
### 1. Navigate to the `Login` page. (Logout first if necessary.) | ||
|
||
### 2. Click button `ENCRYPT PASSWORD`. | ||
|
||
### 3. Type in your password and hit `Enter`. | ||
|
||
### 4. Copy the result into your `config.json` file to field `password`. | ||
## Secure the Admin | ||
|
||
### 5. Change the `plain` field to `false`. | ||
You can avoid using plain text password by setting `admin.plain` to `false`. Use [any](https://bcrypt-generator.com/) bcrypt generator to hash your password and paste the result in `admin.password`. You should also use HTTPS to secure the traffic if the admin is going to be exposed to the Internet. | ||
|
||
### 6. Save the file and **restart** the server. Everything will do! | ||
|
||
## Auto-saving | ||
|
||
The markdown editor autosaves the content in it every 3 seconds to `localStorage` of your browser. **If you want to apply the change to server, please click button `Save`**. | ||
|
||
**Notice!** The editor lazy-loads your posts and pages which means only if you click button `Reload`, it retrieves the file from server. Otherwise it displays what is stored in your browser(your latest editing version). In this case, you should **feel safe** to close the editor whenever you like without feeling unsure about your work. | ||
|
||
## Language | ||
|
||
Change the `lang` field in `config.json`. Default is `en_US`. Following languages are available. | ||
|
||
- `en_US` | ||
- `zh_CN` 简体中文 | ||
|
||
## Assets | ||
|
||
Read [this](https://hexo.io/docs/asset-folders.html) about `post_asset_folder` before. | ||
|
||
Change the `post_asset_folder` field to `true` in `_config.yml` of your Hexo will do. | ||
|
||
**Notice!** New asset folder of the same name with your file will be created if there isn't one. | ||
|
||
### Upload Asset | ||
|
||
Upload is easy. Just click the button `Upload` and choose your file. It will be uploaded to the asset folder. | ||
|
||
![upload](docs/upload.png) | ||
|
||
### Delete Asset | ||
|
||
Delete is easy. Just click the button `Assets` to show your assets and click `Delete`. | ||
|
||
![assets](docs/assets.png) | ||
|
||
### Reference Asset | ||
|
||
You can read [this](https://hexo.io/docs/asset-folders.html#Tag-Plugins-For-Relative-Path-Referencing) on how to reference your assets in your files. | ||
|
||
Basically: | ||
|
||
``` | ||
{% asset_path slug %} | ||
{% asset_img slug [title] %} | ||
{% asset_link slug [title] %} | ||
``` | ||
|
||
## Deploy | ||
|
||
`hexo-node-admin` supports 2 types of deploy, you can use both **default** Hexo deploy and **custom** shell script that can be executed on the server. | ||
## Features | ||
|
||
### 1. Hexo default deploy | ||
- Support loading the admin on subdirectory. For example, '/admin' of your blog URL. | ||
- Support [Post Asset Folder](https://hexo.io/docs/asset-folders#Post-Asset-Folder) feature. You can upload and delete post assets. | ||
|
||
Just define your deploy setting in `_config.yml` of your Hexo folder as suggested [here](https://hexo.io/docs/deployment.html). `hexo-node-admin` will execute `hexo deploy` command for you. | ||
## Localization | ||
|
||
### 2. Custom shell script | ||
Currently supported languages: | ||
- English (United States): `en-US` | ||
- 简体中文 Simplified Chinese (PRC): `zh-CN` | ||
- 正體中文 Traditional Chinese (Taiwan): `zh-TW` | ||
|
||
Change the deploy type in `config.json` to `custom` and specify the `script` field. | ||
## Advanced Configuration | ||
|
||
**Notice!** Don't forget to `chmod +x your_script.sh` on `Linux` and `Mac`. | ||
Change `config.json` to match your needs. | ||
|
||
**Notice!** The `script` field can either be **The Absolute Path of a shell file (`.sh` on Linux/Mac, `.cmd` or `.bat` on Windows)**, or **A single line of command like `cp -fr /path/to/hexo/public/* /webroot`**. | ||
| config | value | | ||
|:--------------:|:----------------------------------------------------------------------------------------------------------------------------------------------:| | ||
| `root` | The root path for mounting the admin. Default to `'/'`. Can be set to subdirectory as `'/admin'`. | | ||
| `host` | The address to listen on. Default to `'localhost'`. To listen on all, set to `'0.0.0.0'`. | | ||
| `port` | The port to listen on. Default to `4001`. | | ||
| `hexo_dir` | Path to your hexo blog root folder. If using relative path, the path will be relative to the 'hexo-node-admin' folder. | | ||
| `admin.plain` | If using plain text password. Default to `true`. Set to `false` to use hashed password. | | ||
| `admin.username` | Username for login. | | ||
| `admin.password` | Password for login. If `admin.plain == true`, this is plaint text password.If `admin.plain == false`, this needs to be a bcrypt-ed hash. | | ||
| `deploy.type` | Type for deployment. Default to `'default'`, this runs `hexo deploy`. Set to `'command'` to run a single command. Set to `'script'` to run a script. | | ||
| `deploy.script` | If `deploy.type == 'command'`, this is the one line command to execute. If `deploy.type == 'script'`, this is the path to the script. | | ||
| `lang` | Language to use. Default to `'en-US'`. All available options please see localization section. | | ||
| `jwt_secret` | JSON web token secret. Default to empty, this will make the admin generate a random secret on every start. You can set it to any string. | | ||
|
||
## Contribute | ||
# Credits | ||
|
||
I sincerely welcome everyone to contribute to this project. Thanks a lot! | ||
This project is using [React](https://reactjs.org/), [Material UI](https://material-ui.com/) and [JWT](https://jwt.io/). Special credit to [react-markdown-editor-lite](https://github.com/HarryChen0506/react-markdown-editor-lite). All third-party software follows their own licenses. |
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,14 +1,17 @@ | ||
{ | ||
"root": "/", | ||
"host": "localhost", | ||
"port": 4001, | ||
"hexo_dir": "", | ||
"admin": { | ||
"plain": true, | ||
"username": "test", | ||
"password": "test", | ||
"plain": true | ||
"password": "test" | ||
}, | ||
"deploy": { | ||
"type": "default", | ||
"script": "" | ||
}, | ||
"lang": "en_US" | ||
"lang": "en-US", | ||
"jwt_secret": "" | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.