This repository has been archived by the owner on Feb 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 203
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
190 changed files
with
21,811 additions
and
10 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,9 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
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,18 @@ | ||
# App | ||
APP_ENVIRONMENT=production | ||
APP_URL=http://example.com/ | ||
APP_PORT=3000 | ||
|
||
# Security | ||
AUTH_LIFETIME=1h | ||
AUTH_SECRET=**** | ||
AUTH_PASSWORD_MIN_LENGTH=8 | ||
|
||
# SMTP | ||
SMTP_HOST=smtp.example.com | ||
SMTP_USERNAME=smtp_user | ||
SMTP_PASSWORD=**** | ||
SMTP_PORT=587 | ||
SMTP_SECURE=true | ||
SMTP_FROM_NAME=Example User | ||
SMTP_FROM_EMAIL=[email protected] |
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,23 @@ | ||
{ | ||
"rules": { | ||
"comma-dangle": ["warn"], | ||
"eqeqeq": ["warn"], | ||
"no-console": ["off"], | ||
"indent": ["error", 2], | ||
"quotes": ["error", "single"], | ||
"linebreak-style": ["error", "unix"], | ||
"no-unused-vars": ["warn", { "vars": "all", "args": "after-used" }], | ||
"prefer-arrow-callback": ["warn"], | ||
"semi": ["error", "always"] | ||
}, | ||
"env": { | ||
"node": true, | ||
"es6": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"globals": { | ||
"__basedir": true, | ||
"__version": true, | ||
"Postleaf": true | ||
} | ||
} |
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,63 @@ | ||
# Contributing to Postleaf | ||
|
||
Postleaf is a simple, beautiful, decentralized publishing platform that anyone can use. It's free, open source, and built for the modern publisher. | ||
|
||
I'm building Postleaf for the greater good. I want everyone to have a chance to participate in its development no matter their skill level, and nobody should feel out of place for asking a question, submitting their code, etc. | ||
|
||
That said, I have a few simple rules I'm asking everyone to follow: | ||
|
||
- Don't be mean. | ||
- Don't be a troll. | ||
- Don't be a keyboard warrior. | ||
|
||
People from all over the world participate here, and everyone is welcome. Please bear in mind that not all people share the same languages, skills, and beliefs as you. Many are here to learn, so please facilitate that. | ||
|
||
## Support | ||
|
||
Please **do not** use the issue tracker for personal support requests. [The Postleaf community forum](https://community.postleaf.org/) is the preferred place to ask for help. | ||
|
||
Remember, Postleaf is open source. We have a great community of users volunteering their time at no cost to you. Attitude and demeanor go a long way in getting help. 😁 | ||
|
||
## Bug Reports | ||
|
||
Bugs should be submitted to the issue tracker. Before creating a new issue, please search open and closed issues to make sure it hasn't already been addressed. | ||
|
||
For bug reports, please provide: | ||
|
||
- Step-by-step instructions to reproduce the bug. | ||
- A minimal test case to demonstrate the bug (if applicable). | ||
- Postleaf version, Node version, etc. | ||
|
||
A good bug report will show us how to reproduce the problem quickly. A not-so-good bug report is likely to sit around waiting for additional feedback before anything can get fixed. | ||
|
||
## Feature Requests | ||
|
||
Feature requests may be submitted to the issue tracker as well. Before creating a new issue, please search open and close issues to make sure it hasn't already been requested. | ||
|
||
To vote for a specific feature, use GitHub reactions to 👍 or 👎. Remember that you can watch an issue to receive notifications anytime somebody comments. | ||
|
||
## Pull Requests | ||
|
||
I welcome design and code contributions, but bear in mind that I'm very opinionated. I've spent a lot of time and effort working on Postleaf, and I've developed a very clear vision for this project. | ||
|
||
Before embarking on a large, complex, or controversial feature, please open an issue so we can discuss it. Someone may be working on it already, it might not align with Postleaf's roadmap, or we might be able to improve on your idea before you spend time working on it. | ||
|
||
If your PR doesn't get accepted, don't let it get you down. Many don't. It doesn't mean I don't value your idea or contribution, it just means that it doesn't align with my vision for the project. As the maintainer, I'll do my best to explain why every PR doesn't get accepted. | ||
|
||
### Code Quality | ||
|
||
Postleaf uses an `.editorconfig` file to enforce things like indentation, trailing whitespace, etc. Please make sure your editor supports [EditorConfig]((http://editorconfig.org/)) before submitting a PR. | ||
|
||
I'm quite picky about code quality. That doesn't mean I don't like your code, it means I prefer the code to stay consistent. If you follow the same conventions as the rest of the project's code, you'll be good to go. | ||
|
||
### Linting | ||
|
||
I recommend using [Atom](https://atom.io/) because it has [a great linter plugin](https://atom.io/packages/atom-lint). If you use this along with [linter-eslint](https://atom.io/packages/linter-eslint) you'll save yourself a lot of time during development. While you're at it, don't forget to grab the [.editorconfig](https://atom.io/packages/editorconfig) plugin. | ||
|
||
This is by no means mandatory, but it will save you a lot of time. If your preferred IDE doesn't support linting, you can also see ESLint errors while running `gulp watch`. | ||
|
||
## License and Code Contributions | ||
|
||
By submitting bug fixes, code, documentation, or anything else to this project, you agree to allow the developer and his company, A Beautiful Site, LLC, to license or relicense your work under their license of choice and you agree to forfeit all copyrights, intellectual property rights, and royalties pertaining to your contribution. | ||
|
||
I want Postleaf to remain free for everyone to use, forever, so please do not submit any design, code, or content that is licensed or copyrighted without first getting written consent from the author. |
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,20 @@ | ||
### Summary | ||
|
||
Please summarize your issue here. | ||
|
||
### Steps to Reproduce | ||
|
||
1. Step one | ||
2. Step two | ||
3. ... | ||
|
||
### Additional info | ||
|
||
- Postleaf version: | ||
- Node version: | ||
- Affected browsers: | ||
- Operating system: | ||
|
||
--- | ||
|
||
Note: This issue tracker is ONLY for bug reports and feature requests. If this is a personal support issue, please ask on the forum instead: community.postleaf.org |
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,19 @@ | ||
### Pull Request Summary | ||
|
||
Please describe what your PR does here. | ||
|
||
--- | ||
|
||
### Contributor License Agreement | ||
|
||
Before your pull request can be accepted, I ask that you agree to the following terms to ensure there are no conflicts with Postleaf's license now or in the future. | ||
|
||
I want Postleaf to remain free for everyone to use, forever, so please do not submit any design, code, or content that is licensed or copyrighted without first getting written consent from the author. | ||
|
||
[ ] I certify that the code I am contributing to this project is completely original or free of any known license or copyright. | ||
|
||
[ ] I agree to allow the developer of Postleaf, A Beautiful Site, LLC, to license or relicense my work at their discretion. By submitting this pull request, I agree to forfeit all copyrights, intellectual property rights, and royalties pertaining to my contribution. | ||
|
||
[ ] By entering my name in the space provided below, I agree to all of the terms mentioned above. | ||
|
||
Signed: FULL_LEGAL_NAME |
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,15 @@ | ||
# Files | ||
.DS_Store | ||
.env | ||
|
||
# Directories | ||
assets/ | ||
cache/ | ||
data/ | ||
design/ | ||
node_modules/ | ||
uploads/ | ||
|
||
# Ignore everything except the default theme | ||
themes/* | ||
#!themes/default |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2017 A Beautiful Site, LLC | ||
|
||
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. |
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,21 +1,84 @@ | ||
# Postleaf | ||
# <img src="http://postleaf.s3.amazonaws.com/website/images/postleaf_wordmark.svg" alt="Postleaf" width="300"> | ||
|
||
Simple, beautiful publishing. | ||
**Simple, beautiful publishing.** | ||
|
||
--- | ||
![Postleaf on a laptop, tablet, and phone](http://postleaf.s3.amazonaws.com/website/images/devices.png) | ||
|
||
Postleaf is a simple, beautiful, decentralized publishing platform that anyone can use. It's free, open source, and built for the modern publisher. | ||
|
||
Created by [Cory LaViska](https://twitter.com/claviska) | ||
|
||
- Website: [postleaf.org](https://www.postleaf.org/) | ||
- Twitter: [@postleafapp](https://twitter.com/postleafapp) | ||
|
||
This software is dedicated to my daughter, Sophia, and my son, Calvin. Chase your dreams, lil’ ones. 💙💚 | ||
|
||
## Requirements | ||
|
||
- Node 7 | ||
- SQLite 3 | ||
- GraphicsMagick | ||
|
||
## Download | ||
|
||
**This is the development repo!** You'll need to build Postleaf using the instructions below before running it. | ||
|
||
## Contributing | ||
|
||
Postleaf uses NPM to manage dependencies and Gulp as its task runner. To contribute to this project, you'll need to clone the repository and install the required development tools listed below. | ||
|
||
- [Node](https://nodejs.org/en/) | ||
- [Gulp](http://gulpjs.com/) (Install using `npm install -g gulp-cli`) | ||
|
||
Please read through our [contributing guidelines](https://github.com/claviska/postleaf/blob/master/.github/CONTRIBUTING.md). | ||
|
||
## Building | ||
|
||
Once you have the necessary development tools installed: | ||
|
||
1. Open a terminal | ||
2. Navigate to the root directory of your cloned repo | ||
3. Run the following command: | ||
|
||
``` | ||
npm install | ||
gulp build | ||
``` | ||
|
||
This will generate all the assets you need to run Postleaf. | ||
|
||
## Using Gulp | ||
|
||
- Use `gulp build` to build all assets. | ||
- Use `gulp clean` to remove all assets. | ||
- Use `gulp help` to see all available tasks. | ||
|
||
## Testing | ||
|
||
You can run Postleaf using the following command: | ||
|
||
``` | ||
node app.js | ||
``` | ||
|
||
Then open http://localhost:3000 in your browser. | ||
|
||
## Versioning | ||
|
||
Postleaf is maintained under the [Semantic Versioning guidelines](http://semver.org/) and we adhere to them as closely as possible. | ||
|
||
To my awesome users: | ||
## License | ||
|
||
I've been taking some time to reimagine what Postleaf should have been. Yes, the betas were pretty awesome, but they weren't what I wanted them to be in terms of design, code, and function. I can do better, and you deserve nothing less than my very best. | ||
©2016 A Beautiful Site, LLC | ||
|
||
The last few months were difficult for me as I struggled to find my place in the world of content management. I thought about giving it up and getting out of software altogether. My vision was cloudy, my passion had faded. Recently, I looked at Postleaf from a completely different perspective and everything started to make sense again. | ||
This software is copyrighted. You may use it under the terms of the MIT license. See LICENSE.md for details. | ||
|
||
*I have a vision to bring simple, beautiful publishing to the world. And I'm not going to stop until I get it right.* | ||
All code is copyrighted by A Beautiful Site, LLC except where noted. Third-party libraries are copyrighted and licensed by their respective owners. | ||
|
||
Thanks for giving me the time I needed to find myself. | ||
## Support | ||
|
||
Postleaf will be back very soon. And it will be better than you ever imagined. | ||
Please visit [the community forum](https://community.postleaf.org/) for support. | ||
|
||
--- | ||
|
||
If you're looking for a fork of the original concept, please visit [Leafpub](https://leafpub.org). Marc is doing an excellent job maintaining the project, already piloting it to the [first stable version](https://github.com/Leafpub/leafpub/releases/tag/1.0.0). | ||
*“The starting point of all achievement is desire.” — Napoleon Hill* |
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,109 @@ | ||
'use strict'; | ||
|
||
// Environment | ||
require('dotenv').config(); | ||
process.env.TZ = 'UTC'; | ||
|
||
// Globals | ||
global.__basedir = __dirname; | ||
global.__version = require('./package.json').version; | ||
|
||
// Node modules | ||
const Adaro = require('adaro'); | ||
const BodyParser = require('body-parser'); | ||
const Chalk = require('chalk'); | ||
const CookieParser = require('cookie-parser'); | ||
const Compression = require('compression'); | ||
const Express = require('express'); | ||
const Path = require('path'); | ||
const Slashes = require('connect-slashes'); | ||
|
||
// Express app | ||
const app = Express(); | ||
const AdminRouter = require(Path.join(__basedir, 'source/routers/admin_router.js')); | ||
const ApiRouter = require(Path.join(__basedir, 'source/routers/api_router.js')); | ||
const ThemeRouter = require(Path.join(__basedir, 'source/routers/theme_router.js')); | ||
const AuthMiddleware = require(Path.join(__basedir, 'source/middleware/auth_middleware')); | ||
const ViewMiddleware = require(Path.join(__basedir, 'source/middleware/view_middleware.js')); | ||
const ErrorController = require(Path.join(__basedir, 'source/controllers/error_controller.js')); | ||
const DynamicImages = require(Path.join(__basedir, 'source/modules/dynamic_images.js')); | ||
|
||
// Database | ||
const Database = require(Path.join(__basedir, 'source/modules/database.js')); | ||
app.locals.Database = Database; | ||
|
||
// Sync the database | ||
Database.init() | ||
.then(() => { | ||
let models = Database.sequelize.models; | ||
|
||
// Generate search indexes on startup | ||
models.post.buildSearchIndex(); | ||
models.user.buildSearchIndex(); | ||
models.tag.buildSearchIndex(); | ||
}) | ||
// Load settings into app.locals.Settings | ||
.then(() => Database.loadSettings()) | ||
.then((settings) => app.locals.Settings = settings) | ||
// Load navigation into app.locals.Navigation | ||
.then(() => Database.sequelize.models.navigation.getArray()) | ||
.then((navigation) => app.locals.Navigation = navigation) | ||
// Load i18n into app.locals.I18n | ||
.then(() => { | ||
app.locals.I18n = require(Path.join(__basedir, 'source/modules/i18n.js')); | ||
return app.locals.I18n.load(app.locals.Settings.language); | ||
}) | ||
// Start the app | ||
.then(() => { | ||
// App config | ||
app.enable('strict routing'); | ||
app.disable('x-powered-by'); | ||
|
||
// App-level middleware | ||
app | ||
.use(Slashes(false)) | ||
.use(CookieParser()) | ||
.use(Compression()) | ||
.use(DynamicImages.processImages) | ||
.use('/assets', Express.static(Path.join(__basedir, 'assets'))) | ||
.use('/themes', Express.static(Path.join(__basedir, 'themes'))) | ||
.use('/uploads', Express.static(Path.join(__basedir, 'uploads'))) | ||
.use(BodyParser.urlencoded({ extended: true, limit: '10mb' })) | ||
.use(AuthMiddleware.attachUser) | ||
.use(ViewMiddleware.attachViewData) | ||
.use(ViewMiddleware.enableDynamicViews); | ||
|
||
// View engine | ||
app.engine('dust', Adaro.dust({ | ||
cache: process.env.APP_ENVIRONMENT === 'production', | ||
helpers: [ | ||
'dustjs-helpers', | ||
'source/modules/helpers/html_helpers.js', | ||
'source/modules/helpers/utility_helpers.js', | ||
'source/modules/helpers/theme_helpers.js' | ||
], | ||
whitespace: process.env.APP_ENVIRONMENT !== 'production' | ||
})); | ||
app.set('views', Path.join(__basedir, 'source/views')); | ||
app.set('view engine', 'dust'); | ||
|
||
// App routers | ||
ApiRouter(app); | ||
AdminRouter(app); | ||
ThemeRouter(app); | ||
|
||
// Error pages | ||
app.use(ErrorController.notFound); | ||
app.use(ErrorController.applicationError); | ||
|
||
// Start sailing! ⚓️ | ||
app.listen(process.env.APP_PORT, () => { | ||
console.info('Postleaf publishing on port %d! 🌱', process.env.APP_PORT); | ||
}); | ||
}) | ||
.catch((err) => { | ||
console.error( | ||
Chalk.red('Error: ') + 'Postleaf failed to start! 🐛\n\n' + | ||
Chalk.red(err) | ||
); | ||
}); |
Oops, something went wrong.