This is my contribution to Superalgos
This commit is contained in:
1 parent
c623daee34
commit
4a0925ed1b
2 files changed
+49
-15
No files matched your search
@@ -526,13 +526,15 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
switch (requestParameters[2]) { // switch by command
|
||||
case 'Contribute': {
|
||||
try {
|
||||
const GITHUB = require('../Github.json')
|
||||
if (GITHUB.user === 'Your Github.com Username' || GITHUB.user === 'Your Github.com Password' ) {
|
||||
let GITHUB
|
||||
try {
|
||||
GITHUB = require('../Github.json')
|
||||
} catch (err) {
|
||||
let error = {
|
||||
result: 'Fail Because',
|
||||
message: 'File Github.json does not exist.'
|
||||
}
|
||||
respondWithContent(JSON.stringify(error), httpResponse)
|
||||
respondWithContent(JSON.stringify(error), httpResponse)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -544,16 +546,12 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
}
|
||||
const git = simpleGit(options)
|
||||
const commitMessage = unescape(requestParameters[3])
|
||||
const USER = 'Luis-Fernando-Molina';
|
||||
const PASS = 'somewhere';
|
||||
const REPO = 'github.com/username/private-repo';
|
||||
|
||||
const remote = `https://${USER}:${PASS}@${REPO}`;
|
||||
const remote = `https://${GITHUB.user}:${GITHUB.password}@${GITHUB.repository}`;
|
||||
|
||||
git
|
||||
.add('./*')
|
||||
.commit(commitMessage)
|
||||
.push('origin')
|
||||
.push(remote)
|
||||
|
||||
//function onCommit(err) {
|
||||
// if (err) { throw err }
|
||||
|
||||
+42
-6
@@ -18,17 +18,53 @@
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "At the root folder of Superalgos, you will find a JSON file called Github.json. Please open it with a simple text editor like notepad and configure there your Github credentials.",
|
||||
"updated": 1609855434274
|
||||
"text": "At the root folder of Superalgos, you will need to create a JSON file called Github.json. Use simple text editor like notepad and configure there your Github credentials. You can copy and paste the following template, replacing the dummy strings with your actual user name and password.",
|
||||
"updated": 1609856366366
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The file looks like this:"
|
||||
"style": "Title",
|
||||
"text": "Github File Template",
|
||||
"updated": 1609856386094
|
||||
},
|
||||
{
|
||||
"style": "Javascript",
|
||||
"text": "{\n \"user\": \"Your Github.com Username\",\n \"password\": \"Your Github.com Password\"\n}",
|
||||
"updated": 1609855288091
|
||||
"text": "{\n \"user\": \"Your Github.com Username\",\n \"password\": \"Your Github.com Password\"\n \"repository\": \"\"\n }",
|
||||
"updated": 1609857106444
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
"text": "Properties",
|
||||
"updated": 1609857199167
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "user: Your Github.com Username."
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "parrword: Your Github.com Password."
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "repository: The URL of your Superalgos fork."
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
"text": "Example"
|
||||
},
|
||||
{
|
||||
"style": "Javascript",
|
||||
"text": "{\n \"user\": \"john-smith\",\n \"password\": \"john123$\"\n \"repository\": \"github.com/john-smith/Superalgos\"\n }",
|
||||
"updated": 1609857447825
|
||||
},
|
||||
{
|
||||
"style": "Note",
|
||||
"text": "Don't worry, your crendentials will not be uploaded to the repository because the file Github.json is listed at the .gitignore file, so it will be ignored and will only be at your local computer."
|
||||
},
|
||||
{
|
||||
"style": "Important",
|
||||
"text": "The system will use your credentials only to execute a git push command pointing to your Superalgos repository fork, in order to upload all the changes you made to Docs Pages.",
|
||||
"updated": 1609856824492
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user