From 5f36417a826590624d2547d897c0610b935addb2 Mon Sep 17 00:00:00 2001 From: alan Date: Thu, 11 Jan 2024 17:04:58 -0500 Subject: [PATCH] WIP, add user remap --- README.md | 1 + config/server.json | 1 + config/user_remap.json | 9 +++++++++ src/index.js | 18 ++++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 config/user_remap.json diff --git a/README.md b/README.md index 8b59b84..a78ecad 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,4 @@ Automation tool to reduce pain while taking CGT365 - Tips on [managing API tokens](https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/) - [PatternPacker](https://git.alanocull.com/alan/pattern-packer/src/branch/master/src/server/server.ts) uses some basic express hosting - Jira REST API docs for [issues](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-group-issues) +- Gitea REST API [docs](https://git.alanocull.com/api/swagger) diff --git a/config/server.json b/config/server.json index adc1d2a..1359f9c 100644 --- a/config/server.json +++ b/config/server.json @@ -1,3 +1,4 @@ { + "gitea": "https://git.alanocull.com", "port": 3001 } \ No newline at end of file diff --git a/config/user_remap.json b/config/user_remap.json new file mode 100644 index 0000000..bb7e31b --- /dev/null +++ b/config/user_remap.json @@ -0,0 +1,9 @@ +{ + "alan": "arocull@purdue.edu", + "Will": "montgow@purdue.edu", + "connor": "celswort@purdue.edu", + "shelby": "shockada@purdue.edu", + "tommy": "thochste@purdue.edu", + "matt": "mcschule@purdue.edu", + "patrick": "ryan227@purdue.edu" +} \ No newline at end of file diff --git a/src/index.js b/src/index.js index 333d9d6..a26506a 100644 --- a/src/index.js +++ b/src/index.js @@ -9,14 +9,32 @@ const CONFIG = JSON.parse(fs.readFileSync(`${CONFIG_DIRECTORY}server.json`, 'utf const SECRETS = JSON.parse(fs.readFileSync(`${CONFIG_DIRECTORY}secrets.json`, 'utf-8')); const PORT = CONFIG['port']; +// BUILD OAUTH +const OAUTH_JIRA = `${SECRETS['jira-email']}:${SECRETS['jira-token']}`; +const OAUTH_GITEA = `token ${SECRETS['gitea-token']}`; + +const URL_GITEA = `${CONFIG['gitea']}/api`; + // INITIALIZE EXPRESS const app = express(); + + +// FUNCTIONALITY + + + +// SET UP WEBHOOKS app.get('/', (req, res) => { console.log("Got request ", req.url); res.send({'data':'nice'}); }) +// HOST app.listen(PORT, () => { console.log(`Server is running on localhost:${PORT}, working in ${CONFIG_DIRECTORY}`) }); + +app.post(`${URL_GITEA}/repos/triple-aaa-games/hook-line-axe/issues`, (req, res) => { + console.log(req.body); +});