[no ci] Update wifibroadcast-ng (#1730)

pull/1731/head
viktorxda 2025-02-25 15:18:26 +01:00 committed by GitHub
parent 0822a26212
commit 1adb8b8f5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 68 additions and 64 deletions

View File

@ -1,12 +1,14 @@
wireless:
txpower: 1
channel: 161
mode: HT20
width: HT20
broadcast:
wfb_index: 2
mcs_index: 2
tun_index: 1
fec_k: 8
fec_n: 12
stbc: 0
ldpc: 0
link_id: 7669206
telemetry:
router: msposd

View File

@ -55,25 +55,25 @@ load_modules() {
load_interface() {
iw "$wfb_dev" set monitor none
iw "$wfb_dev" set channel "$channel" "$mode"
iw "$wfb_dev" set channel "$channel" "$width"
iw reg set 00
[ "$driver" = "88XXau" ] && wfb_pwr=$((txpower * -100)) || wfb_pwr=$((txpower * 50))
iw "$wfb_dev" set txpower fixed "$wfb_pwr"
[ "$mode" = "HT20" ] && bandwidth=20 || bandwidth=40
[ "$driver" = "88XXau" ] && wfb_power=$((txpower * -100)) || wfb_power=$((txpower * 50))
iw "$wfb_dev" set txpower fixed "$wfb_power"
[ "$width" = "HT20" ] && wfb_width=20 || wfb_width=40
}
start_broadcast() {
echo_log "Starting wfb_tx"
wfb_tx -K "$wfb_key" -M "$wfb_index" -B "$bandwidth" -C 8000 -G short \
-k "$fec_k" -n "$fec_n" -i "$link_id" "$wfb_dev" &> /dev/null &
wfb_tx -K "$wfb_key" -M "$mcs_index" -B "$wfb_width" -k "$fec_k" -n "$fec_n" \
-S "$stbc" -L "$ldpc" -i "$link_id" -C 8000 -G short "$wfb_dev" &> /dev/null &
}
start_tunnel() {
echo_log "Starting wfb_tun"
wfb_rx -p 160 -u 5800 -K "$wfb_key" -i "$link_id" "$wfb_dev" &> /dev/null &
wfb_tx -p 32 -u 5801 -K "$wfb_key" -M "$tun_index" \
-k "$fec_k" -n "$fec_n" -i "$link_id" "$wfb_dev" &> /dev/null &
wfb_tx -p 32 -u 5801 -K "$wfb_key" -M "$tun_index" -k "$fec_k" -n "$fec_n" \
-S "$stbc" -L "$ldpc" -i "$link_id" "$wfb_dev" &> /dev/null &
wfb_tun -a 10.5.0.10/24 > /dev/null &
}

View File

@ -12,11 +12,11 @@
<a href="javascript:location.reload()"><img src="logo.webp" width="220dp"></a>
</header>
<div class="container">
<section class="video-section">
<section class="video-section">
<video id="preview" poster="/mjpeg"></video>
</section>
</section>
<div class="container">
<section class="form-section">
<form id="majestic-form">
<h3>Video</h3>
@ -41,7 +41,7 @@
<select id="bitrate" name="majestic.video0.bitrate"></select>
</div>
<div class="row">
<label for="records">Recording:</label>
<label for="records">Record:</label>
<input type="checkbox" id="records" name="majestic.records.enabled">
</div>
@ -53,7 +53,7 @@
<input type="checkbox" id="audio" name="majestic.audio.enabled">
</div>
<div class="row">
<label for="srate">Samplerate:</label>
<label for="srate">Sample:</label>
<select id="srate" name="majestic.audio.srate">
<option value="8000">8000</option>
<option value="48000">48000</option>
@ -61,6 +61,8 @@
</div>
</form>
<hr class="divider">
<div class="button-container">
<button id="apply-video-button">Apply</button>
<button id="reset-video-button">Reset</button>
@ -115,12 +117,8 @@
<h3>Broadcast</h3>
<div class="row">
<label for="wfb_index">WFB Index:</label>
<select id="wfb_index" name="wfb.broadcast.wfb_index"></select>
</div>
<div class="row">
<label for="tun_index">TUN Index:</label>
<select id="tun_index" name="wfb.broadcast.tun_index"></select>
<label for="wfb_index">MCS Index:</label>
<select id="wfb_index" name="wfb.broadcast.mcs_index"></select>
</div>
<hr class="divider">
@ -142,6 +140,8 @@
</div>
</form>
<hr class="divider">
<div class="button-container">
<button id="apply-wfb-button">Apply</button>
<button id="reset-wfb-button">Reset</button>

View File

@ -22,6 +22,10 @@ async function runCommand(command) {
});
}
if (navigator.userAgent.includes("Android")) {
document.querySelector('.video-section').style.display = 'none';
}
function syncForm(data, formPrefix, mode) {
Object.keys(data).forEach((section) => {
Object.keys(data[section]).forEach((key) => {
@ -34,17 +38,10 @@ function syncForm(data, formPrefix, mode) {
const value = data[section][key];
if (mode === "setup") {
if (isCheckbox) {
field.checked = value === true;
} else {
field.value = value;
}
isCheckbox ? field.checked = value === true : field.value = value;
} else if (mode === "update") {
if (isCheckbox) {
data[section][key] = field.checked;
} else {
data[section][key] = field.value;
}
data[section][key] = isCheckbox ?
field.checked : (isNaN(field.value) ? field.value : Number(field.value));
}
});
});
@ -99,7 +96,3 @@ loadYAML('/etc/wfb.yaml', (data) => {
configData.wfb = data;
syncForm(configData.wfb, 'wfb', "setup");
});
if (navigator.userAgent.includes("Android")) {
document.querySelector('.video-section').style.display = 'none';
}

View File

@ -19,69 +19,78 @@ h3 {
color: #dee2e6bf;
}
.row {
margin: 20px;
.container {
display: flex;
justify-content: space-evenly;
width: 100%;
}
.form-section .row {
display: flex;
justify-content: space-between;
margin: 10px 40px;
}
.form-section {
width: 45%;
margin: 20px 0;
padding-top: 20px;
background-color: #2d2d2d;
border-radius: 4px;
box-shadow: 0 2px 10px #00000080;
max-width: 60%;
padding: 20px;
margin: 20px auto;
}
.form-section label {
width: 10vw;
margin: 10px 0 5px;
display: inline-block;
font-weight: bold;
margin: 10px 0 5px;
width: 150px;
vertical-align: top;
color: #dee2e6;
font-size: 0.9rem;
}
.form-section select {
width: 120px;
width: 16vw;
padding: 10px;
margin-bottom: 15px;
background-color: #3c3c3c;
border-radius: 4px;
border: 1px solid #555;
background-color: #3c3c3c;
color: #dcdcdc;
display: inline-block;
box-sizing: border-box;
font-size: 0.9rem;
}
.form-section input {
width: 120px;
height: 25px;
width: 16vw;
height: 26px;
margin-bottom: 25px;
}
.form-section button {
width: 20vw;
padding: 10px;
margin: 10px;
border: none;
cursor: pointer;
font-size: 1rem;
color: white;
border-radius: 4px;
box-shadow: 0 2px 10px #00000040;
}
.button-container {
display: flex;
flex-direction: column;
align-items: center;
}
.form-section button {
width: 160px;
padding: 10px;
margin: 10px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1rem;
color: white;
box-shadow: 0 2px 10px #00000040;
margin: 25px;
}
#preview {
width: 100%;
max-width: 80%;
max-width: 75%;
background-color: #000;
box-shadow: 0 2px 10px #00000080;
border-radius: 4px;
box-shadow: 0 2px 10px #00000080;
}
#apply-video-button, #apply-wfb-button {