13 Commits
Author SHA1 Message Date
semantic-release-bot 351917cbbd chore: Release v1.1.2 [skip ci]
## [1.1.2](http://gitea:3000/StanPonomarev/twitter-patch/compare/v1.1.1...v1.1.2) (2026-08-22)

### 🐛 Bug Fixes

* manifest ([7062792](http://gitea:3000/StanPonomarev/twitter-patch/commit/7062792215590cce79caa6e78354ee73375eaa79))
2026-08-22 08:27:54 +00:00
StanPonomarev 7062792215 fix: manifest
Release / Release (push) Successful in 58s
2026-08-22 10:26:52 +02:00
semantic-release-bot 1b47dcf787 chore: Release v1.1.1 [skip ci]
## [1.1.1](http://gitea:3000/StanPonomarev/twitter-patch/compare/v1.1.0...v1.1.1) (2026-08-21)

### 🐛 Bug Fixes

* update screen ([cb1230a](http://gitea:3000/StanPonomarev/twitter-patch/commit/cb1230a7abf46edb11f2b8dad100b091dd672aee))
2026-08-21 23:30:10 +00:00
StanPonomarev cb1230a7ab fix: update screen
Release / Release (push) Successful in 56s
2026-08-22 01:29:12 +02:00
semantic-release-bot 29816c940a chore: Release v1.1.0 [skip ci]
## [1.1.0](http://gitea:3000/StanPonomarev/twitter-patch/compare/v1.0.3...v1.1.0) (2026-08-21)

### ✨ New Features

* remove upgrade button ([723964b](http://gitea:3000/StanPonomarev/twitter-patch/commit/723964bc29d0a9edc7ad1915c9cf5669fe9e6f95))
2026-08-21 18:50:40 +00:00
StanPonomarev 723964bc29 feat: remove upgrade button
Release / Release (push) Successful in 56s
2026-08-21 20:49:42 +02:00
semantic-release-bot 6ec6b0032b chore: Release v1.0.3 [skip ci]
## [1.0.3](http://gitea:3000/StanPonomarev/twitter-patch/compare/v1.0.2...v1.0.3) (2026-08-21)

### 🐛 Bug Fixes

* artifact ([0a2b472](http://gitea:3000/StanPonomarev/twitter-patch/commit/0a2b4725fb53bf0fa741dc4be1a9914ad1e5be8b))
2026-08-21 16:15:17 +00:00
StanPonomarev 0a2b4725fb fix: artifact
Release / Release (push) Successful in 54s
2026-08-21 18:14:25 +02:00
StanPonomarev 5dc2c501b1 add AGENTS.md
Release / Release (push) Successful in 54s
2026-08-21 17:49:25 +02:00
semantic-release-bot b7c143788b chore: Release v1.0.2 [skip ci]
## [1.0.2](http://gitea:3000/StanPonomarev/twitter-patch/compare/v1.0.1...v1.0.2) (2026-08-21)

### 🐛 Bug Fixes

* release again ([ef64be8](http://gitea:3000/StanPonomarev/twitter-patch/commit/ef64be8da665680ebf9fadcf60ae79046594292d))
2026-08-21 15:48:27 +00:00
StanPonomarev ef64be8da6 fix: release again
Release / Release (push) Successful in 1m5s
2026-08-21 17:45:56 +02:00
semantic-release-bot 98aa1e9e1f chore: Release v1.0.1 [skip ci]
## [1.0.1](http://gitea:3000/StanPonomarev/twitter-patch/compare/v1.0.0...v1.0.1) (2026-08-21)

### 🐛 Bug Fixes

* update release strat ([818e291](http://gitea:3000/StanPonomarev/twitter-patch/commit/818e291ffdfa17eff5f57e9a47e3f73a00b7c050))
2026-08-21 15:07:48 +00:00
StanPonomarev 818e291ffd fix: update release strat
Release / Release (push) Successful in 2m18s
2026-08-21 17:05:37 +02:00
16 changed files with 249 additions and 146 deletions
+21 -10
View File
@@ -4,20 +4,30 @@ const path = require('node:path');
function releaseEnvironment(context) { function releaseEnvironment(context) {
const env = context.env ?? process.env; const env = context.env ?? process.env;
const serverUrl = env.GITEA_URL?.replace(/\/$/, ''); const serverUrl = env.GITEA_URL?.replace(/\/$/, '');
const publicUrl = env.GITEA_PUBLIC_URL?.replace(/\/$/, '');
const repository = env.GITEA_REPOSITORY; const repository = env.GITEA_REPOSITORY;
const token = env.GITEA_TOKEN; const token = env.GITEA_TOKEN;
if (!serverUrl || !repository || !token) { if (!serverUrl || !publicUrl || !repository || !token) {
throw new Error('GITEA_URL, GITEA_REPOSITORY, and GITEA_TOKEN are required'); throw new Error(
'GITEA_URL, GITEA_PUBLIC_URL, GITEA_REPOSITORY, and GITEA_TOKEN are required',
);
} }
if (!/^https?:\/\//.test(serverUrl)) { if (!/^https?:\/\//.test(serverUrl)) {
throw new Error('GITEA_URL must be an HTTP(S) URL'); throw new Error('GITEA_URL must be an HTTP(S) URL');
} }
if (!/^https?:\/\//.test(publicUrl)) {
throw new Error('GITEA_PUBLIC_URL must be an HTTP(S) URL');
}
if (!/^[^/]+\/[^/]+$/.test(repository)) { if (!/^[^/]+\/[^/]+$/.test(repository)) {
throw new Error('GITEA_REPOSITORY must use the owner/repository format'); throw new Error('GITEA_REPOSITORY must use the owner/repository format');
} }
return { serverUrl, repository, token }; return { serverUrl, publicUrl, repository, token };
}
function makeUrlsPublic(value, serverUrl, publicUrl) {
return value?.split(serverUrl).join(publicUrl);
} }
async function giteaRequest(url, token, options = {}) { async function giteaRequest(url, token, options = {}) {
@@ -43,10 +53,11 @@ module.exports.verifyConditions = async (_pluginConfig, context) => {
module.exports.prepare = async (pluginConfig, context) => { module.exports.prepare = async (pluginConfig, context) => {
const { nextRelease, cwd } = context; const { nextRelease, cwd } = context;
const notes = nextRelease.notes?.trim(); const rawNotes = nextRelease.notes?.trim();
if (!notes) return; if (!rawNotes) return;
const { serverUrl, repository } = releaseEnvironment(context); const { serverUrl, publicUrl, repository } = releaseEnvironment(context);
const notes = makeUrlsPublic(rawNotes, serverUrl, publicUrl);
const changelogPath = path.resolve(cwd, pluginConfig.changelogFile ?? 'CHANGELOG.md'); const changelogPath = path.resolve(cwd, pluginConfig.changelogFile ?? 'CHANGELOG.md');
const releaseJsonPath = path.resolve(cwd, pluginConfig.releaseJsonPath ?? 'patches-bundle.json'); const releaseJsonPath = path.resolve(cwd, pluginConfig.releaseJsonPath ?? 'patches-bundle.json');
@@ -67,7 +78,7 @@ module.exports.prepare = async (pluginConfig, context) => {
const releaseData = { const releaseData = {
created_at: new Date().toISOString().replace(/\.\d{3}Z$/, ''), created_at: new Date().toISOString().replace(/\.\d{3}Z$/, ''),
description: notes, description: notes,
download_url: `${serverUrl}/${repository}/releases/download/${nextRelease.gitTag}/${assetName}`, download_url: `${publicUrl}/${repository}/releases/download/${nextRelease.gitTag}/${assetName}`,
signature_download_url: '', signature_download_url: '',
version, version,
}; };
@@ -75,7 +86,7 @@ module.exports.prepare = async (pluginConfig, context) => {
}; };
module.exports.publish = async (pluginConfig, context) => { module.exports.publish = async (pluginConfig, context) => {
const { serverUrl, repository, token } = releaseEnvironment(context); const { serverUrl, publicUrl, repository, token } = releaseEnvironment(context);
const { branch, cwd, nextRelease } = context; const { branch, cwd, nextRelease } = context;
const repositoryPath = repository.split('/').map(encodeURIComponent).join('/'); const repositoryPath = repository.split('/').map(encodeURIComponent).join('/');
const apiUrl = `${serverUrl}/api/v1/repos/${repositoryPath}`; const apiUrl = `${serverUrl}/api/v1/repos/${repositoryPath}`;
@@ -96,10 +107,10 @@ module.exports.publish = async (pluginConfig, context) => {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ body: JSON.stringify({
body: nextRelease.notes, body: makeUrlsPublic(nextRelease.notes, serverUrl, publicUrl),
draft: false, draft: false,
name: nextRelease.name, name: nextRelease.name,
prerelease: Boolean(branch.prerelease), prerelease: false,
tag_name: nextRelease.gitTag, tag_name: nextRelease.gitTag,
target_commitish: branch.name, target_commitish: branch.name,
}), }),
-73
View File
@@ -1,73 +0,0 @@
name: Open a PR to main
on:
push:
branches:
- dev
workflow_dispatch:
permissions:
pull-requests: write
contents: read
jobs:
pull-request:
name: Open pull request
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Open pull request
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
GITEA_URL: ${{ gitea.server_url }}
GITEA_REPOSITORY: ${{ gitea.repository }}
SOURCE_BRANCH: ${{ gitea.ref_name }}
TARGET_BRANCH: main
shell: bash
run: |
set -euo pipefail
api_url="${GITEA_URL%/}/api/v1"
auth_header="Authorization: token ${GITEA_TOKEN}"
open_pulls="$(
curl --fail-with-body --silent --show-error \
--get \
--header "$auth_header" \
--data-urlencode "state=open" \
--data-urlencode "base_branch=${TARGET_BRANCH}" \
--data-urlencode "limit=50" \
"${api_url}/repos/${GITEA_REPOSITORY}/pulls"
)"
if jq -e --arg branch "$SOURCE_BRANCH" \
'any(.[]; .head.ref == $branch)' <<<"$open_pulls" >/dev/null; then
echo "Pull request already exists."
exit 0
fi
commits="$(git rev-list --count "origin/${TARGET_BRANCH}..HEAD")"
if [[ "$commits" -eq 0 ]]; then
echo "No commits between ${TARGET_BRANCH} and ${SOURCE_BRANCH}. Skipping pull request creation."
exit 0
fi
payload="$(
jq -n \
--arg base "$TARGET_BRANCH" \
--arg head "$SOURCE_BRANCH" \
--arg title 'chore: Merge branch `dev` to `main`' \
--arg body 'When dev (pre-release) is ready, merge this pull request to create a new stable release.' \
'{base: $base, head: $head, title: $title, body: $body}'
)"
curl --fail-with-body --silent --show-error \
--request POST \
--header "$auth_header" \
--header "Content-Type: application/json" \
--data "$payload" \
"${api_url}/repos/${GITEA_REPOSITORY}/pulls" >/dev/null
echo "Pull request created."
+1
View File
@@ -52,6 +52,7 @@ jobs:
env: env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
GITEA_URL: ${{ gitea.server_url }} GITEA_URL: ${{ gitea.server_url }}
GITEA_PUBLIC_URL: https://git.krtss.de
GITEA_REPOSITORY: ${{ gitea.repository }} GITEA_REPOSITORY: ${{ gitea.repository }}
GITEA_REF_NAME: ${{ gitea.ref_name }} GITEA_REF_NAME: ${{ gitea.ref_name }}
run: npx semantic-release run: npx semantic-release
+3 -21
View File
@@ -1,11 +1,5 @@
{ {
"branches": [ "branches": ["main"],
"main",
{
"name": "dev",
"prerelease": true
}
],
"plugins": [ "plugins": [
[ [
"@semantic-release/commit-analyzer", "@semantic-release/commit-analyzer",
@@ -34,6 +28,7 @@
} }
} }
], ],
"gradle-semantic-release-plugin",
[ [
"./.gitea/scripts/morphe-release.cjs", "./.gitea/scripts/morphe-release.cjs",
{ {
@@ -42,11 +37,10 @@
"assetDirectory": "patches/build/libs" "assetDirectory": "patches/build/libs"
} }
], ],
"gradle-semantic-release-plugin",
[ [
"@semantic-release/exec", "@semantic-release/exec",
{ {
"prepareCmd": "./gradlew generatePatchesList && jq '.version=\"${nextRelease.version}\"' patches-list.json > patches-list.json.tmp && mv patches-list.json.tmp patches-list.json && python3 .gitea/scripts/generate_patches_readme.py \"$GITEA_URL\" \"$GITEA_REPOSITORY\" \"$GITEA_REF_NAME\" patches-list.json README.md" "prepareCmd": "./gradlew generatePatchesList && jq '.version=\"${nextRelease.version}\"' patches-list.json > patches-list.json.tmp && mv patches-list.json.tmp patches-list.json && python3 .gitea/scripts/generate_patches_readme.py \"$GITEA_PUBLIC_URL\" \"$GITEA_REPOSITORY\" \"$GITEA_REF_NAME\" patches-list.json README.md"
} }
], ],
[ [
@@ -61,18 +55,6 @@
], ],
"message": "chore: Release v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" "message": "chore: Release v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
} }
],
[
"@cleyrop-org/semantic-release-backmerge",
{
"backmergeBranches": [
{
"from": "main",
"to": "dev"
}
],
"clearWorkspace": true
}
] ]
] ]
} }
+21
View File
@@ -0,0 +1,21 @@
# Agent Instructions
## Release-managed files
Agents must never create, edit, delete, restore, regenerate, format, resolve conflicts in, or stage files managed by the release pipeline.
Protected files:
- `CHANGELOG.md`
- `gradle.properties`
- `patches-bundle.json`
- `patches-list.json`
- `README.md`
These files are generated, updated, and committed exclusively by `semantic-release`. Manual changes or conflict resolutions cause divergence from the release commit and create pull or rebase conflicts.
When a task requires different generated content, change only the source, generator, or release configuration responsible for producing it. Leave every protected file untouched and tell the user that the next release must regenerate it.
If a protected file is conflicted, do not resolve, restore, or stage it. Stop and report the conflict to the user.
Do not run release or generation commands that modify protected files, including `npx semantic-release`, `./gradlew generatePatchesList`, or `.gitea/scripts/generate_patches_readme.py`. A dry run is allowed only when it is proven not to write any protected file.
+36
View File
@@ -1,3 +1,39 @@
## [1.1.2](https://git.krtss.de/StanPonomarev/twitter-patch/compare/v1.1.1...v1.1.2) (2026-08-22)
### 🐛 Bug Fixes
* manifest ([7062792](https://git.krtss.de/StanPonomarev/twitter-patch/commit/7062792215590cce79caa6e78354ee73375eaa79))
## [1.1.1](https://git.krtss.de/StanPonomarev/twitter-patch/compare/v1.1.0...v1.1.1) (2026-08-21)
### 🐛 Bug Fixes
* update screen ([cb1230a](https://git.krtss.de/StanPonomarev/twitter-patch/commit/cb1230a7abf46edb11f2b8dad100b091dd672aee))
## [1.1.0](https://git.krtss.de/StanPonomarev/twitter-patch/compare/v1.0.3...v1.1.0) (2026-08-21)
### ✨ New Features
* remove upgrade button ([723964b](https://git.krtss.de/StanPonomarev/twitter-patch/commit/723964bc29d0a9edc7ad1915c9cf5669fe9e6f95))
## [1.0.3](https://git.krtss.de/StanPonomarev/twitter-patch/compare/v1.0.2...v1.0.3) (2026-08-21)
### 🐛 Bug Fixes
* artifact ([0a2b472](https://git.krtss.de/StanPonomarev/twitter-patch/commit/0a2b4725fb53bf0fa741dc4be1a9914ad1e5be8b))
## [1.0.2](https://git.krtss.de/StanPonomarev/twitter-patch/compare/v1.0.1...v1.0.2) (2026-08-21)
### 🐛 Bug Fixes
* release again ([ef64be8](https://git.krtss.de/StanPonomarev/twitter-patch/commit/ef64be8da665680ebf9fadcf60ae79046594292d))
## [1.0.1](http://gitea:3000/StanPonomarev/twitter-patch/compare/v1.0.0...v1.0.1) (2026-08-21)
### 🐛 Bug Fixes
* update release strat ([818e291](http://gitea:3000/StanPonomarev/twitter-patch/commit/818e291ffdfa17eff5f57e9a47e3f73a00b7c050))
## 1.0.0 (2026-08-21) ## 1.0.0 (2026-08-21)
### 🐛 Bug Fixes ### 🐛 Bug Fixes
+3 -2
View File
@@ -4,9 +4,9 @@ Patch bundle for X (Twitter), maintained by
[Stan Ponomarev](https://git.krtss.de/StanPonomarev). [Stan Ponomarev](https://git.krtss.de/StanPonomarev).
<!-- PATCHES_START --> <!-- PATCHES_START -->
> **[v1.0.0](http://gitea:3000/StanPonomarev/twitter-patch/releases/tag/v1.0.0)**&nbsp;&nbsp;•&nbsp;&nbsp;`main`&nbsp;&nbsp;•&nbsp;&nbsp;1 patches total > **[v1.1.2](https://git.krtss.de/StanPonomarev/twitter-patch/releases/tag/v1.1.2)**&nbsp;&nbsp;•&nbsp;&nbsp;`main`&nbsp;&nbsp;•&nbsp;&nbsp;2 patches total
<details open> <details open>
<summary>📦 X&nbsp;&nbsp;•&nbsp;&nbsp;1 patch</summary> <summary>📦 X&nbsp;&nbsp;•&nbsp;&nbsp;2 patches</summary>
<br> <br>
**🎯 Supported versions:** **🎯 Supported versions:**
@@ -17,6 +17,7 @@ Patch bundle for X (Twitter), maintained by
| 💊&nbsp;Patch | 📜&nbsp;Description | ⚙️&nbsp;Options | | 💊&nbsp;Patch | 📜&nbsp;Description | ⚙️&nbsp;Options |
|----------|----------------|-----------| |----------|----------------|-----------|
| [Disable outdated version screen](#disable-outdated-version-screen) | Prevents X from blocking app access when it marks the client version as outdated. | | | [Disable outdated version screen](#disable-outdated-version-screen) | Prevents X from blocking app access when it marks the client version as outdated. | |
| [Remove timeline Upgrade button](#remove-timeline-upgrade-button) | Removes the Premium Upgrade button from the timeline's top bar. | |
</details> </details>
+1 -1
View File
@@ -1,4 +1,4 @@
org.gradle.parallel = true org.gradle.parallel = true
org.gradle.caching = true org.gradle.caching = true
kotlin.code.style = official kotlin.code.style = official
version = 1.0.0 version = 1.1.2
-28
View File
@@ -5,7 +5,6 @@
"packages": { "packages": {
"": { "": {
"devDependencies": { "devDependencies": {
"@cleyrop-org/semantic-release-backmerge": "^6.2.0",
"@semantic-release/exec": "^7.1.0", "@semantic-release/exec": "^7.1.0",
"@semantic-release/git": "^11.0.1", "@semantic-release/git": "^11.0.1",
"conventional-changelog-conventionalcommits": "^9.3.1", "conventional-changelog-conventionalcommits": "^9.3.1",
@@ -87,26 +86,6 @@
"node": ">=6.9.0" "node": ">=6.9.0"
} }
}, },
"node_modules/@cleyrop-org/semantic-release-backmerge": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@cleyrop-org/semantic-release-backmerge/-/semantic-release-backmerge-6.2.0.tgz",
"integrity": "sha512-d3dvZJgwBqsbhWKW1msIWlnkv3c1UoxUkFznrIYb0IewIiJLrfSv6ZWQvJVG67opAc3yTcqiovVL/J8G7/UnAA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@semantic-release/error": "^4.0.0",
"aggregate-error": "^5.0.0",
"debug": "^4.4.3",
"execa": "^9.6.1",
"lodash": "^4.18.1"
},
"engines": {
"node": "^22.14.0 || >=24.10.0"
},
"peerDependencies": {
"semantic-release": ">=24"
}
},
"node_modules/@colors/colors": { "node_modules/@colors/colors": {
"version": "1.5.0", "version": "1.5.0",
"resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz",
@@ -2201,13 +2180,6 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/lodash": {
"version": "4.18.1",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",
"integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==",
"dev": true,
"license": "MIT"
},
"node_modules/lodash-es": { "node_modules/lodash-es": {
"version": "4.18.1", "version": "4.18.1",
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.18.1.tgz", "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.18.1.tgz",
-1
View File
@@ -1,6 +1,5 @@
{ {
"devDependencies": { "devDependencies": {
"@cleyrop-org/semantic-release-backmerge": "^6.2.0",
"@semantic-release/exec": "^7.1.0", "@semantic-release/exec": "^7.1.0",
"@semantic-release/git": "^11.0.1", "@semantic-release/git": "^11.0.1",
"conventional-changelog-conventionalcommits": "^9.3.1", "conventional-changelog-conventionalcommits": "^9.3.1",
+4 -4
View File
@@ -1,7 +1,7 @@
{ {
"created_at": "2026-08-21T14:54:51", "created_at": "2026-08-22T08:27:42",
"description": "## 1.0.0 (2026-08-21)\n\n### 🐛 Bug Fixes\n\n* fix release ([9a26817](http://gitea:3000/StanPonomarev/twitter-patch/commit/9a26817b4133e2d0c3bde7ee86ef0f5eb4b72fd9))\n* readme template ([59b41b5](http://gitea:3000/StanPonomarev/twitter-patch/commit/59b41b55603351bffccc046d06147ffbe14b62e7))\n\n### ✨ New Features\n\n* disable outdated version screen ([c5d43f5](http://gitea:3000/StanPonomarev/twitter-patch/commit/c5d43f5b51126ca0008653aada6d5c67bd793bd7))", "description": "## [1.1.2](https://git.krtss.de/StanPonomarev/twitter-patch/compare/v1.1.1...v1.1.2) (2026-08-22)\n\n### 🐛 Bug Fixes\n\n* manifest ([7062792](https://git.krtss.de/StanPonomarev/twitter-patch/commit/7062792215590cce79caa6e78354ee73375eaa79))",
"download_url": "http://gitea:3000/StanPonomarev/twitter-patch/releases/download/v1.0.0/patches-1.0.0.mpp", "download_url": "https://git.krtss.de/StanPonomarev/twitter-patch/releases/download/v1.1.2/patches-1.1.2.mpp",
"signature_download_url": "", "signature_download_url": "",
"version": "1.0.0" "version": "1.1.2"
} }
+29 -1
View File
@@ -1,11 +1,39 @@
{ {
"NOTE": "Do NOT manually edit this file. This file is automatically updated when semantic release (release.yml) runs. Manually editing this file can break your releases and break third party tools that use this file.", "NOTE": "Do NOT manually edit this file. This file is automatically updated when semantic release (release.yml) runs. Manually editing this file can break your releases and break third party tools that use this file.",
"version": "1.0.0", "version": "1.1.2",
"patches": [ "patches": [
{ {
"name": "Disable outdated version screen", "name": "Disable outdated version screen",
"description": "Prevents X from blocking app access when it marks the client version as outdated.", "description": "Prevents X from blocking app access when it marks the client version as outdated.",
"default": true, "default": true,
"dependencies": [
"ResourcePatch"
],
"compatiblePackages": [
{
"packageName": "com.twitter.android",
"name": "X",
"description": null,
"apkFileType": "APKM",
"appIconColor": "#000000",
"signatures": null,
"targets": [
{
"version": "12.7.1-release.0",
"versionCodes": null,
"isExperimental": false,
"minSdk": 28,
"description": null
}
]
}
],
"options": []
},
{
"name": "Remove timeline Upgrade button",
"description": "Removes the Premium Upgrade button from the timeline's top bar.",
"default": true,
"dependencies": [], "dependencies": [],
"compatiblePackages": [ "compatiblePackages": [
{ {
+1 -1
View File
@@ -43,7 +43,7 @@ tasks {
register<JavaExec>("generatePatchesList") { register<JavaExec>("generatePatchesList") {
description = "Build patch with patch list" description = "Build patch with patch list"
dependsOn(build) dependsOn(buildAndroid)
classpath = sourceSets["main"].runtimeClasspath + patchListGeneratorClasspath classpath = sourceSets["main"].runtimeClasspath + patchListGeneratorClasspath
mainClass.set("util.PatchListGeneratorKt") mainClass.set("util.PatchListGeneratorKt")
@@ -23,7 +23,7 @@ import kotlin.test.assertTrue
class MorphePatchIntegrationTest { class MorphePatchIntegrationTest {
@Test @Test
fun `applies outdated version patch to target APKM`() { fun `applies patches to target APKM`() {
val inputApkm = requiredPathProperty("integrationTest.inputApkm") val inputApkm = requiredPathProperty("integrationTest.inputApkm")
val patchBundle = requiredPathProperty("integrationTest.patchBundle") val patchBundle = requiredPathProperty("integrationTest.patchBundle")
val morpheCache = requiredPathProperty("integrationTest.morpheCache") val morpheCache = requiredPathProperty("integrationTest.morpheCache")
@@ -47,7 +47,8 @@ class MorphePatchIntegrationTest {
"patch", "patch",
"--patches=${patchBundle.absolutePathString()}", "--patches=${patchBundle.absolutePathString()}",
"--exclusive", "--exclusive",
"--enable=$PATCH_NAME", "--enable=$OUTDATED_PATCH_NAME",
"--enable=$UPGRADE_PATCH_NAME",
"--unsigned", "--unsigned",
"--out=${patchedApk.absolutePathString()}", "--out=${patchedApk.absolutePathString()}",
"--result-file=${resultFile.absolutePathString()}", "--result-file=${resultFile.absolutePathString()}",
@@ -91,7 +92,10 @@ class MorphePatchIntegrationTest {
val appliedPatchNames = result.getAsJsonArray("appliedPatches") val appliedPatchNames = result.getAsJsonArray("appliedPatches")
.map { it.asJsonObject.get("name").asString } .map { it.asJsonObject.get("name").asString }
assertTrue(PATCH_NAME in appliedPatchNames, "Expected patch was not applied: $appliedPatchNames") assertTrue(
appliedPatchNames.containsAll(listOf(OUTDATED_PATCH_NAME, UPGRADE_PATCH_NAME)),
"Expected patches were not applied: $appliedPatchNames"
)
assertTrue(result.getAsJsonArray("failedPatches").isEmpty, "Morphe reported failed patches") assertTrue(result.getAsJsonArray("failedPatches").isEmpty, "Morphe reported failed patches")
} finally { } finally {
workDirectory.toFile().deleteRecursively() workDirectory.toFile().deleteRecursively()
@@ -142,7 +146,8 @@ class MorphePatchIntegrationTest {
} }
private companion object { private companion object {
const val PATCH_NAME = "Disable outdated version screen" const val OUTDATED_PATCH_NAME = "Disable outdated version screen"
const val UPGRADE_PATCH_NAME = "Remove timeline Upgrade button"
const val MORPHE_VERSION = "1.13.1" const val MORPHE_VERSION = "1.13.1"
const val MORPHE_SHA256 = "a212531f68d3ada4b504bf9dac3e02460589f3bf8868ee66e1b4780152d3466b" const val MORPHE_SHA256 = "a212531f68d3ada4b504bf9dac3e02460589f3bf8868ee66e1b4780152d3466b"
const val MORPHE_URL = const val MORPHE_URL =
@@ -3,7 +3,9 @@ package app.twitter.patches
import app.morphe.patcher.extensions.InstructionExtensions.addInstructions import app.morphe.patcher.extensions.InstructionExtensions.addInstructions
import app.morphe.patcher.Fingerprint import app.morphe.patcher.Fingerprint
import app.morphe.patcher.patch.bytecodePatch import app.morphe.patcher.patch.bytecodePatch
import app.morphe.patcher.patch.resourcePatch
import app.twitter.patches.shared.Constants.COMPATIBILITY_X import app.twitter.patches.shared.Constants.COMPATIBILITY_X
import org.w3c.dom.Element
private val outdatedVersionEnforcementFingerprint = Fingerprint( private val outdatedVersionEnforcementFingerprint = Fingerprint(
definingClass = "Lcom/twitter/subsystem/clientshutdown/o;", definingClass = "Lcom/twitter/subsystem/clientshutdown/o;",
@@ -13,6 +15,41 @@ private val outdatedVersionEnforcementFingerprint = Fingerprint(
strings = listOf("Target version is ", "Detected shutdown") strings = listOf("Target version is ", "Detected shutdown")
) )
private val forceUpdateNavigationFingerprint = Fingerprint(
definingClass = "Lcom/x/android/main/helpers/o8;",
name = "a",
returnType = "Lcom/x/compose/core/o2;",
parameters = listOf(
"Lcom/x/navigation/RootNavigationArgs;",
"Lcom/arkivanov/decompose/c;",
"Lcom/x/navigation/f1;"
)
)
private val shutdownForegroundHandlerFingerprint = Fingerprint(
definingClass = "Lcom/twitter/subsystem/clientshutdown/m;",
name = "invoke",
returnType = "Ljava/lang/Object;",
parameters = listOf("Ljava/lang/Object;"),
strings = listOf("Entered foreground, shutdown is ", "Launching app update")
)
private val appUpdateLauncherFingerprint = Fingerprint(
definingClass = "Lcom/twitter/subsystem/clientshutdown/i;",
name = "a",
returnType = "V",
parameters = listOf("Ljava/lang/String;"),
strings = listOf("Launching app update")
)
private val shutdownEntryPointDisablerFingerprint = Fingerprint(
definingClass = "Lcom/twitter/subsystem/clientshutdown/i;",
name = "b",
returnType = "V",
parameters = emptyList(),
strings = listOf("com.twitter.clientshutdown.update.AppUpdateActivityAlias")
)
private val shutdownStateFingerprint = Fingerprint( private val shutdownStateFingerprint = Fingerprint(
definingClass = "Lcom/twitter/subsystem/clientshutdown/q;", definingClass = "Lcom/twitter/subsystem/clientshutdown/q;",
name = "isShutdown", name = "isShutdown",
@@ -20,6 +57,24 @@ private val shutdownStateFingerprint = Fingerprint(
parameters = emptyList() parameters = emptyList()
) )
private const val APP_UPDATE_ACTIVITY = "com.twitter.clientshutdown.update.AppUpdateActivity"
private val disableOutdatedVersionActivityPatch = resourcePatch {
execute {
document("AndroidManifest.xml").use { document ->
val appUpdateActivity = document.getElementsByTagName("activity")
.let { activities ->
(0 until activities.length)
.asSequence()
.map { activities.item(it) }
.filterIsInstance<Element>()
.single { it.getAttribute("android:name") == APP_UPDATE_ACTIVITY }
}
appUpdateActivity.setAttribute("android:enabled", "false")
}
}
}
@Suppress("unused") @Suppress("unused")
val disableOutdatedVersionScreenPatch = bytecodePatch( val disableOutdatedVersionScreenPatch = bytecodePatch(
name = "Disable outdated version screen", name = "Disable outdated version screen",
@@ -27,8 +82,41 @@ val disableOutdatedVersionScreenPatch = bytecodePatch(
default = true default = true
) { ) {
compatibleWith(COMPATIBILITY_X) compatibleWith(COMPATIBILITY_X)
dependsOn(disableOutdatedVersionActivityPatch)
execute { execute {
forceUpdateNavigationFingerprint.method.addInstructions(
0,
"""
move-object/from16 v2, p1
instance-of v0, v2, Lcom/x/navigation/ForceUpdateArgs;
if-eqz v0, :force_update_allowed
sget-object v0, Lcom/x/navigation/MainLandingArgs${'$'}TabType;->HOME:Lcom/x/navigation/MainLandingArgs${'$'}TabType;
const/4 v1, 0x0
new-instance v2, Lcom/x/navigation/MainLandingArgs;
invoke-direct {v2, v0, v1, v1, v1}, Lcom/x/navigation/MainLandingArgs;-><init>(Lcom/x/navigation/MainLandingArgs${'$'}TabType;Lcom/x/navigation/AcceptGroupInviteArgs;Lcom/x/navigation/RootNavigationArgs;Lcom/x/models/PostIdentifier;)V
move-object/16 p1, v2
:force_update_allowed
"""
)
shutdownForegroundHandlerFingerprint.method.addInstructions(
0,
"""
sget-object v0, Lkotlin/Unit;->a:Lkotlin/Unit;
return-object v0
"""
)
appUpdateLauncherFingerprint.method.addInstructions(
0,
"return-void"
)
shutdownEntryPointDisablerFingerprint.method.addInstructions(
0,
"return-void"
)
outdatedVersionEnforcementFingerprint.method.addInstructions( outdatedVersionEnforcementFingerprint.method.addInstructions(
0, 0,
""" """
@@ -0,0 +1,32 @@
package app.twitter.patches
import app.morphe.patcher.patch.resourcePatch
import app.twitter.patches.shared.Constants.COMPATIBILITY_X
import org.w3c.dom.Element
private const val TOOLBAR_ITEMS_PATH = "res/menu/toolbar_items.xml"
private const val UPGRADE_BUTTON_ID = "premium_upsell_upgrade"
@Suppress("unused")
val removeTimelineUpgradeButtonPatch = resourcePatch(
name = "Remove timeline Upgrade button",
description = "Removes the Premium Upgrade button from the timeline's top bar.",
default = true
) {
compatibleWith(COMPATIBILITY_X)
execute {
document(TOOLBAR_ITEMS_PATH).use { document ->
val menu = document.documentElement
val upgradeButton = (0 until menu.childNodes.length)
.asSequence()
.map { menu.childNodes.item(it) }
.filterIsInstance<Element>()
.single {
it.getAttribute("android:id").substringAfterLast('/') == UPGRADE_BUTTON_ID
}
menu.removeChild(upgradeButton)
}
}
}