From 3f4c0720e1e3421431e7baa20882a4a4512a7fab Mon Sep 17 00:00:00 2001 From: ivar Date: Sun, 19 Oct 2025 23:41:23 +0200 Subject: Initial --- .../fomantic/tasks/config/admin/github.js | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/wwwroot/libraries/fomantic/tasks/config/admin/github.js (limited to 'src/wwwroot/libraries/fomantic/tasks/config/admin/github.js') diff --git a/src/wwwroot/libraries/fomantic/tasks/config/admin/github.js b/src/wwwroot/libraries/fomantic/tasks/config/admin/github.js new file mode 100644 index 0000000..a2c9e20 --- /dev/null +++ b/src/wwwroot/libraries/fomantic/tasks/config/admin/github.js @@ -0,0 +1,37 @@ +/******************************* + GitHub Login +*******************************/ +/* + Logs into GitHub using OAuth +*/ + +var + fs = require('fs'), + path = require('path'), + githubAPI = require('@octokit/rest'), + + // stores oauth info for GitHub API + oAuthConfig = path.join(__dirname, 'oauth.js'), + oAuth = fs.existsSync(oAuthConfig) + ? require(oAuthConfig) + : false, + github +; + +if(!oAuth) { + console.error('Must add oauth token for GitHub in tasks/config/admin/oauth.js'); +} + +github = new githubAPI({ + version : '3.0.0', + debug : true, + protocol : 'https', + timeout : 5000 +}); + +github.authenticate({ + type: 'oauth', + token: oAuth.token +}); + +module.exports = github; -- cgit v1.3