Skip to content

Commit

Permalink
Merge pull request #124 from meshtastic/webui-bundle
Browse files Browse the repository at this point in the history
Make Web UI bundle optional
  • Loading branch information
thebentern authored Nov 17, 2024
2 parents 2256bba + 4817ee3 commit afe3f1c
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 36 deletions.
52 changes: 40 additions & 12 deletions components/targets/Esp32.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,20 @@
</h3>
<label class="relative inline-flex items-center me-5 cursor-pointer" v-if="canFullInstall()">
<input type="checkbox" value="" class="sr-only peer" v-model="firmwareStore.$state.shouldCleanInstall">
<div class="w-11 h-6 bg-gray-200 rounded-full peer peer-focus:ring-4 dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-red-600">
</div>
<span class="ms-3 text-sm font-medium text-gray-900 dark:text-gray-300">
Full Erase and Install
</span>
<div class="w-11 h-6 rounded-full peer peer-focus:ring-4 bg-gray-400 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-red-600"></div>
<span class="ms-3 text-sm font-medium text-gray-900 dark:text-gray-300">Full Erase and Install</span>
</label>
<label class="relative inline-flex items-center me-5 cursor-pointer" v-if="firmwareStore.$state.shouldCleanInstall && canBundleWebUI">
<input type="checkbox" value="" class="sr-only peer" v-model="firmwareStore.$state.shouldBundleWebUI">
<div class="w-11 h-6 rounded-full peer peer-focus:ring-4 bg-gray-400 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-red-600"></div>
<span class="ms-3 text-sm font-medium text-gray-900 dark:text-gray-300">Bundle Web UI</span>
</label>
<div v-if="firmwareStore.$state.shouldCleanInstall" role="alert" class="flex flex-col p-4 mb-4 mt-2 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400">
<div class="flex items-center">
<InformationCircleIcon class="flex-shrink-0 inline w-4 h-4 mr-1" />
<span>
Back up the device’s public and private keys before a full erase and install to restore them after re-flashing if needed.
Back up the device's public and private keys before a full erase and install to restore them after re-flashing if needed.
<span v-if="firmwareStore.$state.shouldBundleWebUI">Additionally, bundling the Web UI will increase the flash utilization, taking away space from core usage and will take longer to install.</span>
</span>
</div>
<div class="flex items-center mt-2">
Expand All @@ -74,7 +77,7 @@
</div>
</div>
<p>
This process could take a minute.
This process could take a while.
</p>
<div>
<div class="p-4 mb-4 my-2 text-sm text-blue-800 rounded-lg bg-blue-50 dark:bg-gray-800 dark:text-blue-400" role="alert">
Expand Down Expand Up @@ -114,6 +117,10 @@ import {
InformationCircleIcon,
LinkIcon,
} from '@heroicons/vue/24/solid';
import {
BlobReader,
ZipReader,
} from '@zip.js/zip.js';
import { useDeviceStore } from '../../stores/deviceStore';
import { useFirmwareStore } from '../../stores/firmwareStore';
Expand All @@ -124,13 +131,16 @@ const deviceStore = useDeviceStore();
const firmwareStore = useFirmwareStore();
const partition = computed(() => {
if (firmwareStore.$state.flashingIndex == 0) {
if (firmwareStore.$state.flashingIndex === 0) {
return 'App Partition';
} else if (firmwareStore.$state.flashingIndex == 1) {
}
if (firmwareStore.$state.flashingIndex === 1) {
return 'OTA Partition';
} else if (firmwareStore.$state.flashingIndex == 2) {
}
if (firmwareStore.$state.flashingIndex === 2) {
return 'File System Partition';
}
return ''
})
const showFlashButton = computed(() => {
Expand All @@ -156,11 +166,29 @@ const canFullInstall = () => {
return false;
return true;
}
const canBundleWebUI = ref(false);
watch(() => firmwareStore.$state.shouldCleanInstall, async () => {
if (firmwareStore.isZipFile && firmwareStore.$state.selectedFile) {
const reader = new BlobReader(firmwareStore.$state.selectedFile);
const zipReader = new ZipReader(reader);
const entries = await zipReader.getEntries();
const foundWebUI = entries.find(entry => entry.filename.startsWith('littlefswebui'));
canBundleWebUI.value = !!foundWebUI;
} else if (firmwareStore.selectedFirmware) {
const littleFsFile = `littlefswebui-${firmwareStore.firmwareVersion}.bin`;
canBundleWebUI.value = await checkIfRemoteFileExists(firmwareStore.getReleaseFileUrl(littleFsFile));
}
else {
canBundleWebUI.value = false;
}
});
const cleanInstallEsp32 = () => {
const firmwareFile = `firmware-${deviceStore.$state.selectedTarget.platformioTarget}-${firmwareStore.firmwareVersion}.bin`;
const otaFile = deviceStore.$state.selectedTarget.architecture == 'esp32-s3' ? 'bleota-s3.bin' : 'bleota.bin';
const littleFsFile = `littlefs-${firmwareStore.firmwareVersion}.bin`;
const otaFile = deviceStore.$state.selectedTarget.architecture === 'esp32-s3' ? 'bleota-s3.bin' : 'bleota.bin';
const prefix = firmwareStore.shouldBundleWebUI ? 'littlefswebui' : 'littlefs';
const littleFsFile = `${prefix}-${firmwareStore.firmwareVersion}.bin`;
firmwareStore.cleanInstallEspFlash(firmwareFile, otaFile, littleFsFile, deviceStore.$state.selectedTarget);
}
Expand Down
1 change: 1 addition & 0 deletions stores/firmwareStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const useFirmwareStore = defineStore('firmware', {
baudRate: 115200,
hasSeenReleaseNotes: false,
shouldCleanInstall: false,
shouldBundleWebUI: false,
flashPercentDone: 0,
isFlashing: false,
flashingIndex: 0,
Expand Down
61 changes: 37 additions & 24 deletions types/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,36 +364,49 @@ export const OfflineHardwareList = [
]

const markdownContent = `
## Enhancements
* Coerce minimum telemetry interval of 30 minutes on defaults and make new default interval one hour by @thebentern in https://github.com/meshtastic/firmware/pull/5086
* Add buzzer feedback on GPS toggle by @Technologyman00 in https://github.com/meshtastic/firmware/pull/5090
* Add \`-p\` flag by @madeofstown in https://github.com/meshtastic/firmware/pull/5093
* Initial NODENUM_BROADCAST_NO_LORA implementation with NeighborInfo module by @thebentern in https://github.com/meshtastic/firmware/pull/5087
* Move 115200 baud GNSS probe earlier by @thebentern in https://github.com/meshtastic/firmware/pull/5101
* MPR121 Touch IC Based Keypad Input Module by @aussieklutz in https://github.com/meshtastic/firmware/pull/5103
* Add RFC 3927 IP address space to private IP checks by @rbrtio in https://github.com/meshtastic/firmware/pull/5115
* Update meshtasticd.service by @yNosGR in https://github.com/meshtastic/firmware/pull/5118
* Add Configurable UPLINK_ENABLED and DOWNLINK_ENABLED in userPrefs.h by @panaceya in https://github.com/meshtastic/firmware/pull/5120
* Add device unique id by @thebentern in https://github.com/meshtastic/firmware/pull/5092
* Account for port number in MQTT server by @JohnathonMohr in https://github.com/meshtastic/firmware/pull/5084
## 🚀 Enhancements
* Add setting to transmit NeighborInfo over LoRa by @GUVWAF in https://github.com/meshtastic/firmware/pull/5286
* Fix non-primary channel usage for non-PKC packets by @GUVWAF in https://github.com/meshtastic/firmware/pull/5287
* Remove scary warning about full NodeDB by @fifieldt in https://github.com/meshtastic/firmware/pull/5292
* Pin library versions in platform.io by @jp-bennett in https://github.com/meshtastic/firmware/pull/5293
* Update dependency versions by @fifieldt in https://github.com/meshtastic/firmware/pull/5299
* Exclude some niche modules by default and populate exclude_modules by @thebentern in https://github.com/meshtastic/firmware/pull/5300
* Rak10701 (rak wismeshtap) optimization by @DanielCao0 in https://github.com/meshtastic/firmware/pull/5280
* Coerce minimum neighborinfo interval on startup by @thebentern in https://github.com/meshtastic/firmware/pull/5314
* Add back some details to the PhoneAPI logs by @thebentern in https://github.com/meshtastic/firmware/pull/5313
* Radiolib update by @caveman99 in https://github.com/meshtastic/firmware/pull/5246
* Fix sending duplicate packets to PhoneAPI/MQTT by @GUVWAF in https://github.com/meshtastic/firmware/pull/5315
* Don't send to public channel by @gjelsoe in https://github.com/meshtastic/firmware/pull/5310
* Portduino packaging: Move meshtastic/web out of \`/usr/share/doc\` by @vidplace7 in https://github.com/meshtastic/firmware/pull/5323
* Reduce the flash usage of wismeshtap platform by @DanielCao0 in https://github.com/meshtastic/firmware/pull/5322
* Add support for ignoring nodes with \`is_ignored\` field in NodeInfo by @mdesmedt in https://github.com/meshtastic/firmware/pull/5319
* RP2040: Update core; add mDNS support by @GUVWAF in https://github.com/meshtastic/firmware/pull/5355
## Bug fixes
* Revert "Permanently engage !CTRL" by @caveman99 in https://github.com/meshtastic/firmware/pull/5095
* Fix GPS_DEBUG output by @fifieldt in https://github.com/meshtastic/firmware/pull/5100
* Wide_Lora uses 12 symbols to be compatible with SX1280 by @caveman99 in https://github.com/meshtastic/firmware/pull/5112
* Fix rebroadcasting encrypted packets when \`KNOWN_ONLY\`/\`LOCAL_ONLY\` is used by @GUVWAF in https://github.com/meshtastic/firmware/pull/5109
## 🐛 Bug fixes
* Fix memory leak in MQTT by @GUVWAF in https://github.com/meshtastic/firmware/pull/5311
* Don't attempt to save NodeDB on low-batt shutdown to prevent FS corruption by @thebentern in https://github.com/meshtastic/firmware/pull/5312
* Fix syntax error with package builds by @fifieldt in https://github.com/meshtastic/firmware/pull/5302
* Package file move - include dotfiles by @fifieldt in https://github.com/meshtastic/firmware/pull/5303
* Fix another heap leak by @GUVWAF in https://github.com/meshtastic/firmware/pull/5328
* Handle repeated packet after potentially canceling previous Tx by @GUVWAF in https://github.com/meshtastic/firmware/pull/5330
* Read voltage during init fixes #5276 by @Blake-Latchford in https://github.com/meshtastic/firmware/pull/5332
* Only allow 30 seconds minimum for power.on_battery_shutdown_after_secs by @thebentern in https://github.com/meshtastic/firmware/pull/5337
* Decrease max nodes for NRF52 to 80 as workaround to prevent FS blowouts by @thebentern in https://github.com/meshtastic/firmware/pull/5338
* Revert "Decrease max nodes for NRF52 to 80 as workaround to prevent FS blowouts" by @thebentern in https://github.com/meshtastic/firmware/pull/5340
* Remove log spam when reading INA sensor. by @Mictronics in https://github.com/meshtastic/firmware/pull/5345
* Migrate NRF52 devices max nodes down to 80 for now to prevent file system blowouts by @thebentern in https://github.com/meshtastic/firmware/pull/5346
* Adds fixed GPS, BUTTON_PIN and BLE code to userPrefs.h by @gjelsoe in https://github.com/meshtastic/firmware/pull/5341
* Add sudo to apt-get commands for Raspbian Build by @fifieldt in https://github.com/meshtastic/firmware/pull/5364
* Typo fix in build_raspbian.yml by @fifieldt in https://github.com/meshtastic/firmware/pull/5365
## New Contributors
* @Technologyman00 made their first contribution in https://github.com/meshtastic/firmware/pull/5090
* @madeofstown made their first contribution in https://github.com/meshtastic/firmware/pull/5093
* @aussieklutz made their first contribution in https://github.com/meshtastic/firmware/pull/5103
* @rbrtio made their first contribution in https://github.com/meshtastic/firmware/pull/5115
* @yNosGR made their first contribution in https://github.com/meshtastic/firmware/pull/5118
* @mdesmedt made their first contribution in https://github.com/meshtastic/firmware/pull/5319
* @Blake-Latchford made their first contribution in https://github.com/meshtastic/firmware/pull/5332
**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.5.7.f77c87d...v2.5.8.6485f03
**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.5.12.aa184e6...v2.5.13.74d0c58
`;

const currentPrereleaseId = '2.5.8.6485f03';
const currentPrereleaseId = '2.5.13.74d0c58';

export const showPrerelease = false;

Expand Down

0 comments on commit afe3f1c

Please sign in to comment.