Merge branch 'dev' of https://github.com/QLHazyCoder/codex-oauth-automation-extension into dev
This commit is contained in:
@@ -425,6 +425,11 @@
|
||||
<option value="52" selected>Thailand</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="data-row" id="row-hero-sms-max-price" style="display:none;">
|
||||
<span class="data-label">最高价格</span>
|
||||
<input type="number" id="input-hero-sms-max-price" class="data-input mono" min="0.0001" step="0.0001" required
|
||||
placeholder="必填,例如 0.08" />
|
||||
</div>
|
||||
<div class="data-row" id="row-hero-sms-api-key" style="display:none;">
|
||||
<span class="data-label">接码 API</span>
|
||||
<div class="input-with-icon">
|
||||
|
||||
+34
-1
@@ -296,8 +296,10 @@ const rowPhoneVerificationEnabled = document.getElementById('row-phone-verificat
|
||||
const inputPhoneVerificationEnabled = document.getElementById('input-phone-verification-enabled');
|
||||
const rowHeroSmsPlatform = document.getElementById('row-hero-sms-platform');
|
||||
const rowHeroSmsCountry = document.getElementById('row-hero-sms-country');
|
||||
const rowHeroSmsMaxPrice = document.getElementById('row-hero-sms-max-price');
|
||||
const rowHeroSmsApiKey = document.getElementById('row-hero-sms-api-key');
|
||||
const inputHeroSmsApiKey = document.getElementById('input-hero-sms-api-key');
|
||||
const inputHeroSmsMaxPrice = document.getElementById('input-hero-sms-max-price');
|
||||
const selectHeroSmsCountry = document.getElementById('select-hero-sms-country');
|
||||
const displayHeroSmsPlatform = document.getElementById('display-hero-sms-platform');
|
||||
const rowAccountRunHistoryHelperBaseUrl = document.getElementById('row-account-run-history-helper-base-url');
|
||||
@@ -2228,6 +2230,9 @@ function collectSettingsPayload() {
|
||||
const heroSmsApiKeyValue = typeof inputHeroSmsApiKey !== 'undefined' && inputHeroSmsApiKey
|
||||
? (inputHeroSmsApiKey.value || '')
|
||||
: '';
|
||||
const heroSmsMaxPriceValue = typeof inputHeroSmsMaxPrice !== 'undefined' && inputHeroSmsMaxPrice
|
||||
? normalizeHeroSmsMaxPriceValue(inputHeroSmsMaxPrice.value)
|
||||
: '';
|
||||
const heroSmsCountry = typeof getSelectedHeroSmsCountryOption === 'function'
|
||||
? getSelectedHeroSmsCountryOption()
|
||||
: {
|
||||
@@ -2331,6 +2336,7 @@ function collectSettingsPayload() {
|
||||
DEFAULT_VERIFICATION_RESEND_COUNT
|
||||
),
|
||||
heroSmsApiKey: heroSmsApiKeyValue,
|
||||
heroSmsMaxPrice: heroSmsMaxPriceValue,
|
||||
heroSmsCountryId: heroSmsCountry.id,
|
||||
heroSmsCountryLabel: heroSmsCountry.label,
|
||||
};
|
||||
@@ -2389,6 +2395,18 @@ function normalizeHeroSmsCountryLabel(value = '') {
|
||||
return String(value || '').trim() || DEFAULT_HERO_SMS_COUNTRY_LABEL;
|
||||
}
|
||||
|
||||
function normalizeHeroSmsMaxPriceValue(value, fallback = '') {
|
||||
const trimmed = String(value ?? '').trim();
|
||||
if (!trimmed) {
|
||||
return String(fallback || '').trim();
|
||||
}
|
||||
const numeric = Number(trimmed);
|
||||
if (!Number.isFinite(numeric) || numeric <= 0) {
|
||||
return String(fallback || '').trim();
|
||||
}
|
||||
return String(numeric);
|
||||
}
|
||||
|
||||
function getSelectedHeroSmsCountryOption() {
|
||||
if (!selectHeroSmsCountry) {
|
||||
return {
|
||||
@@ -2609,7 +2627,7 @@ function updateAccountRunHistorySettingsUI() {
|
||||
|
||||
function updatePhoneVerificationSettingsUI() {
|
||||
const enabled = Boolean(inputPhoneVerificationEnabled?.checked);
|
||||
[rowHeroSmsPlatform, rowHeroSmsCountry, rowHeroSmsApiKey].forEach((row) => {
|
||||
[rowHeroSmsPlatform, rowHeroSmsCountry, rowHeroSmsMaxPrice, rowHeroSmsApiKey].forEach((row) => {
|
||||
if (!row) {
|
||||
return;
|
||||
}
|
||||
@@ -3113,6 +3131,9 @@ function applySettingsState(state) {
|
||||
if (inputHeroSmsApiKey) {
|
||||
inputHeroSmsApiKey.value = state?.heroSmsApiKey || '';
|
||||
}
|
||||
if (inputHeroSmsMaxPrice) {
|
||||
inputHeroSmsMaxPrice.value = normalizeHeroSmsMaxPriceValue(state?.heroSmsMaxPrice);
|
||||
}
|
||||
if (selectHeroSmsCountry) {
|
||||
const restoredCountryId = String(normalizeHeroSmsCountryId(state?.heroSmsCountryId));
|
||||
if (Array.from(selectHeroSmsCountry.options).some((option) => option.value === restoredCountryId)) {
|
||||
@@ -6655,6 +6676,15 @@ inputHeroSmsApiKey?.addEventListener('blur', () => {
|
||||
saveSettings({ silent: true }).catch(() => { });
|
||||
});
|
||||
|
||||
inputHeroSmsMaxPrice?.addEventListener('input', () => {
|
||||
markSettingsDirty(true);
|
||||
scheduleSettingsAutoSave();
|
||||
});
|
||||
inputHeroSmsMaxPrice?.addEventListener('blur', () => {
|
||||
inputHeroSmsMaxPrice.value = normalizeHeroSmsMaxPriceValue(inputHeroSmsMaxPrice.value);
|
||||
saveSettings({ silent: true }).catch(() => { });
|
||||
});
|
||||
|
||||
selectHeroSmsCountry?.addEventListener('change', () => {
|
||||
updateHeroSmsPlatformDisplay(getSelectedHeroSmsCountryOption().label);
|
||||
markSettingsDirty(true);
|
||||
@@ -7057,6 +7087,9 @@ chrome.runtime.onMessage.addListener((message, _sender, sendResponse) => {
|
||||
if (message.payload.heroSmsApiKey !== undefined && inputHeroSmsApiKey) {
|
||||
inputHeroSmsApiKey.value = message.payload.heroSmsApiKey || '';
|
||||
}
|
||||
if (message.payload.heroSmsMaxPrice !== undefined && inputHeroSmsMaxPrice) {
|
||||
inputHeroSmsMaxPrice.value = normalizeHeroSmsMaxPriceValue(message.payload.heroSmsMaxPrice);
|
||||
}
|
||||
if (message.payload.phoneVerificationEnabled !== undefined && inputPhoneVerificationEnabled) {
|
||||
inputPhoneVerificationEnabled.checked = Boolean(message.payload.phoneVerificationEnabled);
|
||||
updatePhoneVerificationSettingsUI();
|
||||
|
||||
Reference in New Issue
Block a user