-
Notifications
You must be signed in to change notification settings - Fork 36
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
138 changed files
with
9,701 additions
and
8,098 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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; |
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,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; |
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,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; |
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,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; |
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,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; |
Oops, something went wrong.