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

Submissions and User auth #1

Open
tomlin7 opened this issue Dec 2, 2024 · 4 comments
Open

Submissions and User auth #1

tomlin7 opened this issue Dec 2, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@tomlin7
Copy link
Owner

tomlin7 commented Dec 2, 2024

Next plan is to include direct submission options within editor. For this authorization will be required. As of now there is no straight forward method to do this, so session cookies can be used.

@tomlin7 tomlin7 added the enhancement New feature or request label Dec 2, 2024
@adityakiran1423
Copy link

So for submissions, this is what I could think of :

  1. Once a user is done with their solution, they can submit it and the backend send it to AOC using selenium (reference). and the response could be rendered too (this can be done even if someone isn't logged in I guess)
  2. We make use of an API, check this out AOC APIs

Still not sure about how to handle auth, any ideas? I've never dealt with auth

@tomlin7
Copy link
Owner Author

tomlin7 commented Dec 3, 2024

@adityakiran1423 I have tried the Python package before. It provides the input for each day, also a clean interface for submissions. Auth is done using the session cookie obtained from browsers. Using Flask would be a good choice here, but that would make the entire app require having installed two different interpreters. Another benefit of using flask would be the support of python runtime as well.

  • We can fetch the input for the day selected by the user (and cache it for that session)
  • Use that for the execution of the solve() methods within the editor.
  • Then provide an interface to directly attempt submission of that function output.
  • If the answer is too high, block next submissions that are higher or same. and same for too low case.

I have no idea how we can fetch the part-2 content of a question though, that's not possible I guess.

further:

  • cache the inputs
  • throttle the requests

@adityakiran1423
Copy link

The python package doesn't provide provisions to fetch text for part 2?
I don't understand why the app requires having two different interpreters?

  1. That works I guess
  2. Could you please point the solve() function so that I can have a look at it?
  3. I'm guessing you mean adding a new button for direct submission and not just run and analyse
  4. I'm guessing this is the implementation for request throttling?

Can you elaborate how we can add support of python runtimes via flask and how we can extend runtime support for other langauges as well?

Maybe this is a very naive approach, however, whenever a user presses on Submit button to check if the answer is right, we can run a container in the backend for that language?

Nevermind, this is what I found for runtime support : multiple language runtime support

Or should it have only a python runtime?

@tomlin7
Copy link
Owner Author

tomlin7 commented Dec 3, 2024

@adityakiran1423 we can look into multiple runtimes at a later point. For now, we can implement the submission process and auth in this issue.

The python package doesn't provide fetch options for any puzzle content at all. Instead, it provides a plugin to optionally scrape the contents of the puzzle. So yeah, there is no option to fetch part 2 of any question.

There is no concept of solve() method yet, the JS runtime simply executes whatever code is in the editor and provides an output. Instead, like other online coding platforms, we can provide some boilerplate code, here's a basic working model:

function solve() {
  // write solution code here
  // return output as well
}

// sample test case runner
console.log(solve(input));

OR we can hide all the boilerplate surrounding the actual solution code and show only the solve method to user as well

  • It is possible to also scrape the sample tests cases easily
  • Upon submission action, the program will call solve with the complete input fetched from AoC servers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants