A Chrome extension that polls a local HTTP server on port 4578 for CPH (Competitive Programming Helper) tool requests and automatically submits code to AtCoder.
- Polls
http://localhost:4578/submitevery second for submission tasks. - Parses problem ID (e.g.,
abc123a) and generates AtCoder URLs. - Opens the AtCoder submission page, fills in the code, and clicks submit.
- Stores submission history in Chrome storage.
- Popup displays history with links to problem and results.
- Clone or download this repository.
- Open Chrome and go to
chrome://extensions/. - Enable Developer mode (toggle in top-right).
- Click Load unpacked and select the folder containing this extension (the folder with
manifest.json). - The extension should appear with icon "CPH Auto Submitter".
You need a local HTTP server running on port 4578 that provides submission tasks. For testing, you can use the provided server.js:
node server.jsThis server will respond to GET http://localhost:4578/submit with a sample submission task.
After loading the extension, its background script will automatically start polling the local server every second. You should see console logs (inspect background page) confirming "Starting polling to http://localhost:4578/submit".
When the local server returns a valid task (JSON with problem, code, and optional language), the extension will:
- Open a new tab with the AtCoder submission page.
- Inject the code into the editor.
- Click the submit button.
- Store the submission in history.
Click the extension icon to open the popup, which shows a list of past submissions with links to the problem and results.
- Polling endpoint: Currently fixed at
http://localhost:4578/submit(can be changed inbackground.js). - Polling interval: 1 second (adjustable in
background.js). - Language mapping: Not yet implemented; defaults to C++ (GCC 9.2.1). To change, modify
content.jssetLanguagefunction. - Options page: Access via right-click extension icon → Options (basic port setting).
.
├── manifest.json
├── background.js # HTTP polling and submission handling
├── content.js # DOM automation on AtCoder submit page
├── popup/
│ ├── popup.html
│ ├── popup.js
│ └── popup.css
├── icons/
│ ├── icon16.png
│ ├── icon48.png
│ └── icon128.png
├── options/ # Options page (basic)
│ ├── options.html
│ └── options.js
├── plan.md # Design plan
├── todo.md # Implementation todo list
├── server.js # Test local server
├── test.js # Legacy test script (TCP)
└── README.md
To verify the extension's polling behavior, you can run the provided test local server:
node server.jsThen load the extension and inspect the background page logs. The extension should poll http://localhost:4578/submit every second and, upon receiving a task, automatically open AtCoder and submit.
For a quick integration test, you can also modify server.js to return custom tasks.
- Inspect background page: go to
chrome://extensions/, find the extension, click "service worker" link. - Inspect popup: right-click the extension icon, select "Inspect popup".
- Inspect content script: open AtCoder submit page, open DevTools, look for console logs.
- AtCoder page structure may change, breaking the code editor selector.
- Requires user to be logged into AtCoder; otherwise submission fails.
- Only supports ABC problem format (
abc123a). Can be extended to ARC/AGC. - Language mapping is hardcoded; future version should allow configuration.
- Polling may cause unnecessary network traffic if local server is not running.
- The extension requires a local HTTP server running on port 4578; if not present, polling will fail silently.
- Support for multiple contest types (ARC, AGC, etc.)
- Configurable language mapping via options page.
- Submission result polling and notification.
- Better error handling and retry logic.
- Support for other competitive programming platforms (Codeforces, etc.)
MIT