Recently I looked through the OJ system I built for my graduation project again. I feel there is still a lot worth improving, and given the data from 2016 to the present, leaving it idle would be a waste. So I thought I’d see whether I can reorganize it again:
Logically, after all these years, my skills should have improved somewhat.
Domain enabled: Home - DidaOJ
20250615: Subsequent update plans and other information will be maintained preferentially on the site; this article is for backup only.
Plan Overview
TODO Record
- Problems
- Problem list
- Problem details
- Basic functionality
- Custom problem statements
- Problem sets, similar to tags
- Problem recommendations
- Problem-setting workflow
- Edit problems, upload judge data to R2 storage
- More judge types, including Virtual Judge
- Multiple-choice, regular fill-in-the-blank, and code fill-in-the-blank questions, etc.
- Judging
- Judging list
- Online testing? It would consume noticeable server resources; see whether it can be supported.
- Change the code button on the judging list page to a modal popup.
- Ignore one trailing newline
- Generate rule.yaml when uploading judge data
- Special judge
- Determine the result based on the program’s ret
- 0 - AC
- 1 - WA
- 2 - PE
- other - RE
- Determine the result based on the program’s ret
- Some problem data needs to be organized
- 276 is missing the out file
- Hide the contest judging ID when entering it directly
- Hide the problem ID when displaying contest judging
- Ranking
- Overall ranking
- Daily ranking
- Rank ranking
- Discussion
- Merge functions from the original blog
- Support bookmarking blog posts
- Support custom Markdown syntax, such as displaying problem tags1
- Users
- Login
- Registration
- Permission management
- Permission items
- Roles
- Assign roles to specific users on the admin page
- User activity
- Recent submissions
- Recent posts and replies
- No protection considered for submissions; privacy protection for posts?
- Space status updates
- Consider necessity; is it redundant with the posting feature?
- Custom space styles
- Consider necessity; user participation may not be high
- Check-in
- Automatic check-in on daily login?
- Points system
- Redeem points for some rewards? Problem data?
- Contests
- Contest list
- Upcoming contests
- The public source is no longer available; scrape well-known OJs to generate data
- Contest management
- Everyone can create contests
- Problems can be uploaded in the background, distributed, and cached
- After successful distribution, the CDN version can be viewed on the page
- Enter a password to view
- Contest editing
- Manage problems
- Write custom problem statements for problems
- Set access rules
- Public
- Private
- Show in list / hide from list
- Set password
- Whether registration is allowed
- Set deadline
- Anti-cheating
- Plagiarism check
- Additional client
- Restrict access to client only
- Mobile app lock
- Camera photo capture
- Screen monitoring
- IP identification
- Need to verify the egress IP
- Consider deploying an anti-cheating verification server in the school computer room?
- Detect whether pasted content contains keywords when pasting into the input box
- System
- Status
- Read update information from the R2 or Cloudflare database interface
- About
- Read post information or redirect directly?
- Status
- Tools
- Code pool
- Miscellaneous
- Display effects
-
Component margin optimization -
Option to not load background images -
live2D component
-
- Add distributed locks for edits that involve R2 storage operations
- Display effects
Architecture
Make the most of Cloudflare resources and analyze performance bottlenecks. Daily load is not a major issue; spikes occur during large contests.
- View problems
- Auto-generate offline? Proxy?
- Use with Hugo? Password verification?
- Submit code
- Judging
- Introduce a task center for judge task distribution
Frontend
Developed with the Vue 3 framework, using TDesign as the base UI component library.
Backend
Developed with Golang, using MongoDB as the database.
Judge Machine Security
The judge machine sandbox directly uses go-judge; only a scheduler needs to be built.
Go Judge Documentation
How does an Online Judge solve security issues on the judging side? - Zhihu
Judge Data Distribution
Judge data is stored using Cloudflare R2 storage, and the judge machine pulls data from R2 during judging.
Each problem’s judge data has an MD5 hash stored in the problem attributes; when the judge machine finds that it does not match the local data, it pulls the judge data again.
If it still does not match after downloading, it sleeps and retries.
When uploading files in the background, they are first stored in a web-side folder; after the user clicks save, the MD5 is calculated and the files are uploaded to R2.
Consider supporting automatic extraction of uploaded archives.
Judge Machine Environment
| |
g++ –version Python 3.11 Java 1.17 golang 1.19
Old Data Migration
Write a migration program that reads data from the old database, organizes it, and writes it into the new MongoDB database.
- HPUOJ · 1.0 - [ ~ 2016.10 ]
- The data is still unaccounted for and cannot be recovered for now; see if anyone has any clues.
- It seems at least some problems can be manually recovered from the blog
- HPUOJ · 2.0 - [ 2015.09 ~ 2018.12 ]
- All OJ data was imported into CodeOJ 1.0; user passwords cannot be recovered due to the rules, so we can try to provide a migration page.
- Try to import Vjudge data into DidaOJ
- CodeOJ · 1.0 - [ 2019.01 ~ present ]
- Data is relatively controllable and supports perfect migration
- hpuoj.com
- Data is relatively controllable and supports perfect migration
- Migrate problem data
- Use CodeOJ data as the standard
- Re-import judge data through the system
- Migrate users
- Use jol data as the standard
- Supplement with data unique to codeoj
- Migrate contest records
- Merge jol and vhoj data
- Sort by time
- Migrate judging records
- Merge jol, codeoj, and vhoj data
- Sort by time
- Migrate discussion area
- Merge jol and codeoj data
- Sort by time
- Migrate other data
- Mainly manual editing
Update Plan
The following is mainly kept as an archive of the old plan.
Feature-related
- Registration system
- Teaching and editorial system2
- User signature display3
- OJ system information display
- Form system4
- Voting system5
- Tools (drafts, drawing board, …)
The following was completed before public beta and is archived for reference
Note This task has been recorded since May 23,
- Tests for various judging results
- Task-based judging
- Remove HTTP-based database connections
- SPJ refactor
- Preview image layer order
Changelog
This log has been recorded since April 19, 2019.
20250527
- Core OJ features are basically complete; continue improving details
20250516
- User system completed
20250505
- Improve C/C++/Java/Python judging logic
- Improve user login and logout operations
20250501
- Improve problem details page
20250530
- Improve system-related documentation
20250429
- Improve user system
20250428
- Improve database migration logic
- Improve basic judge machine logic
20250427
- Improve the website editor and problem details page
20250426
- OJ restart project initiated
- Initialize the website’s basic framework and problem list page
20190817
- Add background image display
- Fix news permission display bug on the news editing page
- Open-source frontend code
- Fix MIIT filing link
- Fix static proxy link
- Optimize display of friend links on the homepage
- Fix bug where replies could not be edited
20190621
- Fix friend link style bug on Apple devices
20190620
- Add friend links to the homepage
- Optimize homepage ring style
- Fix bug where user space data did not reload when switching users
20190619
- Display problem source for problems
- Fix date bug on Apple systems
- Display submission statistics on the space page
20190618
- Support view count statistics for blog posts
- Add Code Pool feature
20190617
- Fix error where overly long blog posts caused editing to fail
20190616
- CodeOJ enters public beta
20190526
- Judging completed
20190514
- Test judging
20190513
- Optimize status page
- Add user signature information
- Multiple judging methods
20190512
- Status page
- Submit code
20190510~20190511
- Judging code
20190509
- Fix bug where the title of a new blog post could be set to empty
- New problem feature
- Fix errors when hint and other fields are empty
20190508
- Improve problem management
- Submission status page
- Fix search bug
20190508
- Problem management
- Problem editing
- Add problem
20190507
- Initial design of judging system
- Problem list page design
20190502~20190506
- Design judging system
- Write related reports
20190501
- Run programs in Docker
20190430
- Image upload feature
- Message push
- Docker technology
20190429
- Optimize news permissions
- Fix time bug
20190428
- Improve adding blog posts
- Improve blog filtering
- News management
20190427
- Organize reports
- Add article options
20190426
- Organize system information
- Detail adjustments
20190425
- Improve email system
- Improve homepage carousel settings
- List filtering feature
- Fix system bug
20190424
- Improve forgot password feature
- Switch email service to Tencent Exmail
- Email sending system pending observation
20190423
- Registration feature
- Forgot password page
- Fix bug
20190422
- Admin page – Homepage carousel settings page – Support switching ports on the admin page
20190421
- Admin page – User information editing – User email verification – Blog management page
- Dynamic port switching
20190420
- Add private article option; add token check when fetching articles
- User information page
- Admin backend menu
20190419
- Improve permission system
- Organize and fix systemic issues
- Add error page
- Improve blog system; add article editing page
- Deploy project to server
Before
- Design architecture
- Frontend pages with Vue
- Backend framework PhalApi
- Write homepage, problem list page, problem page, and blog page
Before That
- Research advanced experience from other OJs