mirror of https://github.com/ospab/ostp.git
fix(gui): remove duplicate junk/tcp-frag fields from the profile editor modal
These were editable in two disconnected places: the profile editor modal
(pm-* fields, written into each saved profile's own tcp_fragmentation/
frag_chunk/frag_sleep/junk_pc/junk_ps) and the simple settings page (cs-*
fields, a global override applied at connect time via buildConfig()'s
merge: `s.tcpFrag || active.tcp_fragmentation`, etc). The simple settings
page already covers the same knobs, so the modal copy was pure duplication
and a source of confusion about which one actually took effect.
Removed the pm-tcp-settings panel and its fields from index.html, and all
now-dead JS: the variable lookups, the open-editor populate/reset logic,
the save-profile field writes (existing profiles keep their previously-
saved values via the {...profiles[idx], ...} merge - only new edits
through this modal no longer touch these fields), and the two change
listeners whose sole job was showing/hiding the removed panel. The
Transport (UDP/UoT) dropdown itself is untouched.
This commit is contained in:
parent
c756e02b63
commit
c6a130673d
|
|
@ -402,55 +402,6 @@
|
|||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Advanced TCP/UoT Settings (visible only if uot is selected) -->
|
||||
<div id="pm-tcp-settings" style="display:none; padding: 10px; background: rgba(0,0,0,0.2); border-radius: 8px; margin-bottom: 15px;">
|
||||
<div class="toggle-row" style="padding:0; border:none; margin-bottom:10px;">
|
||||
<div class="toggle-text">
|
||||
<span class="toggle-name">TCP Fragmentation</span>
|
||||
<span class="toggle-hint">Split handshake to bypass DPI</span>
|
||||
</div>
|
||||
<label class="toggle">
|
||||
<input type="checkbox" id="pm-tcp-frag" />
|
||||
<span class="toggle-track"><span class="toggle-thumb"></span></span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div id="pm-frag-details" style="display:none;">
|
||||
<div style="display:flex; gap:10px; margin-bottom:10px;">
|
||||
<div class="inline-field" style="padding:0; border:none; flex:1;">
|
||||
<span class="field-label">Chunk Size</span>
|
||||
<input id="pm-frag-chunk" class="field-input compact" type="number" placeholder="2" min="1" />
|
||||
</div>
|
||||
<div class="inline-field" style="padding:0; border:none; flex:1;">
|
||||
<span class="field-label">Sleep (ms)</span>
|
||||
<input id="pm-frag-sleep" class="field-input compact" type="number" placeholder="2" min="0" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-divider-mini" style="margin-top:0;"><span>Junk Packets</span></div>
|
||||
<div style="display:flex; gap:10px; margin-bottom:10px;">
|
||||
<div class="inline-field" style="padding:0; border:none; flex:1;">
|
||||
<span class="field-label">Count (Min)</span>
|
||||
<input id="pm-junk-pc-min" class="field-input compact" type="number" placeholder="2" min="0" />
|
||||
</div>
|
||||
<div class="inline-field" style="padding:0; border:none; flex:1;">
|
||||
<span class="field-label">Count (Max)</span>
|
||||
<input id="pm-junk-pc-max" class="field-input compact" type="number" placeholder="5" min="0" />
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:flex; gap:10px;">
|
||||
<div class="inline-field" style="padding:0; border:none; flex:1;">
|
||||
<span class="field-label">Size (Min)</span>
|
||||
<input id="pm-junk-ps-min" class="field-input compact" type="number" placeholder="100" min="0" />
|
||||
</div>
|
||||
<div class="inline-field" style="padding:0; border:none; flex:1;">
|
||||
<span class="field-label">Size (Max)</span>
|
||||
<input id="pm-junk-ps-max" class="field-input compact" type="number" placeholder="1000" min="0" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-actions">
|
||||
<button id="btn-profile-cancel" class="btn secondary">Cancel</button>
|
||||
<button id="btn-profile-delete" class="btn danger" style="display:none;">Delete</button>
|
||||
|
|
|
|||
|
|
@ -113,15 +113,6 @@ const pmName = $('pm-name');
|
|||
const pmServer = $('pm-server');
|
||||
const pmKey = $('pm-key');
|
||||
const pmTransport = $('pm-transport');
|
||||
const pmTcpFrag = $('pm-tcp-frag');
|
||||
const pmFragChunk = $('pm-frag-chunk');
|
||||
const pmFragSleep = $('pm-frag-sleep');
|
||||
const pmJunkPcMin = $('pm-junk-pc-min');
|
||||
const pmJunkPcMax = $('pm-junk-pc-max');
|
||||
const pmJunkPsMin = $('pm-junk-ps-min');
|
||||
const pmJunkPsMax = $('pm-junk-ps-max');
|
||||
const pmTcpSettings = $('pm-tcp-settings');
|
||||
const pmFragDetails = $('pm-frag-details');
|
||||
const btnProfileCancel = $('btn-profile-cancel');
|
||||
const btnProfileSave = $('btn-profile-save');
|
||||
const btnProfileDelete = $('btn-profile-delete');
|
||||
|
|
@ -522,31 +513,15 @@ function openProfileEditor(id) {
|
|||
pmServer.value = p.server || '';
|
||||
pmKey.value = p.key || '';
|
||||
pmTransport.value = p.transport || 'udp';
|
||||
pmTcpFrag.checked = !!p.tcp_fragmentation;
|
||||
pmFragChunk.value = p.frag_chunk || 2;
|
||||
pmFragSleep.value = p.frag_sleep || 2;
|
||||
pmJunkPcMin.value = p.junk_pc ? p.junk_pc[0] : 2;
|
||||
pmJunkPcMax.value = p.junk_pc ? p.junk_pc[1] : 5;
|
||||
pmJunkPsMin.value = p.junk_ps ? p.junk_ps[0] : 100;
|
||||
pmJunkPsMax.value = p.junk_ps ? p.junk_ps[1] : 1000;
|
||||
btnProfileDelete.style.display = '';
|
||||
} else {
|
||||
profileModalTitle.textContent = 'New Profile';
|
||||
pmName.value = pmServer.value = pmKey.value = '';
|
||||
pmTransport.value = 'udp';
|
||||
pmTcpFrag.checked = false;
|
||||
pmFragChunk.value = 2;
|
||||
pmFragSleep.value = 2;
|
||||
pmJunkPcMin.value = 2;
|
||||
pmJunkPcMax.value = 5;
|
||||
pmJunkPsMin.value = 100;
|
||||
pmJunkPsMax.value = 1000;
|
||||
btnProfileDelete.style.display = 'none';
|
||||
}
|
||||
pmKey.type = 'password';
|
||||
profileModal.classList.remove('hidden');
|
||||
pmTransport.dispatchEvent(new Event('change'));
|
||||
pmTcpFrag.dispatchEvent(new Event('change'));
|
||||
setTimeout(() => pmName.focus(), 80);
|
||||
}
|
||||
|
||||
|
|
@ -564,11 +539,6 @@ function saveProfileFromEditor() {
|
|||
server,
|
||||
key,
|
||||
transport: pmTransport.value,
|
||||
tcp_fragmentation: pmTcpFrag.checked,
|
||||
frag_chunk: parseInt(pmFragChunk.value) || 2,
|
||||
frag_sleep: parseInt(pmFragSleep.value) || 2,
|
||||
junk_pc: [parseInt(pmJunkPcMin.value)||2, parseInt(pmJunkPcMax.value)||5],
|
||||
junk_ps: [parseInt(pmJunkPsMin.value)||100, parseInt(pmJunkPsMax.value)||1000],
|
||||
};
|
||||
}
|
||||
} else {
|
||||
|
|
@ -578,11 +548,6 @@ function saveProfileFromEditor() {
|
|||
server,
|
||||
key,
|
||||
transport: pmTransport.value,
|
||||
tcp_fragmentation: pmTcpFrag.checked,
|
||||
frag_chunk: parseInt(pmFragChunk.value) || 2,
|
||||
frag_sleep: parseInt(pmFragSleep.value) || 2,
|
||||
junk_pc: [parseInt(pmJunkPcMin.value)||2, parseInt(pmJunkPcMax.value)||5],
|
||||
junk_ps: [parseInt(pmJunkPsMin.value)||100, parseInt(pmJunkPsMax.value)||1000],
|
||||
};
|
||||
profiles.push(p);
|
||||
if (!activeId) { activeId = p.id; saveActiveId(activeId); }
|
||||
|
|
@ -875,12 +840,6 @@ window.addEventListener('DOMContentLoaded', async () => {
|
|||
btnProfileCancel.addEventListener('click', () => profileModal.classList.add('hidden'));
|
||||
btnProfileSave.addEventListener('click', saveProfileFromEditor);
|
||||
btnProfileDelete.addEventListener('click', deleteEditingProfile);
|
||||
pmTransport.addEventListener('change', () => {
|
||||
pmTcpSettings.style.display = pmTransport.value === 'uot' ? 'block' : 'none';
|
||||
});
|
||||
pmTcpFrag.addEventListener('change', () => {
|
||||
pmFragDetails.style.display = pmTcpFrag.checked ? 'block' : 'none';
|
||||
});
|
||||
btnPeekPm.addEventListener('click', () => {
|
||||
pmKey.type = pmKey.type === 'password' ? 'text' : 'password';
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue