Skip to content

Commit

Permalink
fix: stream config urls, fix: get last ffprobe for url (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiroaisen authored Dec 23, 2023
2 parents b4ef34d + 2b65c08 commit e8b35ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
import { mdiContentCopy, mdiLink, mdiLockReset } from '@mdi/js';
import _copy from "copy-to-clipboard";
import { page } from '$app/stores';
$: scheme = $page.url.protocol.split(":")[0] ?? "https";
const copy = (value: string) => {
return {
Expand Down Expand Up @@ -245,8 +248,8 @@
label=""
icon={mdiLink}
readonly
btn={copy(`${data.config.stream_public_url}/stream/${data.station._id}`)}
value="{data.config.stream_public_url}/stream/{data.station._id}"
btn={copy(`${scheme}:${data.config.stream_public_url}/stream/${data.station._id}`)}
value="{scheme}:{data.config.stream_public_url}/stream/{data.station._id}"
/>
</div>
</div>
Expand All @@ -257,8 +260,8 @@
label=""
icon={mdiLink}
readonly
btn={copy(`${data.config.stream_public_url}/stream/${data.station._id}.m3u`)}
value="{data.config.stream_public_url}/stream/{data.station._id}.m3u"
btn={copy(`${scheme}:${data.config.stream_public_url}/stream/${data.station._id}.m3u`)}
value="{scheme}:{data.config.stream_public_url}/stream/{data.station._id}.m3u"
/>
</div>
</div>
Expand All @@ -269,8 +272,8 @@
label=""
icon={mdiLink}
readonly
btn={copy(`${data.config.stream_public_url}/stream/${data.station._id}.pls`)}
value="{data.config.stream_public_url}/stream/{data.station._id}.pls"
btn={copy(`${scheme}:${data.config.stream_public_url}/stream/${data.station._id}.pls`)}
value="{scheme}:{data.config.stream_public_url}/stream/{data.station._id}.pls"
/>
</div>
</div>
Expand Down
6 changes: 4 additions & 2 deletions rs/packages/db/src/models/probe/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::Model;
use mongodb::{bson::doc, IndexModel};
use mongodb::{bson::doc, options::FindOneOptions, IndexModel};
use serde::{Deserialize, Serialize};
use serde_util::DateTime;
use ts_rs::TS;
Expand Down Expand Up @@ -33,7 +33,9 @@ pub struct Probe {
impl Probe {
pub async fn last_for_url(url: &str) -> Result<Option<Self>, mongodb::error::Error> {
let filter = doc! { Self::KEY_URL: url };
Self::cl().find_one(filter, None).await
let sort = doc! { Self::KEY_CREATED_AT: -1 };
let options = FindOneOptions::builder().sort(sort).build();
Self::cl().find_one(filter, options).await
}
}

Expand Down

0 comments on commit e8b35ce

Please sign in to comment.