11 commits
feat(navigation): add TV link to Navbar and update TV page layout
Why: To enhance user navigation by providing quick access to the TV section, ensuring that users can easily find more content on the platform.
What:
How:
Navbar.tsx to include a new Link component for the "TV" section, ensuring proper styling and visibility across different screen sizes.tv.tsx to introduce a footer and restructure the content area, including changes to text color for improved contrast and legibility.pages/_document.js file and ensured that the main document structure is preserved in pages/_document.tsx with appropriate attributes.feat(controllers): refactor request handling and update imports
Why: The existing controllers were utilizing an outdated request and response model that did not align with the new structure of the application. This refactor improves the clarity and consistency of the codebase by aligning with the updated HttpRequest and HttpResponse classes.
What:
GetMagnetronTvDocumentsController, GetShowcasePendingDocumentsController, and UpdateShowcaseStatusController to import HttpRequest and HttpResponse from the correct path.executeImpl method in GetMagnetronTvDocumentsController to handle locale and revised error handling to be more general and flexible.UpdateShowcaseStatusController to maintain consistent data processing.How:
HttpRequest and HttpResponse while also making internal changes to accommodate the new request handling structure.GetMagnetronTvDocumentsController, added locale as a query parameter and adjusted the error handling mechanism to eliminate type casting and improve clarity.UpdateShowcaseStatusController enhances data integrity by ensuring the user information is properly formatted before being processed.This commit ensures that the controllers are more aligned with the evolving architecture of the application while improving maintainability and readability.
feat(sitemap): integrate TV documents into sitemap generation
Why: To enhance the SEO performance of our application, it's essential to include TV video URLs in the sitemap. This will improve discoverability and indexing of our video content by search engines.
What: The GenerateSitemapUseCase has been updated to fetch approved TV documents and include their URLs in the generated sitemap. This adds relevant dynamic content alongside static pages.
How: A new dependency on GetMagnetronTvDocumentsUseCase was introduced to retrieve up to 1000 approved TV documents. The execution of this use case collects video URLs, which are then formatted and appended to the sitemap XML structure. The updated URLs include the last modification date derived from the documents' metadata, ensuring freshness and relevance for search engines.
feat(seo): enhance metadata for better discoverability and sharing
Why: To improve search engine optimization (SEO) and enhance user engagement through social media sharing, it is crucial to have comprehensive and properly structured metadata on the video and TV pages.
What:
_document.tsx to accommodate locale-specific metadata in the HTML document structure.How:
tv.tsx include a more descriptive page title and a dynamic description that incorporates the total number of videos available.[...params].tsx), the metadata now includes dynamic titles and descriptions based on the document's properties, ensuring relevant and concise information is presented.dangerouslySetInnerHTML to inject structured data in JSON-LD format, which describes the video gallery and individual videos, improving indexing by search engines._document.tsx allows extraction of locale information from the URL, enabling better localization support for metadata across different regions.feat(admin): implement showcase status management and pending documents
Why: To enhance the admin interface for managing showcase statuses of documents, providing a way to review, approve, or reject documents that require showcase status updates.
What:
How:
BrowserApiClient to include methods for updating and fetching showcase statuses.GetShowcasePendingDocumentsController to handle the retrieval of documents with a pending showcase status.UpdateShowcaseStatusController to facilitate status updates.GetShowcasePendingDocumentsUseCase and UpdateShowcaseStatusUseCase that encapsulate the business logic.showcaseStatus field for MagnetronDocument and added migration scripts.This update allows administrators to effectively manage the showcase status workflow in the Magnetron application, improving content management efficiency.
feat(tv): implement video player page for Magnetron TV documents
Why: Users need a dedicated video player page to playback content directly from Magnetron TV documents. This feature enhances user experience by allowing seamless navigation to video playback.
What: Added a new dynamic route for video player pages, implementing logic to fetch and display individual video documents. Updated the Magnetron TV document listing to navigate to corresponding video player pages.
How:
pages/[locale]/tv/[...params].tsx which handles the video playback functionality, including error handling and loading states.pages/[locale]/tv.tsx to implement the handleCardClick function that utilizes the Next.js router for navigation to the video player page.GetMagnetronTvDocumentsUseCase to build a player URL based on the document ID and title, ensuring proper formats using base36 encoding.IMagnetronTvDocumentsRequest and IMagnetronTvDocumentsResponse to support the new routing structure and player URLs.MagnetronDocumentRepo to retrieve video documents, ensuring that they are properly fetched based on their unique IDs.feat(tv): add Magnetron TV documents feature and related components
Why: To enhance the platform by allowing users to explore videos on a dedicated TV section, thereby improving content discoverability and user engagement.
What: Introduced a new feature that includes:
MagnetronTv page for displaying videos.How:
GetMagnetronTvDocumentsController to manage the request lifecycle and interact with the use case that retrieves the videos.GetMagnetronTvDocumentsUseCase to encapsulate the business logic for fetching magnetron documents, ensuring appropriate error handling and data fetching strategies.mainRouter to support TV document retrieval requests.MagnetronDocumentRepo to facilitate querying documents with completed versions.tv.tsx page.cleanup
cleanup
feat(render): add audio generation from narration in SceneUrlRenderService
Why: The existing implementation only considers audio URLs present in the scene properties. It does not cater to scenarios where the audio should be generated from text narration, which is essential for scenes lacking pre-defined audio files.
What: This update introduces checks for the presence of narration and voice settings in the audio properties of the scene. If the audio URL is absent, the service now generates audio using the Chirp3TextToSpeechUseCase.
How: The code first verifies the existence of the audio field, narration, and voice properties. If any required element is missing, a corresponding failure result is returned. If all necessary components are present but the audio URL is missing, it invokes the TTS use case to create an audio file, handles potential errors during the generation process, and logs the audio generation success with the URL. The implementation leverages async/await for executing the TTS and downloads the resulting audio file to the specified path.
feat(render): preserve intermediate files and videos in non-production
Why: To facilitate debugging during development and testing, it is essential to retain intermediate video files and frames instead of cleaning them up immediately in non-production environments.
What: The changes modify the MagnetronVideoRenderService and RenderMagnetronDocumentUseCase classes to conditionally clean up temporary files and local video files based on the environment. In production, files are cleaned up as before, while in non-production environments, relevant messages are logged to indicate that files are being preserved for debugging.
How:
MagnetronVideoRenderService, the cleanup of intermediate scene videos and frames is wrapped in a conditional check for the NODE_ENV environment variable. If it is not production, the files are preserved, and a message is logged.cleanupIntermediateFiles now also includes this environment check to avoid unnecessary deletions in non-production contexts.RenderMagnetronDocumentUseCase, the local video file cleanup logic similarly checks the environment before proceeding, ensuring local files are only deleted in production. This behavior is communicated to the developer through console logs.9 commits
feat(oauth): remove YouTubeOAuthController for streamlining auth flow
Why: The YouTubeOAuthController was deemed unnecessary for the current authentication architecture. With improvements and refinements in our OAuth handling, this controller added complexity without significant benefits.
What: The file YouTubeOAuthController.ts has been deleted. This includes all associated methods for authorizing with YouTube, handling OAuth callbacks, and managing refresh tokens.
How: Removed all code related to OAuth operations for YouTube, including the authorize, callback, and getAccessToken methods. This change simplifies the codebase and encourages a more modular approach to authentication, potentially allowing for better maintenance and clearer separation of concerns in the future.
feat(docker): add service for publishing to YouTube
Why Introduced support for a dedicated service to manage the YouTube publishing process. This aims to streamline workflows and provide a clear separation between application functionalities.
What
Added a new service definition in the docker-compose.yml file named publish-to-youtube. This service is configured to run the npm run publish-to-youtube command under production settings and uses the existing magnetron-data volume for data persistence.
How
The new service includes specific configuration options such as the build context and Dockerfile specification. The environment variable NODE_ENV is set to production to ensure the correct environment is used during execution. The service is also set to restart unless stopped to improve resilience during runtime.
feat(youtube): enhance video description hashtags in publish workflow
Why: The previous set of hashtags in the video description lacked coverage for relevant terms that could improve discoverability and searchability on YouTube.
What: Updated the video description to include new hashtags. Removed "#VideoMarketing" and replaced it with "#Sketch" and "#Whiteboard" to better align with current content themes.
How: Modified the string concatenation in the getVideoDescription function of the PublishToYoutubeUseCase class. This change directly impacts the metadata exposed to users and algorithms on YouTube, potentially improving the reach of the published videos.
feat(youtube): improve document version handling in publish workflow
Why: Previously, there was no mechanism to ensure that the YouTube publishing job was executed based on the latest completed document version. This could lead to inconsistencies and unexpected behavior when publishing, especially if multiple versions of a document existed.
What:
PublishToYoutubeController to fetch the latest completed document version before generating the idempotency key.PublishToYoutubeUseCase to include adjustments in logic for handling document states.How:
findLatestCompletedVersion in the MagnetronDocumentVersionRepo to retrieve the most recent version of the document prior to processing the request.feat(youtube): add unpublished magnetron documents management UI
Why: To enhance the management of unpublished magnetron documents, enabling users to view documents that are pending publication and perform actions such as publishing to YouTube directly from the interface.
What: This update introduces a new UI page for "Unpublished Magnetron Documents" which displays a list of unpublished documents along with their associated metadata. Users can initiate the publishing process to YouTube directly from this page. Additionally, it adds backend support for fetching unpublished documents using a dedicated controller and use case.
How:
pages/admin/magnetron/unpublished.tsx to render the document list with pagination and action buttons.GetUnpublishedMagnetronDocumentsController and PublishToYoutubeController to manage the fetching and publishing processes.MagnetronDocumentRepo and its related repositories to fetch documents based on their publication status and count completed document versions.adminRouter to include new routes for document management features.BrowserApiClient to include methods for interacting with the new backend endpoints.package.json to reflect the changes in command execution for publishing videos.feat(youtube): improve video description formatting in publication
Why: The previous implementation concatenated narrations with a space, which can make the video description less readable and visually cluttered. A clearer format can enhance the viewer's understanding and engagement.
What: Updated the way narrations are joined to use line breaks instead of spaces. This change allows for better separation of thoughts and improves the overall presentation of the video description.
How: Modified the narrations.join(" ") line to narrations.join("\n\n"), thereby introducing double line breaks between each narration. This change enhances the readability of the description format in the published YouTube videos.
feat(youtube): enhance YouTube integration with video management capabilities
Why: Users need a more robust way to manage YouTube videos, specifically to allow for updating existing videos and deleting old videos during the publishing process. This improves the overall user experience and ensures content remains up to date.
What:
youtube.force-ssl for broader permissions, including uploading, updating, and deleting videos.YouTubeUploadService, allowing for the removal of old videos when new ones are published.PublishToYoutubeUseCase to check for already published videos and update them if necessary, rather than duplicating content.How:
.envprod and reflected in the setupYoutubeAuth.ts script.YouTubeUploadService handle the deletion of videos and better error handling for insufficient permissions.PublishToYoutubeUseCase was modified to generate descriptions dynamically from document narrations and conditionally update YouTube videos based on their publication status.This commit significantly enhances the YouTube integration within the application, ensuring users can effectively manage their video content.
feat(youtube): enhance YouTube integration with OAuth and publish flow
Why: To streamline the process of uploading videos to YouTube by implementing OAuth 2.0 authentication and integrating it into the existing upload service. This improves security and user experience by enabling automatic token management.
What:
setupYoutubeAuth.ts for managing OAuth credentials and obtaining refresh tokens.YouTubeOAuthController to handle authorization and callback logic for OAuth.PublishToYoutubeUseCase to utilize the new OAuth flow, including handling document statuses during the upload process.MagnetronDocument and Contact to track YouTube upload statuses.PublishToYoutube.ts for command line access to the publish functionality.How:
feat(youtube): implement video upload functionality to YouTube
Why: To enable users to publish videos generated from Magnetron documents directly to their YouTube channels, enhancing the platform's usability and integration with popular services.
What: Added a new service, YouTubeUploadService, responsible for handling video uploads to YouTube. Introduced interfaces for requests and responses specific to YouTube publishing. Implemented PublishToYoutubeUseCase to handle the business logic of fetching document versions and facilitating the upload process.
How:
MagnetronDocumentVersionRepo now includes a method to find the latest completed version of a document.YouTubeUploadService leverages Google APIs to download video streams and upload them, also managing thumbnail uploads.PublishToYoutubeUseCase orchestrates the process, validating input and invoking the upload service with necessary data such as video URL and user access tokens.1 commit
refactor(MagnetronLoader): remove illustration grid logic for clarity
Why: The existing approach for handling illustrations was complex and added unnecessary clutter to the MagnetronLoader component. Simplifying this logic will enhance maintainability and readability.
What: Removed the getIllustrations function and the corresponding IllustrationGrid component that were responsible for rendering a 3x3 grid of illustrations from the magnetron document.
How: The deletion of both the illustration fetching logic and the grid rendering allows for a cleaner component structure. This change will pave the way for future enhancements regarding how illustrations are managed without impacting performance or functionality. The loading experience remains unchanged as the visual component for illustrations during processing is no longer displayed.