Switch from hashes to URL paths to hack around login issue.
This commit is contained in:
8
app.yaml
8
app.yaml
@@ -13,6 +13,14 @@ handlers:
|
|||||||
http_headers:
|
http_headers:
|
||||||
X-Content-Type-Options: nosniff
|
X-Content-Type-Options: nosniff
|
||||||
|
|
||||||
|
- url: /baby/.*
|
||||||
|
static_files: static/babystats.html
|
||||||
|
upload: static/babystats.html
|
||||||
|
secure: always
|
||||||
|
login: required
|
||||||
|
http_headers:
|
||||||
|
X-Content-Type-Options: nosniff
|
||||||
|
|
||||||
- url: /static
|
- url: /static
|
||||||
static_dir: static
|
static_dir: static
|
||||||
secure: always
|
secure: always
|
||||||
|
|||||||
@@ -6,6 +6,14 @@
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
var BabyStats = function(container) {
|
var BabyStats = function(container) {
|
||||||
|
var urlRE = new RegExp('^/baby/([-0-9a-f]{36})$');
|
||||||
|
var match = window.location.pathname.match(urlRE);
|
||||||
|
if (!match) {
|
||||||
|
window.location.pathname = '/baby/' + Cosmopolite.uuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var id = match[1];
|
||||||
|
|
||||||
this.container_ = container;
|
this.container_ = container;
|
||||||
|
|
||||||
this.tileScaleHeight_ = 1;
|
this.tileScaleHeight_ = 1;
|
||||||
@@ -24,22 +32,13 @@ var BabyStats = function(container) {
|
|||||||
this.intervals_ = {};
|
this.intervals_ = {};
|
||||||
|
|
||||||
this.cosmo_ = new Cosmopolite();
|
this.cosmo_ = new Cosmopolite();
|
||||||
if (window.location.hash) {
|
hogfather.PublicChat.Join(this.cosmo_, id).then(this.onChatReady_.bind(this));
|
||||||
var id = window.location.hash.substring(1);
|
|
||||||
hogfather.PublicChat.Join(this.cosmo_, id).then(
|
|
||||||
this.onChatReady_.bind(this));
|
|
||||||
} else {
|
|
||||||
hogfather.PublicChat.Create(this.cosmo_).then(
|
|
||||||
this.onChatReady_.bind(this));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
BabyStats.prototype.onChatReady_ = function(chat) {
|
BabyStats.prototype.onChatReady_ = function(chat) {
|
||||||
this.chat_ = chat;
|
this.chat_ = chat;
|
||||||
|
|
||||||
window.location.hash = this.chat_.getID();
|
|
||||||
|
|
||||||
this.buildCells_();
|
this.buildCells_();
|
||||||
this.buildStylesheet_();
|
this.buildStylesheet_();
|
||||||
this.buildLayout_();
|
this.buildLayout_();
|
||||||
|
|||||||
Reference in New Issue
Block a user