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

Removing the github redirect entirely #88

Open
SteakFisher opened this issue Oct 4, 2023 · 8 comments
Open

Removing the github redirect entirely #88

SteakFisher opened this issue Oct 4, 2023 · 8 comments
Assignees
Labels
contribute-a-thon Issues for contribute-a-thon hacktoberfest

Comments

@SteakFisher
Copy link
Contributor

Thought it'd be pretty clean if we could display the code on the same site, without ever having to jump from one website to another, so the code gets displayed (along with syntax highlighting ofc) on the same website
I'd also like to be assigned to the issue (contribut-a-thon)
image

@AniModi
Copy link
Member

AniModi commented Oct 6, 2023

It looks good. You can also consider adding a button in the top right corner of the code block to make it easier to copy the code. Additionally, if you are able to include all languages on the same page, that would be great. (I have attached an example from GFG for reference).
image

@AniModi AniModi added hacktoberfest contribute-a-thon Issues for contribute-a-thon labels Oct 6, 2023
@aryanargupta
Copy link
Member

Any Updates on this @SteakFisher?

@SteakFisher
Copy link
Contributor Author

@aryanargupta I've got the base fetching of code and syntax highlighting down
The copy code button suggested by Anirudhh sir has also been completed
currently working on the different tabs to switch between code blocks
the page looks AWFUL, but I hate CSS, so someone else may have to pick that up, but I'll have the base feature ready in a couple days

@aryanargupta
Copy link
Member

@aryanargupta I've got the base fetching of code and syntax highlighting down
The copy code button suggested by Anirudhh sir has also been completed
currently working on the different tabs to switch between code blocks
the page looks AWFUL, but I hate CSS, so someone else may have to pick that up, but I'll have the base feature ready in a couple days

Cool. Ping any of me or @AniModi in case you face any issues, or if you are done with the task.

@SteakFisher
Copy link
Contributor Author

@aryanargupta @AniModi So upon working on the features Anirudhh sir suggested for a while more I realized a couple problems,
If we were to implement the feature of having a tab at the top to switch between the languages, to ensure a seemless experience we'd need to fetch all the code from github at initial page load. (Most of those languages would be reduntant).
The problem with that is, we are currently making unauthorized fetch requests to the github api, which limits the amount of calls we can make to 60 per hour per IP.
Upon implementation fetching each files contents turns into an individual fetch request, so assuming 5 languages on average per algorithm, we're possibly limiting the website to about 12 redirects/reloads (as requests aren't cached) per user.
Since we aren't working with NextJs or Remix, any sort of server side work, or PROPER caching (although client side maybe a bandage to the issue) becomes a PHD paper on it's own, so the alternative solution becomes implementing an OAuth flow which increases requests to 5000.
But of course that is both a pain to implement and unnecessary hassle for the user.
So do I send a PR for what I've worked on so far, and we'll continue the discussion of the rate limiting issues after that..? Because I dont mind continuing to work on the repo for a couple more features.

@SteakFisher
Copy link
Contributor Author

@AniModi @aryanargupta bump

@aryanargupta
Copy link
Member

@aryanargupta @AniModi So upon working on the features Anirudhh sir suggested for a while more I realized a couple problems,
If we were to implement the feature of having a tab at the top to switch between the languages, to ensure a seemless experience we'd need to fetch all the code from github at initial page load. (Most of those languages would be reduntant).
The problem with that is, we are currently making unauthorized fetch requests to the github api, which limits the amount of calls we can make to 60 per hour per IP.
Upon implementation fetching each files contents turns into an individual fetch request, so assuming 5 languages on average per algorithm, we're possibly limiting the website to about 12 redirects/reloads (as requests aren't cached) per user.
Since we aren't working with NextJs or Remix, any sort of server side work, or PROPER caching (although client side maybe a bandage to the issue) becomes a PHD paper on it's own, so the alternative solution becomes implementing an OAuth flow which increases requests to 5000.
But of course that is both a pain to implement and unnecessary hassle for the user.
So do I send a PR for what I've worked on so far, and we'll continue the discussion of the rate limiting issues after that..? Because I dont mind continuing to work on the repo for a couple more features.

See afaik, there are certain more methods to implement this. But idk if you would be comfortable doing that. You can set up a virtual environment on a web server and clone the repository there, and then render the codebase as per your wish.

But that would require an expertise in tools like docker and Jenkins (for CI/CD), and it's not the case that I expect that you will actually implement it, but if you think you can without error integrate everything properly, then you can take up that task (No hard deadline for this task).

My suggestion would be to currently avoid taking up tasks like this solo as of now. Because this may pose the risk of completely making the website non-functional due to limitations of free hosting platforms.

In any case, we don't prefer to use the GitHub api to fetch code and then render it. Either find some alternative like the one I mentioned above, or else drop any such features that require you to make api calls to GitHub.

If you still wish to implement the previously mentioned features, ping us anytime you face any issues or if you want to step back from the task.

@SteakFisher
Copy link
Contributor Author

Ight.. my current solution fits within the rate limits so I'll open a PR for it.. feel free to reject it
Ik how to work with docker containers, but I really don't wanna take the migration upon myself.. so I'll leave it as it is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribute-a-thon Issues for contribute-a-thon hacktoberfest
Projects
None yet
Development

No branches or pull requests

3 participants