From 1f632182a59052f047dbaef1c1e3ccce0d239b81 Mon Sep 17 00:00:00 2001 From: Pranav <71651408+CrowTaker@users.noreply.github.com> Date: Mon, 14 Nov 2022 22:52:16 +0530 Subject: [PATCH 1/2] Added support for TickTick --- public/apps/index.html | 6 ++++++ utils/PatchListRememberer.js | 4 ++++ utils/downloadApp.js | 6 ++++++ wsEvents/getAppVersion.js | 10 ++++++++-- wsEvents/patchApp.js | 8 ++++++++ 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/public/apps/index.html b/public/apps/index.html index a4ae2eb9..2a8bc56b 100644 --- a/public/apps/index.html +++ b/public/apps/index.html @@ -66,6 +66,12 @@

Select the app you want to patch

>TikTok +
  • + +
  • diff --git a/utils/PatchListRememberer.js b/utils/PatchListRememberer.js index e8deba47..97941858 100644 --- a/utils/PatchListRememberer.js +++ b/utils/PatchListRememberer.js @@ -26,6 +26,10 @@ const defaultPatchesList = JSON.stringify( { name: 'trill', patches: [] + }, + { + name: 'task', + patches: [] } ] }, diff --git a/utils/downloadApp.js b/utils/downloadApp.js index ad25223b..a6c9fd95 100644 --- a/utils/downloadApp.js +++ b/utils/downloadApp.js @@ -43,6 +43,12 @@ async function downloadApp(ws) { versionDownload = await fetch( `https://www.apkmirror.com/apk/tiktok-pte-ltd/tik-tok/tik-tok-${apkMirrorVersionArg}-release/` ); + break; + case 'task': + versionDownload = await fetch( + `https://www.apkmirror.com/apk/appest-inc/ticktick-to-do-list-with-reminder-day-planner/ticktick-to-do-list-with-reminder-day-planner-${apkMirrorVersionArg}-release/` + ); + break; } if (!versionDownload.ok) { diff --git a/wsEvents/getAppVersion.js b/wsEvents/getAppVersion.js index ca493d0c..cf4abed9 100644 --- a/wsEvents/getAppVersion.js +++ b/wsEvents/getAppVersion.js @@ -1,7 +1,7 @@ const exec = require('../utils/promisifiedExec.js'); const fetch = require('node-fetch'); -const { load } = require('cheerio'); +const { load, version } = require('cheerio'); const semver = require('semver'); const { getAppVersion: getAppVersion_ } = require('../utils/getAppVersion.js'); @@ -14,6 +14,7 @@ const APKMIRROR_UPLOAD_BASE = 'https://www.apkmirror.com/uploads/?appcategory='; * @param {string} ver */ const sanitizeVersion = (ver) => { + return ver .replace(/\.0(\d)/gi, '.$1') // because apparently x.0y.z (ex. 5.09.51) isn't a valid version .replace(/^(\d+)\.(\d+)$/gi, '$1.$2.0'); // nor are versions without a patch (ex. 2.3) @@ -135,6 +136,10 @@ module.exports = async function getAppVersion(ws, message) { break; case 'trill': versionsList = await getPage(`${APKMIRROR_UPLOAD_BASE}tik-tok`); + break; + case 'task': + versionsList = await getPage(`${APKMIRROR_UPLOAD_BASE}ticktick-to-do-list-with-reminder-day-planner`); + break; } /** @type {{ version: string; recommended: boolean; beta: boolean }[]} */ @@ -150,7 +155,8 @@ module.exports = async function getAppVersion(ws, message) { .replace('Twitter ', '') .replace('Reddit ', '') .replace('WarnWetter ', '') - .replace('TikTok ', ''); + .replace('TikTok ', '') + .replace('TickTick:To-do list & Tasks ', ''); if ( (global.jarNames.selectedApp === 'android' && diff --git a/wsEvents/patchApp.js b/wsEvents/patchApp.js index e65e4e54..7fadb55a 100644 --- a/wsEvents/patchApp.js +++ b/wsEvents/patchApp.js @@ -93,6 +93,10 @@ async function reinstallReVanced() { break; case 'trill': pkgNameToGetUninstalled = 'com.ss.android.ugc.trill'; + break; + case 'task': + pkgNameToGetUninstalled = 'com.ticktick.task'; + break; } await exec( @@ -125,6 +129,10 @@ function outputName() { break; case 'warnapp': part2 = 'WarnWetter'; + break; + case 'task': + part2 = 'TickTick'; + break; } // TODO: If the existing input APK is used from revanced/ without downloading, version and arch aren't set From 30d5584b42996941ffeebc4bb47b7bedf16f5565 Mon Sep 17 00:00:00 2001 From: Pranav <71651408+CrowTaker@users.noreply.github.com> Date: Tue, 15 Nov 2022 19:51:01 +0530 Subject: [PATCH 2/2] Convert non-semantic versions to semantic versions --- wsEvents/getAppVersion.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wsEvents/getAppVersion.js b/wsEvents/getAppVersion.js index cf4abed9..9b6c8951 100644 --- a/wsEvents/getAppVersion.js +++ b/wsEvents/getAppVersion.js @@ -15,6 +15,9 @@ const APKMIRROR_UPLOAD_BASE = 'https://www.apkmirror.com/uploads/?appcategory='; */ const sanitizeVersion = (ver) => { + while(ver.match(/\./g).length > 2) + ver = ver.replace(/.([^.]*)$/, '$1') + return ver .replace(/\.0(\d)/gi, '.$1') // because apparently x.0y.z (ex. 5.09.51) isn't a valid version .replace(/^(\d+)\.(\d+)$/gi, '$1.$2.0'); // nor are versions without a patch (ex. 2.3)