mirror of
https://github.com/jsbin/jsbin.git
synced 2026-01-18 15:18:04 +00:00
Merge branch 'master' of git://github.com/remy/jsbin
This commit is contained in:
commit
df524d70b0
@ -5,7 +5,8 @@
|
||||
"host": "localhost:3000",
|
||||
"prefix": "/",
|
||||
"ssl": false,
|
||||
"static": false
|
||||
"static": false,
|
||||
"runner": false
|
||||
},
|
||||
"max-request-size": "1MB",
|
||||
"store": {
|
||||
|
||||
11
lib/app.js
11
lib/app.js
@ -85,9 +85,10 @@ if (!process.env.TZ && options.timezone) {
|
||||
options.port = port;
|
||||
})();
|
||||
|
||||
// Strip trailing slash from the prefix.
|
||||
// Strip trailing slash from the prefix
|
||||
options.url.prefix = options.url.prefix.replace(/\/$/, '');
|
||||
|
||||
|
||||
// Apply the keys from the config file. All nested properties are
|
||||
// space delimited to match the express style.
|
||||
//
|
||||
@ -121,6 +122,14 @@ if (options.url.static) {
|
||||
app.set('static url', app.set('url full'));
|
||||
}
|
||||
|
||||
if (options.url.runner) {
|
||||
// strip trailing slash, just in case
|
||||
options.url.runner = options.url.runner.replace(/\/$/, '');
|
||||
app.set('url runner', options.url.runner);
|
||||
} else {
|
||||
app.set('url runner', app.set('url full'));
|
||||
}
|
||||
|
||||
app.engine('html', hogan.renderer).engine('txt', hogan.renderer);
|
||||
|
||||
// Define some generic template variables.
|
||||
|
||||
@ -617,6 +617,7 @@ module.exports = Observable.extend({
|
||||
version: version,
|
||||
token: req.session._csrf,
|
||||
root: root,
|
||||
runner: helpers.runner,
|
||||
static: helpers.urlForStatic(),
|
||||
settings: !bin.url ? config && config.settings : {},
|
||||
// If we've pulled a just created bin out of the flash messages object
|
||||
@ -799,6 +800,7 @@ module.exports = Observable.extend({
|
||||
jsbin: function (bin, options) {
|
||||
return {
|
||||
root: options.root,
|
||||
runner: this.helpers.runner,
|
||||
static: options.static || options.root,
|
||||
version: options.version,
|
||||
state: {
|
||||
|
||||
@ -11,6 +11,10 @@ module.exports.createHelpers = function createHelpers(app) {
|
||||
// Check to see if the app is in production.
|
||||
production: app.get('env') === app.PRODUCTION,
|
||||
|
||||
|
||||
// Pre-set the URL used for the runner
|
||||
runner: app.set('url runner') + '/runner',
|
||||
|
||||
// Renders the analytics snippet. Accepts a callback that recieves
|
||||
// and error and html object.
|
||||
analytics: function (render, fn) {
|
||||
|
||||
@ -50,7 +50,7 @@ module.exports = function (app) {
|
||||
binHandler.on('latest-for-user', spike.updateUserSpikes.bind(spike));
|
||||
binHandler.on('new-revision', spike.bumpRevision.bind(spike));
|
||||
|
||||
binHandler.on('render-scripts', spike.appendScripts.bind(spike));
|
||||
binHandler.on('render-scripts', spike.appendScripts.bind(spike, app.settings.version));
|
||||
|
||||
// Load the bin from the store when encountered in the url. Also handles the
|
||||
// "latest" url action.
|
||||
|
||||
@ -300,11 +300,11 @@ module.exports = {
|
||||
}, delayTrigger);
|
||||
},
|
||||
|
||||
appendScripts: function (scripts) {
|
||||
appendScripts: function (version, scripts) {
|
||||
// TODO this should really detect that there's an active session going
|
||||
// on and the user is saving, and therefore include the spike intelligently
|
||||
scripts.push('js/vendor/eventsource.js');
|
||||
scripts.push('js/spike.js');
|
||||
scripts.push('js/vendor/eventsource.js?' + version);
|
||||
scripts.push('js/spike.js?' + version);
|
||||
},
|
||||
|
||||
utils: utils
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
"name": "jsbin",
|
||||
"description": "Collaborative JavaScript Debugging App",
|
||||
"main": "./lib/app",
|
||||
"version": "3.7.1",
|
||||
"version": "3.7.3",
|
||||
"preferGlobal": "true",
|
||||
"homepage": "http://jsbin.com",
|
||||
"bin": "./bin/jsbin",
|
||||
|
||||
@ -264,7 +264,7 @@ var renderLivePreview = (function () {
|
||||
iframe.setAttribute('sandbox', 'allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts');
|
||||
iframe.setAttribute('frameBorder', '0');
|
||||
$live.prepend(iframe);
|
||||
iframe.src = jsbin.root.replace('jsbin', 'run.jsbin') + '/runner';
|
||||
iframe.src = jsbin.runner;
|
||||
try {
|
||||
iframe.contentWindow.name = '/' + jsbin.state.code + '/' + jsbin.state.revision;
|
||||
} catch (e) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user