From 17dd9f44364efe94bb0e5e4e88109fc4fd149fd7 Mon Sep 17 00:00:00 2001 From: Balackburn Date: Sat, 3 Aug 2024 09:41:58 +0200 Subject: [PATCH] YTLite custom .deb support --- .github/workflows/buildapp.yml | 26 +++++++++++++++----------- Makefile | 12 ++++++------ 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/.github/workflows/buildapp.yml b/.github/workflows/buildapp.yml index da0d7a8..3d62971 100644 --- a/.github/workflows/buildapp.yml +++ b/.github/workflows/buildapp.yml @@ -1,6 +1,3 @@ -# Original idea by @ISnackable. Many thanks to him for handling the most hardest parts! -# https://github.com/ISnackable/CercubePlus/blob/main/.github/workflows/Build.yml - name: Build and Release YTLitePlus on: @@ -16,6 +13,11 @@ on: default: "" required: true type: string + ytlite_deb_url: + description: "Direct URL of the YTLite deb file" + default: "" + required: true + type: string bundle_id: description: "Modify the bundle ID" default: "com.google.ios.youtube" @@ -90,7 +92,6 @@ jobs: - name: Download iOS SDK if: steps.SDK.outputs.cache-hit != 'true' run: | - # Only download the specific SDK version git clone -n --depth=1 --filter=tree:0 https://github.com/theos/sdks/ cd sdks git sparse-checkout set --no-cone iPhoneOS${{ inputs.sdk_version }}.sdk @@ -115,23 +116,25 @@ jobs: - name: Fix Compiling run: | - # Update GNU Make to allow for faster building echo "$(brew --prefix make)/libexec/gnubin" >> $GITHUB_PATH (echo export PATH="/usr/local/opt/make/libexec/gnubin:$PATH" >> ~/.bash_profile) source ~/.bash_profile - - name: Prepare YouTube iPA + - name: Prepare YouTube iPA and YTLite deb run: | # Download and unzip iPA wget "$YOUTUBE_URL" --no-verbose -O main/YouTube.ipa unzip -q main/YouTube.ipa -d main/tmp # Get the version number of the YouTube app and store it echo "YT_VERSION=$(grep -A 1 'CFBundleVersion' main/tmp/Payload/YouTube.app/Info.plist | grep '' | awk -F'[><]' '{print $3}')" >> $GITHUB_ENV - # Get the version number of the latest release - wget -qO- https://github.com/dayanch96/YTLite/releases/latest > main/tmp/release_page.html - YTLITE_VERSION=$(grep -o -E '/tag/v[^"]+' main/tmp/release_page.html | head -n 1 | sed 's/\/tag\/v//') + + # Download YTLite deb + wget "$YTLITE_DEB_URL" --no-verbose -O main/YTLite.deb + # Extract YTLite version from the deb file + YTLITE_VERSION=$(dpkg-deb -f main/YTLite.deb Version) echo "YTLITE_VERSION=${YTLITE_VERSION}" >> $GITHUB_ENV echo $YTLITE_VERSION + # Remove contents in the iPA that interfere with sideloading rm -rf main/tmp/Payload/YouTube.app/_CodeSignature/CodeResources rm -rf main/tmp/Payload/YouTube.app/PlugIns/* @@ -154,6 +157,7 @@ jobs: env: THEOS: ${{ github.workspace }}/theos YOUTUBE_URL: ${{ inputs.decrypted_youtube_url }} + YTLITE_DEB_URL: ${{ inputs.ytlite_deb_url }} - name: Build Package id: build_package @@ -165,7 +169,7 @@ jobs: sed -i '' "s/^PACKAGE_VERSION.*$/PACKAGE_VERSION = ${{ env.YT_VERSION }}-${{ env.YTLITE_VERSION }}/" Makefile sed -i '' "s/^export TARGET.*$/export TARGET = iphone:clang:${{ inputs.sdk_version }}:14.0/" Makefile # Build the package - make package + make YTLITE_DEB_URL=${{ inputs.ytlite_deb_url }} package # Rename the package based on the version (mv "packages/$(ls -t packages | head -n1)" "packages/YTLitePlus_${{ env.YT_VERSION }}_${{ env.YTLITE_VERSION }}.ipa") # Pass package name to the upload step @@ -252,4 +256,4 @@ jobs: run: | REPO_URL="https://github.com/${{ github.repository }}" DELETE_RUNS_URL="$REPO_URL/actions/workflows/delete-workflow-runs.yml" - echo -e '### 🧹 Cleanup\n\nYou can remove previous GitHub Action runs here: '$DELETE_RUNS_URL >> $GITHUB_STEP_SUMMARY + echo -e '### 🧹 Cleanup\n\nYou can remove previous GitHub Action runs here: '$DELETE_RUNS_URL >> $GITHUB_STEP_SUMMARY \ No newline at end of file diff --git a/Makefile b/Makefile index 8400c15..d48fa2a 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ EXTRA_CFLAGS := $(addprefix -I,$(shell find Tweaks/FLEX -name '*.h' -exec dirnam # Allow YouTubeHeader to be accessible using #include <...> export ADDITIONAL_CFLAGS = -I$(THEOS_PROJECT_DIR)/Tweaks -YTLitePlus_INJECT_DYLIBS = Tweaks/YTLite/var/jb/Library/MobileSubstrate/DynamicLibraries/YTLite.dylib .theos/obj/libcolorpicker.dylib .theos/obj/iSponsorBlock.dylib .theos/obj/YTUHD.dylib .theos/obj/YouPiP.dylib .theos/obj/YouTubeDislikesReturn.dylib .theos/obj/YTABConfig.dylib .theos/obj/YouMute.dylib .theos/obj/DontEatMyContent.dylib .theos/obj/YTHoldForSpeed.dylib .theos/obj/YTVideoOverlay.dylib .theos/obj/YouGroupSettings.dylib .theos/obj/YouQuality.dylib .theos/obj/YouTimeStamp.dylib +YTLitePlus_INJECT_DYLIBS = Tweaks/YTLite/Library/MobileSubstrate/DynamicLibraries/YTLite.dylib .theos/obj/libcolorpicker.dylib .theos/obj/iSponsorBlock.dylib .theos/obj/YTUHD.dylib .theos/obj/YouPiP.dylib .theos/obj/YouTubeDislikesReturn.dylib .theos/obj/YTABConfig.dylib .theos/obj/YouMute.dylib .theos/obj/DontEatMyContent.dylib .theos/obj/YTHoldForSpeed.dylib .theos/obj/YTVideoOverlay.dylib .theos/obj/YouGroupSettings.dylib .theos/obj/YouQuality.dylib .theos/obj/YouTimeStamp.dylib YTLitePlus_FILES = YTLitePlus.xm $(shell find Source -name '*.xm' -o -name '*.x' -o -name '*.m') $(shell find Tweaks/FLEX -type f \( -iname \*.c -o -iname \*.m -o -iname \*.mm \)) YTLitePlus_IPA = ./tmp/Payload/YouTube.app YTLitePlus_CFLAGS = -fobjc-arc -Wno-deprecated-declarations -Wno-unsupported-availability-guard -Wno-unused-but-set-variable -DTWEAK_VERSION=$(PACKAGE_VERSION) $(EXTRA_CFLAGS) @@ -27,14 +27,14 @@ SUBPROJECTS += Tweaks/Alderis Tweaks/iSponsorBlock Tweaks/YTUHD Tweaks/YouPiP Tw include $(THEOS_MAKE_PATH)/aggregate.mk YTLITE_PATH = Tweaks/YTLite -YTLITE_VERSION := $(shell wget -qO- "https://github.com/dayanch96/YTLite/releases/latest" | grep -o -E '/tag/v[^"]+' | head -n 1 | sed 's/\/tag\/v//') +YTLITE_VERSION := $(YTLITE_VERSION) YTLITE_DEB = $(YTLITE_PATH)/com.dvntm.ytlite_$(YTLITE_VERSION)_iphoneos-arm64.deb -YTLITE_DYLIB = $(YTLITE_PATH)/var/jb/Library/MobileSubstrate/DynamicLibraries/YTLite.dylib -YTLITE_BUNDLE = $(YTLITE_PATH)/var/jb/Library/Application\ Support/YTLite.bundle +YTLITE_DYLIB = $(YTLITE_PATH)/Library/MobileSubstrate/DynamicLibraries/YTLite.dylib +YTLITE_BUNDLE = $(YTLITE_PATH)/Library/Application\ Support/YTLite.bundle before-package:: @echo -e "==> \033[1mMoving tweak's bundle to Resources/...\033[0m" @mkdir -p Resources/Frameworks/Alderis.framework && find .theos/obj/install/Library/Frameworks/Alderis.framework -maxdepth 1 -type f -exec cp {} Resources/Frameworks/Alderis.framework/ \; - @cp -R Tweaks/YTLite/var/jb/Library/Application\ Support/YTLite.bundle Resources/ + @cp -R Tweaks/YTLite/Library/Application\ Support/YTLite.bundle Resources/ @cp -R Tweaks/YTUHD/layout/Library/Application\ Support/YTUHD.bundle Resources/ @cp -R Tweaks/YouPiP/layout/Library/Application\ Support/YouPiP.bundle Resources/ @cp -R Tweaks/Return-YouTube-Dislikes/layout/Library/Application\ Support/RYD.bundle Resources/ @@ -59,7 +59,7 @@ before-all:: rm -rf $(YTLITE_PATH)/*; \ $(PRINT_FORMAT_BLUE) "Downloading YTLite"; \ echo "YTLITE_VERSION: $(YTLITE_VERSION)"; \ - curl -s -L "https://github.com/dayanch96/YTLite/releases/download/v$(YTLITE_VERSION)/com.dvntm.ytlite_$(YTLITE_VERSION)_iphoneos-arm64.deb" -o $(YTLITE_DEB); \ + curl -s -L "$(YTLITE_DEB_URL)" -o $(YTLITE_DEB); \ tar -xf $(YTLITE_DEB) -C $(YTLITE_PATH); tar -xf $(YTLITE_PATH)/data.tar* -C $(YTLITE_PATH); \ if [[ ! -f $(YTLITE_DYLIB) || ! -d $(YTLITE_BUNDLE) ]]; then \ $(PRINT_FORMAT_ERROR) "Failed to extract YTLite"; exit 1; \