-
-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prefetch urls in background and insert "real" anchor links (#543)
* Remove lazy loader for relative files * Add setting to enable support for private repositories * Insert real href tag * Add token field to settings page * Add octolinker api helper * Align format with new octolinker api * Use ZEIT now deployment * Split head from base sha in url In some cases the file path in PR comment contains head and a base sha like https://github.com/user/repo/pull/123/files/f18370bde83d7f1ced7acf5af54a21d2e53912ff..637d21dd86c8f50e9100b8da656e43cadcccde4d#diff-fd9ad2ea8184b3a5e7d76f54e87ae438 * Resolve urls with either the github or octolinker API * Update E2E test to work with href attribute * Correct grammar See #543 (comment) * Implement simple GitHub search * Remove option to toggle line indicator * Open settings dialog rather than being a new tab * Fix GitHub API call in Firefox * Simplify loader * Add trusted url resolver to reduce load on octolinker api * Fix tests
- Loading branch information
1 parent
61f7d97
commit 5ad3152
Showing
41 changed files
with
483 additions
and
431 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
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
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,29 @@ | ||
import loader from '../loader'; | ||
|
||
describe('loader', () => { | ||
const getMatches = (type, urls) => [ | ||
{ | ||
link: { href: '' }, | ||
urls: [ | ||
{ | ||
type, | ||
urls, | ||
user: 'octolinker', | ||
repo: 'testrepo', | ||
branch: 'master', | ||
path: 'lib/index.js', | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
it('call github api to resolve internal links', () => { | ||
loader( | ||
getMatches('internal-link', [ | ||
'https://github.com/octolinker/testrepo/blob/master/lib/index.js', | ||
]), | ||
); | ||
}); | ||
it('call octolinker api to resolve external links', () => {}); | ||
it('call github and octolinker api to resolve external and internal links', () => {}); | ||
}); |
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,23 +1,12 @@ | ||
import * as storage from '@octolinker/helper-settings'; | ||
import newTab from './newTab'; | ||
import fetchUrls from '../utils/fetch'; | ||
|
||
storage.load().then(() => { | ||
newTab(); | ||
}); | ||
|
||
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { | ||
if (request.type !== 'fetch') { | ||
return; | ||
} | ||
chrome.runtime.onMessage.addListener(({ action }) => { | ||
if (action !== 'openSettings') return; | ||
|
||
fetchUrls(request.urls) | ||
.then(res => { | ||
sendResponse(res); | ||
}) | ||
.catch(() => { | ||
sendResponse(); | ||
}); | ||
|
||
return true; | ||
chrome.runtime.openOptionsPage(); | ||
}); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.