Skip to content
This repository was archived by the owner on Feb 5, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ For example:

`proxy` allows you to easily use spreadsheets not located on Google Spreadsheet servers. Setting `proxy: "http://www.proxy.com"` is equivalent to setting `{ simple_url: true, singleton: true, endpoint: "http://www.proxy.com" }`. [Flatware](https://github.com/jsoma/flatware) might provide better documentation.


#### httpProxyUrl

`httpProxyUrl` if tabletop is being used in a node.js environment and httpProxyUrl is provided, Tabletop will pass the proxy url as the proxy argument to the JS request module, e.g. `httpProxyUrl: "http:uname:pw@proxy:port"`

#### wait

`wait` prevents tabletop from pulling the Google spreadsheet until you're ready. Used in the backbone.js example.
Expand Down
11 changes: 10 additions & 1 deletion src/tabletop.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
this.simpleUrl = !!(options.simpleUrl || options.simple_url); //jshint ignore:line
this.authkey = options.authkey;
this.sheetPrivacy = this.authkey ? 'private' : 'public'
this.httpProxyUrl = options.httpProxyUrl;

this.callbackContext = options.callbackContext;
// Default to on, unless there's a proxy, in which case it's default off
Expand Down Expand Up @@ -268,7 +269,15 @@
var self = this;

this.log('Fetching', this.endpoint + path);
request({url: this.endpoint + path, json: true}, function(err, resp, body) {
var requestOpts = {};
typeof(this.httpProxyUrl) === 'undefined'
? (requestOpts = { url: this.endpoint + path, json: true })
: (requestOpts = {
url: this.endpoint + path,
json: true,
proxy: this.httpProxyUrl,
});
request(requestOpts, function(err, resp, body) {
if (err) {
return console.error(err);
}
Expand Down