Inject reddit id

This commit is contained in:
Nikhil Badyal
2023-07-13 16:50:48 +05:30
parent a62cf4266e
commit 0be39e7b42
7 changed files with 106 additions and 0 deletions
+38
View File
@@ -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"
}
]
}
]
+27
View File
@@ -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}"