-
-
Notifications
You must be signed in to change notification settings - Fork 249
feat(gateway)!: align embedding APIs #3818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,12 @@ | |
| //! DASH over HTTP from MoQ broadcasts (export), fetching media groups on demand. | ||
|
|
||
| use std::net::SocketAddr; | ||
| use std::path::PathBuf; | ||
|
|
||
| use anyhow::Context; | ||
| use axum::http::Method; | ||
| use hang::moq_net; | ||
| use url::Url; | ||
|
|
||
| use crate::moq::{ImportTarget, notify_ready}; | ||
|
|
||
|
|
@@ -60,6 +62,7 @@ pub async fn import(target: ImportTarget, playlist: String) -> anyhow::Result<() | |
| .announce(Default::default()) | ||
| .context("failed to announce broadcast")?; | ||
|
|
||
| let playlist = playlist_url(&playlist)?; | ||
| let mut importer = moq_hls::import::Import::new(producer, catalog, moq_hls::import::Config::new(playlist))?; | ||
|
|
||
| tracing::info!(%name, "importing HLS"); | ||
|
|
@@ -69,6 +72,20 @@ pub async fn import(target: ImportTarget, playlist: String) -> anyhow::Result<() | |
| Ok(importer.run().await?) | ||
| } | ||
|
|
||
| fn playlist_url(playlist: &str) -> anyhow::Result<Url> { | ||
| if playlist.starts_with("http://") || playlist.starts_with("https://") { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: sed -n '55,100p' rs/moq-cli/src/hls.rs
rg -n 'playlist_url|Config::new|file URL|playlist' rs/moq-cli/src/hls.rs rs/moq-hls/src/import.rsRepository: moq-dev/moq Length of output: 12812 🏁 Script executed: sed -n '1,90p' rs/moq-cli/src/hls.rs
sed -n '160,225p' rs/moq-hls/src/import.rs
sed -n '576,625p' rs/moq-hls/src/import.rs
rg -n 'struct Fetcher|impl Fetcher|fn fetch|file://|Url::parse|url\.scheme|reqwest|std::fs' rs/moq-hls/src/import.rs rs/moq-cli/src/hls.rsRepository: moq-dev/moq Length of output: 9989 🏁 Script executed: sed -n '1,95p' rs/moq-cli/src/hls.rs
sed -n '150,215p' rs/moq-hls/src/import.rs
sed -n '576,625p' rs/moq-hls/src/import.rs
rg -n 'struct Fetcher|impl Fetcher|fn fetch|file://|Url::parse|url\.scheme|reqwest|std::fs' rs/moq-hls/src/import.rs rs/moq-cli/src/hls.rsRepository: moq-dev/moq Length of output: 10075 Parse HTTP(S) URLs without case-sensitive prefix checks.
Proposed fix- if playlist.starts_with("http://") || playlist.starts_with("https://") {
- return Url::parse(playlist).context("invalid HLS playlist URL");
+ if let Ok(url) = Url::parse(playlist)
+ && matches!(url.scheme(), "http" | "https")
+ {
+ return Ok(url);
}🤖 Prompt for AI Agents |
||
| return Url::parse(playlist).context("invalid HLS playlist URL"); | ||
| } | ||
|
|
||
| let path = PathBuf::from(playlist); | ||
| let absolute = if path.is_absolute() { | ||
| path | ||
| } else { | ||
| std::env::current_dir()?.join(path) | ||
| }; | ||
| Url::from_file_path(&absolute).map_err(|_| anyhow::anyhow!("invalid HLS playlist path: {}", absolute.display())) | ||
| } | ||
|
|
||
| /// Serve HLS and DASH over HTTP for the single broadcast `name` (reached at | ||
| /// `/<name>/master.m3u8` and `/<name>/manifest.mpd`); other broadcasts in the | ||
| /// Origin are not served. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Keep the Gateway review gate until release and migration requirements are covered.
moq-hls,moq-rtc, andmoq-rtmpcontain breaking changes to released public APIs. Route their releases throughdev, notmain. Add separatedoc/setup/upgrade.mdsections for HLS, RTC, and RTMP. Each section must include the related PR and replacement call. These sections are required independently of the SRT andmoq-statsmigrations.🤖 Prompt for AI Agents