From 30b08fc01286fd92f5570e5eb54849d46c8f1726 Mon Sep 17 00:00:00 2001 From: Nick Martin Date: Mon, 19 Aug 2013 19:51:01 -0700 Subject: [PATCH] Export Spiderable symbol, so people can override user agents. Also add twitterbot to agents. Fixes #1300. --- packages/spiderable/package.js | 2 ++ packages/spiderable/spiderable.js | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/spiderable/package.js b/packages/spiderable/package.js index 425c2ae8bb..431cc5c77e 100644 --- a/packages/spiderable/package.js +++ b/packages/spiderable/package.js @@ -7,6 +7,8 @@ Package.on_use(function (api) { api.use(['templating'], 'client'); api.use(['underscore'], ['client', 'server']); + api.export('Spiderable', 'server'); + api.add_files('spiderable.html', 'client'); api.add_files('spiderable.js', 'server'); }); diff --git a/packages/spiderable/spiderable.js b/packages/spiderable/spiderable.js index 2e5bd04c4a..9bc8f8118f 100644 --- a/packages/spiderable/spiderable.js +++ b/packages/spiderable/spiderable.js @@ -9,7 +9,13 @@ Spiderable = {}; // not obey the _escaped_fragment_ protocol. The page is served // statically to any client whos user agent matches any of these // regexps. Users may modify this array. -Spiderable.userAgentRegExps = [/^facebookexternalhit/i, /^linkedinbot/i]; +// +// An original goal with the spiderable package was to avoid doing +// user-agent based tests. But the reality is not enough bots support +// the _escaped_fragment_ protocol, so we need to hardcode a list +// here. I shed a silent tear. +Spiderable.userAgentRegExps = [ + /^facebookexternalhit/i, /^linkedinbot/i, /^twitterbot/i]; // how long to let phantomjs run before we kill it var REQUEST_TIMEOUT = 15*1000;