CnGal 资料站

repository·master·Indexed 41 days ago

https://github.com/cngal/cngalwebsite

A comprehensive, wiki-style information repository for Chinese Galgame/AVG content. Built with .NET 7.0, ASP.NET Core Web API, and Blazor, it features a structured database for games, characters, and staff, an open API for third-party integration, and an authentication center based on IdentityServer4.

Tokens
39.1K
Snippets
91
Records
184
Agent score
99%

What's inside CnGal

  1. Overview of Admin Page Migration (New Site vs Old Site)

    master

    This document tracks the migration of administrator pages from the old site architecture to the new site architecture.

    • New Site Path: CnGalWebSite.MainSite.Shared\Pages\Admin\
    • Old Site Path: CnGalWebSite.Shared\Pages\Normal\Admin\

    Most administrative functionalities have been successfully migrated to the new site, with some pages being split into multiple components (e.g., ManageHome.razor is now AdminCarouselsPage.razor and AdminFriendLinksPage.razor).

  2. Overview of CnGal 资料站

    master
    CnGal 资料站 is a non-profit platform dedicated to collecting and organizing information about Chinese Galgame/AVG content, including introductions, walkthroughs, reviews, and impressions. It serves as a wiki-style repository for games, developers, characters, and staff, facilitating community participation through open editing and an open API.
  3. Overview of CnGal Documentation Site

    master
    CnGal Documentation Site (CnGal资料站) is a platform dedicated to preserving and showcasing the works of CnGal creators. The project aims to ensure that every creator's work is remembered and accessible. It features internationalization support (English and Simplified Chinese), a structured content directory, and a dedicated architecture for managing documentation and community contributions.
  4. Review enhanced features in the new Admin Site

    master

    The new administration site (MainSite.Shared) introduces several improvements over the legacy Shared site:

    • Real-time Monitoring: The Admin Home (AdminIndexPage) features automatic data refreshing at 1-second intervals for server monitoring.
    • Advanced Data Visualization: The Data Overview (AdminDataPage) includes a time range selector for chart data.
    • Improved Visual Cues: Dynamic management pages use color-coded markers for different source types (e.g., Weibo, Bilibili, Xiaoheihe).
    • Modular Structure: Features like Carousels and Friendly Links have been split into independent management pages for better organization.
    • Modern Tech Stack:
      • Built using a unified design system with components like CgDataTable, CgModal, and CgButton.
      • Uses InteractiveServer rendering mode for all admin pages, replacing the legacy WASM approach.
  5. Navigate the API project structure

    master

    The API project follows an MVC architecture and is data-driven. Key directories and files include:

    • Application/: Contains common methods for various modules (e.g., BackUpArchiveService for the Internet Archive backup module).
    • Controller/: Contains the controllers that expose the outermost interfaces to users.
    • IRepository: Defines data repository interfaces (e.g., IRepository<Entry> for entry operations).
    • AppDbContext: The database context.
    • appsettings.json: The project configuration file.
  6. Manage Peripherals (周边)

    master

    Peripherals are used to track items related to entries.

    • Requirement: A peripheral must be associated with an entry to allow lookup.
    • Display: Peripherals associated with the same entry are displayed as a collection.
    • Collection Tracking: Users can record their collection status for a peripheral, and progress is tracked on a per-collection basis.
  7. Understand the data model retrieval workflow

    master

    When retrieving data for an entry (词条), the system follows a specific sequence of operations to ensure data integrity, user-specific pending edits, and engagement tracking. The workflow is as follows:

    1. Identify the Entry: Retrieve the unique Id.
    2. Fetch Original Data: Locate and load the original source data for the corresponding entry.
    3. Check User Authentication: Determine if the user is logged in.
    4. Retrieve Pending Edits: If logged in, fetch any pending audit requests (待审核请求) that the user has submitted for this specific entry.
    5. Load Pending Requests: Load the content of those pending requests.
    6. Process Data Segments: Process the data sequentially across six defined parts.
    7. Determine Edit Status: Evaluate the editing state (编辑状态) for each of the six parts.
    8. Track Engagement: Increment the view/read count (阅读次数) for the entry.
  8. Understand the new Account authentication flow

    master

    The authentication process has been refactored. The old client-side RemoteAuthenticatorView used in Normal\Account\Authentication.razor is no longer required in the new site architecture.

    Instead, the new site uses server-side OIDC via MapMainSiteAuthenticationEndpoints. Authentication (login, registration, callbacks, etc.) is now handled by the server rather than a dedicated client-side Blazor page.

  9. Manage Articles and Comments

    master

    Article Management (AdminArticlesPage)

    Uses CgDataTable to manage articles. Supports:

    • Pagination, searching, and sorting.
    • Adjusting weight (priority).
    • Toggling visibility (hidden/shown).
    • Enabling/disabling comment boards.

    Comment Management (AdminCommentsPage)

    Manages user comments. Supports:

    • Adjusting priority via EditPriority.
    • Toggling visibility via ToggleHidden.
    • Note: Target object names and user links are currently displayed as plain text without clickable links in the new site.
  10. Understand the CnGal technical architecture

    master

    The project is built using the following technology stack:

    Website

    • Backend: ASP .NET Core Web API
    • Frontend: ASP .NET Core Blazor
    • UI Libraries: Masa Blazor, BlazorBootstrap
    • Database: MySQL 8.0
    • ORM: Entity Framework Core 7.0
    • SDK: .NET 7.0

    Authentication Center

    • Architecture: ASP.NET Core MVC based on IdentityServer4

    Kanban Girl (Robot)

  11. Component Design and Directory Structure

    master

    When building new features, follow this directory structure to maintain the design system:

    • Pages/: Page components responsible for structure and data orchestration.
    • Components/Features/: Business components that encapsulate specific functional views.
    • Components/DesignSystem/: Low-level, reusable base components (buttons, inputs, etc.) that form the core UI library.
    • Components/Layout/ or Layout/: Global shell and navigation components.