Unfortunately there isn't a direct way to achieve this right now. You had a nice idea with the cron job, but since javascript has to execute, it won't work unless you use a headless browser like phantomjs to load the page. You might give that a try.
Alternatively, one of our firepad users, Clément Wehrung solved this with some tricky node code that runs firepad.js inside of node from a backend server. I haven't played with the code, but it may be a good starting point.
node-firepad.js:
/* jshint evil: true */
var jsdom = require('jsdom');
var fs = require('fs');
var Firepad = {};
/**
* Load Dependencies Sources
*/
// HACK: Make Firepad expose FirebaseAdapter
Firepad.FirepadSource = fs.readFileSync(__dirname+'/firepad.js').toString().replace('return firepad.Firepad;', 'firepad.Firepad.FirebaseAdapter = firepad.FirebaseAdapter; return firepad.Firepad;').replace('= global.CodeMirror', '= window.CodeMirror || global.CodeMirror');
Firepad.CodeMirrorSource = fs.readFileSync(__dirname+'/codemirror.js');
/**
* Node Firepad Proxy Loader
*/
Firepad.load = function(ref, callback) {
jsdom.env('<head></head><body><div id="firepad"></div></body>', function (errors, window) {
/**
* Load CodeMirror
*/
var document = document || window.document;
var navigator = navigator || { userAgent:'', platform:'' };
eval(Firepad.CodeMirrorSource+'');
var CodeMirror = window.CodeMirror;
/**
* Load Firepad
*/
eval(Firepad.FirepadSource+'');
// HACK: disable cursor
Firepad.FirebaseAdapter.prototype.sendCursor = function(){};
Firepad.FirebaseAdapter.prototype.setColor = function(){};
/**
* Launch
*/
var codeMirror_ = CodeMirror(window.document.getElementById('firepad'), { lineWrapping: true }, window);
var firepad_ = Firepad.fromCodeMirror(ref, codeMirror_,
{ richTextShortcuts: true, richTextToolbar: true });
if (callback) callback(firepad_, window, errors, document);
});
};
module.exports = Firepad;
Which you can then use something like this:
var FirepadManager = require(__dirname+’/node-firepad’);
FirepadManager.load(firebaseRef, function(firepad, window, errors, document) {
// The callback is called as soon as the Firepad instance is created.
// Hence, you can perform stuff like adding your entities support at this point...
addEntitiesToFirepad(firepad, document);
firepad.on('ready', function() {
if (callback) callback(firepad, window, errors, document);
});
});
If you go this route and have troubles, let me know (michael@firebase.com). I may be able to help. Good luck!