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

Add subcommand to submit solution #38

Open
nindalf opened this issue Dec 7, 2019 · 3 comments
Open

Add subcommand to submit solution #38

nindalf opened this issue Dec 7, 2019 · 3 comments

Comments

@nindalf
Copy link

nindalf commented Dec 7, 2019

I think this would be helpful to add. @gobanos , what do you think?

@gobanos
Copy link
Owner

gobanos commented Dec 9, 2019

Should be quite easy to implement, and we already open a browser tab for criterion results, so it should be possible to open the puzzle page after submission.

@nindalf
Copy link
Author

nindalf commented Dec 10, 2019

I think that might not even be necessary. When I tried to implement this, I figured it would be easier to store the result of cargo aoc in a file, and submit that value in a POST. We'd then parse the returned HTML to let the user if they got it right or not.

        let post_data = format!{"{{\"answer\": {}, \"level\": {}}}", solution, part.as_u8()};

        let mut response = client
            .post(&date.submit_url()) //  "https://adventofcode.com/{}/day/{}/answer",
            .body(post_data)
            .header(COOKIE, formated_token)
            .send()?;

I noticed the repo is undergoing some refactoring. Is that complete?

@nindalf
Copy link
Author

nindalf commented Dec 11, 2019

Sorry if the previous comments weren't clear about this - I'm happy to implement this feature.

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

No branches or pull requests

2 participants