webui: add preview fingerprint toggle

This commit is contained in:
KOWX712 2025-03-04 00:16:16 +08:00
parent 18364bcbc3
commit 15883b47ae
2 changed files with 64 additions and 23 deletions

View File

@ -20,6 +20,13 @@
<div class="toggle-list ripple-element" id="fetch">
<span class="toggle-text">Fetch pif.json</span>
</div>
<div class="toggle-list ripple-element" id="preview-fp-toggle-container">
<span class="toggle-text">Use preview fingerprint</span>
<label class="toggle-switch">
<input type="checkbox" id="toggle-preview-fp" disabled>
<span class="slider round"></span>
</label>
</div>
<div class="toggle-list ripple-element" id="sdk-vending-toggle-container">
<span class="toggle-text">Spoof sdk version to Play Store</span>
<label class="toggle-switch">

View File

@ -20,6 +20,7 @@ async function execCommand(command) {
function applyButtonEventListeners() {
const fetchButton = document.getElementById('fetch');
const sdkVendingToggle = document.getElementById('sdk-vending-toggle-container');
const previewFpToggle = document.getElementById('preview-fp-toggle-container');
const clearButton = document.querySelector('.clear-terminal');
fetchButton.addEventListener('click', runAction);
@ -43,10 +44,21 @@ function applyButtonEventListeners() {
appendToOutput(`[+] Successfully changed spoofVendingSdk to ${isChecked ? 0 : 1}`);
document.getElementById('toggle-sdk-vending').checked = !isChecked;
} catch (error) {
appendToOutput("[-] Failed to change spoofVendingSdk");
appendToOutput("[!] Failed to change spoofVendingSdk");
console.error('Failed to toggle sdk vending:', error);
}
});
previewFpToggle.addEventListener('click', async () => {
try {
const isChecked = document.getElementById('toggle-preview-fp').checked;
await execCommand(`sed -i 's/^FORCE_PREVIEW=.*$/FORCE_PREVIEW=${isChecked ? 0 : 1}/' /data/adb/modules/playintegrityfix/action.sh`);
appendToOutput(`[+] Switched fingerprint to ${isChecked ? 'beta' : 'preview'}`);
loadPreviewFingerprintConfig();
} catch (error) {
appendToOutput("[!] Failed to switch fingerprint type");
console.error('Failed to switch fingerprint type:', error);
}
});
clearButton.addEventListener('click', () => {
const output = document.querySelector('.output-terminal-content');
output.innerHTML = '';
@ -92,13 +104,14 @@ async function loadVersionFromModuleProp() {
const version = await execCommand("grep '^version=' /data/adb/modules/playintegrityfix/module.prop | cut -d'=' -f2");
versionElement.textContent = version.trim();
} catch (error) {
appendToOutput("[-] Failed to read version from module.prop");
appendToOutput("[!] Failed to read version from module.prop");
console.error("Failed to read version from module.prop:", error);
}
}
// Function to load spoofVendingSdk config
async function loadSpoofVendingSdkConfig() {
try {
const sdkVendingToggle = document.getElementById('toggle-sdk-vending');
const isChecked = await execCommand(`grep -o '"spoofVendingSdk": [01]' /data/adb/modules/playintegrityfix/pif.json | cut -d' ' -f2`);
if (isChecked === '0') {
@ -106,6 +119,26 @@ async function loadSpoofVendingSdkConfig() {
} else {
sdkVendingToggle.checked = true;
}
} catch (error) {
appendToOutput("[!] Failed to load spoofVendingSdk config");
console.error("Failed to load spoofVendingSdk config:", error);
}
}
// Function to load preview fingerprint config
async function loadPreviewFingerprintConfig() {
try {
const previewFpToggle = document.getElementById('toggle-preview-fp');
const isChecked = await execCommand(`grep -o 'FORCE_PREVIEW=[01]' /data/adb/modules/playintegrityfix/action.sh | cut -d'=' -f2`);
if (isChecked === '0') {
previewFpToggle.checked = false;
} else {
previewFpToggle.checked = true;
}
} catch (error) {
appendToOutput("[!] Failed to load preview fingerprint config");
console.error("Failed to load preview fingerprint config:", error);
}
}
// Function to append element in output terminal
@ -262,6 +295,7 @@ document.addEventListener('DOMContentLoaded', async () => {
checkMMRL();
loadVersionFromModuleProp();
loadSpoofVendingSdkConfig();
loadPreviewFingerprintConfig();
applyButtonEventListeners();
applyRippleEffect();
});