Skip to content

Commit

Permalink
add extraction check in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
yne committed May 13, 2023
1 parent 7c9be69 commit 334f514
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/push.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: push
name: ci

on:
push:
Expand All @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 10 additions & 8 deletions dzr
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 334f514

Please sign in to comment.