diff --git a/app.js b/app.js index 925f25c..34888a4 100644 --- a/app.js +++ b/app.js @@ -13,6 +13,7 @@ var IS_TESTING = 'IS_TESTING' in process.env; var PORT = process.env.PORT || 3000; var bundlejs; +var discoursejs; var screenshotConfig = new ScreenshotConfig(); var redisCache = new RedisCache(process.env.REDIS_URL || process.env.REDISTOGO_URL, @@ -48,6 +49,14 @@ app.get('/healthcheck', function(req, res, next) { }); }); +app.get('/js/discourse-onebox.js', function(req, res, next) { + if (!discoursejs || DEBUG) { + discoursejs = require('fs') + .readFileSync(__dirname + '/contrib/discourse-onebox.js'); + } + return res.type('text/javascript').send(discoursejs); +}); + app.get('/js/bundle.js', function(req, res, next) { if (!bundlejs || DEBUG) { var b = browserify(); diff --git a/static/manual-test/index.html b/static/manual-test/index.html index 9836baa..62d4e79 100644 --- a/static/manual-test/index.html +++ b/static/manual-test/index.html @@ -5,17 +5,16 @@
++ + +Hi, I am a fake Discourse post. Here is a Webmaker link, which should look roughly like a Discourse onebox.
+https://toolness.makes.org/thimble/hey-french-toast-refactored
+Here is a non-Webmaker link, which should not look like a Discourse onebox.
+ +