-
Notifications
You must be signed in to change notification settings - Fork 1
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 #22 from gary-Shen/fix/gist
feat: new github access token server page
- Loading branch information
Showing
1 changed file
with
74 additions
and
2 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 |
---|---|---|
|
@@ -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 = { | ||
|
684229b
There was a problem hiding this comment.
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