mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-25 03:48:37 +09:00
✨ Inject reddit id
This commit is contained in:
@@ -53,6 +53,7 @@ jobs:
|
||||
DEBUG_ENABLED: ${{ inputs.DEBUG_ENABLED }}
|
||||
secrets:
|
||||
ENVS: ${{ secrets.ENVS }}
|
||||
REDDIT_CLIENT_ID: ${{ secrets.REDDIT_CLIENT_ID }}
|
||||
|
||||
upload-to-github:
|
||||
name: GitHub Upload
|
||||
|
||||
@@ -13,6 +13,8 @@ on:
|
||||
secrets:
|
||||
ENVS:
|
||||
required: false
|
||||
REDDIT_CLIENT_ID:
|
||||
required: false
|
||||
inputs:
|
||||
FILES_TO_EXPECT:
|
||||
type: string
|
||||
@@ -42,6 +44,38 @@ jobs:
|
||||
run: |
|
||||
echo "${{ secrets.ENVS }}" >> .env
|
||||
|
||||
|
||||
- name: Inject Reddit Client ID
|
||||
env:
|
||||
REDDIT_CLIENT_ID: ${{ secrets.REDDIT_CLIENT_ID }}
|
||||
if: env.REDDIT_CLIENT_ID != null
|
||||
run: |
|
||||
client_id="${REDDIT_CLIENT_ID}"
|
||||
path="apks/options.json"
|
||||
json_data=$(cat "${path}")
|
||||
|
||||
new_object='{
|
||||
"patchName": "Change OAuth client id",
|
||||
"options": [
|
||||
{
|
||||
"key": "client-id",
|
||||
"value": "'${client_id}'"
|
||||
}
|
||||
]
|
||||
}'
|
||||
# Check if an object with the patchName "Change OAuth client id" already exists
|
||||
existing_object_index=$(echo "${json_data}" | jq 'map(.patchName) | index("Change OAuth client id")')
|
||||
echo "${existing_object_index}"
|
||||
if [[ ${existing_object_index} != "null" ]]; then
|
||||
echo "Patch entry already exists. Overriding client ID in it."
|
||||
updated_json=$(echo "${json_data}" | jq ".[${existing_object_index}].options[0].value = \"${client_id}\"")
|
||||
else
|
||||
echo "Patch entry doesn't exists. Adding new entry."
|
||||
updated_json=$(echo "${json_data}" | jq ". += [${new_object}]")
|
||||
fi
|
||||
echo "${updated_json}" > "${path}"
|
||||
|
||||
|
||||
- name: Setup tmate session
|
||||
uses: mxschmitt/action-tmate@v3
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && inputs.DEBUG_ENABLED }}
|
||||
|
||||
@@ -286,5 +286,7 @@ By default, script build the version as recommended by Revanced team.
|
||||
16. Make your Action has write access. If not click [here](https://github.
|
||||
com/nikhilbadyal/docker-py-revanced/settings/actions). In the bottom give read and write access to Actions.
|
||||
<img src="https://i.imgur.com/STSv2D3.png" width="400">
|
||||
17. If you want to patch reddit apps using your own Client ID. You can provide your Client ID
|
||||
as secret `REDDIT_CLIENT_ID` in `GitHub secrets`.
|
||||
|
||||
Thanks to [@aliharslan0](https://github.com/aliharslan0/pyrevanced) for his work.
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
[
|
||||
{
|
||||
"patchName": "Change OAuth client id",
|
||||
"options": [
|
||||
{
|
||||
"key": "client-id",
|
||||
"value": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"patchName": "Custom double tap length",
|
||||
"options": [
|
||||
{
|
||||
"key": "DoubleTapLengthArrays",
|
||||
"value": "3, 5, 10, 15, 20, 30, 60, 120, 180"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"patchName": "Reddit settings",
|
||||
"options": [
|
||||
{
|
||||
"key": "RedditSettings",
|
||||
"value": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"patchName": "Custom Video Speed",
|
||||
"options": [
|
||||
{
|
||||
"key": "CustomSpeedArrays",
|
||||
"value": "0.25, 0.5, 0.75, 0.9, 1.0, 1.12, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0, 4.0, 5.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
client_id="test"
|
||||
path="apks/options.json"
|
||||
json_data=$(cat "${path}")
|
||||
|
||||
new_object='{
|
||||
"patchName": "Change OAuth client id",
|
||||
"options": [
|
||||
{
|
||||
"key": "client-id",
|
||||
"value": "'${client_id}'"
|
||||
}
|
||||
]
|
||||
}'
|
||||
# Check if an object with the patchName "Change OAuth client id" already exists
|
||||
existing_object_index=$(echo "${json_data}" | jq 'map(.patchName) | index("Change OAuth client id")')
|
||||
echo "${existing_object_index}"
|
||||
if [[ ${existing_object_index} != "null" ]]; then
|
||||
echo "Exist"
|
||||
updated_json=$(echo "${json_data}" | jq ".[${existing_object_index}].options[0].value = \"${client_id}\"")
|
||||
else
|
||||
echo "Does not exist"
|
||||
updated_json=$(echo "${json_data}" | jq ". += [${new_object}]")
|
||||
fi
|
||||
echo "${updated_json}" > "${path}"
|
||||
@@ -40,6 +40,7 @@ class RevancedConfig(object):
|
||||
self.normal_cli_jar = "revanced-cli.jar"
|
||||
self.normal_patches_jar = "revanced-patches.jar"
|
||||
self.normal_integrations_apk = "revanced-integrations.apk"
|
||||
self.normal_options_json = "options.json"
|
||||
self.cli_jar = (
|
||||
f"inotia00-{self.normal_cli_jar}"
|
||||
if self.build_extended
|
||||
|
||||
@@ -85,6 +85,7 @@ class Parser(object):
|
||||
cli = self.config.normal_cli_jar
|
||||
patches = self.config.normal_patches_jar
|
||||
integrations = self.config.normal_integrations_apk
|
||||
options = self.config.normal_options_json
|
||||
if self.config.build_extended and app in self.config.extended_apps:
|
||||
cli = self.config.cli_jar
|
||||
patches = self.config.patches_jar
|
||||
@@ -102,6 +103,8 @@ class Parser(object):
|
||||
f"Re-{app}-{version}{output_prefix}output.apk",
|
||||
"--keystore",
|
||||
self.config.keystore_name,
|
||||
"--options",
|
||||
options,
|
||||
]
|
||||
if is_experimental:
|
||||
logger.debug("Using experimental features")
|
||||
|
||||
Reference in New Issue
Block a user