diff options
author | Xavier Priour <xavier.priour@bubblyware.com> | 2015-12-02 09:54:21 +0100 |
---|---|---|
committer | Xavier Priour <xavier.priour@bubblyware.com> | 2015-12-02 09:54:21 +0100 |
commit | 569f8d50ba5dd65be2ab2c3ee9a52ea22d2e566b (patch) | |
tree | 75b1188515d70a814933e30d1b89d63116029710 /sandstorm.js | |
parent | 82c59fb85f5f44928a506da59087809640d99050 (diff) | |
parent | 827663f2550ba691067535b317dd9f0b0bec12ba (diff) | |
download | wekan-569f8d50ba5dd65be2ab2c3ee9a52ea22d2e566b.tar.gz wekan-569f8d50ba5dd65be2ab2c3ee9a52ea22d2e566b.tar.bz2 wekan-569f8d50ba5dd65be2ab2c3ee9a52ea22d2e566b.zip |
Merge remote-tracking branch 'upstream/devel' into devel
Diffstat (limited to 'sandstorm.js')
-rw-r--r-- | sandstorm.js | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sandstorm.js b/sandstorm.js index 997aed46..a711a960 100644 --- a/sandstorm.js +++ b/sandstorm.js @@ -54,10 +54,10 @@ if (isSandstorm && Meteor.isServer) { // XXX If this routing scheme changes, this will break. We should generate // the location URL using the router, but at the time of writing, the // it is only accessible on the client. - const path = `/boards/${sandstormBoard._id}/${sandstormBoard.slug}`; + const boardPath = `/b/${sandstormBoard._id}/${sandstormBoard.slug}`; res.writeHead(301, { - Location: base + path, + Location: base + boardPath, }); res.end(); @@ -126,6 +126,22 @@ if (isSandstorm && Meteor.isServer) { } if (isSandstorm && Meteor.isClient) { + // Since the Sandstorm grain is displayed in an iframe of the Sandstorm shell, + // we need to explicitly expose meta data like the page title or the URL path + // so that they could appear in the browser window. + // See https://docs.sandstorm.io/en/latest/developing/path/ + function updateSandstormMetaData(msg) { + return window.parent.postMessage(msg, '*'); + } + + FlowRouter.triggers.enter([({ path }) => { + updateSandstormMetaData({ setPath: path }); + }]); + + Tracker.autorun(() => { + updateSandstormMetaData({ setTitle: DocHead.getTitle() }); + }); + // XXX Hack. `Meteor.absoluteUrl` doesn't work in Sandstorm, since every // session has a different URL whereas Meteor computes absoluteUrl based on // the ROOT_URL environment variable. So we overwrite this function on a |