mwarning / openwrt-firmware-selector

OpenWrt firmware selector. With custom image builder support.
https://mwarning.github.io/openwrt-firmware-selector/www/
Creative Commons Zero v1.0 Universal
39 stars 22 forks source link

use upstream like json files #4

Closed aparcar closed 4 years ago

aparcar commented 4 years ago

This PR simplifies the code by using a data structure similar to the OpenWrt upstream files. Ideally OpenWrt offers at some point files similar to names-.json.

The missing bit is that multiple files files containing images of a release should be loaded, however always just the selected one and on demand, so not all JSON files if only the latest version is selected. I tried to implement this, however ended up in the callback hell (as I learned today) - so please don't hesitate helping me here.

I accidentally used an autoformat tool called js-beautify which changed parts of the code indention without changing its functionality, however as this is more a RFC than an actual PR I did not fixed it afterwards.

Using this structure would also work together with the new image on demand service I'm working on0.

Signed-off-by: Paul Spooren mail@aparcar.org

aparcar commented 4 years ago

image

aparcar commented 4 years ago

Having multiple release files on demand also allows to keep things small while supporting more and more releases, the single file approach eventually bloats up the initial data loading.

mwarning commented 4 years ago

Thanks for the proposal.

A few things:

aparcar commented 4 years ago

The buttons can should have additional descriptions however better based on type not filename, don't you think?

I'm okay with the rest, are you up to do the async magic?

mwarning commented 4 years ago

@aparcar I do not think the type field of the OpenWrt json output has enough information for this image selector yet. I would like to keep the heuristic for now.

Please have a look at the current state of the code and let me know if that is something we can continue on.

aparcar commented 4 years ago

In fine with the current heuristic, I'm just caring about the data structure right now

mwarning commented 4 years ago

Is that ok? https://github.com/mwarning/yet_another_firmware_selector/blob/master/names-SNAPSHOT.json

mwarning commented 4 years ago

I'm okay with the rest, are you up to do the async magic?

Here is the gist of it. Or what do you mean?

mkdir tmp
rsync -avm  --include='*.json' --include='*/' --exclude='*' 'rsync://downloads.openwrt.org/downloads/snapshots/targets/' tmp/