Skip to content

Commit

Permalink
[no ci] Update wifibroadcast-ng (#1730)
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorxda authored Feb 25, 2025
1 parent 0822a26 commit 1adb8b8
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 60 deletions.
6 changes: 4 additions & 2 deletions general/package/wifibroadcast-ng/files/wfb.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 8 additions & 8 deletions general/package/wifibroadcast-ng/files/wifibroadcast
Original file line number Diff line number Diff line change
Expand Up @@ -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 &
}

Expand Down
24 changes: 12 additions & 12 deletions general/package/wifibroadcast-ng/www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
<a href="javascript:location.reload()"><img src="logo.webp" width="220dp"></a>
</header>

<div class="container">
<section class="video-section">
<video id="preview" poster="/mjpeg"></video>
</section>
<section class="video-section">
<video id="preview" poster="/mjpeg"></video>
</section>

<div class="container">
<section class="form-section">
<form id="majestic-form">
<h3>Video</h3>
Expand All @@ -41,7 +41,7 @@ <h3>Video</h3>
<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>

Expand All @@ -53,14 +53,16 @@ <h3>Audio</h3>
<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>
</select>
</div>
</form>

<hr class="divider">

<div class="button-container">
<button id="apply-video-button">Apply</button>
<button id="reset-video-button">Reset</button>
Expand Down Expand Up @@ -115,12 +117,8 @@ <h3>Wireless</h3>

<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">
Expand All @@ -142,6 +140,8 @@ <h3>Telemetry</h3>
</div>
</form>

<hr class="divider">

<div class="button-container">
<button id="apply-wfb-button">Apply</button>
<button id="reset-wfb-button">Reset</button>
Expand Down
21 changes: 7 additions & 14 deletions general/package/wifibroadcast-ng/www/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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));
}
});
});
Expand Down Expand Up @@ -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';
}
57 changes: 33 additions & 24 deletions general/package/wifibroadcast-ng/www/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

.button-container {
display: flex;
flex-direction: column;
align-items: center;
width: 16vw;
height: 26px;
margin-bottom: 25px;
}

.form-section button {
width: 160px;
width: 20vw;
padding: 10px;
margin: 10px;
border: none;
border-radius: 4px;
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;
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 {
Expand Down

0 comments on commit 1adb8b8

Please sign in to comment.