-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from dacoaster/jira-integration
JIRA integration, config rework, and bug fixes
- Loading branch information
Showing
44 changed files
with
1,863 additions
and
121 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
VUE_APP_JIRA_CLIENT_ID=3tPI6y3UgOxjUUVd2ELL3mhZr6cGAatt | ||
VUE_APP_JIRA_CLIENT_SECRET=ATOAHCxhe5I4NKjvZo_hnzLSS6N038CmfyUsdnoXHCI0e8el_dY_xrFmMFJVHMAfa14d8502F3BF | ||
VUE_APP_I18N_LOCALE=en | ||
VUE_APP_I18N_FALLBACK_LOCALE=en | ||
|
||
VUE_APP_SERVER_PORT=64064 |
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
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,36 @@ | ||
const express = require("express"); | ||
const bodyParser = require("body-parser"); | ||
const cors = require("cors"); | ||
const path = require("path"); | ||
|
||
const app = express(); | ||
const port = process.env.VUE_APP_SERVER_PORT || 64064; | ||
|
||
const corsOptions = { | ||
origin: `http://localhost:${port}`, | ||
}; | ||
|
||
app.use(cors()); | ||
app.use(cors(corsOptions)); | ||
|
||
// parse requests of content-type - application/json | ||
app.use(bodyParser.json()); | ||
|
||
// parse requests of content-type - application/x-www-form-urlencoded | ||
app.use(bodyParser.urlencoded({ extended: true })); | ||
|
||
// path | ||
app.use(express.static(path.join(__dirname, "images"))); | ||
|
||
app.disable("x-powered-by"); | ||
|
||
// modules | ||
require("./modules/JiraUtility")(app); | ||
|
||
try { | ||
app.listen(port, () => { | ||
console.log(`OAuth redirect server running at http://localhost:${port}`); | ||
}); | ||
} catch (err) { | ||
console.log(err); | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,76 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1.0"> | ||
<title>YATTIE</title> | ||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css"> | ||
<link rel="icon" href="/favicon.ico"> | ||
<style> | ||
body { | ||
margin: 0; | ||
background-color: #fafafa; | ||
border-color: #fafafa; | ||
} | ||
|
||
.wrapper { | ||
width: 100%; | ||
min-height: 100vh; | ||
} | ||
|
||
.container { | ||
padding: 12px; | ||
padding-top: 80px; | ||
margin-left: auto; | ||
margin-right: auto; | ||
} | ||
|
||
.container .logo { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.container .notification { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.container .notification span { | ||
background-color: #fff; | ||
border-color: #fff; | ||
border-radius: 4px; | ||
color: rgba(0, 0, 0, .87); | ||
box-shadow: 0 3px 1px -2px rgba(0, 0, 0, .2), 0 2px 2px 0 rgba(0, 0, 0, .14), 0 1px 5px 0 rgba(0, 0, 0, .12) !important; | ||
display: block; | ||
font-size: 20px; | ||
margin-bottom: 16px; | ||
padding: 25px; | ||
position: relative; | ||
transition: .3s cubic-bezier(.25, .8, .5, 1); | ||
border-left: 4px solid #6200ea; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div class="wrapper"> | ||
<div class="container"> | ||
<div class="logo"> | ||
<img src="/logo.png" alt="logo" width="80"> | ||
</div> | ||
<div class="notification"> | ||
<span>You are now connected to JIRA! You can close this window and go back to the YATTIE app to get started | ||
testing.</span> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</body> | ||
|
||
</html> |
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,41 @@ | ||
const open = require("open"); | ||
const path = require("path"); | ||
const ClientOAuth2 = require("client-oauth2"); | ||
const port = process.env.VUE_APP_SERVER_PORT; | ||
const auth = new ClientOAuth2({ | ||
clientId: process.env.VUE_APP_JIRA_CLIENT_ID, | ||
clientSecret: process.env.VUE_APP_JIRA_CLIENT_SECRET, | ||
accessTokenUri: "https://auth.atlassian.com/oauth/token", | ||
authorizationUri: | ||
"https://auth.atlassian.com/authorize?audience=api.atlassian.com&prompt=consent", | ||
redirectUri: `http://localhost:${port}/oauth2/atlassian/callback`, | ||
scopes: ["read:jira-work", "write:jira-work", "read:me", "offline_access"], | ||
}); | ||
module.exports = (app) => { | ||
app.use((req, res, next) => { | ||
res.header( | ||
"Access-Control-Allow-Headers", | ||
"x-access-token, Origin, Content-Type, Accept" | ||
); | ||
next(); | ||
}); | ||
|
||
app.get("/oauth2/atlassian", (req, res) => { | ||
var uri = auth.code.getUri(); | ||
open(uri, (err) => { | ||
console.log(err); | ||
}); | ||
return res.send(uri); | ||
}); | ||
app.get("/oauth2/atlassian/callback", (req, res) => { | ||
auth.code.getToken(req.originalUrl).then((user) => { | ||
const data = { | ||
type: "jira", | ||
accessToken: user.data, | ||
}; | ||
process.send(data); | ||
|
||
return res.sendFile(path.join(__dirname, "../jira.html")); | ||
}); | ||
}); | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.