the-codingsloth / haha-funny-leetcode-extension Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
It seems that sometimes when you update the problem set, it's not being updated in storage. To me it might be that if the user selects too fast, there's not enough time to make the changes.
As the title states for easier usage, also i think the extension itself should have a toggle to turn off or on. Idk if soemone else stated this though!
need a way to filter out premium problems for people who don't have LeetCode premium
The timeout in the onMessageReceived function in backjground.js introduces a race condition if the user hits submit more than once within 30 seconds:
case 'userClickedSubmit':
userJustSubmitted = true;
setTimeout(() => {
userJustSubmitted = false;
}, 30000); // Reset after 30 seconds
break;
I can fix it
If you install the extension and haven't solved your leetcode problem, but already had other tabs open. You cannot do anything in those other tabs, so can't submit a form, can't click a button (anything that executes a request). Not sure if we should keep it or not lol
Yeah kinda forgot to add this, it shouldn't take too long
Modify this function to take into account the user's already solved problem (not sure based on solved extension problems or leetcode submissions)
From then make a randomize system to lower the chance to get the same problem.
Edge case:
If by some miracle they get the same problem they solved yesterday, change the problem (might need to have a previousProblem in the storage for this, just to make it easy)
If you guys have any other suggestions/ideas put a comment here
What if we add a feature that enables users to add websites that are absolutely essential to them(like a school website) and prevent redirecting if there's a URL match
let the user decide what problem category they'd like to work on like arrays, strings, linked lists, graphs, etc
I am using the new leetcode dynamic UI. (https://leetcode.com/discuss/feedback/4041069/Feedback%3A-Dynamic-Layout-is-technically-impressive-but-poor-design-and-UX.)
And now when I solve the leetcode gulag extension problem of the day the extension does not let me browse the internet.
Browser: Brave browser
Edit: I tried the extension again and I don't think the bug is related to the new Leetcode UX.
Add a streak feature, which every we keep track of the consecutive days a user solves a leetcode problem.
example: User solves a problem for a whole week, their streak is 7.
User solves a problem today, their streak starts at 1.
As this project is early in development, would it be worth migrating the logic into this browser extension framework called plasmo? It might be a big lift now but it could save a lot of time in the future.
Currently these tests pass when you run it individually, but if you run them together whether with jest or jest --runInBand the saveToJSON tests break (no clue why right now, probably doing some dumb mistake with the saving to file tests)
If I want to practice leetcode and go to neetcode.io or search leetcode myself the extension still redirects me to the solving page.
Make the extension look for leetcode-based searches using open-ais API.
https://platform.openai.com/docs/api-reference/introduction
For the Firefox version, in order to get the extension to work, users have to manually enable optional permissions (really annoying). It's not automatic like chrome. If anyone can figure out a way to make it automatic, it would essentially complete the Firefox version.
sometimes fetching a problem takes a bit, adding a loading screen would be helpful.
A few problems with the current system:
easy
problem and submit the solution.Saw a YouTube comment of this cool (painful) feature, where instead of users only having to solve 1 problem, they can decide how many problems they want to solve before being able to access websites again.
The redirect rule is executing based on if the url contains "leetcode.com", if it doesn't then it'll redirect.
The problem is if the user tries to login with a provider such as google, github, etc they get redirect to accounts.google.com, github.com, so they can't sign in since they get redirected.
Need to update the rule to allow certain login provider urls to allow users to log in properly.
There's no tests for the extension, which makes it annoying to check some features, here's some test's I've thought of so far:
Have a button either in the popup or in the leetcode website itself through the content script to allow users to "give up" which will give them access to websites like google (chatGPT? idk) and any other coding websites for help.
Still restrict them from websites like youtube, tiktok, twitter, facebook, instagram, etc. We're not that generous
Please I beg of you to learn proper scraping before you decide to use an entire fucking browser (via puppeteer/selenium) for a super simple task.
What you did is the equivalent of bringing a rocket launcher to a knife fight
Here is a simpler solution:
(instead of eval
ing you would want to replace !0
with true
and such, and use JSON.parse
)
Saw a comment on YouTube where someone's leetcode problem changed mid day lol.
Currently I have the leetcode problem to change every 24 hours but based on the moment you installed the extension, not based on if it hits midnight.
Also need it to support time zones based on the user's location.
Add some funny messages to the congratulationModal based on the programming language they used. You guys can come up with the messages.
Mainly just need to modify the checkIfUserSolvedProblem function to now use the data.lang to modify the message.
add a disable button for users (people who hate torture). This button should simply remove all listeners and redirect rules happening in background.ts. Only thing that should probably stay active is probably the alarms (not sure though)
I'd appreciate if anyone would add better error handling for some of these functions, since it seems that these errors end up being really broad sometimes. ex of error handling: Error generating problem, Error handling submission, Error updating storage, etc.
Add a feature to keep track of the problems the user has solved.
So it would show in the popup something along the lines of 30/75 problems solved if they're on blind75,
Would also be nice to also modify the content.js file to display a progress bar when they solve the problem giving them a signal that they're making progress.
Upon installing this project, for me it was easier to have the pnpm package installed with npm. It shouldn't really effect anything,
Because of a resource typo in the generateRandomLeetCodeProblem function it fails to fetch the app's resource in the background.js file and throws an exception.
To fetch "leetcode-problems/blind75Problems.json"
I just found out about leetcode's list
What's cool about this is we could make our own list and make it public!
We could then use the GraphQL API request to get those lists. We could even create a list based on Neetcode's problems and add that to our dropdown or create our own list and add it to the category; we could create a list of only problems with linked lists!
I think it's worth looking into if it works, I'm making a PR soon with the current public lists and one of mine. If it works on everyone else's end, this could solve a lot of problems
The extension is cool, but after I have completed the problem on my browser Opera GX, it is not marked as completed by the extension, so I will be stuck inside Leetcode forever despite having successfully tortured myself :0
Currently the extension only supports chrome. Would be nice if we could support FireFox and Edge.
By default right now, the extension is using the Blind 75 problem set since that JSON file is hard coded in.
Need to modify it to let users pick which problem sets they want.
Some things to think about:
Add an option to load the next problem to solve, according to NeetCode's roadmap rather than a random problem from the tree.
Check out NeetCode's video on creating the NeetCode website. He explains how solving problems at random isn't the best approach and he created a tree we could use to determine the problem to solve.
I think we can improve the readme file a bit more good So that the contributers have Completely understand this project.
PS: I would like to work on this issue :)
Modify web scraper to now include the category, difficulty and if the problem is premium for future features
The URL to the problem is correct here:
But the extension doesn't seem to be updated with the correct URL:
Please fix with an updated build :)
Was working on trying to get it to work on firefox, and have this issue:
async function setRedirectRule(newRedirectUrl: string) {
let newRedirectRule = {
id: RULE_ID,
priority: 1,
action: {
type: "redirect",
redirect: { url: newRedirectUrl }
},
condition: {
urlFilter: "*://*/*",
excludedInitiatorDomains: [
"leetcode.com",
"www.leetcode.com",
"developer.chrome.com"
],
resourceTypes: ["main_frame"]
}
}
try {
chrome.declarativeNetRequest.updateDynamicRules({
removeRuleIds: [RULE_ID],
addRules: [newRedirectRule]
})
const currentRules = await chrome.declarativeNetRequest.getDynamicRules()
console.log("Redirect rule updated")
console.log("Current rules:", currentRules)
} catch (error) {
console.error("Error updating redirect rule:", error)
}
}
For some reason the new rule gets updated in chrome, but not in firefox. When I console log currentRules it shows an empty array on firefox, when it should be showing the rule inside of the array. If anyone knows why or can fix this, that'd be awesome and you're better than me
Currently every time you switch difficulties you change the assigned problem. That's cheating the system of torture.
Original URL -->
Redirect to leetcode problem -->
When solution is correct bring pop up -->
Add a button that says continue browsing --> redirect back to original URL
Original URL can be kept in local storage.
I am trying to install the extension on firefox, when I do I get met with error
Warning details Reading manifest: Error processing content_security_policy.extension_pages: “script-src” directive contains a forbidden http: protocol source
I have found that in the manifest it is auto injecting
"content_security_policy": { "extension_pages": "script-src 'self' http://localhost;object-src 'self';" }
In version 3 of the manifest, you cannot refrence a remote script with script-src anymore, moreover it also does not allow http requests. I cannot find out why this is happening. I can only figure out that this is being injected on compile.
I discovered this while looking for the issues for #67
If you go to the compiled manifest in build/firefox and edit the manifest and CSP by removing the locahost injection is starts working. I do not know firefox well enough to figure this out right now.
It would be nice to be able to set which time websites get blocked at. That way if I'm doing something important early in the morning I'm not blocked off from that and only get restricted during my free time or something . It would be nice to have a "turn on at [time]" option that you can set.
Yeah I need someone to help get this extension to function correctly on firefox. I've been trying but I think i'm too dumb.
What I've seen so far:
To get this working on firefox do these steps:
Add modify the manifest part of package.json to this:
"manifest": {
"browser_specific_settings": {
"gecko": {
"id": "{743ff2c1-74c2-4384-a218-2c33d6a765a5}"
}
},
"permissions": [
"declarativeNetRequest",
"declarativeNetRequestFeedback",
"storage",
"tabs",
"activeTab",
"alarms",
"webRequest",
"declarativeNetRequestWithHostAccess"
],
"web_accessible_resources": [
{
"resources": [
"leetcode-problems/*"
],
"matches": [
"https://www.plasmo.com/*"
]
}
],
"host_permissions": [
"https://*/*"
]
}
In your firefox browser type in for the url: about:debugging
Click the "This Firefox" button
You'll see the temporary extension area.
Now in the code in your terminal run "pnpm run dev --target=firefox-mv3"
You'll see a build folder with a folder called "firefox-mv3-dev"
In your Firefox browser click "Load Temporary Add-on" and select any file from the firefox-mv3-dev
The extension should be applied.
From what I've seen so far, a lot of the issues here, like these
could be fixed by using an API instead of a web scraper. Leetcode has a public graphql endpoint but there is no official documentation on how to use it, however there are open source APIs that people have put together. I'm currently looking into a few different APIs to see if I can connect the extension directly to LC's data for problems and user submissions.
https://github.com/codingsnack/leetcode-api/
https://github.com/JacobLinCool/LeetCode-Query
Add a timer feature for user's to see how long it took them to solve a problem, and show them the recommend time to solve during an interview.
Timer depends on the problem:
Currently using JavaScript throughout this whole extension and that's some Junior Developer behavior. TypeScript support would help a lot and make this look more professional because we're all 10x developers here.
Here's a link for chrome type package to get started:
chrome type package
Create the functionality of letting users to pick out difficulty of leetcode problems, so in the extension they have the option to only select easy, medium, hard problems, and an any difficulty option.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.