Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefetch urls in background and insert "real" anchor links #543

Merged
merged 18 commits into from
Mar 11, 2019

Conversation

stefanbuck
Copy link
Member

@stefanbuck stefanbuck commented Feb 15, 2019

The overall goal of this Pull Request is to process links in the background before you actual click on a link. Previously, OctoLinker started processing links just on click for various reasons. From a UX point of view this wasn't really great. It was slow, but more important it broke the expected behaviour of a anchor tag element. It was basically just a dumb anchor tag <a href="#" /> and we had to re-implement things like CMD+click and middle mouse button to open the url in a new tab. Also hovering over the link to see where OctoLinker takes you wasn't possible. Over the last few months, I did a lot major refactoring which was required to shipping this feature and this change will finally ship the feature.

In order to resolve relative links within a repo, OctoLinker is now using the GitHub API. Therefore you need to create a GitHub token for private repositories. The architecture of our OctoLinker service which is responsible to resolve registry packages also changed quite a lot and we will share some updates soon.

I still need to write a few unit + E2E tests followed by a proper Q&A session. I'm considering a beta phase for this release. If you're interested in being a beta tester react with 🚀 below and I'll come back to you.

Fixes #277 #530

@stefanbuck
Copy link
Member Author

@josephfrazier I think you should be able to push straight to my branch.

@stefanbuck stefanbuck changed the base branch from master to v5 March 1, 2019 21:13
@josephfrazier
Copy link
Member

Ah whoops, I was looking directly at the commit, outside the context of a PR, so I thought it might have already been merged. Will do!

@stefanbuck stefanbuck force-pushed the 277-real-links branch 3 times, most recently from 50266e6 to 15c286c Compare March 10, 2019 21:50
@stefanbuck
Copy link
Member Author

Before this PR is turning into a huge monster, I'm going to merge it into a v5 branch. As far as I can tell everything works as expected. Will do some more testing later this week.

@stefanbuck stefanbuck merged commit e1fcfe1 into OctoLinker:v5 Mar 11, 2019
@stefanbuck stefanbuck deleted the 277-real-links branch March 11, 2019 21:18
stefanbuck added a commit that referenced this pull request Mar 16, 2019
* 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
stefanbuck added a commit that referenced this pull request Jun 1, 2019
* 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
stefanbuck pushed a commit that referenced this pull request Jun 1, 2019
* 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

* Remove not longer needed new tab background job

* Rerun octolinker after progressive-container has loaded

* Invoke OctoLinker when expanding a diff view

* Rearrange options page

* Update API url

* Fix blob selector for gists

* Perform GET request to leverage the browser cache

* Fix blob-reader units tests after refactoring

* Fix snippets parsing

* readme update

* Add demo build step

* Add highlight option via url hash

* Optimize highlighting for retina

* Update description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants