From 334f51444462be2ec2383228276de6f3fcded826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20F?= Date: Sat, 13 May 2023 16:44:16 +0200 Subject: [PATCH] add extraction check in CI --- .github/workflows/{push.yml => ci.yml} | 5 ++++- README.md | 2 +- dzr | 18 ++++++++++-------- 3 files changed, 15 insertions(+), 10 deletions(-) rename .github/workflows/{push.yml => ci.yml} (86%) diff --git a/.github/workflows/push.yml b/.github/workflows/ci.yml similarity index 86% rename from .github/workflows/push.yml rename to .github/workflows/ci.yml index 6651431..26a417c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: push +name: ci on: push: @@ -10,6 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 + - name: check key extract + run: | + [ "$(DZR_CBC= ./dzr ! 2>/dev/null | sha1sum)" = '3ad58d9232a3745ad9308b0669c83b6f7e8dba4d -' ] - name: publish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 37427d7..f57a07a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![dzr logo](.github/.logo.svg) -# DZR: the command line deezer.com player +# DZR: the command line deezer.com player [![ci](https://github.com/yne/dzr/actions/workflows/ci.yml/badge.svg)](https://github.com/yne/dzr/actions/workflows/ci.yml) > ⚠️ For [legal reasons](https://github.com/github/dmca/blob/master/2021/02/2021-02-10-deezer.md) this project > - does not contain any track decryption key diff --git a/dzr b/dzr index cb851cf..a3e3960 100755 --- a/dzr +++ b/dzr @@ -15,24 +15,26 @@ elif [ "$REQUEST_METHOD" = "GET" ] ; then fi [ ! -z "$REQUEST_METHOD" ] && exit -# dependencies check, see: https://github.com/yne/dzr/issues/12 -for c in jq curl dialog openssl $(echo "$PLAYER" | cut -f 1 -d " "); do - command -v $c >/dev/null || { echo "$c is required" 1>&2 ; UNMET_DEPENDENCIES=1;} -done -[ -n "$UNMET_DEPENDENCIES" ] && exit 1; - # extraction + warning by charleywright, see: https://github.com/yne/dzr/issues/11 unscramble(){ printf "${8}${16}${7}${15}${6}${14}${5}${13}${4}${12}${3}${11}${2}${10}${1}${9}";} if [ -z "$DZR_CBC" ]; then - printf "Add the following to your shell profile e.g. ~/.profile or ~/.zshrc:" >&2 + command -v $(echo "$FETCH" | cut -f 1 -d " ") >/dev/null || { echo "key extraction require $FETCH" 1>&2 ; exit 1 ;} + printf "Add the following to your shell profile e.g. ~/.profile or ~/.zshrc:\n" >&2 APP_WEB=$($FETCH -L deezer.com/en/channels/explore | sed -n 's/.*src="\([^"]*app-web[^"]*\).*/\1/p' | xargs $FETCH -L) - TMP_CBC=$(echo "$APP_WEB" | tr ,_ '\n' | sed -n 's/.*\(%5B\(0x[0-9a-f]\{2\}\(%2C\)\?\)\{8\}%5D\).*/\1/p' | sed 's/%../\n/g' | xargs printf '\\%o ') + TMP_CBC=$(echo "$APP_WEB" | tr ,_ '\n' | sed -n 's/.*\(%5B0x..%2C.\{39\}%2C0x..%5D\).*/\1/p' | sed 's/%../\n/g' | xargs printf '\\%o ') export DZR_CBC=$(unscramble $TMP_CBC); printf " export DZR_CBC=$DZR_CBC" >&2 [ "-$@" = "-!" ] && printf '%s' "$DZR_CBC" && exit sleep 2 # give time to read the warning + echo fi +# dependencies check, see: https://github.com/yne/dzr/issues/12 +for c in jq curl dialog openssl $(echo "$PLAYER" | cut -f 1 -d " "); do + command -v $c >/dev/null || { echo "$c is required" 1>&2 ; UNMET_DEPENDENCIES=1;} +done +[ -n "$UNMET_DEPENDENCIES" ] && exit 1; + # main API="api.deezer.com" DLG_LIST="dialog --keep-tite --output-fd 1 --menu $1: 0 0 0"