Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions boj/args_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ def add_submit_parser(subparsers):
type=int,
help="timeout for websocket",
)
submit_parser.add_argument(
"-f",
"--force",
action="store_true",
default=False,
help="mark as accepted forcefully",
)


def add_clean_parser(subparsers):
Expand Down Expand Up @@ -176,11 +183,7 @@ def add_case_parser(subparsers):
help="problem id",
)
case_parser.add_argument(
"-n",
"--new",
action="store_true",
default=False,
help="open a new testcase"
"-n", "--new", action="store_true", default=False, help="open a new testcase"
)
case_parser.add_argument(
"-e",
Expand Down
18 changes: 12 additions & 6 deletions boj/commands/submit/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,28 @@ def execute(self, args):
cwd = config.workspace.search_dir(args.problem_id)
boj_info = self.boj_info_repository.find(cwd, ".boj-info.json")

status.update("Reading source code..")
source_code = self.text_file_repository.find(
cwd=boj_info.metadata.dir,
query=boj_info.source_path(abs_=False),
)

if args.force:
boj_info.accepted = True
boj_info.checksum = self.text_file_repository.hash(source_code)
self.boj_info_repository.save(boj_info)
return

status.update("Authenticating..")
credential = self.credential_repository.find(cwd=constant.boj_cli_path())
main_page = HtmlResponse(http.get(BojMainPageRequest()))
session = Session(credential, main_page.cookies)

status.update("Reading source code..")
submit_page = HtmlResponse(
http.get(BojSubmitPageRequest(boj_info.id, session.session_cookies))
)
csrf_key = self.csrf_key_parser.find(submit_page.html)

source_code = self.text_file_repository.find(
cwd=boj_info.metadata.dir,
query=boj_info.source_path(abs_=False),
)

status.update("Submitting source code..")
session_cookies = session.session_cookies
data = make_submit_post_body(boj_info, csrf_key, source_code, args.open)
Expand Down