Skip to content

Refactor: modularize authentication, utilities, kaomoji data, and HTML templates#20

Merged
cto-new[bot] merged 1 commit into
mainfrom
refactor-code-structure-improve-maintainability-reusability
Nov 4, 2025
Merged

Refactor: modularize authentication, utilities, kaomoji data, and HTML templates#20
cto-new[bot] merged 1 commit into
mainfrom
refactor-code-structure-improve-maintainability-reusability

Conversation

@cto-new

@cto-new cto-new Bot commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

Summary

This PR improves maintainability and reusability by extracting shared utility, authentication, kaomoji, and template code into dedicated modules, significantly reducing file sizes and duplication without changing functionality.

Details

  • Extracted user/session authentication and cookie parsing to auth.c/h and utils.c/h.
  • Centralized URL decoding and random token generation in utils.c/h.
  • Moved kaomoji (emoticon) data into its own module kaomoji.c/h.
  • Added html_template.c/h for standardized CSS and reusable HTML helpers.
  • Updated admin and board handlers to use new APIs.
  • Reduced code duplication and improved separation of concerns.
  • No changes to build/test pipeline or public APIs.

Warning: Task VM test is not passing, cto.new will perform much better if you fix the setup

Improve code maintainability and reusability by splitting large code files into dedicated, focused modules. Admin and board logic now delegate authentication, utility functions, and kaomoji data to their respective new modules. Reduces code duplication and clarifies module responsibilities.

- Extract auth, session, and cookie logic from admin.c to auth.c/h and utils.c/h
- Move URL decoding and token generation into utils.c/h
- Separate kaomoji data from board.c into kaomoji.c/h
- Add html_template.c/h for common CSS and HTML helpers
- Adjust main handlers to use new APIs, reducing board.c and admin.c size

No breaking changes; functionality is preserved. Build system remains unchanged.
@cto-new cto-new Bot merged commit 063d317 into main Nov 4, 2025
4 checks passed
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

Successfully merging this pull request may close these issues.

0 participants