refactor: Use python scripts and remove unnessecary manifests (#2876)

Co-authored-by: jmir1 <jhmiramon@gmail.com>
This commit is contained in:
Claudemirovsky 2024-02-05 19:31:21 -03:00 committed by GitHub
parent 3d05621bb1
commit 5068d25516
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
184 changed files with 292 additions and 536 deletions

108
.github/scripts/create-repo.py vendored Normal file
View file

@ -0,0 +1,108 @@
import json
import os
import re
import subprocess
from pathlib import Path
from zipfile import ZipFile
PACKAGE_NAME_REGEX = re.compile(r"package: name='([^']+)'")
VERSION_CODE_REGEX = re.compile(r"versionCode='([^']+)'")
VERSION_NAME_REGEX = re.compile(r"versionName='([^']+)'")
IS_NSFW_REGEX = re.compile(r"'tachiyomi.animeextension.nsfw' value='([^']+)'")
APPLICATION_LABEL_REGEX = re.compile(r"^application-label:'([^']+)'", re.MULTILINE)
APPLICATION_ICON_320_REGEX = re.compile(
r"^application-icon-320:'([^']+)'", re.MULTILINE
)
LANGUAGE_REGEX = re.compile(r"aniyomi-([^\.]+)")
*_, ANDROID_BUILD_TOOLS = (Path(os.environ["ANDROID_HOME"]) / "build-tools").iterdir()
REPO_DIR = Path("repo")
REPO_APK_DIR = REPO_DIR / "apk"
REPO_ICON_DIR = REPO_DIR / "icon"
REPO_ICON_DIR.mkdir(parents=True, exist_ok=True)
with open("output.json", encoding="utf-8") as f:
inspector_data = json.load(f)
index_data = []
index_min_data = []
for apk in REPO_APK_DIR.iterdir():
badging = subprocess.check_output(
[
ANDROID_BUILD_TOOLS / "aapt",
"dump",
"--include-meta-data",
"badging",
apk,
]
).decode()
package_info = next(x for x in badging.splitlines() if x.startswith("package: "))
package_name = PACKAGE_NAME_REGEX.search(package_info).group(1)
application_icon = APPLICATION_ICON_320_REGEX.search(badging).group(1)
with ZipFile(apk) as z, z.open(application_icon) as i, (
REPO_ICON_DIR / f"{package_name}.png"
).open("wb") as f:
f.write(i.read())
language = LANGUAGE_REGEX.search(apk.name).group(1)
sources = inspector_data[package_name]
if len(sources) == 1:
source_language = sources[0]["lang"]
if (
source_language != language
and source_language not in {"all", "other"}
and language not in {"all", "other"}
):
language = source_language
common_data = {
"name": APPLICATION_LABEL_REGEX.search(badging).group(1),
"pkg": package_name,
"apk": apk.name,
"lang": language,
"code": int(VERSION_CODE_REGEX.search(package_info).group(1)),
"version": VERSION_NAME_REGEX.search(package_info).group(1),
"nsfw": int(IS_NSFW_REGEX.search(badging).group(1)),
}
min_data = {
**common_data,
"sources": [],
}
for source in sources:
min_data["sources"].append(
{
"name": source["name"],
"lang": source["lang"],
"id": source["id"],
"baseUrl": source["baseUrl"],
}
)
index_min_data.append(min_data)
index_data.append(
{
**common_data,
"hasReadme": 0,
"hasChangelog": 0,
"sources": sources,
}
)
index_data.sort(key=lambda x: x["pkg"])
index_min_data.sort(key=lambda x: x["pkg"])
with (REPO_DIR / "index.json").open("w", encoding="utf-8") as f:
index_data_str = json.dumps(index_data, ensure_ascii=False, indent=2)
print(index_data_str)
f.write(index_data_str)
with (REPO_DIR / "index.min.json").open("w", encoding="utf-8") as f:
json.dump(index_min_data, f, ensure_ascii=False, separators=(",", ":"))

View file

@ -1,69 +0,0 @@
#!/bin/bash
set -e
TOOLS="$(ls -d ${ANDROID_HOME}/build-tools/* | tail -1)"
mkdir -p repo/apk
mkdir -p repo/icon
cp -f apk/* repo/apk
cd repo
APKS=( ../apk/*".apk" )
for APK in ${APKS[@]}; do
FILENAME=$(basename ${APK})
BADGING="$(${TOOLS}/aapt dump --include-meta-data badging $APK)"
PACKAGE=$(echo "$BADGING" | grep package:)
PKGNAME=$(echo $PACKAGE | grep -Po "package: name='\K[^']+")
VCODE=$(echo $PACKAGE | grep -Po "versionCode='\K[^']+")
VNAME=$(echo $PACKAGE | grep -Po "versionName='\K[^']+")
NSFW=$(echo $BADGING | grep -Po "tachiyomi.animeextension.nsfw' value='\K[^']+")
HASREADME=$(echo $BADGING | grep -Po "tachiyomi.animeextension.hasReadme' value='\K[^']+")
HASCHANGELOG=$(echo $BADGING | grep -Po "tachiyomi.animeextension.hasChangelog' value='\K[^']+")
APPLICATION=$(echo "$BADGING" | grep application:)
LABEL=$(echo $APPLICATION | grep -Po "label='\K[^']+")
LANG=$(echo $APK | grep -Po "aniyomi-\K[^\.]+")
ICON=$(echo "$BADGING" | grep -Po "application-icon-320.*'\K[^']+")
unzip -p $APK $ICON > icon/${PKGNAME}.png
# TODO: legacy icons; remove after a while
cp icon/${PKGNAME}.png icon/${FILENAME%.*}.png
SOURCE_INFO=$(jq ".[\"$PKGNAME\"]" < ../output.json)
# Fixes the language code without needing to update the packages.
SOURCE_LEN=$(echo $SOURCE_INFO | jq length)
if [ $SOURCE_LEN = "1" ]; then
SOURCE_LANG=$(echo $SOURCE_INFO | jq -r '.[0].lang')
if [ $SOURCE_LANG != $LANG ] && [ $SOURCE_LANG != "all" ] && [ $SOURCE_LANG != "other" ] && [ $LANG != "all" ] && [ $LANG != "other" ]; then
LANG=$SOURCE_LANG
fi
fi
jq -n \
--arg name "$LABEL" \
--arg pkg "$PKGNAME" \
--arg apk "$FILENAME" \
--arg lang "$LANG" \
--argjson code $VCODE \
--arg version "$VNAME" \
--argjson nsfw $NSFW \
--argjson hasReadme $HASREADME \
--argjson hasChangelog $HASCHANGELOG \
--argjson sources "$SOURCE_INFO" \
'{name:$name, pkg:$pkg, apk:$apk, lang:$lang, code:$code, version:$version, nsfw:$nsfw, hasReadme:$hasReadme, hasChangelog:$hasChangelog, sources:$sources}'
done | jq -sr '[.[]]' > index.json
# Alternate minified copy
jq -c '.' < index.json > index.min.json
cat index.json

16
.github/scripts/move-apks.py vendored Normal file
View file

@ -0,0 +1,16 @@
from pathlib import Path
import shutil
REPO_APK_DIR = Path("repo/apk")
try:
shutil.rmtree(REPO_APK_DIR)
except FileNotFoundError:
pass
REPO_APK_DIR.mkdir(parents=True, exist_ok=True)
for apk in (Path.home() / "apk-artifacts").glob("**/*.apk"):
apk_name = apk.name.replace("-release.apk", ".apk")
shutil.move(apk, REPO_APK_DIR / apk_name)

View file

@ -1,26 +0,0 @@
#!/bin/bash
set -e
shopt -s globstar nullglob extglob
# Get APKs from previous jobs' artifacts
cp -R ~/apk-artifacts/ $PWD
APKS=( **/*".apk" )
# Fail if too little extensions seem to have been built
if [ "${#APKS[@]}" -le "50" ]; then
echo "Insufficient amount of APKs found. Please check the project configuration."
exit 1
else
echo "Moving ${#APKS[@]} APKs"
fi
DEST=$PWD/apk
rm -rf $DEST && mkdir -p $DEST
for APK in ${APKS[@]}; do
BASENAME=$(basename $APK)
APKNAME="${BASENAME%%+(-release*)}.apk"
APKDEST="$DEST/$APKNAME"
cp $APK $APKDEST
done

View file

@ -12,7 +12,7 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v8
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Close everything older than ~6 months

View file

@ -2,9 +2,11 @@ name: PR build check
on:
pull_request:
paths-ignore:
- '**.md'
- '.github/workflows/issue_moderator.yml'
paths:
- '**'
- '!**.md'
- '!.github/**'
- '.github/workflows/build_pull_request.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
@ -26,20 +28,20 @@ jobs:
CI_MODULE_GEN: true
steps:
- name: Clone repo
uses: actions/checkout@v4
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/wrapper-validation-action@27152f6fa06a6b8062ef7195c795692e51fc2c81 # v2
- name: Set up JDK
uses: actions/setup-java@v4
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4
with:
java-version: 17
distribution: adopt
distribution: temurin
- id: get-changed-files
name: Get changed files
uses: Ana06/get-changed-files@v2.2.0
uses: Ana06/get-changed-files@e0c398b7065a8d84700c471b6afc4116d1ba4e96 # v2.2.0
- id: parse-changed-files
name: Parse changed files
@ -64,11 +66,12 @@ jobs:
echo "isIndividualChanged=$isIndividualChanged" >> $GITHUB_OUTPUT
echo "isMultisrcChanged=$isMultisrcChanged" >> $GITHUB_OUTPUT
- name: Set up Gradle
uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3
- name: Generate multisrc sources
if: ${{ steps.parse-changed-files.outputs.isMultisrcChanged == '1' }}
uses: gradle/gradle-build-action@v2
with:
arguments: :multisrc:generateExtensions
run: ./gradlew :multisrc:generateExtensions
- name: Get number of modules
run: |
@ -80,7 +83,7 @@ jobs:
- id: generate-matrices
name: Create output matrices
uses: actions/github-script@v7
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
script: |
const numIndividualModules = process.env.NUM_INDIVIDUAL_MODULES;
@ -105,30 +108,29 @@ jobs:
matrix: ${{ fromJSON(needs.prepare.outputs.multisrcMatrix) }}
steps:
- name: Checkout PR
uses: actions/checkout@v4
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Set up JDK
uses: actions/setup-java@v4
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4
with:
java-version: 17
distribution: adopt
distribution: temurin
- name: Generate sources from the multi-source library
uses: gradle/gradle-build-action@v2
env:
CI_MODULE_GEN: "true"
- name: Set up Gradle
uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3
with:
arguments: :multisrc:generateExtensions
cache-read-only: true
- name: Generate sources from the multi-source library
env:
CI_MODULE_GEN: "true"
run: ./gradlew :multisrc:generateExtensions
- name: Build extensions (chunk ${{ matrix.chunk }})
uses: gradle/gradle-build-action@v2
env:
CI_MULTISRC: "true"
CI_CHUNK_NUM: ${{ matrix.chunk }}
with:
arguments: assembleDebug
cache-read-only: true
run: ./gradlew assembleDebug
build_individual:
name: Build individual modules
@ -139,19 +141,21 @@ jobs:
matrix: ${{ fromJSON(needs.prepare.outputs.individualMatrix) }}
steps:
- name: Checkout PR
uses: actions/checkout@v4
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Set up JDK
uses: actions/setup-java@v4
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4
with:
java-version: 17
distribution: adopt
distribution: temurin
- name: Set up Gradle
uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3
with:
cache-read-only: true
- name: Build extensions (chunk ${{ matrix.chunk }})
uses: gradle/gradle-build-action@v2
env:
CI_MULTISRC: "false"
CI_CHUNK_NUM: ${{ matrix.chunk }}
with:
arguments: assembleDebug
cache-read-only: true
run: ./gradlew assembleDebug

View file

@ -4,9 +4,12 @@ on:
push:
branches:
- master
paths-ignore:
- '**.md'
- '.github/workflows/issue_moderator.yml'
paths:
- '**'
- '!**.md'
- '!.github/**'
- '.github/scripts/**'
- '.github/workflows/build_push.yml'
concurrency:
group: ${{ github.workflow }}
@ -26,46 +29,48 @@ jobs:
CI_MODULE_GEN: true
steps:
- name: Clone repo
uses: actions/checkout@v4
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
ref: master
token: ${{ secrets.ANIYOMIORG_BOT_PAT }}
- name: Find lib changes
id: modified-libs
uses: tj-actions/changed-files@v40
uses: tj-actions/changed-files@90a06d6ba9543371ab4df8eeca0be07ca6054959 #v42
with:
files: lib/**
files: lib/
files_ignore: lib/**.md
files_separator: " "
# This step is going to commit, but this will not trigger another workflow.
safe_output: false
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
# This step is going to commit, but this will not trigger another workflow.
- name: Bump extensions that uses a modified lib
if: steps.modified-libs.outputs.any_changed == 'true'
run: |
./.github/scripts/bump-versions.sh ${{ steps.modified-libs.outputs.all_changed_files }}
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/wrapper-validation-action@27152f6fa06a6b8062ef7195c795692e51fc2c81 # v2
- name: Set up JDK
uses: actions/setup-java@v4
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4
with:
java-version: 17
distribution: adopt
distribution: temurin
- name: Set up Gradle
uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3
- name: Generate multisrc sources
uses: gradle/gradle-build-action@v2
with:
arguments: :multisrc:generateExtensions
run: ./gradlew :multisrc:generateExtensions
- name: Get number of modules
run: |
@ -77,7 +82,7 @@ jobs:
- id: generate-matrices
name: Create output matrices
uses: actions/github-script@v7
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
script: |
const numIndividualModules = process.env.NUM_INDIVIDUAL_MODULES;
@ -101,40 +106,39 @@ jobs:
matrix: ${{ fromJSON(needs.prepare.outputs.multisrcMatrix) }}
steps:
- name: Checkout master branch
uses: actions/checkout@v4
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
ref: master
- name: Set up JDK
uses: actions/setup-java@v4
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4
with:
java-version: 17
distribution: adopt
distribution: temurin
- name: Prepare signing key
run: |
echo ${{ secrets.SIGNING_KEY }} | base64 -d > signingkey.jks
- name: Set up Gradle
uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3
- name: Generate sources from the multi-source library
uses: gradle/gradle-build-action@v2
env:
CI_MODULE_GEN: "true"
with:
arguments: :multisrc:generateExtensions
run: ./gradlew :multisrc:generateExtensions
- name: Build extensions (chunk ${{ matrix.chunk }})
uses: gradle/gradle-build-action@v2
env:
CI_MULTISRC: "true"
CI_CHUNK_NUM: ${{ matrix.chunk }}
ALIAS: ${{ secrets.ALIAS }}
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
with:
arguments: assembleRelease
run: ./gradlew assembleRelease
- name: Upload APKs (chunk ${{ matrix.chunk }})
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4
if: "github.repository == 'aniyomiorg/aniyomi-extensions'"
with:
name: "multisrc-apks-${{ matrix.chunk }}"
@ -152,33 +156,34 @@ jobs:
matrix: ${{ fromJSON(needs.prepare.outputs.individualMatrix) }}
steps:
- name: Checkout master branch
uses: actions/checkout@v4
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
ref: master
- name: Set up JDK
uses: actions/setup-java@v4
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4
with:
java-version: 17
distribution: adopt
distribution: temurin
- name: Prepare signing key
run: |
echo ${{ secrets.SIGNING_KEY }} | base64 -d > signingkey.jks
- name: Set up Gradle
uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3
- name: Build extensions (chunk ${{ matrix.chunk }})
uses: gradle/gradle-build-action@v2
env:
CI_MULTISRC: "false"
CI_CHUNK_NUM: ${{ matrix.chunk }}
ALIAS: ${{ secrets.ALIAS }}
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
with:
arguments: assembleRelease
run: ./gradlew assembleRelease
- name: Upload APKs (chunk ${{ matrix.chunk }})
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4
if: "github.repository == 'aniyomiorg/aniyomi-extensions'"
with:
name: "individual-apks-${{ matrix.chunk }}"
@ -197,18 +202,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download APK artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4
with:
path: ~/apk-artifacts
- name: Set up JDK
uses: actions/setup-java@v4
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4
with:
java-version: 17
distribution: adopt
distribution: temurin
- name: Checkout master branch
uses: actions/checkout@v4
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
ref: master
path: master
@ -216,21 +221,22 @@ jobs:
- name: Create repo artifacts
run: |
cd master
./.github/scripts/move-apks.sh
python ./.github/scripts/move-apks.py
INSPECTOR_LINK="$(curl -s "https://api.github.com/repos/aniyomiorg/aniyomi-extensions-inspector/releases/latest" | jq -r '.assets[0].browser_download_url')"
curl -L "$INSPECTOR_LINK" -o ./Inspector.jar
java -jar ./Inspector.jar "apk" "output.json" "tmp"
./.github/scripts/create-repo.sh
java -jar ./Inspector.jar "repo/apk" "output.json" "tmp"
python ./.github/scripts/create-repo.py
- name: Checkout repo branch
uses: actions/checkout@v4
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
repository: aniyomiorg/aniyomi-extensions
token: ${{ secrets.ANIYOMIORG_BOT_PAT }}
ref: repo
path: repo
token: ${{ secrets.ANIYOMIORG_BOT_PAT }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

View file

@ -14,9 +14,8 @@ jobs:
permissions:
issues: write
steps:
- uses: dessant/lock-threads@v5
- uses: dessant/lock-threads@1bf7ec25051fe7c00bdd17e6a7cf3d7bfb7dc771 # v5
with:
github-token: ${{ github.token }}
issue-inactive-days: '2'
pr-inactive-days: '2'
process-only: 'issues, prs'

View file

@ -184,7 +184,7 @@ The simplest extension structure looks like this:
```console
$ tree src/<lang>/<mysourcename>/
src/<lang>/<mysourcename>/
├── AndroidManifest.xml
├── AndroidManifest.xml (optional)
├── build.gradle
├── build.gradle
├── res
@ -215,18 +215,19 @@ src/<lang>/<mysourcename>/
should be adapted from the site name, and can only contain lowercase ASCII letters and digits.
Your extension code must be placed in the package `eu.kanade.tachiyomi.animeextension.<lang>.<mysourcename>`.
#### AndroidManifest.xml
A minimal [Android manifest file](https://developer.android.com/guide/topics/manifest/manifest-intro) is needed for Android to recognize a extension when it's compiled into an APK file. You can also add intent filters inside this file (see [URL intent filter](#url-intent-filter) for more information).
#### AndroidManifest.xml (optional)
You only need to create this file if you want to add deep linking to your extension.
See [URL intent filter](#url-intent-filter) for more information.
#### build.gradle
Make sure that your new extension's `build.gradle` file follows the following structure:
```gradle
```groovy
ext {
extName = '<My source name>'
extClass = '.<MySourceName>'
extVersionCode = 1
containsNsfw = true
isNsfw = true
}
apply from: "$rootDir/common.gradle"
@ -237,10 +238,9 @@ apply from: "$rootDir/common.gradle"
| `extName` | The name of the extension. Should be romanized if site name is not in English.|
| `extClass` | Points to the class that implements `AnimeSource`. You can use a relative path starting with a dot (the package name is the base path). This is used to find and instantiate the source(s). |
| `extVersionCode` | The extension version code. This must be a positive integer and incremented with any change to the code. |
| `libVersion` | (Optional, defaults to `14`) The version of the [extensions library](https://github.com/aniyomiorg/extensions-lib) used. |
| `containsNsfw` | (Optional, defaults to `false`) Flag to indicate that a source contains NSFW content. |
| `isNsfw` | (Optional, defaults to `false`) Flag to indicate that a source contains NSFW content. |
The extension's version name is generated automatically by concatenating `libVersion` and `extVersionCode`. With the example used above, the version would be `14`.
The extension's version name is generated automatically by concatenating `14` and `extVersionCode`. With the example used above, the version would be `14.1`.
### Core dependencies
@ -250,31 +250,31 @@ Extensions rely on [extensions-lib](https://github.com/aniyomiorg/extensions-lib
#### CryptoAES library
The [`lib-cryptoaes`](https://github.com/aniyomiorg/aniyomi-extensions/tree/master/lib/cryptoaes) provides utilities for decrypting AES-encrypted data, like data encrypted with AES+EvpKDF (The key-derivation algorithm used by the [cryptojs](https://cryptojs.gitbook.io/docs/) library). It also includes some utilities to decrypt strings in the [jsfuck](https://jsfuck.com/) format.
The [`cryptoaes`](https://github.com/aniyomiorg/aniyomi-extensions/tree/master/lib/cryptoaes) provides utilities for decrypting AES-encrypted data, like data encrypted with AES+EvpKDF (The key-derivation algorithm used by the [cryptojs](https://cryptojs.gitbook.io/docs/) library). It also includes some utilities to decrypt strings in the [jsfuck](https://jsfuck.com/) format.
```gradle
```groovy
dependencies {
implementation(project(":lib-cryptoaes"))
implementation(project(":lib:cryptoaes"))
}
```
#### Unpacker library
The [`lib-unpacker`](https://github.com/aniyomiorg/aniyomi-extensions/tree/master/lib/unpacker) library provides a deobfuscator(unpacker) for javascript code obfuscated with the [jspacker](http://dean.edwards.name/packer/) algorithm.
The [`unpacker`](https://github.com/aniyomiorg/aniyomi-extensions/tree/master/lib/unpacker) library provides a deobfuscator(unpacker) for javascript code obfuscated with the [jspacker](http://dean.edwards.name/packer/) algorithm.
```gradle
```groovy
dependencies {
implementation(project(":lib-unpacker"))
implementation(project(":lib:unpacker"))
}
```
#### Synchrony library
[`lib-synchrony`](https://github.com/aniyomiorg/aniyomi-extensions/tree/master/lib/synchrony) is a library that bundles and runs the [synchrony](https://github.com/relative/synchrony) deobfuscator with your extension to help when deobfuscating obfuscated javascript. Useful to get data on highly obfuscated javascript code.
[`synchrony`](https://github.com/aniyomiorg/aniyomi-extensions/tree/master/lib/synchrony) is a library that bundles and runs the [synchrony](https://github.com/relative/synchrony) deobfuscator with your extension to help when deobfuscating obfuscated javascript. Useful to get data on highly obfuscated javascript code.
```gradle
```groovy
dependencies {
implementation(project(":lib-synchrony"))
implementation(project(":lib:synchrony"))
}
```
@ -707,6 +707,6 @@ Please **do test your changes by compiling it through Android Studio** before su
- Update `extVersionCode` value in `build.gradle` for individual extensions
- Update `overrideVersionCode` or `baseVersionCode` as needed for all multisrc extensions
- Reference all related issues in the PR body (e.g. "Closes #xyz")
- Add the `containsNsfw = true` flag in `build.gradle` when appropriate
- Add the `isNsfw = true` flag in `build.gradle` when appropriate
- Explicitly kept the `id` if a source's name or language were changed
- Test the modifications by compiling and running the extension through Android Studio

View file

@ -3,6 +3,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlinx-serialization'
apply plugin: 'org.jmailen.kotlinter'
assert !ext.has("pkgNameSuffix")
assert !ext.has("libVersion")
assert extName.chars().max().asInt < 0x180 : "Extension name should be romanized"
android {
compileSdkVersion AndroidConfig.compileSdk
namespace AndroidConfig.namespace
@ -26,27 +31,15 @@ android {
targetSdkVersion AndroidConfig.targetSdk
applicationIdSuffix project.parent.name + "." + project.name
versionCode extVersionCode
versionName project.ext.properties.getOrDefault("libVersion", "14") + ".$extVersionCode"
versionName "14.$extVersionCode"
base {
archivesName = "aniyomi-$applicationIdSuffix-v$versionName"
}
def readmes = project.projectDir.listFiles({ File file ->
file.name.equals("README.md") ||
file.name.equals("CHANGELOG.md")
} as FileFilter)
def hasReadme = readmes != null && readmes.any { File file ->
file.name.startsWith("README")
}
def hasChangelog = readmes != null && readmes.any { File file ->
file.name.startsWith("CHANGELOG")
}
assert extClass.startsWith(".")
manifestPlaceholders = [
appName : "Aniyomi: $extName",
extClass: extClass,
extFactory: project.ext.properties.getOrDefault("extFactory", ""),
nsfw: project.ext.properties.getOrDefault("containsNsfw", false) ? 1 : 0,
hasReadme: hasReadme ? 1 : 0,
hasChangelog: hasChangelog ? 1 : 0,
nsfw: project.ext.find("isNsfw") ? 1 : 0,
]
}
@ -104,6 +97,20 @@ configurations.all {
}
}
tasks.register("writeManifestFile") {
doLast {
def manifest = android.sourceSets.getByName("main").manifest
if (!manifest.srcFile.exists()) {
File tempFile = layout.buildDirectory.get().file("tempAndroidManifest.xml").getAsFile()
if (!tempFile.exists()) {
tempFile.withWriter {
it.write('<?xml version="1.0" encoding="utf-8"?>\n<manifest />\n')
}
}
manifest.srcFile(tempFile.path)
}
}
}
preBuild.dependsOn(lintKotlin)
preBuild.dependsOn(writeManifestFile, lintKotlin)
lintKotlin.dependsOn(formatKotlin)

View file

@ -6,10 +6,7 @@
<application android:icon="@mipmap/ic_launcher" android:allowBackup="false" android:label="${appName}">
<meta-data android:name="tachiyomi.animeextension.class" android:value="${extClass}" />
<meta-data android:name="tachiyomi.animeextension.factory" android:value="${extFactory}" />
<meta-data android:name="tachiyomi.animeextension.nsfw" android:value="${nsfw}" />
<meta-data android:name="tachiyomi.animeextension.hasReadme" android:value="${hasReadme}" />
<meta-data android:name="tachiyomi.animeextension.hasChangelog" android:value="${hasChangelog}" />
</application>

View file

@ -51,7 +51,7 @@ interface ThemeSourceGenerator {
return listOf("eu", "kanade", "tachiyomi", "multisrc", themePkg).joinToString(separator)
}
private fun writeGradle(gradle: File, source: ThemeSourceData, themePkg: String, baseVersionCode: Int, defaultAdditionalGradlePath: String, additionalGradleOverridePath: String) {
private fun writeGradle(gradle: File, source: ThemeSourceData, baseVersionCode: Int, defaultAdditionalGradlePath: String, additionalGradleOverridePath: String) {
fun File.readTextOrEmptyString(): String = if (exists()) readText(Charsets.UTF_8) else ""
val defaultAdditionalGradleText = File(defaultAdditionalGradlePath).readTextOrEmptyString()
@ -72,9 +72,8 @@ interface ThemeSourceGenerator {
|ext {
| extName = '${source.name}'
| extClass = '.${source.className}'
| extFactory = '$themePkg'
| extVersionCode = ${baseVersionCode + source.overrideVersionCode + MULTISRC_LIBRARY_VERSION}
| ${if (source.isNsfw) "containsNsfw = true\n" else ""}
| ${if (source.isNsfw) "isNsfw = true\n" else ""}
|}
|
|apply from: "${'$'}rootDir/common.gradle"
@ -100,14 +99,6 @@ interface ThemeSourceGenerator {
androidManifestOverride.copyTo(androidManifestFile)
} else if (defaultAndroidManifest.exists()) {
defaultAndroidManifest.copyTo(androidManifestFile)
} else {
androidManifestFile.writeText(
"""
|<?xml version="1.0" encoding="utf-8"?>
|<!-- THIS FILE IS AUTO-GENERATED; DO NOT EDIT -->
|<manifest />
""".trimMargin(),
)
}
}
@ -133,7 +124,7 @@ interface ThemeSourceGenerator {
projectRootFile.deleteRecursively()
projectRootFile.mkdirs()
writeGradle(projectGradleFile, source, themePkg, baseVersionCode, defaultAdditionalGradlePath, additionalGradleOverridePath)
writeGradle(projectGradleFile, source, baseVersionCode, defaultAdditionalGradlePath, additionalGradleOverridePath)
writeAndroidManifest(projectAndroidManifestFile, manifestOverridePath, defaultAndroidManifestPath)
writeSourceClasses(projectSrcPath, srcOverridePath, source, themePkg, themeClass)

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -2,7 +2,7 @@ ext {
extName = 'Jav Guru'
extClass = '.JavGuru'
extVersionCode = 10
containsNsfw = true
isNsfw = true
}
apply from: "$rootDir/common.gradle"

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -2,7 +2,7 @@ ext {
extName = 'MissAV'
extClass = '.MissAV'
extVersionCode = 6
containsNsfw = true
isNsfw = true
}
apply from: "$rootDir/common.gradle"

View file

@ -2,7 +2,7 @@ ext {
extName = 'SupJav'
extClass = '.SupJavFactory'
extVersionCode = 2
containsNsfw = true
isNsfw = true
}
apply from: "$rootDir/common.gradle"

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,5 +1,5 @@
ext {
extName = 'أكوام'
extName = 'Akwam'
extClass = '.Akwam'
extVersionCode = 9
}

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,5 +1,5 @@
ext {
extName = 'أنمي بالكوم'
extName = 'Anime Blkom'
extClass = '.AnimeBlkom'
extVersionCode = 17
}

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,5 +1,5 @@
ext {
extName = 'عرب سيد'
extName = 'Arab Seed'
extClass = '.ArabSeed'
extVersionCode = 10
}
@ -10,4 +10,4 @@ dependencies {
implementation(project(":lib:dood-extractor"))
implementation(project(":lib:voe-extractor"))
implementation(project(":lib:streamwish-extractor"))
}
}

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,5 +1,5 @@
ext {
extName = 'فاصل اعلاني'
extName = 'FASELHD'
extClass = '.FASELHD'
extVersionCode = 14
}

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,5 +1,5 @@
ext {
extName = 'توك توك سينما'
extName = 'Tuktuk Cinema'
extClass = '.Tuktukcinema'
extVersionCode = 16
}
@ -14,4 +14,4 @@ dependencies {
implementation(project(':lib:vidbom-extractor'))
implementation(project(':lib:playlist-utils'))
implementation "dev.datlag.jsunpacker:jsunpacker:1.0.1"
}
}

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -2,7 +2,7 @@ ext {
extName = 'Anime-Base'
extClass = '.AnimeBase'
extVersionCode = 19
containsNsfw = true
isNsfw = true
}
apply from: "$rootDir/common.gradle"

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -2,7 +2,7 @@ ext {
extName = 'Anime-Loads'
extClass = '.AnimeLoads'
extVersionCode = 12
containsNsfw = true
isNsfw = true
}
apply from: "$rootDir/common.gradle"

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -2,7 +2,6 @@ ext {
extName = 'AnimeTake'
extClass = '.AnimeTake'
extVersionCode = 4
containsNsfw = false
}
apply from: "$rootDir/common.gradle"
@ -12,4 +11,4 @@ dependencies {
implementation(project(":lib:mp4upload-extractor"))
implementation(project(":lib:filemoon-extractor"))
implementation(project(":lib:gogostream-extractor"))
}
}

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -2,7 +2,7 @@ ext {
extName = 'haho.moe'
extClass = '.HahoMoe'
extVersionCode = 10
containsNsfw = true
isNsfw = true
}
apply from: "$rootDir/common.gradle"

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -2,7 +2,7 @@ ext {
extName = 'hanime.tv'
extClass = '.Hanime'
extVersionCode = 17
containsNsfw = true
isNsfw = true
}
apply from: "$rootDir/common.gradle"

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -2,7 +2,7 @@ ext {
extName = 'HentaiMama'
extClass = '.HentaiMama'
extVersionCode = 7
containsNsfw = true
isNsfw = true
}
apply from: "$rootDir/common.gradle"

View file

@ -2,7 +2,7 @@ ext {
extName = 'Hstream'
extClass = '.Hstream'
extVersionCode = 7
containsNsfw = true
isNsfw = true
}
apply from: "$rootDir/common.gradle"

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -2,7 +2,7 @@ ext {
extName = 'Kawaiifu'
extClass = '.Kawaiifu'
extVersionCode = 4
containsNsfw = true
isNsfw = true
}

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,9 +1,5 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
ext {
extName = 'NollyVerse'
pkgNameSuffix = 'en.nollyverse'
extClass = '.NollyVerse'
extVersionCode = 3
}

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View file

@ -2,7 +2,7 @@ ext {
extName = 'Oppai Stream'
extClass = '.OppaiStream'
extVersionCode = 3
containsNsfw = true
isNsfw = true
}
apply from: "$rootDir/common.gradle"

Some files were not shown because too many files have changed in this diff Show more