Skip to content

Commit

Permalink
Merge pull request #22 from gary-Shen/fix/gist
Browse files Browse the repository at this point in the history
feat: new github access token server page
  • Loading branch information
gary-Shen authored Jun 26, 2023
2 parents 95ac22c + 14279c9 commit 684229b
Showing 1 changed file with 74 additions and 2 deletions.
76 changes: 74 additions & 2 deletions server/api/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,80 @@ function sendRejection(response, status = 400, content) {
}

function writeJSON(response, data) {
response.setHeader('Content-Type', 'application/json');
response.write(JSON.stringify(data));
response.setHeader('Content-Type', 'text/html');
response.write(`
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
href="https://unpkg.com/@primer/css@^20.2.4/dist/primer.css"
rel="stylesheet"
/>
<title>Github access token for candi-tab</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/clipboard.min.js"></script>
<style>
#content {
display: flex;
flex-direction: column;
align-items: center;
}
.inputs {
display: flex;
}
.inputs > * {
padding: 0.5rem 0.6rem;
border: 1px solid #ccc;
border-radius: 6px;
}
.inputs button {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.inputs input {
border-right: 0;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
</style>
</head>
<body>
<div id="content">
<h1>Success!</h1>
<p>Copy the following access token and paste it into the extension.</p>
<div class="inputs">
<input
readonly
class="form-control"
type="text"
id="token"
type="text"
value="${data.accessToken}"
placeholder="Standard input"
aria-label="Repository description"
/>
<button
class="btn tooltipped tooltipped-nw"
type="button"
id="copy"
data-clipboard-target="#token"
aria-label="This is the tooltip on the North West side."
>
Copy
</button>
</div>
</div>
<script>
new ClipboardJS('#copy');
</script>
</body>
</html>
`);
}

module.exports = {
Expand Down

1 comment on commit 684229b

@vercel
Copy link

@vercel vercel bot commented on 684229b Jun 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

candi-tab – ./

candi-tab.vercel.app
candi-tab-git-master-gary-shen.vercel.app
candi-tab-gary-shen.vercel.app

Please sign in to comment.