diff --git a/.github/workflows/docker-pr.yml b/.github/workflows/docker-pr.yml new file mode 100644 index 0000000..2fcf807 --- /dev/null +++ b/.github/workflows/docker-pr.yml @@ -0,0 +1,27 @@ +name: docker-pr + +on: + pull_request: + branches: [master] + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: checkout code + uses: actions/checkout@v2 + - name: Set hash + id: vars + run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + - name: create-json + id: create-json + uses: jsdaniell/create-json@1.1.2 + with: + name: "version.json" + json: '{"type": "docker", "tag": "nightly", "commit": "${{ steps.vars.outputs.sha_short }}", "date": "${{ steps.date.outputs.date }}"}' + dir: 'backend/' + - name: Build docker images + run: docker build . -t tzahi12345/youtubedl-material:nightly-pr \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index abf93a5..165b51b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -31,7 +31,7 @@ jobs: uses: jsdaniell/create-json@1.1.2 with: name: "version.json" - json: '{"type": "docker", "tag": "nightly", "commit": "${{ steps.vars.outputs.sha_short }}", "date": "${{ steps.date.outputs.date }}"}' + json: '{"type": "docker", "tag": "${{secrets.DOCKERHUB_MASTER_TAG}}", "commit": "${{ steps.vars.outputs.sha_short }}", "date": "${{ steps.date.outputs.date }}"}' dir: 'backend/' - name: setup platform emulator uses: docker/setup-qemu-action@v1 @@ -49,4 +49,8 @@ jobs: file: ./Dockerfile platforms: linux/amd64,linux/arm,linux/arm64/v8 push: true - tags: tzahi12345/youtubedl-material:nightly + # Defaults: + # DOCKERHUB_USERNAME : tzahi12345 + # DOCKERHUB_REPO : youtubedl-material + # DOCKERHUB_MASTER_TAG: nightly + tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:${{secrets.DOCKERHUB_MASTER_TAG}} diff --git a/README.md b/README.md index 15b12b8..bf4c4f2 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![GitHub issues badge](https://img.shields.io/github/issues/Tzahi12345/YoutubeDL-Material)](https://github.com/Tzahi12345/YoutubeDL-Material/issues) [![License badge](https://img.shields.io/github/license/Tzahi12345/YoutubeDL-Material)](https://github.com/Tzahi12345/YoutubeDL-Material/blob/master/LICENSE.md) -YoutubeDL-Material is a Material Design frontend for [youtube-dl](https://rg3.github.io/youtube-dl/). It's coded using [Angular 11](https://angular.io/) for the frontend, and [Node.js](https://nodejs.org/) on the backend. +YoutubeDL-Material is a Material Design frontend for [youtube-dl](https://rg3.github.io/youtube-dl/). It's coded using [Angular 13](https://angular.io/) for the frontend, and [Node.js](https://nodejs.org/) on the backend. Now with [Docker](#Docker) support! diff --git a/armhf.Dockerfile b/armhf.Dockerfile deleted file mode 100644 index 7f192be..0000000 --- a/armhf.Dockerfile +++ /dev/null @@ -1,49 +0,0 @@ -FROM alpine:3.12 as frontend - -RUN apk add --no-cache \ - npm \ - curl - -RUN npm install -g @angular/cli - -WORKDIR /build - -RUN curl -L https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-arm.tar.gz | tar zxvf - -C . && mv qemu-3.0.0+resin-arm/qemu-arm-static . - -COPY [ "package.json", "package-lock.json", "/build/" ] -RUN npm install - -COPY [ "angular.json", "tsconfig.json", "/build/" ] -COPY [ "src/", "/build/src/" ] -RUN ng build --prod - -#--------------# - -FROM arm32v7/alpine:3.12 - -COPY --from=frontend /build/qemu-arm-static /usr/bin - -ENV UID=1000 \ - GID=1000 \ - USER=youtube - -RUN addgroup -S $USER -g $GID && adduser -D -S $USER -G $USER -u $UID - -RUN apk add --no-cache \ - ffmpeg \ - npm \ - python2 \ - su-exec \ - && apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ \ - atomicparsley - -WORKDIR /app -COPY --chown=$UID:$GID [ "backend/package.json", "backend/package-lock.json", "/app/" ] -RUN npm install && chown -R $UID:$GID ./ - -COPY --chown=$UID:$GID --from=frontend [ "/build/backend/public/", "/app/public/" ] -COPY --chown=$UID:$GID [ "/backend/", "/app/" ] - -EXPOSE 17442 -ENTRYPOINT [ "/app/entrypoint.sh" ] -CMD [ "node", "app.js" ] diff --git a/src/app/app.component.html b/src/app/app.component.html index f1270c7..278b8fe 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -51,7 +51,7 @@ - {{subscription.name}} + {{subscription.name}} diff --git a/src/app/components/concurrent-stream/concurrent-stream.component.ts b/src/app/components/concurrent-stream/concurrent-stream.component.ts index 6c2cc67..e99108b 100644 --- a/src/app/components/concurrent-stream/concurrent-stream.component.ts +++ b/src/app/components/concurrent-stream/concurrent-stream.component.ts @@ -42,6 +42,11 @@ export class ConcurrentStreamComponent implements OnInit { } + ngOnDestroy(): void { + if (this.check_timeout) { clearInterval(this.check_timeout); } + if (this.update_timeout) { clearInterval(this.update_timeout); } + } + startServer() { this.started = true; this.server_started = true; diff --git a/src/app/components/twitch-chat/twitch-chat.component.ts b/src/app/components/twitch-chat/twitch-chat.component.ts index d2e0aa0..bbeb7de 100644 --- a/src/app/components/twitch-chat/twitch-chat.component.ts +++ b/src/app/components/twitch-chat/twitch-chat.component.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, Component, ElementRef, Input, OnInit, QueryList, ViewChild, ViewChildren } from '@angular/core'; +import { Component, ElementRef, Input, OnDestroy, OnInit, QueryList, ViewChild, ViewChildren } from '@angular/core'; import { PostsService } from 'app/posts.services'; @Component({ @@ -6,7 +6,7 @@ import { PostsService } from 'app/posts.services'; templateUrl: './twitch-chat.component.html', styleUrls: ['./twitch-chat.component.scss'] }) -export class TwitchChatComponent implements OnInit, AfterViewInit { +export class TwitchChatComponent implements OnInit, OnDestroy { full_chat = null; visible_chat = null; @@ -33,7 +33,8 @@ export class TwitchChatComponent implements OnInit, AfterViewInit { this.getFullChat(); } - ngAfterViewInit() { + ngOnDestroy(): void { + if (this.chat_check_interval_obj) { clearInterval(this.chat_check_interval_obj); } } private isUserNearBottom(): boolean { diff --git a/src/app/subscription/subscription/subscription.component.ts b/src/app/subscription/subscription/subscription.component.ts index dcb6c5c..967b5bd 100644 --- a/src/app/subscription/subscription/subscription.component.ts +++ b/src/app/subscription/subscription/subscription.component.ts @@ -52,6 +52,8 @@ export class SubscriptionComponent implements OnInit, OnDestroy { this.route.params.subscribe(params => { this.id = params['id']; + if (this.sub_interval) { clearInterval(this.sub_interval); } + this.postsService.service_initialized.subscribe(init => { if (init) { this.getConfig();