diff --git a/forcetk.js b/forcetk.js index 8964464..c531e8e 100644 --- a/forcetk.js +++ b/forcetk.js @@ -51,9 +51,10 @@ if (forcetk.Client === undefined) { * @param [loginUrl='https://login.salesforce.com/'] Login endpoint * @param [proxyUrl=null] Proxy URL. Omit if running on Visualforce or * PhoneGap etc + * @param [communityInd=null] Indicator if forcetk is used from Community * @constructor */ - forcetk.Client = function (clientId, loginUrl, proxyUrl) { + forcetk.Client = function (clientId, loginUrl, proxyUrl, communityInd) { 'use strict'; this.clientId = clientId; this.loginUrl = loginUrl || 'https://login.salesforce.com/'; @@ -64,6 +65,7 @@ if (forcetk.Client === undefined) { } else { // In Visualforce - still need proxyUrl for Apex REST methods this.proxyUrl = location.protocol + "//" + location.hostname + + (communityInd === true ? location.pathname.replace(/apex\/\w+/, "").replace(/\/$/, "") : "") + "/services/proxy"; } this.authzHeader = "Authorization"; diff --git a/package.json b/package.json new file mode 100644 index 0000000..1d25847 --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "ForceTK", + "version": "1.0.0", + "description": "ForceTK - a minimal Force.com REST API for JavaScript apps", + "main": "forcetk.js", + "directories": { + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/mattgoldspink/Force.com-JavaScript-REST-Toolkit.git" + }, + "keywords": [ + ], + "author": "OSREC ", + "license": "BSD3", + "bugs": { + "url": "https://github.com/mattgoldspink/Force.com-JavaScript-REST-Toolkit/issues" + }, + "homepage": "https://github.com/mattgoldspink/Force.com-JavaScript-REST-Toolkit#readme" +}