Re: [webmin-devel] Building a Google Gears manifest file ofWebminstatic files

"Jamie Cameron" <[email protected]> Tue, 17 Feb 2009 09:38:13 -0800 (PST)
Newsgroups gmane.comp.web.webmin.devel
Message-ID <[email protected]>
On 17/Feb/2009 01:37 David Harrison wrote ..
> On 17/02/2009, at 7:56 AM, Jamie Cameron wrote:
> 
> > Assuming you just want to cache all images and .js files, you could
> > build a full list with code like :
> >
> > open(FIND, "find $root_directory -type f -name '*.{gif,png,jpg,js}'  
> > |");
> > while($file = <FIND>) {
> >  chop($file);
> >  $file =~ s/^\Q$root_directory\E//;
> >  $file = $gconfig{'webprefix'}.$file;
> >  $manifest .= "{ \"url\" : \"$file\" },";
> > }
> > print $manifest;
> >
> > Does that help?
> 
> 
> Thanks Jamie,
> Based on the snippet you provided I've built a far more flexible  
> manifest generation script.
> I chose to use File::Find rather than the command line 'find' tool as  
> it seemed to keep me more platform neutral.
> 
> Now rather than caching just a couple of hundred files all of a Webmin  
> installs static content (excluding other themes) is cached.
> For my test Webmin installation this turned out to be 2,400-odd files.

Great! 

Shouldn't the browser be caching these static files after they are fetched
once though? Or does gears pre-cache them all?

> I've had to do a bit of a quick hack job on the init_config function  
> in order to get around the referrer check.
> This is due to Gears operating as a separate process and not including  
> any referrer details when making the manifest request.

There is a supported way of skipping refer checking in this case .. just
set $trust_unknown_referers = 1; before calling init_config.

 - Jamie

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
-
Forwarded by the Webmin development list at [email protected]
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel