Test Message

This commit is contained in:
Luis Fernando Molina committed 2021-01-06 14:03:45 +01:00
1 parent e3c0ba7f1c
commit 0b27186d9a
3 files changed
+33 -8

No files matched your search

+7 -4
View File
@@ -527,7 +527,9 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
case 'Contribute': {
try {
const commitMessage = unescape(requestParameters[3])
const username = unescape(requestParameters[4])
const token = unescape(requestParameters[5])
contribute()
async function contribute() {
@@ -552,7 +554,6 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
async function doGithub() {
const token = ""
const { Octokit } = require("@octokit/rest")
const octokit = new Octokit({
@@ -562,7 +563,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
const repo = 'Superalgos'
const owner = 'Superalgos'
const head = 'Luis-Fernando-Molina:in-app-documentation'
const head = username + ':in-app-documentation'
const base = 'in-app-documentation'
const title = 'Contribution to Superalgos'
@@ -578,7 +579,9 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
} catch (err) {
console.log('[ERROR] httpInterface -> App -> Contribute -> Method call produced an error.')
console.log('[ERROR] httpInterface -> App -> Contribute -> err.stack = ' + err.stack)
console.log('[ERROR] httpInterface -> App -> Contribute -> Params Received = ' + requestParameters[3])
console.log('[ERROR] httpInterface -> App -> Contribute -> commitMessage = ' + commitMessage)
console.log('[ERROR] httpInterface -> App -> Contribute -> username = ' + username)
console.log('[ERROR] httpInterface -> App -> Contribute -> token = ' + token)
let error = {
result: 'Fail Because',
@@ -3,8 +3,8 @@
"pageNumber": "2",
"type": "App Error Github Credentials Missing",
"definition": {
"text": "In order to manage contributions from within the app, you first need to provide your Github.com credentials so that we can get authenticated when pushing your changes to the remote repository.",
"updated": 1609855182001
"text": "In order to manage contributions from within the app, you first need to provide your Github.com credentials so that we can get authenticated when pushing your changes to the remote repository. 1",
"updated": 1609937191972
},
"paragraphs": [
{
@@ -31,12 +31,34 @@ function newSuperalgosDocsCommmandInterface() {
}
if (UI.projects.superalgos.spaces.docsSpace.commandInterface.command.indexOf('App.Contribute') !== 0 && UI.projects.superalgos.spaces.docsSpace.commandInterface.command.indexOf('app.contribute') !== 0) { return }
/* Set up the commit message */
let message = UI.projects.superalgos.spaces.docsSpace.commandInterface.command.trim().substring(UI.projects.superalgos.spaces.docsSpace.commandInterface.command.indexOf(' ') + 1, UI.projects.superalgos.spaces.docsSpace.commandInterface.command.length)
if (message.toLowerCase() === 'app.contribute') {
message = 'This is my contribution to Superalgos'
}
}
httpRequest(undefined, 'App/Contribute/' + message, onResponse)
/* Find the Username and Password */
let apisNode = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsByType('APIs')
if (apisNode === undefined) {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Error Github Credentials Missing', 'Anchor Github Credentials Missing')
return true
}
if (apisNode.githubAPI === undefined) {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Error Github Credentials Missing', 'Anchor Github Credentials Missing')
return true
}
let config = JSON.parse(apisNode.githubAPI.config)
if (config.username === undefined || config.username === "") {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Error Github Credentials Missing', 'Anchor Github Credentials Missing')
return true
}
if (config.token === undefined || config.token === "") {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Error Github Credentials Missing', 'Anchor Github Credentials Missing')
return true
}
httpRequest(undefined, 'App/Contribute/' + message + '/' + config.username + '/' + config.token, onResponse)
return true
function onResponse(err, data) {