From 3a48ff2d50db08ce20a19b701bdee4cca48c90f4 Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Sun, 1 May 2022 21:11:01 -0400 Subject: [PATCH 1/9] docker build and push action now uses secrets for DockerHub username, repo, and tag --- .github/workflows/docker.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 3fd4ab2..0782193 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -21,7 +21,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 @@ -39,4 +39,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}} From 2981f843c3356fa4a98e59587da607013004b084 Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Sun, 1 May 2022 21:11:21 -0400 Subject: [PATCH 2/9] Added docker build PR check --- .github/workflows/docker-pr.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/docker-pr.yml diff --git a/.github/workflows/docker-pr.yml b/.github/workflows/docker-pr.yml new file mode 100644 index 0000000..9aebc2b --- /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-compose build \ No newline at end of file From 4c06c430eb702fc05b9fa27c11baf45d69ee2eb6 Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Sun, 1 May 2022 21:21:39 -0400 Subject: [PATCH 3/9] Converted docker-compose build to docker build for docker-pr GH action --- .github/workflows/docker-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-pr.yml b/.github/workflows/docker-pr.yml index 9aebc2b..0e566ea 100644 --- a/.github/workflows/docker-pr.yml +++ b/.github/workflows/docker-pr.yml @@ -24,4 +24,4 @@ jobs: json: '{"type": "docker", "tag": "nightly", "commit": "${{ steps.vars.outputs.sha_short }}", "date": "${{ steps.date.outputs.date }}"}' dir: 'backend/' - name: Build docker images - run: docker-compose build \ No newline at end of file + run: docker build . -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:${{secrets.DOCKERHUB_MASTER_TAG}} \ No newline at end of file From 9f9054ed9df364e66059b924214cd684849163ee Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Sun, 1 May 2022 22:59:55 -0400 Subject: [PATCH 4/9] Removed secrets from docker-pr.yml --- .github/workflows/docker-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-pr.yml b/.github/workflows/docker-pr.yml index 0e566ea..2fcf807 100644 --- a/.github/workflows/docker-pr.yml +++ b/.github/workflows/docker-pr.yml @@ -24,4 +24,4 @@ jobs: 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 ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:${{secrets.DOCKERHUB_MASTER_TAG}} \ No newline at end of file + run: docker build . -t tzahi12345/youtubedl-material:nightly-pr \ No newline at end of file From dab0b7a8b62b57c9440ca8d22bdd5d92058db4f2 Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Sun, 1 May 2022 23:13:00 -0400 Subject: [PATCH 5/9] Updated Angular version in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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! From a68726e7cbf087a1784aecaee33bfb6f7bb2ddd9 Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Sun, 1 May 2022 23:13:11 -0400 Subject: [PATCH 6/9] Removed deprecated armhf.Dockerfile --- armhf.Dockerfile | 49 ------------------------------------------------ 1 file changed, 49 deletions(-) delete mode 100644 armhf.Dockerfile 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" ] From 8a323f028da2aa460ff89dd929fca58955690ea2 Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Sun, 1 May 2022 23:15:09 -0400 Subject: [PATCH 7/9] Fixed bug where subscription avatars were missing --- src/app/app.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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}} From 88c16d71953b6a82d9736ce2d8227359d126403f Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Sun, 1 May 2022 23:23:19 -0400 Subject: [PATCH 8/9] All setIntervals on the frontend are now properly destroyed --- .../concurrent-stream/concurrent-stream.component.ts | 5 +++++ src/app/components/twitch-chat/twitch-chat.component.ts | 3 ++- src/app/subscription/subscription/subscription.component.ts | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) 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..e4ec4c7 100644 --- a/src/app/components/twitch-chat/twitch-chat.component.ts +++ b/src/app/components/twitch-chat/twitch-chat.component.ts @@ -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(); From a36761e96a3da59c28accc6022f6bcd6198cae64 Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Sun, 1 May 2022 23:24:15 -0400 Subject: [PATCH 9/9] Fixed frontend build error --- src/app/components/twitch-chat/twitch-chat.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/components/twitch-chat/twitch-chat.component.ts b/src/app/components/twitch-chat/twitch-chat.component.ts index e4ec4c7..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;