feat: add device props support for qwq233' TS fork

ref: bab87cef90
This commit is contained in:
KOWX712
2025-07-18 15:18:06 +08:00
parent 36325fc241
commit ae12fe8b28
7 changed files with 126 additions and 36 deletions

View File

@@ -143,19 +143,23 @@ set_security_patch() {
TODAY=$(date +%Y%m%d) TODAY=$(date +%Y%m%d)
if [ -n "$formatted_security_patch" ] && [ "$TODAY" -lt "$security_patch_after_1y" ]; then if [ -n "$formatted_security_patch" ] && [ "$TODAY" -lt "$security_patch_after_1y" ]; then
TS_version=$(grep "versionCode=" "/data/adb/modules/tricky_store/module.prop" | cut -d'=' -f2) TS_version=$(grep "versionCode=" "/data/adb/modules/tricky_store/module.prop" | cut -d'=' -f2)
# Official TrickyStore which supports custom security patch
if [ "$TS_version" -ge 158 ]; then
SECURITY_PATCH_FILE="/data/adb/tricky_store/security_patch.txt"
printf "system=prop\nboot=%s\nvendor=%s\n" "$security_patch" "$security_patch" > "$SECURITY_PATCH_FILE"
chmod 644 "$SECURITY_PATCH_FILE"
# James Clef's TrickyStore fork (GitHub@qwq233/TrickyStore) # James Clef's TrickyStore fork (GitHub@qwq233/TrickyStore)
elif grep -q "James" "/data/adb/modules/tricky_store/module.prop"; then if grep -q "James" "/data/adb/modules/tricky_store/module.prop"; then
SECURITY_PATCH_FILE="/data/adb/tricky_store/devconfig.toml" SECURITY_PATCH_FILE="/data/adb/tricky_store/devconfig.toml"
if grep -q "^securityPatch" "$SECURITY_PATCH_FILE"; then if grep -q "^securityPatch" "$SECURITY_PATCH_FILE"; then
sed -i "s/^securityPatch .*/securityPatch = \"$security_patch\"/" "$SECURITY_PATCH_FILE" sed -i "s/^securityPatch .*/securityPatch = \"$security_patch\"/" "$SECURITY_PATCH_FILE"
else else
echo "securityPatch = \"$security_patch\"" >> "$SECURITY_PATCH_FILE" if ! grep -q "^\\[deviceProps\\]" "$SECURITY_PATCH_FILE"; then
echo "securityPatch = \"$security_patch\"" >> "$SECURITY_PATCH_FILE"
else
sed -i "s/^\[deviceProps\]/securityPatch = \"$security_patch\"\n&/" "$SECURITY_PATCH_FILE"
fi
fi fi
# Official TrickyStore which supports custom security patch
elif [ "$TS_version" -ge 158 ]; then
SECURITY_PATCH_FILE="/data/adb/tricky_store/security_patch.txt"
printf "system=prop\nboot=%s\nvendor=%s\n" "$security_patch" "$security_patch" > "$SECURITY_PATCH_FILE"
chmod 644 "$SECURITY_PATCH_FILE"
# Other # Other
else else
resetprop ro.vendor.build.security_patch "$security_patch" resetprop ro.vendor.build.security_patch "$security_patch"

View File

@@ -290,14 +290,54 @@
</div> </div>
<!-- James' fork input --> <!-- James' fork input -->
<div id="james-mode-inputs" class="normal-mode-inputs hidden"> <div id="devconfig-mode-inputs" class="normal-mode-inputs hidden">
<div class="input-group"> <div class="input-group">
<label id="security_patch-james">Security Patch</label> <label>Security Patch</label>
<input type="text" id="james-patch" placeholder="2025-01-01" autocapitalize="none" oninput="formatDate(this)" maxlength="10"> <input type="text" id="devconfig-securityPatch" placeholder="2025-01-01" autocapitalize="none" oninput="formatDate(this)" maxlength="10">
</div> </div>
<div class="input-group"> <div class="input-group">
<label id="os-james">OS Version</label> <label>OS Version</label>
<input type="text" id="james-os" placeholder="34" maxlength="2" autocapitalize="none"> <input type="text" id="devconfig-osVersion" placeholder="34" maxlength="2" autocapitalize="none">
</div>
<div class="input-group">
<br>
<label>Device Property</label>
</div>
<div class="input-group">
<label>brand</label>
<input type="text" id="devconfig-brand" placeholder="google" autocapitalize="none">
</div>
<div class="input-group">
<label>device</label>
<input type="text" id="devconfig-device" placeholder="oriole" autocapitalize="none">
</div>
<div class="input-group">
<label>product</label>
<input type="text" id="devconfig-product" placeholder="oriole_beta" autocapitalize="none">
</div>
<div class="input-group">
<label>manufacturer</label>
<input type="text" id="devconfig-manufacturer" placeholder="Google" autocapitalize="none">
</div>
<div class="input-group">
<label>model</label>
<input type="text" id="devconfig-model" placeholder="Pixel 6" autocapitalize="none">
</div>
<div class="input-group">
<label>serial</label>
<input type="text" id="devconfig-serial" placeholder="5e043839" autocapitalize="none">
</div>
<div class="input-group">
<label>meid</label>
<input type="text" id="devconfig-meid" placeholder="32b6af4d93aca6" autocapitalize="none">
</div>
<div class="input-group">
<label>imei</label>
<input type="text" id="devconfig-imei" placeholder="73598126407" autocapitalize="none">
</div>
<div class="input-group">
<label>imei2</label>
<input type="text" id="devconfig-imei2" placeholder="77983102465" autocapitalize="none">
</div> </div>
</div> </div>

View File

@@ -52,6 +52,7 @@
<string name="menu_set_custom_keybox">Set Custom Keybox</string> <string name="menu_set_custom_keybox">Set Custom Keybox</string>
<string name="menu_set_verified_boot_hash">Set Verified Boot Hash</string> <string name="menu_set_verified_boot_hash">Set Verified Boot Hash</string>
<string name="menu_set_security_patch">Set Security Patch</string> <string name="menu_set_security_patch">Set Security Patch</string>
<string name="menu_set_devconfig">Set DevConfig</string>
<string name="menu_about">About</string> <string name="menu_about">About</string>
<!-- Boot Hash --> <!-- Boot Hash -->
<string name="boot_hash_title">Boot Hash</string> <string name="boot_hash_title">Boot Hash</string>

View File

@@ -52,6 +52,7 @@
<string name="menu_set_custom_keybox">Set Custom Keybox</string> <string name="menu_set_custom_keybox">Set Custom Keybox</string>
<string name="menu_set_verified_boot_hash">Set Verified Boot Hash</string> <string name="menu_set_verified_boot_hash">Set Verified Boot Hash</string>
<string name="menu_set_security_patch">Set Security Patch</string> <string name="menu_set_security_patch">Set Security Patch</string>
<string name="menu_set_devconfig">Set DevConfig</string>
<string name="menu_about">About</string> <string name="menu_about">About</string>
<!-- Boot Hash --> <!-- Boot Hash -->
<string name="boot_hash_title">Boot Hash</string> <string name="boot_hash_title">Boot Hash</string>

View File

@@ -1,6 +1,5 @@
import { linkRedirect, basePath, showPrompt } from './main.js'; import { linkRedirect, basePath, showPrompt } from './main.js';
import { translations } from './language.js'; import { spawn } from './assets/kernelsu.js';
import { spawn, toast } from './assets/kernelsu.js';
const aboutOverlay = document.getElementById('about-overlay'); const aboutOverlay = document.getElementById('about-overlay');
const aboutContent = document.querySelector('.about-menu'); const aboutContent = document.querySelector('.about-menu');

View File

@@ -1,5 +1,6 @@
import { exec, spawn } from './assets/kernelsu.js'; import { exec, spawn } from './assets/kernelsu.js';
import { basePath, showPrompt } from './main.js'; import { basePath, showPrompt } from './main.js';
import { translations } from './language.js';
let jamesFork = false; let jamesFork = false;
@@ -9,17 +10,31 @@ const advancedToggleElement = document.querySelector('.advanced-toggle');
const advancedToggle = document.getElementById('advanced-mode'); const advancedToggle = document.getElementById('advanced-mode');
const normalInputs = document.getElementById('normal-mode-inputs'); const normalInputs = document.getElementById('normal-mode-inputs');
const advancedInputs = document.getElementById('advanced-mode-inputs'); const advancedInputs = document.getElementById('advanced-mode-inputs');
const jamesInputs = document.getElementById('james-mode-inputs'); const devconfigInputs = document.getElementById('devconfig-mode-inputs');
const allPatchInput = document.getElementById('all-patch'); const allPatchInput = document.getElementById('all-patch');
const bootPatchInput = document.getElementById('boot-patch'); const bootPatchInput = document.getElementById('boot-patch');
const systemPatchInput = document.getElementById('system-patch'); const systemPatchInput = document.getElementById('system-patch');
const vendorPatchInput = document.getElementById('vendor-patch'); const vendorPatchInput = document.getElementById('vendor-patch');
const jamesPatchInput = document.getElementById('james-patch'); const devconfigPatchInput = document.getElementById('devconfig-securityPatch');
const jamesOsInput = document.getElementById('james-os');
const getButton = document.getElementById('get-patch'); const getButton = document.getElementById('get-patch');
const autoButton = document.getElementById('auto-config'); const autoButton = document.getElementById('auto-config');
const saveButton = document.getElementById('save-patch'); const saveButton = document.getElementById('save-patch');
// Configurable options in james' fork
const devconfigOption = [
'securityPatch',
'osVersion',
'brand',
'device',
'product',
'manufacturer',
'model',
'serial',
'meid',
'imei',
'imei2'
];
// Hide security patch dialog // Hide security patch dialog
const hideSecurityPatchDialog = () => { const hideSecurityPatchDialog = () => {
document.body.classList.remove("no-scroll"); document.body.classList.remove("no-scroll");
@@ -32,7 +47,8 @@ const hideSecurityPatchDialog = () => {
/** /**
* Save the security patch configuration to file * Save the security patch configuration to file
* @param {string} mode - 'disable', 'manual' * @param {string} mode - 'disable',
'manual'
* @param {string} value - The security patch value to save, if mode is 'manual'. * @param {string} value - The security patch value to save, if mode is 'manual'.
*/ */
function handleSecurityPatch(mode, value = null) { function handleSecurityPatch(mode, value = null) {
@@ -69,13 +85,14 @@ async function loadCurrentConfig() {
if (stdout.trim() !== '') { if (stdout.trim() !== '') {
const lines = stdout.split('\n'); const lines = stdout.split('\n');
for (const line of lines) { for (const line of lines) {
if (line.startsWith('securityPatch =')) { for (const option of devconfigOption) {
const jamesPatchValue = line.split('=')[1].trim().replace(/"/g, ''); if (line.startsWith(`${option} =`)) {
if (jamesPatchValue !== '') jamesPatchInput.value = jamesPatchValue; const value = line.split('=')[1].trim().replace(/"/g, '');
} document.getElementById(`devconfig-${option}`).value = value;
if (line.startsWith('osVersion =')) { }
const jamesOsVersionValue = line.split('=')[1].trim().replace(/"/g, ''); if (!stdout.includes(option)) {
if (jamesOsVersionValue !== '') jamesOsInput.value = jamesOsVersionValue; document.getElementById(`devconfig-${option}`).value = '';
}
} }
} }
} }
@@ -222,9 +239,10 @@ export function securityPatch() {
.then(({ errno }) => { .then(({ errno }) => {
if (errno === 0) { if (errno === 0) {
jamesFork = true; jamesFork = true;
document.getElementById('security-patch').textContent = translations.menu_set_devconfig;
advancedToggleElement.style.display = 'none'; advancedToggleElement.style.display = 'none';
normalInputs.classList.add('hidden'); normalInputs.classList.add('hidden');
jamesInputs.classList.remove('hidden'); devconfigInputs.classList.remove('hidden');
} }
}); });
document.getElementById("security-patch").addEventListener("click", () => { document.getElementById("security-patch").addEventListener("click", () => {
@@ -282,19 +300,45 @@ export function securityPatch() {
// Save button // Save button
saveButton.addEventListener('click', async () => { saveButton.addEventListener('click', async () => {
if (jamesFork) { if (jamesFork) {
const securityPatchValue = jamesPatchInput.value.trim(); const devconfig = new Map();
const osVersionValue = jamesOsInput.value.trim(); for (const option of devconfigOption) {
const input = document.getElementById(`devconfig-${option}`);
if (input.value.trim() === '') continue;
devconfig.set(option, input.value.trim());
}
if (!securityPatchValue) handleSecurityPatch('disable'); if (devconfig.size === 0) {
if (!securityPatchValue && !osVersionValue) { handleSecurityPatch('disable');
hideSecurityPatchDialog(); hideSecurityPatchDialog();
return; return;
} }
const config = [ if (!devconfig.has('securityPatch')) {
securityPatchValue ? `securityPatch = \\"${securityPatchValue}\\"` : '', exec('rm -f /data/adb/tricky_store/security_patch_auto_config || true');
osVersionValue ? `osVersion = ${osVersionValue}` : '' }
].filter(Boolean).join('\n');
// Separate top-level and deviceProps
const topLevelKeys = ['securityPatch', 'osVersion'];
const topLevel = [];
const deviceProps = [];
for (const [key, value] of devconfig.entries()) {
if (topLevelKeys.includes(key)) {
if (key === 'osVersion') {
topLevel.push(`${key} = ${value}`);
} else {
topLevel.push(`${key} = \\"${value}\\"`);
}
} else {
deviceProps.push(`${key} = \\"${value}\\"`);
}
}
let config = topLevel.join('\n');
if (deviceProps.length > 0) {
config += `\n[deviceProps]\n` + deviceProps.join('\n');
}
handleSecurityPatch('manual', config); handleSecurityPatch('manual', config);
} else if (!advancedToggle.checked) { } else if (!advancedToggle.checked) {
// Normal mode validation // Normal mode validation
@@ -356,6 +400,7 @@ export function securityPatch() {
allPatchInput.value = ''; allPatchInput.value = '';
} }
} }
overlayContent.scrollTop = 0;
hideSecurityPatchDialog(); hideSecurityPatchDialog();
loadCurrentConfig(); loadCurrentConfig();
}); });
@@ -373,7 +418,7 @@ export function securityPatch() {
systemPatchInput.value = 'prop'; systemPatchInput.value = 'prop';
bootPatchInput.value = data; bootPatchInput.value = data;
vendorPatchInput.value = data; vendorPatchInput.value = data;
jamesPatchInput.value = data; devconfigPatchInput.value = data;
}); });
output.stderr.on('data', (data) => { output.stderr.on('data', (data) => {
if (data.includes("failed")) { if (data.includes("failed")) {

View File

@@ -13,7 +13,7 @@
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2); box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
width: calc(90% - 60px); width: calc(90% - 60px);
max-width: 300px; max-width: 300px;
max-height: calc(80% - 60px); max-height: calc(60% - 60px);
overflow-y: auto; overflow-y: auto;
} }