From 8cf717fab6d2892888974b71ea57169a6a45a76b Mon Sep 17 00:00:00 2001 From: Dan <38832025+dayanch96@users.noreply.github.com> Date: Sun, 8 Dec 2024 23:04:14 +0300 Subject: [PATCH] Validates content type --- .github/workflows/main.yml | 15 ++++++++++++--- .github/workflows/ytp_beta.yml | 24 +++++++++++++++++++++--- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9689921..8917250 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -70,6 +70,18 @@ jobs: path: main submodules: recursive + - name: Hide sensitive inputs + uses: levibostian/action-hide-sensitive-inputs@v1 + + - name: Validate IPA URL + run: | + response=$(curl -sI "${{ inputs.ipa_url }}") + content_type=$(echo "$response" | grep -i "Content-Type" | awk '{print $2}' | tr -d '\r') + if [[ "$content_type" != "application/octet-stream" ]]; then + echo "Direct link to the IPA file required. Entered link is not a direct download or does not point to an IPA file." + exit 1 + fi + - name: Install Dependencies run: brew install make ldid @@ -115,9 +127,6 @@ jobs: deb_url="https://github.com/dayanch96/YTLite/releases/download/v${{ inputs.tweak_version }}/com.dvntm.ytlite_${{ inputs.tweak_version }}_iphoneos-arm.deb" wget "$deb_url" --no-verbose -O ${{ github.workspace }}/ytplus.deb - - name: Hide sensitive inputs - uses: levibostian/action-hide-sensitive-inputs@v1 - - name: Download YouTube id: download_youtube run: wget "${{ inputs.ipa_url }}" --no-verbose -O ${{ github.workspace }}/youtube.ipa diff --git a/.github/workflows/ytp_beta.yml b/.github/workflows/ytp_beta.yml index b223503..5a0ca77 100644 --- a/.github/workflows/ytp_beta.yml +++ b/.github/workflows/ytp_beta.yml @@ -70,6 +70,27 @@ jobs: path: main submodules: recursive + - name: Hide sensitive inputs + uses: levibostian/action-hide-sensitive-inputs@v1 + + - name: Validate IPA URL + run: | + response=$(curl -sI "${{ inputs.ipa_url }}") + content_type=$(echo "$response" | grep -i "Content-Type" | awk '{print $2}' | tr -d '\r') + if [[ "$content_type" != "application/octet-stream" ]]; then + echo "Direct link to the IPA file required. Entered link is not a direct download or does not point to an IPA file." + exit 1 + fi + + - name: Validate Tweak URL + run: | + response=$(curl -sI "${{ inputs.tweak_url }}") + content_type=$(echo "$response" | grep -i "Content-Type" | awk '{print $2}' | tr -d '\r') + if [[ "$content_type" != "application/octet-stream" ]]; then + echo "Direct link to the tweak file required. Entered link is not a direct download or does not point to a DEB file." + exit 1 + fi + - name: Install Dependencies run: brew install make ldid @@ -109,9 +130,6 @@ jobs: - name: Install cyan run: pipx install --force https://github.com/asdfzxcvbn/pyzule-rw/archive/main.zip - - name: Hide sensitive inputs - uses: levibostian/action-hide-sensitive-inputs@v1 - - name: Download YouTube id: download_youtube run: wget "${{ inputs.ipa_url }}" --no-verbose -O ${{ github.workspace }}/youtube.ipa