Skip to content

Commit

Permalink
bug - no reload when slug changed in episode, podcast, serie
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexRoehm committed Apr 1, 2024
1 parent c2db8b4 commit 5e74c30
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 11 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/cicd-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Create Image for Refactoring Branch

on: workflow_dispatch

jobs:
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
with:
ref: refactor/separate-backend
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: yarn install
- run: yarn build

deploy:
needs: build
if: "!contains(github.event.head_commit.message, 'skip cd')"
runs-on: ubuntu-latest

steps:
- name: Check out
uses: actions/checkout@v4
with:
ref: refactor/separate-backend
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v4
with:
images: ghcr.io/ccfreiburg/podkashde
tags: |
type=sha
type=raw,latest-branch
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_PASSWORD }}

- name: Build image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
build-args: |
BUILDTIME=${{ fromJSON(steps.docker_meta.outputs.json).labels['org.opencontainers.image.created'] }}
VERSION=${{ fromJSON(steps.docker_meta.outputs.json).labels['org.opencontainers.image.version'] }}
REVISION=${{ fromJSON(steps.docker_meta.outputs.json).labels['org.opencontainers.image.revision'] }}
3 changes: 0 additions & 3 deletions backend/src/controller/Podcast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import { createDir, dataPath } from "../tools/DataFiles";

export async function generateRssAction(request: Request, response: Response) {
try {
console.log(process.env.podcastRssUrl)
console.log(request.query)
console.log(request.query.mediaBase)
const slug = request.query.slug as string;
const baseUrl = process.env.podcastRssUrl ?? request.query.mediaBase as string
const podcast = await getExtQueryGen(Podcast, {
Expand Down
2 changes: 1 addition & 1 deletion backend/src/tools/Configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require('dotenv').config()

export const DATABASE_PATH = process.env.DATABASE_PATH ?? 'data';
export const DATA_PATH = process.env.DATA_PATH ?? 'public';
export const DATABASE_FILE = "podcasts.sqlite"
export const DATABASE_FILE = process.env.DATABASE_FILE ?? "podcasts.sqlite"
export const DATAFILES_PATH = '/files/'
export const SERVER_IMG_PATH = '/s/covers/';
export const SERVER_POSTIMG_PATH = '/s/posts/';
Expand Down
1 change: 0 additions & 1 deletion base/WpImport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ export function episodeFromWpMetadata(
podcastImage,
enumerations
): IEpisode {
// console.log(JSON.stringify(wpEpisode))
var pubdate = strToDate((wpEpisode.meta.date_recorded.length>0?wpEpisode.meta.date_recorded:wpEpisode.date))
if (!pubdate)
pubdate = new Date();
Expand Down
1 change: 0 additions & 1 deletion components/PodcastDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ export default defineComponent({
try {
if (imgMetadata.value.selectedFile) {
postData.body = getImageInFormData()
console.log(postData)
postResult = await myFetch( UPLOAD_AP, postData)
}
} catch (err) {
Expand Down
1 change: 0 additions & 1 deletion composables/useAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export default function useAuth( onetimeToken: String | undefined = undefined )
}

const reRefreshAccessToken = () => {
console.log('tock')
readPersistedData()
if (!hasAuthData()) return false
const request = {
Expand Down
1 change: 1 addition & 0 deletions composables/useData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function useDatas( datas: Ref<Array<any>>, apiSlug: string ) {
}

export function useData( data: Ref<any>, apiSlug: string, query: string ) {

const {apiBase} = useRuntimeConfig().public
const loading = ref(!data.value)

Expand Down
2 changes: 1 addition & 1 deletion composables/useEpisode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function useEpisode(slug:string) {
serie.value = episode.value?.serie as ISerie
loading.value = false
}
if (!episode.value)
if (!episode.value || episode.value.slug!==slug)
refresh()
return {
episode,
Expand Down
2 changes: 1 addition & 1 deletion composables/usePodcast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function usePodcast(slug:string) {

const {generate} = useRss(slug)

if (!podcast.value)
if (!podcast.value || podcast.value.slug!==slug)
refresh()

return {
Expand Down
2 changes: 1 addition & 1 deletion composables/useSerie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function useSerie(slug:string) {
loading.value = false
}

if (!serie.value)
if (!serie.value || serie.value.slug!==slug)
refresh()

return {
Expand Down
2 changes: 1 addition & 1 deletion pages/[episodeslug]/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<PageLayout v-if="episode" :title="$t('episode.episode')" :submenu="submenu" @menuItemClicked="menuItemClicked">
<PageLayout v-if="episode" :submenu="submenu" @menuItemClicked="menuItemClicked">
<select-podcast-modal v-if="dialog" :error="error" :podcasts="podcasts" @cancel="() => dialog = false"
@submit="changePodcast"></select-podcast-modal>
<BaseContainerClean class="flex flex-col items-center ">
Expand Down
3 changes: 3 additions & 0 deletions pages/admin/[episodeslug]/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const {on_mounted, on_before, on_user_changed} = useMounted(refresh, user, true)
onMounted( on_mounted )
onBeforeMount( on_before )
watch(user, on_user_changed);
onBeforeUpdate(()=> {
console.log("Hi")
refresh()})
const myFetch = useFetchApi()
const router = useRouter()
Expand Down

0 comments on commit 5e74c30

Please sign in to comment.