Skip to content

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
mrzapp committed Nov 26, 2017
2 parents 334c05f + fa19df2 commit d0c4815
Show file tree
Hide file tree
Showing 138 changed files with 9,701 additions and 8,098 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# HashBrown CMS
A free and open-source CMS built with Node.js and MongoDB
A free and open-source headless CMS built with Node.js and MongoDB

## The centralised approach
Ever wonder why you have to run a completely separate CMS for every single project? We did too, and that's why HashBrown exists today. This is the new central brain for your extended project structure.
Expand All @@ -13,7 +13,7 @@ Then checkout and run HashBrown:
```
git clone https://github.com/Putaitu/hashbrown-cms.git -b stable --single-branch --recursive
cd ./hashbrown-cms
npm install
npm install --production
node hashbrown.js
```

Expand All @@ -22,8 +22,8 @@ To update the core HashBrown version and all of its dependencies:
```
cd /to/your/hashbrown/dir
git pull
git submodule update--recursive --init
npm install
git submodule update --recursive --init
npm install --production
```

## Getting started
Expand Down
34 changes: 6 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "hashbrown-cms",
"repository": "https://github.com/Putaitu/hashbrown-cms.git",
"version": "0.10.3",
"version": "1.0.0",
"description": "The pluggable CMS",
"main": "hashbrown.js",
"scripts": {
Expand All @@ -21,13 +21,11 @@
"marked": "^0.3.5",
"mongodb": "^2.1.7",
"multer": "^1.1.0",
"nodemailer": "^4.0.1",
"path-to-regexp": "^1.2.1",
"pug": "^2.0.0-beta11",
"rimraf": "^2.5.2",
"semver": "^5.4.1",
"to-markdown": "^2.0.1",
"xoauth2": "^1.2.0"
"to-markdown": "^2.0.1"
},
"devDependencies": {
"babel-core": "^6.18.0",
Expand Down
73 changes: 73 additions & 0 deletions plugins/api/client/DeployerEditor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
'use strict';

class ApiDeployerEditor extends Crisp.View {
// Alias
static get alias() { return 'api'; }

/**
* Constructor
*/
constructor(params) {
super(params);

this.fetch();
}

/**
* Render URL editor
*/
renderUrlEditor() {
return new HashBrown.Views.Widgets.Input({
type: 'text',
value: this.model.url,
placeholder: 'Input URL',
onChange: (newValue) => {
this.model.url = newValue;
}
}).$element;
}

/**
* Render Token editor
*/
renderTokenEditor() {
return new HashBrown.Views.Widgets.Input({
type: 'text',
value: this.model.token,
placeholder: 'Input token',
onChange: (newValue) => {
this.model.token = newValue;
}
}).$element;
}

/**
* Renders this editor
*/
template() {
return _.div({class: 'deployer-editor deployer-editor--api'},
// Url
_.div({class: 'editor__field'},
_.div({class: 'editor__field__key'},
_.div({class: 'editor__field__key__label'}, 'URL'),
_.div({class: 'editor__field__key__description'}, 'The base URL of the API')
),
_.div({class: 'editor__field__value'},
this.renderUrlEditor()
)
),
// Token
_.div({class: 'editor__field'},
_.div({class: 'editor__field__key'},
_.div({class: 'editor__field__key__label'}, 'Token'),
_.div({class: 'editor__field__key__description'}, 'An authenticated API token')
),
_.div({class: 'editor__field__value'},
this.renderTokenEditor()
)
)
);
}
}

HashBrown.Views.Editors.DeployerEditors.Api = ApiDeployerEditor;
17 changes: 17 additions & 0 deletions plugins/api/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

const Deployer = require('./server/Deployer');

/**
* The HashBrown API plugin
*/
class API {
/**
* Init this plugin
*/
static init(app) {
HashBrown.Helpers.ConnectionHelper.registerDeployer(Deployer);
}
}

module.exports = API;
96 changes: 96 additions & 0 deletions plugins/api/server/Deployer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
'use strict';

/**
* API deployer
*/
class ApiDeployer extends HashBrown.Models.Deployer {
// Name and alias
static get name() { return 'API'; }
static get alias() { return 'api'; }

/**
* Gets the root path
*
* @returns {String} Root
*/
getRootPath() {
return this.url;
}

/**
* Structure
*/
structure() {
super.structure();

this.def(String, 'url');
this.def(String, 'token');
}

/**
* Tests this deployer
*
* @returns {Promise} Result
*/
test() {
return HashBrown.Helpers.RequestHelper.request('get', this.getPath('/test'));
}

/**
* Gets a file
*
* @param {String} path
*
* @return {Promise} Promise
*/
getFile(path) {
return HashBrown.Helpers.RequestHelper.request('get', path);
}

/**
* Gets a folder
*
* @param {String} path
*
* @returns {Promise} Result
*/
getFolder(path) {
return this.getFile(path);
}

/**
* Set file
*
* @param {String} path
* @param {String} base64
*
* @return {Promise} Promise
*/
setFile(path, base64) {
return HashBrown.Helpers.RequestHelper.request('post', path, base64);
}

/**
* Removes a file
*
* @param {String} path
*
* @return {Promise} Promise
*/
removeFile(path) {
return HashBrown.Helpers.RequestHelper.request('delete', path);
}

/**
* Removes a folder
*
* @param {String} path
*
* @returns {Promise} Result
*/
removeFolder(path) {
return this.removeFile(path);
}
}

module.exports = ApiDeployer;
49 changes: 49 additions & 0 deletions plugins/filesystem/client/DeployerEditor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
'use strict';

class FileSystemDeployerEditor extends Crisp.View {
// Alias
static get alias() { return 'filesystem'; }

/**
* Constructor
*/
constructor(params) {
super(params);

this.fetch();
}

/**
* Render local path editor
*/
renderPathEditor() {
return new HashBrown.Views.Widgets.Input({
type: 'text',
value: this.model.rootPath,
placeholder: 'Input path',
onChange: (newValue) => {
this.model.rootPath = newValue;
}
}).$element;
}

/**
* Renders this editor
*/
template() {
return _.div({class: 'deployer-editor deployer-editor--filesystem'},
// Path
_.div({class: 'editor__field'},
_.div({class: 'editor__field__key'},
_.div({class: 'editor__field__key__label'}, 'Root path'),
_.div({class: 'editor__field__key__description'}, 'A path to a folder on this machine')
),
_.div({class: 'editor__field__value'},
this.renderPathEditor()
)
)
);
}
}

HashBrown.Views.Editors.DeployerEditors.FileSystem = FileSystemDeployerEditor;
17 changes: 17 additions & 0 deletions plugins/filesystem/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

const Deployer = require('./server/Deployer');

/**
* The HashBrown FileSystem plugin
*/
class FileSystem {
/**
* Init this plugin
*/
static init(app) {
HashBrown.Helpers.ConnectionHelper.registerDeployer(Deployer);
}
}

module.exports = FileSystem;
Loading

0 comments on commit d0c4815

Please sign in to comment.