Centralized configuration of Greasemonkey user scripts
Greasemonkey requires manual configuration for each user script that is installed. This is a hassle for a user who wants a consistent configuration across several machines, and untenable for an organization that wants consistent configurations across hundreds or thousands of machines.
These problems will grow as user scripts become more prevelant. It will become important to be able to upgrade script versions, to automatically add cool new (safe) scripts, and to block hostile scripts. Something like this is probably essentially if Greasemonkey is to gain any traction in the workplace.
One obvious solution is to push the configuration on to a centralized server and use the local filesystem merely as a cache.
It’s fairly easy to achieve much of this vision without changing Greasemonkey at all. The “uber user script” at the bottom of this post has no hardwired logic of its own, but uses XmlHttpRequest to pass the current URL to a web server that can decide what logic to run in response to that web page.
You can imagine backing with a variety of different web based configuration tools optiimized for individuals, corporations, and groups. It would also be possible to make the existing Greasemonkey dialogs talk to the web server rather than the filesystem to record user changes.
This isn’t just a tool for IT Nazis. Imagine being able to have communities of people sharing script recommendations.
To make this more efficient, we would want to respect the http cache headers on the fetched script so that it doesn’t have to be fetched repeatedly for the same URL. We would also want a way for Greasemonkey to ask the server for all of the URL patterns that the server might be interested in, so that on other URLs the server doesn’t need to be hit at all.
// uberuserscript
//
// ==UserScript==
// @name Uber User Script
// @namespace http://www.example.com
// @description Allow a server to specify greasemonkey user script configuration
// @include *
// ==/UserScript==
GM_xmlhttpRequest
({
method:’GET’,
url: ‘http://greasemonkeyconfig.com/userscript?url=’ + escape(document.location),
onload:function(results) {
eval(results.responseText)
}
});
No Comments so far
Leave a comment
Leave a comment