External javascript file (+wifi site survey)

Want to share your OpenWrt / Gargoyle knowledge? Implemented a new feature? Let us know here.

Moderator: Moderators

Post Reply
BashfulBladder
Moderator
Posts: 250
Joined: Thu Jan 17, 2013 11:43 pm

External javascript file (+wifi site survey)

Post by BashfulBladder »

So I'm working on another plugin
survey.png
survey.png (62.08 KiB) Viewed 4773 times
and I've come across an issue I can't seem to get past.

I want vendor lookup from MAC address. I have a small 5 line sample which provides the lookup for the last row. The full array winds up being a hefty 775kb array scraped from http://standards.ieee.org/develop/regauth/oui/oui.txt Since it can't go on the router, I though pull it in locally. Safari, Chrome & Firefox prevent that.

Can a Gargoyle webpage pull a javascript file from an external website & have a browser load it successfully?
TP-Link WDR3600 v1.1 running 1.5.10+ L10n-English (Built 20130922 - OpenWrt r38093)
TP-Link WDR4300 running 1.5.10+ i18n-English (Built 20131010 - OpenWrt r38286)

https://github.com/BashfulBladder/gargoyle-plugins/wiki

mtr
Posts: 29
Joined: Sun Oct 28, 2012 1:14 pm

Re: External javascript file (+wifi site survey)

Post by mtr »

Wow, you're on fire with plugins! :D

Maybe you can check, before downloading oui.txt, if there is an external storage such a hard drive, thumbdrive, etc plugged and then save the oui.txt file there.
I think It's an option to save space on router filesystem and also keep a single copy of file.

My 2 cents.

BashfulBladder
Moderator
Posts: 250
Joined: Thu Jan 17, 2013 11:43 pm

Re: External javascript file (+wifi site survey)

Post by BashfulBladder »

FireVortex wrote:Wow, you're on fire with plugins! :D
yeah, I have needs. A "tech savvry neighbor" with all kinds of airs. And an inability to set passwords.

---------------------
I had been looking up things like JSONP & CORS....

The solution was already there - haserl can echo those variables from /tmp as the page loads for direct injection. Thanks Eric.

Code: Select all

<script>
<!--
<?
	cat /tmp/OUIs.js
?>
//-->
</script>
survey2.png
survey2.png (86.32 KiB) Viewed 4717 times
Vendor lookup in the 1st column bottom line in each row! Yes, its the little things in life...

Its not going to be transparent though. It will require the end user to either copy something to /tmp or maybe I can create a package that will install to /tmp.
-------------------------
In OpenWrt, /tmp is mapped to a tmpfs (temporary filesystem) that behaves like a ramdisk. Anything there doesn't survive a restart - it never gets onto the flash chip. I say this like I have no problem using RAM because I have 64MB of RAM on my router & the most strain I put on it is serving some webpages up.

Not every router is in the same boat, and it's not a perfect solution - but it is the one for me. I will also look into storing/installing onto a USB partition.
TP-Link WDR3600 v1.1 running 1.5.10+ L10n-English (Built 20130922 - OpenWrt r38093)
TP-Link WDR4300 running 1.5.10+ i18n-English (Built 20131010 - OpenWrt r38286)

https://github.com/BashfulBladder/gargoyle-plugins/wiki

Post Reply