This commit refactors the archive cleanup functionality to be more robust and general.
The previous implementation relied on directory names to identify old archives. This new implementation crawls the directory tree and removes files based on their modification time. It then does a second pass to remove any empty directories.
This approach is more resilient to changes in the directory structure and accurately reflects the user's intent to clean up old files based on their age.
Renamed the generic HTMLTemplateData struct to OverviewTemplateData
to better reflect its purpose as the data model for the digest overview.
This improves clarity and consistency with GroupedEntriesTemplateData.
Updated all references across the codebase, including:
- internal/app/services/*
- internal/archive/archive.go
- internal/digest/digest.go
- internal/email/email.go
- internal/email/email_test.go
- internal/models/models.go
- internal/processor/processor.go
- internal/templates/templates.go
- internal/templates/templates_test.go
- internal/testutil/mocks.go
- scripts/preview/main.go
This commit updates the scripts/preview/main.go to use the ArchiveService to generate the overview and grouped entry HTML files.
- Removed the generateHTML and writeHTMLToFile functions.
- Called application.ArchiveService.MakeArchiveHTML to generate the HTML files.
- Updated the email sending logic to use the files returned by MakeArchiveHTML.
This commit implements the email functionality for the overview digest and grouped entries.
- Modified internal/email/email.go to send one email with the Overview Digest as the body and attach all Group Digest HTML files.
- Updated internal/app/interfaces.go and internal/testutil/mocks.go to reflect the changes in the Send function signature.
- Updated cmd/miniflux-digest/main.go and internal/processor/processor.go to reflect the changes in the Send function signature and to pass the data to the Send function.
This commit implements the HTML generation for the overview digest and grouped entries.
- Renamed internal/templates/entries.gohtml to internal/templates/grouped-entries.gohtml.
- Created internal/templates/overview.gohtml.
- Made getHTML function in internal/archive/archive.go reusable.
- Modified internal/archive/archive.go to create daily archive directories and render HTML files for both the overview and grouped entries.
This commit refactors the getHTML function in internal/archive/archive.go to accept an html/template.Template as an argument. This makes the function reusable for different HTML templates, such as the overview digest and grouped entries.
This commit updates the MockDigestService in internal/testutil/mocks.go to reflect the change in the BuildDigestData signature, which now includes the sortBy parameter. This ensures consistency between the mock and the actual interface, and allows for proper testing of the sorting functionality.
This commit refactors the code to break a circular dependency between the `digest` and `llm` packages.
The `digest` package was responsible for both creating the LLM prompt and parsing the response, while also depending on the `llm` package to make the actual API call. This created a tight coupling between the two packages.
This commit introduces a new `DigestLLMService` in the `digest` package, which is responsible for all LLM-related logic within the digest context. The `llm` package now provides a more generic `LLMService` that is only responsible for making the API call.
This change improves the separation of concerns and makes the code more modular and easier to maintain.
Refactors data fetching, grouping, and initial processing for the new overview digest.
Updates configuration, main application loop, and preview script.
Adjusts related tests for compatibility.