Skip to content

Commit

Permalink
Fixed gpodder link loading (#909)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamTV12345 authored Aug 31, 2024
1 parent a397ece commit 5f0eeaa
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
11 changes: 10 additions & 1 deletion src/gpodder/episodes/gpodder_episodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub async fn get_episode_actions(

let since_date = DateTime::from_timestamp(since.since, 0)
.map(|v| v.naive_utc());
let actions = Episode::get_actions_by_username(
let mut actions = Episode::get_actions_by_username(
username.clone(),
&mut pool.get().unwrap(),
since_date,
Expand All @@ -56,6 +56,15 @@ pub async fn get_episode_actions(
since.podcast.clone(),
)
.await;


if let Some(device) = since.device.clone() {
actions.iter_mut().for_each(|a| {
a.device = device.clone();
});
}


Ok(HttpResponse::Ok().json(EpisodeActionResponse {
actions,
timestamp: get_current_timestamp(),
Expand Down
6 changes: 5 additions & 1 deletion src/gpodder/subscription/subscriptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ pub async fn get_subscriptions(
)
.await;


match res {
Ok(res) => Ok(HttpResponse::Ok().json(res)),
Ok(res) => {

Ok(HttpResponse::Ok().json(res))
},
Err(_) => Ok(HttpResponse::InternalServerError().finish()),
}
}
Expand Down
17 changes: 10 additions & 7 deletions ui/src/pages/GPodderIntegration.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios, {AxiosResponse} from "axios";
import {Setting} from "../models/Setting";
import {useState} from "react";
import {useEffect, useState} from "react";
import {useTranslation} from "react-i18next";
import {Podcast} from "../store/CommonSlice";
import {handleAddPodcast} from "../utils/ErrorSnackBarResponses";
Expand All @@ -16,11 +16,14 @@ export const GPodderIntegration = ()=> {
const [gpodderOnlyPodcasts, setGPodderOnlyPodcasts] = useState<GPodderIntegrationItem[]>([])
const {t} = useTranslation()

axios.get('/podcast/available/gpodder')
.then((res: AxiosResponse<GPodderIntegrationItem[]>) => {
console.log("Res is",res)
setGPodderOnlyPodcasts(res.data)
})

useEffect(() => {
axios.get('/podcast/available/gpodder')
.then((res: AxiosResponse<GPodderIntegrationItem[]>) => {
setGPodderOnlyPodcasts(res.data)
})
}, []);


const addPodcast = (feedUrl: string)=>{
setGPodderOnlyPodcasts(gpodderOnlyPodcasts.filter(p=>p.podcast!=feedUrl))
Expand Down Expand Up @@ -63,4 +66,4 @@ export const GPodderIntegration = ()=> {
}
</tbody>
</table>
}
}

0 comments on commit 5f0eeaa

Please sign in to comment.