From 72b5ab648e511220d7ff8b4bf453db94bb952b30 Mon Sep 17 00:00:00 2001 From: Munif Tanjim Date: Mon, 12 May 2025 18:56:39 +0600 Subject: [PATCH 1/9] feat: stremthru improvements (#172) --- packages/utils/src/stremthru.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/utils/src/stremthru.ts b/packages/utils/src/stremthru.ts index 541a000c..0cf8d9c9 100644 --- a/packages/utils/src/stremthru.ts +++ b/packages/utils/src/stremthru.ts @@ -46,6 +46,9 @@ export async function generateStremThruStreams( } } data.append(`req_headers[${i}]`, req_headers); + if (stream.filename) { + data.append(`filename[${i}]`, stream.filename); + } }); if (Settings.ENCRYPT_STREMTHRU_URLS) { @@ -155,7 +158,10 @@ export async function getStremThruPublicIp( } const data = await response.json(); - const publicIp = data.data?.ip?.machine; + const publicIp = + typeof data.data?.ip?.exposed === 'object' // available from `v0.71.0` + ? data.data.ip.exposed['*'] || data.data.ip.machine + : data.data?.ip?.machine; if (publicIp && cache) { cache.set(cacheKey, publicIp, Settings.CACHE_STREMTHRU_IP_TTL); } else { From 181295dd61751aab23c552a106b0394fa9ff5669 Mon Sep 17 00:00:00 2001 From: Viren070 Date: Thu, 22 May 2025 21:40:33 +0100 Subject: [PATCH 2/9] ci: use release-please, remove dev tag, add nightly builds --- .github/workflows/build.yml | 9 -- .github/workflows/deploy-docker.yml | 112 ++++++++++++------- .github/workflows/nightly.yml | 57 ++++++++++ .github/workflows/release.yml | 31 +++++ .release-please-manifest.json | 3 + CHANGELOG.md | 14 --- packages/addon/src/manifest.ts | 2 +- packages/frontend/src/app/configure/page.tsx | 2 +- packages/utils/src/settings.ts | 2 +- release-please-config.json | 20 ++++ 10 files changed, 184 insertions(+), 68 deletions(-) create mode 100644 .github/workflows/nightly.yml create mode 100644 .github/workflows/release.yml create mode 100644 .release-please-manifest.json delete mode 100644 CHANGELOG.md create mode 100644 release-please-config.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b19f39e1..fe50d5ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,15 +1,6 @@ name: Build Addon on: - push: - branches: - - main - paths: - - 'packages/**' - - 'package-lock.json' - - 'package.json' - - 'tsconfig.json' - - 'tsconfig.base.json' pull_request: branches: - main diff --git a/.github/workflows/deploy-docker.yml b/.github/workflows/deploy-docker.yml index 5c1e6aea..ba0a3771 100644 --- a/.github/workflows/deploy-docker.yml +++ b/.github/workflows/deploy-docker.yml @@ -1,62 +1,90 @@ -name: Deploy Docker image to GitHub Container Registry and Docker Hub +name: Build and Deploy Docker Images on: - push: - tags: - - 'v*' # Trigger on any tag that starts with 'v' - branches: - - main # Trigger on push to main branch + workflow_dispatch: + inputs: + ref: + description: Git Ref + required: true + type: string jobs: - docker: + build: + name: build runs-on: ubuntu-latest + permissions: + packages: write + contents: read steps: - # Checkout the repository - - name: Checkout repository + - name: Checkout uses: actions/checkout@v4 - - # Set up QEMU for multi-platform builds - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - # Set up Docker Buildx - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - # Log in to GitHub Container Registry (GHCR) - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 + ref: ${{inputs.ref}} + token: ${{ secrets.GITHUB_TOKEN }} - # Log in to Docker Hub - - name: Log in to Docker Hub - if: startsWith(github.ref, 'refs/tags/v') + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - # Build and push Docker image to both GHCR and Docker Hub - - name: Build and push Docker image (tags) - if: startsWith(github.ref, 'refs/tags/v') - uses: docker/build-push-action@v6 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 with: - platforms: linux/amd64,linux/arm64 - push: true - tags: | - ghcr.io/viren070/aiostreams:${{ github.ref_name }} - ghcr.io/viren070/aiostreams:latest - docker.io/${{ secrets.DOCKERHUB_USERNAME }}/aiostreams:${{ github.ref_name }} - docker.io/${{ secrets.DOCKERHUB_USERNAME }}/aiostreams:latest + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - # Build and push Docker image to GHCR only for each commit to main branch - - name: Build and push Docker image (dev) - if: github.ref == 'refs/heads/main' && github.event_name == 'push' + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Buildx + uses: docker/setup-buildx-action@v3 + + - name: Calculate Image Tags + env: + INPUT_REF: ${{inputs.ref}} + run: | + declare TAGS="" + case "${INPUT_REF}" in + v[0-9]*.[0-9]*.[0-9]*) + TAGS="${INPUT_REF}" + if [[ "$(git rev-parse origin/main)" = "$(git rev-parse "${INPUT_REF}")" ]]; then + TAGS="${TAGS} latest" + fi + ;; + [0-9]*.[0-9]*.[0-9]*-nightly) + TAGS="${INPUT_REF} nightly" + ;; + *) + echo "Invalid Input Ref: ${INPUT_REF}" + exit 1 + esac + + if [[ -z "${TAGS}" ]]; then + echo "Empty Tags!" + exit 1 + fi + + { + echo 'DOCKER_IMAGE_TAGS<> "${GITHUB_ENV}" + + cat "${GITHUB_ENV}" + + - name: Build & Push uses: docker/build-push-action@v6 with: + cache-from: type=gha + cache-to: type=gha,mode=max platforms: linux/amd64,linux/arm64 push: true - tags: ghcr.io/viren070/aiostreams:dev + context: . + file: ./Dockerfile + tags: ${{env.DOCKER_IMAGE_TAGS}} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000..28231548 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,57 @@ +name: Nightly Builds + +on: + push: + branches: [main] + +jobs: + release: + name: release + if: ${{ github.ref == 'refs/heads/main' }} + runs-on: ubuntu-latest + permissions: + actions: write + contents: write + pull-requests: write + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Generate timestamp tag + id: gen_tag + run: | + TIMESTAMP=$(date '+%Y.%m.%d.%H%M-nightly') + echo "tag_name=$TIMESTAMP" >> $GITHUB_OUTPUT + + - name: Create git tag + env: + TAG_NAME: ${{ steps.gen_tag.outputs.tag_name }} + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag $TAG_NAME + git push origin $TAG_NAME + + - name: Get commit message + id: commit_msg + run: | + COMMIT_MSG=$(git log -1 --pretty=%B) + echo "commit_msg<> $GITHUB_OUTPUT + echo "$COMMIT_MSG" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Create GitHub prerelease + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release create "${{ steps.gen_tag.outputs.tag_name }}" \ + --repo "${GITHUB_REPOSITORY}" \ + --title "Nightly Build ${{ steps.gen_tag.outputs.tag_name }}" \ + --notes "${{ steps.commit_msg.outputs.commit_msg }}" \ + --prerelease + + - name: Trigger Docker Image Publish + env: + GH_TOKEN: ${{ github.token }} + run: | + gh workflow run --repo ${GITHUB_REPOSITORY} deploy-docker.yml -f ref=${{ steps.gen_tag.outputs.tag_name }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..b706dab7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: Release + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + release: + name: release + if: ${{ github.ref == 'refs/heads/main' }} + runs-on: ubuntu-latest + permissions: + actions: write + contents: write + pull-requests: write + steps: + - name: Release + id: release + uses: google-github-actions/release-please-action@v4 + # with: + # token: ${{ secrets.RELEASE_PLEASE_TOKEN }} + + - name: Trigger Docker Image Publish + if: ${{ steps.release.outputs['release_created'] }} + env: + GH_TOKEN: ${{ github.token }} + TAG_NAME: ${{ steps.release.outputs.tag_name }} + run: | + gh workflow run --repo ${GITHUB_REPOSITORY} deploy-docker.yml -f ref=${TAG_NAME} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..9e1cdeda --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.21.1" +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 491fab41..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,14 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines. - -## [1.14.2](https://github.com/Viren070/aiostreams/compare/v1.14.1...v1.14.2) (2025-03-18) - - -### Bug Fixes - -* attempt to fix release.yml ([960de88](https://github.com/Viren070/aiostreams/commit/960de88cc59304bde772be86d75e2ab88b48d1b6)) -* **easynews-plus:** encode easynews credentials ([71f2ad4](https://github.com/Viren070/aiostreams/commit/71f2ad434fa0bbbfaf93ec489b48752d8ee6f3a1)) -* **easynews:** encode easynews credentials ([e8cd4a4](https://github.com/Viren070/aiostreams/commit/e8cd4a49a058f1b4035b23824cde490c2c598013)) -* extract config string for custom configs when determining whether to encrypt sensitive information ([57649f0](https://github.com/Viren070/aiostreams/commit/57649f07f657941abe3fefd01a2c5b7462b11382)) -* filter out zero counts from skip reasons in logs ([d0db4db](https://github.com/Viren070/aiostreams/commit/d0db4dbf91c415405702f8e64af901f97a60f5b4)) diff --git a/packages/addon/src/manifest.ts b/packages/addon/src/manifest.ts index 891bce51..4c828b60 100644 --- a/packages/addon/src/manifest.ts +++ b/packages/addon/src/manifest.ts @@ -1,5 +1,5 @@ import { Config } from '@aiostreams/types'; -import { version, description } from '../package.json'; +import { version, description } from '../../../package.json'; import { getTextHash, Settings } from '@aiostreams/utils'; const manifest = (config?: Config, configPresent?: boolean) => { diff --git a/packages/frontend/src/app/configure/page.tsx b/packages/frontend/src/app/configure/page.tsx index d9c72963..028e4420 100644 --- a/packages/frontend/src/app/configure/page.tsx +++ b/packages/frontend/src/app/configure/page.tsx @@ -21,7 +21,7 @@ import ServiceInput from '../../components/ServiceInput'; import AddonsList from '../../components/AddonsList'; import { Slide, ToastContainer, toast } from 'react-toastify'; import showToast, { toastOptions } from '@/components/Toasts'; -import addonPackage from '../../../package.json'; +import addonPackage from '../../../../../package.json'; import { formatSize } from '@aiostreams/formatters'; import { allowedFormatters, diff --git a/packages/utils/src/settings.ts b/packages/utils/src/settings.ts index 77fbf35b..a4b3ef30 100644 --- a/packages/utils/src/settings.ts +++ b/packages/utils/src/settings.ts @@ -1,6 +1,6 @@ import dotenv from 'dotenv'; import path from 'path'; -import p from '../package.json'; +import p from '../../../package.json'; import { cleanEnv, str, diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..7d21dead --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/refs/heads/main/schemas/config.json", + "release-type": "simple", + "bump-minor-pre-major": true, + "include-v-in-tag": true, + "packages": { + ".": { + "release-type": "node", + "include-component-in-tag": false, + "exclude-paths": [ + ".env.sample", + ".gitignore", + ".release-please-manifest.json", + "compose.yaml", + "release-please-config.json" + ], + "pull-request-title-pattern": "chore: release ${version}" + } + } +} \ No newline at end of file From bf182225a661c310c1dd6d3af439b7b117222cf3 Mon Sep 17 00:00:00 2001 From: Viren070 Date: Thu, 22 May 2025 21:46:24 +0100 Subject: [PATCH 3/9] ci: use github token for release please --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b706dab7..eb97db0d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,8 +19,8 @@ jobs: - name: Release id: release uses: google-github-actions/release-please-action@v4 - # with: - # token: ${{ secrets.RELEASE_PLEASE_TOKEN }} + with: + token: ${{ secrets.GITHUB_TOKEN }} - name: Trigger Docker Image Publish if: ${{ steps.release.outputs['release_created'] }} From 25f16324ee896ec85dcd5bd49410cde56acdfb68 Mon Sep 17 00:00:00 2001 From: Viren070 Date: Thu, 22 May 2025 21:46:37 +0100 Subject: [PATCH 4/9] ci: remove nightly build text in release title --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 28231548..d98b6198 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -46,7 +46,7 @@ jobs: run: | gh release create "${{ steps.gen_tag.outputs.tag_name }}" \ --repo "${GITHUB_REPOSITORY}" \ - --title "Nightly Build ${{ steps.gen_tag.outputs.tag_name }}" \ + --title "${{ steps.gen_tag.outputs.tag_name }}" \ --notes "${{ steps.commit_msg.outputs.commit_msg }}" \ --prerelease From ab3ac1090a70403b7d989d7ac437acf622477160 Mon Sep 17 00:00:00 2001 From: Viren070 Date: Thu, 22 May 2025 21:54:06 +0100 Subject: [PATCH 5/9] ci: use pat --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb97db0d..eac1f66a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: id: release uses: google-github-actions/release-please-action@v4 with: - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.RELEASE_PLEASE_TOKEN }} - name: Trigger Docker Image Publish if: ${{ steps.release.outputs['release_created'] }} From b41e210c04777b349629dc98f28982bfb2e54886 Mon Sep 17 00:00:00 2001 From: Viren070 Date: Thu, 22 May 2025 22:03:20 +0100 Subject: [PATCH 6/9] feat: pass `baseUrl` in Easynews++ config and add optional `EASYNEWS_PLUS_PLUS_PUBLIC_URL`. --- packages/utils/src/settings.ts | 4 ++++ packages/wrappers/src/easynewsPlusPlus.ts | 3 +++ 2 files changed, 7 insertions(+) diff --git a/packages/utils/src/settings.ts b/packages/utils/src/settings.ts index a4b3ef30..366a43da 100644 --- a/packages/utils/src/settings.ts +++ b/packages/utils/src/settings.ts @@ -540,6 +540,10 @@ export const Settings = cleanEnv(process.env, { default: 'https://easynews-cloudflare-worker.jqrw92fchz.workers.dev/', desc: 'Easynews++ URL', }), + EASYNEWS_PLUS_PLUS_PUBLIC_URL: url({ + default: undefined, + desc: 'Easynews++ public URL', + }), DEFAULT_EASYNEWS_PLUS_PLUS_TIMEOUT: num({ default: undefined, desc: 'Default Easynews++ timeout', diff --git a/packages/wrappers/src/easynewsPlusPlus.ts b/packages/wrappers/src/easynewsPlusPlus.ts index e4410ea9..5d079191 100644 --- a/packages/wrappers/src/easynewsPlusPlus.ts +++ b/packages/wrappers/src/easynewsPlusPlus.ts @@ -57,6 +57,9 @@ const getEasynewsPlusPlusConfigString = ( showQualities: '4k,1080p,720p,480p', maxResultsPerQuality: '', maxFileSize: '', + baseUrl: ( + Settings.EASYNEWS_PLUS_PLUS_PUBLIC_URL || Settings.EASYNEWS_PLUS_PLUS_URL + ).replace(/\/$/, ''), }; return encodeURIComponent(JSON.stringify(options)); }; From 6c86a49668acb1f812267cd01ef903f77d1b3f23 Mon Sep 17 00:00:00 2001 From: Viren070 Date: Thu, 22 May 2025 22:18:29 +0100 Subject: [PATCH 7/9] docs: use different badges for build status and version --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3453791c..1da295d4 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,10 @@

- Discord Server + Discord Server - version + version GitHub Stars From 289e53a4050099c965053d036c04ae6b5b6eed73 Mon Sep 17 00:00:00 2001 From: Viren070 Date: Thu, 22 May 2025 22:24:54 +0100 Subject: [PATCH 8/9] ci: only trigger nightly builds on relevant paths --- .github/workflows/nightly.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index d98b6198..308c5622 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -3,6 +3,13 @@ name: Nightly Builds on: push: branches: [main] + paths: + - 'packages/**' + - 'package-lock.json' + - 'package.json' + - 'tsconfig.json' + - 'tsconfig.base.json' + - 'Dockerfile' jobs: release: From 927cb7f90f22ce87ee42ef3ef23c95e8b83e7914 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 22 May 2025 22:28:40 +0100 Subject: [PATCH 9/9] chore: release 1.22.0 (#175) Co-authored-by: Viren070 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 9e1cdeda..397c4203 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.21.1" + ".": "1.22.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..c227547f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# Changelog + +## [1.22.0](https://github.com/Viren070/AIOStreams/compare/v1.21.1...v1.22.0) (2025-05-22) + + +### Features + +* pass `baseUrl` in Easynews++ config and add optional `EASYNEWS_PLUS_PLUS_PUBLIC_URL`. ([b41e210](https://github.com/Viren070/AIOStreams/commit/b41e210c04777b349629dc98f28982bfb2e54886)) +* stremthru improvements ([#172](https://github.com/Viren070/AIOStreams/issues/172)) ([72b5ab6](https://github.com/Viren070/AIOStreams/commit/72b5ab648e511220d7ff8b4bf453db94bb952b30)) diff --git a/package-lock.json b/package-lock.json index 50c9f4f7..269afe78 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "aiostreams", - "version": "1.21.1", + "version": "1.22.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "aiostreams", - "version": "1.21.1", + "version": "1.22.0", "license": "MIT", "workspaces": [ "packages/*" diff --git a/package.json b/package.json index bc24b516..9c61df8a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aiostreams", - "version": "1.21.1", + "version": "1.22.0", "description": "Stremio addon to combine streams into one addon", "main": "dist/server.js", "scripts": {