Update BrightSignOS from HTML / JS
7min
brightsign partners who use html / javascript apps (and do not use the brightauthor\ connected interface) can follow the steps outlined below to update to the latest version of brightsignos (bos) access brightsignos go to the downloads http //www brightsign biz/downloads/overview/ section of our website or to brightsignos releases docid\ jrjmrqspcjylopa9uy7xf to download the bos version you want click the download button on the download page that corresponds with the model number of your brightsign player note that bos versions for different model families are often designated with the same number, but they are different files make sure to use only the update file that corresponds to the model number of your brightsign player unzip the downloaded file put the bsfw file in your known url location contact support\@brightsign biz mailto\ support\@brightsign biz if you need help creating an url for the correct bos release install the update to install the update, your code must download the bos update into the root directory of an attached storage device (where the os will look for it during a reboot) and reboot the player after the download you may also want to add a check to see if the bos has been downloaded correctly code requirements specify the correct os version and bsfw from the downloaded url if you know where to download the update, specify that location in your code if not, the code must "decide" where to write the bos update file see "selecting a download location" for more guidance download the bos you can use the downloadfile() function and and the node fetch module or your own preferred method to call the reboot function after download, use the @brightsign/system api you can use the @brightsign/deviceinfo api to make sure the bos was downloaded correctly on the device download location you can use any writable storage device with sufficient space, but we recommend that you implement a search order which prefers a faster or more durable device (prioritize a plugged in usb stick over other storage, while the primary sd should take precedence over the secondary sd, and an sd card the user plugs in should take precedence over an ssd) for example /storage/usb1 (the drive for usb storage devices connected to the player) /storage/sd (the primary sd or microsd drive on the player) /storage/sd2 (the internal microsd drive on the player for 4kx42, xdx32 models) /storage/ssd (the internal ssd on the player for xtx44, xtx43, xdx34, and xdx33 models) have your script iterate over all the mountpoints in /storage (skipping anything that's not a mountpoint, or is a tmpfs, or is read only) looking for a drive with enough space example this code is for illustration purposes only a production implementation should also contain steps to handle errors, data overflow, write protected storage devices, etc if you want to run it, you'll need to have node js enabled in your browser runtime you should also edit it to point to the correct osyouwant the correct os version fwname the bsfw filename of the os url the os url ( https //bsncloud s3 amazonaws com/public is the public url that stores brightsign bsfw files) devicepath write the os update to this storage device // fetch the bos url let fs = require("fs") let path = require("path") let fetch = require("node fetch"); const systemclass = require("@brightsign/system"); let system = new systemclass(); const diclass = require("@brightsign/deviceinfo"); let di = new diclass(); // use the information in the hardcoded url to specify the osyouwant and fwname variables let osyouwant = '8 2 82' let fwname = 'malibu 8 2 82 update bsfw' let url = 'https //bsncloud s3 amazonaws com/public/malibu 8 2 82 update bsfw'; let devicepath = '/storage/sd/'+fwname; const downloadfile = (async (url, path) => { const res = await fetch(url); const filestream = fs createwritestream(path); await new promise((resolve, reject) => { res body pipe(filestream); res body on("error", (err) => { reject(err); }); filestream on("finish", function() { resolve('success'); }); }); }); function main(){ if (di osversioncompare(osyouwant) != 0) { downloadfile(url, devicepath) then(() => { console log(`${osyouwant} has been downloaded successfully!`) system reboot(); }) catch((err) => { console log(err) }) } else{ console log(`you have gotten the right os ${osyouwant} you want!`) } } main(); check brightsignos version after the player reboots, check the brightsignos version in the brightauthor\ connected dws to make sure that it has been updated to the correct version