@firebase/database
Advanced tools
Comparing version 0.1.10-0 to 0.1.10-canary.2e147ff
@@ -46,3 +46,3 @@ "use strict"; | ||
RepoInfo.prototype.needsQueryParam = function () { | ||
return this.host !== this.internalHost; | ||
return this.host !== this.internalHost || this.isCustomHost(); | ||
}; | ||
@@ -49,0 +49,0 @@ RepoInfo.prototype.isCacheableHost = function () { |
@@ -41,2 +41,26 @@ "use strict"; | ||
/** | ||
* @param {!string} queryString | ||
* @return {!{[key:string]:string}} key value hash | ||
*/ | ||
function decodeQuery(queryString) { | ||
var results = {}; | ||
if (queryString.startsWith('?')) { | ||
queryString = queryString.substring(1); | ||
} | ||
for (var _i = 0, _a = queryString.split('&'); _i < _a.length; _i++) { | ||
var segment = _a[_i]; | ||
if (segment.length === 0) { | ||
continue; | ||
} | ||
var kv = segment.split('='); | ||
if (kv.length === 2) { | ||
results[decodeURIComponent(kv[0])] = decodeURIComponent(kv[1]); | ||
} | ||
else { | ||
util_1.warn("Invalid query segment '" + segment + "' in query '" + queryString + "'"); | ||
} | ||
} | ||
return results; | ||
} | ||
/** | ||
* | ||
@@ -85,3 +109,3 @@ * @param {!string} dataURL | ||
} | ||
// Parse host and path. | ||
// Parse host, path, and query string. | ||
var slashInd = dataURL.indexOf('/'); | ||
@@ -91,4 +115,12 @@ if (slashInd === -1) { | ||
} | ||
host = dataURL.substring(0, slashInd); | ||
pathString = decodePath(dataURL.substring(slashInd)); | ||
var questionMarkInd = dataURL.indexOf('?'); | ||
if (questionMarkInd === -1) { | ||
questionMarkInd = dataURL.length; | ||
} | ||
host = dataURL.substring(0, Math.min(slashInd, questionMarkInd)); | ||
if (slashInd < questionMarkInd) { | ||
// For pathString, questionMarkInd will always come after slashInd | ||
pathString = decodePath(dataURL.substring(slashInd, questionMarkInd)); | ||
} | ||
var queryParams = decodeQuery(dataURL.substring(Math.min(dataURL.length, questionMarkInd))); | ||
// If we have a port, use scheme for determining if it's secure. | ||
@@ -115,2 +147,6 @@ colonInd = host.indexOf(':'); | ||
} | ||
// Support `ns` query param if subdomain not already set | ||
if (subdomain === '' && 'ns' in queryParams) { | ||
subdomain = queryParams['ns']; | ||
} | ||
} | ||
@@ -117,0 +153,0 @@ return { |
@@ -44,3 +44,3 @@ /** | ||
RepoInfo.prototype.needsQueryParam = function () { | ||
return this.host !== this.internalHost; | ||
return this.host !== this.internalHost || this.isCustomHost(); | ||
}; | ||
@@ -47,0 +47,0 @@ RepoInfo.prototype.isCacheableHost = function () { |
@@ -18,3 +18,3 @@ /** | ||
import { RepoInfo } from '../../RepoInfo'; | ||
import { warnIfPageIsSecure, fatal } from '../util'; | ||
import { warnIfPageIsSecure, warn, fatal } from '../util'; | ||
/** | ||
@@ -40,2 +40,26 @@ * @param {!string} pathString | ||
/** | ||
* @param {!string} queryString | ||
* @return {!{[key:string]:string}} key value hash | ||
*/ | ||
function decodeQuery(queryString) { | ||
var results = {}; | ||
if (queryString.startsWith('?')) { | ||
queryString = queryString.substring(1); | ||
} | ||
for (var _i = 0, _a = queryString.split('&'); _i < _a.length; _i++) { | ||
var segment = _a[_i]; | ||
if (segment.length === 0) { | ||
continue; | ||
} | ||
var kv = segment.split('='); | ||
if (kv.length === 2) { | ||
results[decodeURIComponent(kv[0])] = decodeURIComponent(kv[1]); | ||
} | ||
else { | ||
warn("Invalid query segment '" + segment + "' in query '" + queryString + "'"); | ||
} | ||
} | ||
return results; | ||
} | ||
/** | ||
* | ||
@@ -84,3 +108,3 @@ * @param {!string} dataURL | ||
} | ||
// Parse host and path. | ||
// Parse host, path, and query string. | ||
var slashInd = dataURL.indexOf('/'); | ||
@@ -90,4 +114,12 @@ if (slashInd === -1) { | ||
} | ||
host = dataURL.substring(0, slashInd); | ||
pathString = decodePath(dataURL.substring(slashInd)); | ||
var questionMarkInd = dataURL.indexOf('?'); | ||
if (questionMarkInd === -1) { | ||
questionMarkInd = dataURL.length; | ||
} | ||
host = dataURL.substring(0, Math.min(slashInd, questionMarkInd)); | ||
if (slashInd < questionMarkInd) { | ||
// For pathString, questionMarkInd will always come after slashInd | ||
pathString = decodePath(dataURL.substring(slashInd, questionMarkInd)); | ||
} | ||
var queryParams = decodeQuery(dataURL.substring(Math.min(dataURL.length, questionMarkInd))); | ||
// If we have a port, use scheme for determining if it's secure. | ||
@@ -114,2 +146,6 @@ colonInd = host.indexOf(':'); | ||
} | ||
// Support `ns` query param if subdomain not already set | ||
if (subdomain === '' && 'ns' in queryParams) { | ||
subdomain = queryParams['ns']; | ||
} | ||
} | ||
@@ -116,0 +152,0 @@ return { |
{ | ||
"name": "@firebase/database", | ||
"version": "0.1.10-0", | ||
"version": "0.1.10-canary.2e147ff", | ||
"description": "", | ||
@@ -18,8 +18,8 @@ "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)", | ||
"peerDependencies": { | ||
"@firebase/app": "^0.1.0", | ||
"@firebase/app-types": "^0.1.0" | ||
"@firebase/app": "0.1.9-canary.2e147ff", | ||
"@firebase/app-types": "0.1.1-canary.2e147ff" | ||
}, | ||
"dependencies": { | ||
"@firebase/database-types": "0.1.1", | ||
"@firebase/util": "0.1.9-0", | ||
"@firebase/database-types": "0.1.1-canary.2e147ff", | ||
"@firebase/util": "0.1.9-canary.2e147ff", | ||
"faye-websocket": "0.11.1" | ||
@@ -26,0 +26,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3783336
45832
+ Added@firebase/app@0.1.9-canary.2e147ff(transitive)
+ Added@firebase/app-types@0.1.1-canary.2e147ff(transitive)
+ Added@firebase/database-types@0.1.1-canary.2e147ff(transitive)
+ Added@firebase/util@0.1.9-canary.2e147ff(transitive)
- Removed@firebase/app@0.1.10(transitive)
- Removed@firebase/app-types@0.1.2(transitive)
- Removed@firebase/database-types@0.1.1(transitive)
- Removed@firebase/util@0.1.100.1.9-0(transitive)
- Removedtslib@1.14.1(transitive)