Skip to content

Commit

Permalink
download from google play
Browse files Browse the repository at this point in the history
  • Loading branch information
Lifeismana committed Oct 16, 2024
1 parent 552f4e0 commit 9c3eb86
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 23 deletions.
24 changes: 23 additions & 1 deletion .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,19 @@ on:
- false
required: false
default: "false"
download_source:
description: 'google or apk-pure'
type: choice
options:
- google
- apk-pure
required: false
default: "google"

repository_dispatch:
schedule:
- cron: '0 6 * * TUE,WED,THU,FRI,SAT'
- cron: '0 6 * * WED,THU,FRI,SAT'
- cron: '0 6 * * TUE'

jobs:

Expand Down Expand Up @@ -50,6 +59,16 @@ jobs:
# sudo rm -rf /usr/local/lib/android
# sudo rm -rf /opt/ghc
# sudo rm -rf /opt/hostedtoolcache/CodeQL
- name: Set variables
id: setvars
run: |
if [[ "${{github.event.schedule}}" == '0 6 * * WED,THU,FRI,SAT' ]]; then
echo "::set-output name=source::google"
elif [[ "${{github.event.schedule}}" == '0 6 * * TUE' ]]; then
echo "::set-output name=source::apk-pure"
else
echo "::set-output name=source::${{ inputs.download_source }}"
fi
- uses: actions/checkout@v4
with:
ref: main
Expand All @@ -58,5 +77,8 @@ jobs:
FORCE: ${{ inputs.force }}
APP_TO_PROCESS: ${{ inputs.app_id }}
APP_VERSION: ${{ inputs.version }}
SOURCE: ${{steps.setvars.outputs.source}}
GOOGLE_MAIL: ${{secrets.GOOGLE_MAIL}}
AAS_TOKEN: ${{secrets.AAS_TOKEN}}
GIT_NAME: ${{ secrets.GIT_NAME}}
GIT_EMAIL: ${{ secrets.GIT_EMAIL}}
48 changes: 26 additions & 22 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ MergeDPIPNG()
if [[ ! $(dirname "$FILE") == *-@(ldpi|mdpi|hdpi|xhdpi|xxhdpi|xxxhdpi) ]]; then
continue
fi
if [ -f "$FILE" ]; then
if [[ -f "$FILE" ]]; then
echo "Merging $FILE"
filename=$(basename "$FILE")
folder=$(basename $(dirname "$FILE"))
# test if folder exists in the parent folder if not create it
foldernodpi=$(dirname $(dirname "$FILE"))/${folder%-*}
[ -d $foldernodpi ] || ( mkdir -p "$foldernodpi" && touch "$foldernodpi/.folderisnotreal" )
# if the file already exists in that folder compare pixel count and keep the bigger one
if [ -f "$foldernodpi/$filename" ]; then
if [[ -f "$foldernodpi/$filename" ]]; then
new=($(identify -format "%w %h" "$FILE"))
old=($(identify -format "%w %h" "$foldernodpi/$filename"))
if [ $(expr ${new[0]} \* ${new[1]}) -gt $(expr ${old[0]} \* ${old[1]}) ]; then
if [[ $(expr ${new[0]} \* ${new[1]}) -gt $(expr ${old[0]} \* ${old[1]}) ]]; then
mv -f "$FILE" "$foldernodpi/$filename"
else
rm -f "$FILE"
Expand All @@ -44,27 +44,31 @@ ProcessApp()
{
echo "Processing $1"
previous_version=''
if [ -f $1/resources/AndroidManifest.xml ]; then
if [[ -f $1/resources/AndroidManifest.xml ]]; then
previous_version=$(xpath -q -e "string(/manifest/@android:versionName)" $1/resources/AndroidManifest.xml)
fi
echo "Previous version: $previous_version"
rm -rf $1
mkdir -p $1
if [ -n "$2" ]; then
apkeep -a $1@$2 -d apk-pure $1
for FILE in $1/*@*apk
do
echo "Renaming $FILE"
extension="${FILE##*.}"
filename="${FILE%@*}"
mv $FILE $filename.$extension
done
Commit_message="$1 Version $2"
else
apkeep -a $1 -d apk-pure $1
fi
if [ -f $1/$1.xapk ]; then
unzip -o $1/$1.xapk -d $1
if [[ "$SOURCE" == "apk-pure" || "$SOURCE" == "" ]]; then
if [[ -n "$2" ]]; then
apkeep -a $1@$2 -d apk-pure $1
for FILE in $1/*@*apk
do
echo "Renaming $FILE"
extension="${FILE##*.}"
filename="${FILE%@*}"
mv $FILE $filename.$extension
done
Commit_message="$1 Version $2"
else
apkeep -a $1 -d apk-pure $1
fi
if [[ -f $1/$1.xapk ]]; then
unzip -o $1/$1.xapk -d $1
fi
elif [[ "$SOURCE" == "google" ]]; then
apkeep -a $1 -d google-play -e $GOOGLE_MAIL -t $AAS_TOKEN $1
fi
jadx --deobf --show-bad-code -d $1 $1/$1.apk
find $1 -type f -exec md5sum {} >> $1/$1.apk.jadx.txt \;
Expand All @@ -77,7 +81,7 @@ ProcessApp()
column -t "/tmp/apkunzip.txt" > "$FILE.txt"
done
# decompile bundle
if [ -f $1/resources/assets/index.android.bundle ]; then
if [[ -f $1/resources/assets/index.android.bundle ]]; then
echo "Decompiling $1/resources/assets/index.android.bundle"
hbc-decompiler $1/resources/assets/index.android.bundle $1/resources/assets/index.android.bundle.decompiled.js
hbc-file-parser $1/resources/assets/index.android.bundle > /tmp/index.android.bundle.header.txt
Expand Down Expand Up @@ -107,7 +111,7 @@ ProcessApp()
MergeDPIPNG $1

current_version=''
if [ -f $1/resources/AndroidManifest.xml ]; then
if [[ -f $1/resources/AndroidManifest.xml ]]; then
current_version=$(xpath -q -e "string(/manifest/@android:versionName)" $1/resources/AndroidManifest.xml)
fi
echo "Current version: $current_version"
Expand All @@ -118,7 +122,7 @@ ProcessApp()
fi
}

if [ -n "$APP_TO_PROCESS" ]; then
if [[ -n "$APP_TO_PROCESS" ]]; then
ProcessApp $APP_TO_PROCESS $APP_VERSION
else
for APP in $APPS;
Expand Down

0 comments on commit 9c3eb86

Please sign in to comment.