Comments (7)
This is a great find! From my testing, it looks like this API doesn't return two things:
- Submodules
- Folders
(Folders can be built from paths, except empty folders.)
This is very unfortunate as it looks very promising. Basically it requires us to trade between the robustness of Octotree (i.e. present everything and anything) and usability (no longer require access tokens for private repos or users who surf 60+ repos an hour). Really tough choice.
(Now, the fact that this is not a documented API is another issue. But that is solvable by coding to fallback to the current documented API.)
Love to hear everybody's thought.
from octotree.
One option, though a bit complex, would be to use the documented API, but fall back to this tree-list endpoint if the documented API returns an auth error. Then perhaps also leave the token option in place for more "advanced" users who want empty folders and submodules to work.
from octotree.
"(Folders can be built from paths, except empty folders.)"
I thought folders can't be empty in Git?
from octotree.
You're right. That was a brain fart. So it reduces to handling submodules & dealing with undocumented API.
from octotree.
The more I think about it, the more I hesitate about using this API due to its being undocumented. When it's changed and assume we fall back to the current API, current matters (private repos, rate limit) come into the picture again. But if we don't fallback, on a beautiful day all, users will see some error message instead of the code tree.
Reversing the API invocation order as suggested by @sullivanmatt doesn't appear to be a good option either. Assume a user runs out of rate limit, the code switch to tree-list
; switch till when? (Obviously it should not make double requests every time.) Besides, if it's a private repo, it will do double request every time because it doesn't know before hand if a repo is private. Even then, if the tree-list API is changed, we need tokens. Back to square one.
Therefore, while I really like the idea of not having to require token, I think unless this API will become part of the official GitHub API, we should not adopt it in Octotree.
from octotree.
If the user were to run out of API quota and the code has to "switch over", I think double requests is a good trade-off, actually. The likelihood of a user expiring their public quota is pretty low, and the double-requests is a small price to pay for a seamless transition (in my opinion). You (rightly) mentioned that this would still cause a double-request for private repos - but in my testing that additional request would only add < 300-500ms of latency, which most users would barely notice.
The undocumented API isn't ideal, but again, if it ever moves or changes substantially, you can easily fall back to the documented API.
You mentioned the possible case where you could end up "back to square one", which you are right about, but back to square one is a huge edge case (while using private repo, undocumented API changes / moves, falls back to documented API, requires OAuth token). And sure, that could be annoying - but right now that annoyance of having to token is already happening. The net effect is almost certainly overwhelmingly positive, and at absolute worst, the user is no better or worse off if it all fails.
I understand your hesitation about not wanting to use an undocumented API, and I respect whatever decision you end up making. Thanks for taking the time to look into it!
from octotree.
Hi, thanks for the input.
The additional 300-500ms latency isn't good enough for me as a trade-off. Plus, it's just the average case scenario, the software might feel sluggish in worse case. Also, the "documented API -> undocumented API -> documented API + token" approach doesn't appeal to me at all, there should be a better way. Finally, falling back is easy, but detecting when/if API changes at runtime can be an ordeal.
I want robustness and high performance (not worse than currently) while not introducing much complexity to the code (~ future bugs).
Anyway, I think there are a few things I can try to utilize this API. I will keep everyone posted.
from octotree.
Related Issues (20)
- Not getting my pro features HOT 2
- Feature request: search files with regex HOT 2
- Bug: `view PRs` not loading PRs HOT 1
- Body pushed too far right with new code view HOT 12
- OctoTree doesn't work at all HOT 3
- Feature request: green checkmarks on folders in PR mode HOT 2
- Bug: Vertical scrollbar in code blocks HOT 2
- [Bug] File tree overlapping with GitHub FeaturePreview 'Global navigation update' side bar HOT 3
- Octotree font change options makes text copying very difficult HOT 16
- bookmark icon not showing next to repo name HOT 2
- Create file in any directory with octotree
- [CHORE] Document Required GitHub Personal Access Token Scopes HOT 2
- Cancel subscription HOT 2
- Keep getting logged out HOT 9
- Repository header pushed too far to the right when the sidebar is pinned HOT 4
- I see two file trees. one of github and one of octotree HOT 1
- [Bug] File tree displaying as "deleted branch" or "no access" when branch is not deleted and has access HOT 8
- File explore panel is overlapping content in View full mode HOT 3
- Url sing- box
- Compatibility issues with v7.11.0 and Edge browser HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from octotree.