From 8947e6f23c1bb85ef9540c4111f84ce524c33c43 Mon Sep 17 00:00:00 2001 From: Tim Wilkinson Date: Wed, 16 Mar 2022 19:42:26 -0700 Subject: [PATCH] Migrate LeafletJS to new URL (#298) --- files/etc/config.mesh/aredn | 4 ++-- files/etc/config/system | 4 ++-- files/etc/uci-defaults/95_aredn_migrate_leafletjs | 6 ++++++ files/www/cgi-bin/advancedconfig | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) create mode 100755 files/etc/uci-defaults/95_aredn_migrate_leafletjs diff --git a/files/etc/config.mesh/aredn b/files/etc/config.mesh/aredn index 564a590c..d86676d4 100644 --- a/files/etc/config.mesh/aredn +++ b/files/etc/config.mesh/aredn @@ -8,8 +8,8 @@ config usb option passthrough '1' config map - option leafletjs 'http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js' - option leafletcss 'http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css' + option leafletjs 'http://unpkg.com/leaflet@0.7.7/dist/leaflet.js' + option leafletcss 'http://unpkg.com/leaflet@0.7.7/dist/leaflet.css' option maptiles 'http://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.jpg' config meshstatus diff --git a/files/etc/config/system b/files/etc/config/system index d04e850a..8feb82ef 100644 --- a/files/etc/config/system +++ b/files/etc/config/system @@ -21,6 +21,6 @@ config button option max '20' config map - option leafletjs 'http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js' - option leafletcss 'http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css' + option leafletjs 'http://unpkg.com/leaflet@0.7.7/dist/leaflet.js' + option leafletcss 'http://unpkg.com/leaflet@0.7.7/dist/leaflet.css' option maptiles 'http://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.jpg' diff --git a/files/etc/uci-defaults/95_aredn_migrate_leafletjs b/files/etc/uci-defaults/95_aredn_migrate_leafletjs new file mode 100755 index 00000000..d4af01d4 --- /dev/null +++ b/files/etc/uci-defaults/95_aredn_migrate_leafletjs @@ -0,0 +1,6 @@ +#!/bin/sh +if [ "$(/sbin/uci -c /etc/config.mesh -q get aredn.@map[0].leafletjs)" = "http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js" ]; then + /sbin/uci -c /etc/config.mesh -q set aredn.@map[0].leafletjs="http://unpkg.com/leaflet@0.7.7/dist/leaflet.js" + /sbin/uci -c /etc/config.mesh -q set aredn.@map[0].leafletcss="http://unpkg.com/leaflet@0.7.7/dist/leaflet.css" + /sbin/uci -c /etc/config.mesh -q commit aredn +fi diff --git a/files/www/cgi-bin/advancedconfig b/files/www/cgi-bin/advancedconfig index 9ac34975..64c1e62b 100755 --- a/files/www/cgi-bin/advancedconfig +++ b/files/www/cgi-bin/advancedconfig @@ -89,13 +89,13 @@ local settings = { key = "aredn.@map[0].leafletcss", type = "string", desc = "Specifies the URL of the leaflet.css file", - default = "http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" + default = "http://unpkg.com/leaflet@0.7.7/dist/leaflet.css" }, { key = "aredn.@map[0].leafletjs", type = "string", desc = "Specifies the URL of the leaflet.js file", - default = "http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js" + default = "http://unpkg.com/leaflet@0.7.7/dist/leaflet.js" }, { key = "aredn.@downloads[0].firmwarepath",