diff --git a/backend/src/controller/Podcast.ts b/backend/src/controller/Podcast.ts index 581fec5..5fd69be 100644 --- a/backend/src/controller/Podcast.ts +++ b/backend/src/controller/Podcast.ts @@ -8,6 +8,7 @@ import { getEnumFunctions } from "../tools/Enumerations"; import { generateRss } from "../tools/RssGenerator"; import { FEED_SLUG } from "../tools/Configuration"; import { createDir, dataPath } from "../tools/DataFiles"; +import { setLastUpdate } from '../services/podcastService'; export async function generateRssAction(request: Request, response: Response) { try { @@ -29,6 +30,7 @@ export async function generateRssAction(request: Request, response: Response) { createDir(dir) const target_file = dir + podcast.slug+".xml" fs.writeFileSync(target_file, xml) + setLastUpdate(podcast.id) respond(response, 201, { message: "RSS for podcast slug=" + podcast.slug + " successfully generated" }); } catch (error) { respond(response, 500, { diff --git a/backend/src/index.ts b/backend/src/index.ts index b24d794..d05e7d0 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -18,9 +18,9 @@ const proxy = require('express-http-proxy'); initDataSource().then(() => { // create express app const app = express(); - app.use("/s", express.static('./public/s')); - app.use("/img", express.static('./public/img')); - app.use("/test", express.static('./public/test')); + app.use("/s", express.static(DATA_PATH+'/s')); + app.use("/img", express.static(DATA_PATH+'/img')); + app.use("/test", express.static(DATA_PATH+'/test')); app.use(bodyParser.json()); app.use(cookieParser()); diff --git a/backend/src/routes.ts b/backend/src/routes.ts index 671050d..6297edc 100644 --- a/backend/src/routes.ts +++ b/backend/src/routes.ts @@ -159,7 +159,6 @@ export const AppRoutes = [ order: { lastEpisode: 'DESC' }, - relations: ['episodes'], }, req, res) }, { diff --git a/backend/src/services/podcastService.ts b/backend/src/services/podcastService.ts index 1a1699a..4bf9301 100644 --- a/backend/src/services/podcastService.ts +++ b/backend/src/services/podcastService.ts @@ -4,6 +4,7 @@ import { createDir, dataPath, writeRss } from "../tools/DataFiles"; import Enumerations from "../tools/Enumerations"; import { generateRss } from "../tools/RssGenerator"; import getRepository from "./datasourceService"; +import { getQueryGen, updateGen } from "./genericService"; export function getPodcast(from : any): Podcast { var podcast = new Podcast(); @@ -40,7 +41,14 @@ export function getPodcast(from : any): Podcast { return podcast; } - + export const setLastUpdate = async ( id: number ) : Promise => { + const podcast = await getQueryGen(Podcast, { id: id }) + podcast.lastbuild = Date.now().toLocaleString() + podcast.updatedAt = Date.now() + updateGen(Podcast, podcast as Podcast) + return podcast.lastbuild + } + // if (object.hasOwnProperty("updatedAt")) // (object as any).updatedAt = new Date(); \ No newline at end of file diff --git a/components/AudioFileSelector.vue b/components/AudioFileSelector.vue index 71e9916..0cecb37 100644 --- a/components/AudioFileSelector.vue +++ b/components/AudioFileSelector.vue @@ -76,7 +76,6 @@ export default defineComponent({ audioFile.value.imgblob = array2blob( id3tag.image.data, id3tag.image.mime) - console.log(audioFile.value.cover_preview) } } catch(err) { console.log(err) diff --git a/components/EpisodeDetail.vue b/components/EpisodeDetail.vue index 65dd434..80944ea 100644 --- a/components/EpisodeDetail.vue +++ b/components/EpisodeDetail.vue @@ -50,7 +50,7 @@ :labelChecked="$t('episode.label.block_true')" :labelUnChecked="$t('episode.label.block_false')" /> - @@ -113,6 +113,8 @@ export default defineComponent({ const myFetch = useFetchApi() const errors = ref([] as Array); const fields = ref({ ...props.episode } as IEpisode); + if (!fields.value.cross_ref) fields.value.cross_ref = '' + if (!fields.value.video_link) fields.value.video_link = '' const isEdit = computed(() => (fields.value as any).id != undefined); const uploadIndicator = ref(false) const keepImage = ref(isEdit.value) @@ -266,7 +268,7 @@ export default defineComponent({ // Upload Image - if (imgMetadata.value.preview != serie.cover_file && (imgMetadata.value.selectedFile || audioMetadata.value.imgblob != undefined)) { + if (!imgMetadata.value.preview.endsWith(serie.cover_file) && (imgMetadata.value.selectedFile || audioMetadata.value.imgblob != undefined)) { var { result, link, nothingToDo } = await upload(SERVER_IMG_PATH, imgMetadata.value.selectedFile, audioMetadata.value.imgblob) if (result.statusCode != 201) { errors.value.push({ field: "", text: "episode.validation.upload" }) diff --git a/components/ImageSelector.vue b/components/ImageSelector.vue index f4c119e..4a6de00 100644 --- a/components/ImageSelector.vue +++ b/components/ImageSelector.vue @@ -67,7 +67,6 @@ export default defineComponent({ img.onload = () => { imgMetadata.value.imgWidth = img.naturalWidth; imgMetadata.value.imgHeight = img.naturalHeight; - console.log('hi') callback(); } img.onerror = () => { @@ -75,7 +74,6 @@ export default defineComponent({ imgMetadata.value.selectedFile = undefined; imgMetadata.value.blob = undefined; imgMetadata.value.imgWidth = 0; - console.log('hi+') imgMetadata.value.imgHeight = 0; callback(); } diff --git a/composables/usePodcast.ts b/composables/usePodcast.ts index 3c00aeb..0a555d3 100644 --- a/composables/usePodcast.ts +++ b/composables/usePodcast.ts @@ -14,6 +14,7 @@ export default function usePodcast(slug:string) { loading.value = true await dataRefresh() episodes.value = podcast.value?.episodes as Array + delete podcast.value.episodes loading.value = false }