feat: Add option to generate public asset links for videos#295
Open
fernnguyen wants to merge 2 commits intochenyme:mainfrom
Open
feat: Add option to generate public asset links for videos#295fernnguyen wants to merge 2 commits intochenyme:mainfrom
fernnguyen wants to merge 2 commits intochenyme:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a new configurable option
video.enable_public_assetthat, when enabled, automatically calls the Grok share API after video generation completes to create a publicly accessible link. The final video URL is replaced with a stable public URL (https://imagine-public.x.ai/imagine-public/share-videos/{id}.mp4) that can be accessed without authentication, making it easier to embed or share generated videos.Changes
Details:
app/services/reverse/media_post_link.py(new) — Reverse interface for POST /rest/media/post/create-link. Handles the Grok share API call, error handling, and 401 token failure recording, consistent with other reverse interfaces in the project.— Added _create_public_link() method to both VideoStreamProcessor and VideoCollectProcessor. The method is called after video generation (and after upscale if applicable) whenenable_public_asset` is enabled. Extracts the video ID from the CDN URL via regex and replaces the final URL with the public asset URL.config.defaults.toml— Added enable_public_asset = true under [video] section._public/static/admin/js/config.js— Added enable_public_asset entry to the video section of LOCALE_MAP so the toggle appears in the admin config UI._public/static/i18n/locales/en.json/ zh.json— Added translations for the new config field.Related Issues
N/A
Verification
docker compose up(built from local Dockerfile)video.enable_public_asset = truein admin config panelhttps://imagine-public.x.ai/imagine-public/share-videos/{video_id}.mp4?cache=1 instead of the original authenticated CDN URL
enable_public_asset = false, behavior is unchanged and the original video URL is returned as-isBreaking Changes
The new config key
video.enable_public_assetdefaults totrueinconfig.defaults.toml. Existing deployments will have this enabled automatically after upgrade. If the Grok share API call failsfor any reason (e.g. network error, 403), the code falls back gracefully to the original video URL — no generation is lost.