Skip to content

Commit 05dd5c8

Browse files
authored
Updated CORS proxy
Update codeit-autolinker.js
2 parents 4971747 + 2b02c8a commit 05dd5c8

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed
File renamed without changes.

git/gitauth.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,14 @@ window.onload = async () => {
142142
async function getGithubToken(gitCode) {
143143

144144
// post through CORS proxy to git with clientId, clientSecret and code
145-
const resp = await axios.post('https://scepter-cors2.herokuapp.com/' +
146-
'https://github.com/login/oauth/access_token?' +
147-
'client_id=7ede3eed3185e59c042d' +
148-
'&client_secret=c1934d5aab1c957800ea8e84ce6a24dda6d68f45' +
149-
'&code=' + gitCode);
145+
const resp = await axios.get(window.location.origin + '/api/cors?url=' +
146+
'https://github.com/login/oauth/access_token?' +
147+
'client_id=7ede3eed3185e59c042d' +
148+
'&client_secret=c1934d5aab1c957800ea8e84ce6a24dda6d68f45' +
149+
'&code=' + gitCode, '', true);
150150

151151
// save git token to localStorage
152-
gitToken = resp.access_token;
152+
gitToken = resp.split('access_token=')[1].split('&')[0];
153153
saveGitTokenLS(gitToken);
154154

155155

lib/plugins/codeit-autolinker.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
var isMac = navigator.platform.indexOf('Mac') > -1;
6868

6969
env.attributes.href = href.replaceAll('\'','').replaceAll('"','').replaceAll('`','');
70-
env.attributes.onclick = 'if (event.ctrlKey || event.metaKey) { event.preventDefault(); window.open(this.href, "_blank") }';
71-
env.attributes.title = isMac ? '⌘ + click to open link' : 'Ctrl + click to open link';
70+
env.attributes.onclick = 'if ((event.ctrlKey || event.metaKey) && event.shiftKey) { event.preventDefault(); window.open(this.href, "_blank") }';
71+
env.attributes.title = isMac ? '⌘ + shift + click to open link' : 'Ctrl + shift + click to open link';
7272

7373
// Silently catch any error thrown by decodeURIComponent (#1186)
7474
try {

manifest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ let manifest = {
2424
"action": window.location.origin + "/full?upload=true",
2525
"name": "code",
2626
"accept": {
27-
"text/plain": ["text/*", "application/json"]
27+
"text/plain": [".js", ".css", ".html", ".json"]
2828
}
2929
}
3030
],

worker/client-channel.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
// update worker name when updating worker
7-
const WORKER_NAME = 'codeit-worker-v532';
7+
const WORKER_NAME = 'codeit-worker-v533';
88

99

1010
// internal paths

0 commit comments

Comments
 (0)