I hate to say this, but UniFi is forcing us to host their ads on our stuff with no UI-facing or configuration options to change it. It looks like this:
https://i.imgur.com/6O7U1un.png
From this thread, folks are talking about how they are modifying a JS file in a Docker image to remove the modal:
They are using this sed command:
sed -Ei '/return n&&r\?.+\.aF\.Root/s/return n/return !1/' webapps/ROOT/app-unifi/react/js/swai.*.js
In this package, this results in this diff:
https://gist.github.com/synthead/1201247394e1159abff00b5d8a7b7ce7
You can add this patch to this PKGBUILD like so:
source=("UniFi-${pkgver}.zip::https://dl.ui.com/unifi/${pkgver}/UniFi.unix.zip"
mongod
unifi.service
unifi.sysusers
unifi.tmpfiles
LICENSE
remove-unifi-ads.patch)
b2sums=('6da6aa08412d8cc3ec43e700cfebf28bc7493fefc7c3eb41b90ee8e688eb4c1c23b803597c70b8e07b08f60853aa0af18507caf26941569a0ed4a585591ec8d5'
'2c8d535aabe8e738a9ba375fc4ab7aaa1713c9aefffc3e652fd49bc6288d0b7d24cae64d04ded5d5052486a377edca190818874a80bafb33cf2ac94742540106'
'753d4f24793ca65c9f554bedfbc22d6507474d835986cdba435538ec6518bd14769a64485a5f4bab1fc879378ff4c4b64ec323fa362dac32f739ed119cb2647c'
'5474a726a8a222f463f47cdca44988889406e2bee7b3c7875d45b20dc283d1d9737772d8cb63cd35c75517f3606feaadcf02c00b73e5bbab40f459d78d066c3e'
'bd254ddbd4b52acca50b41dffe7ae1e2e5250f15574fc371d36dc133215f3a268623b0b5b12e73932c856bf90a69a178ba91530ffa8b08c0da51f51911b2ef92'
'84f2a201143b3e44ba09d1009818db507d8f261d495a86ce239bcbacee059aad5c63af1b43638b126be743ff7c660f0871eb2b4efe2031e2f64bc23f172052e0'
'4651e2cf280cfcefb45d0cba347a963298c0c264046c8e5611e8a4a802ad5ba1085d92a7a9346f0317285132d1a58732769fe08a470adac4c44ab363a7554ff6')
prepare() {
cd "$srcdir/UniFi"
patch -p1 < "$srcdir/remove-unifi-ads.patch"
}
I am running this patch on my UniFi server, and so far, it seems to be working without any side effects.
Keep in mind that this patch targets swai.6eeda0a22aa076976d7e.js, which is probably going to be changed in a new version (probably new minified JS and a new file name). The sed command above will probably work with a new version, which can be used to create a new patch.
Pinned Comments
freswa commented on 2019-10-30 11:50 (UTC)
We are on Stable with this Package. Please flag out-of-date only if the Version provided with this package does not match the version under "Stable" in this link: https://help.ubnt.com/hc/en-us/articles/360008240754#1