1
0
mirror of https://github.com/fazo96/ipfs-boards synced 2025-01-10 12:24:20 +01:00

Merge pull request #90 from Mithgol/ipfs0.4

use a regex (based on the current multihash) to detect a gateway
This commit is contained in:
Enrico Fasoli 2016-01-25 22:34:30 +08:00
commit a28e6e1865

View File

@ -11,7 +11,11 @@ var Updater = React.createClass({
},
checkForUpdates () {
var v = window.location.pathname
var gateway = window.location.pathname.indexOf('/ipfs/') === 0 || window.location.pathname.indexOf('/ipns/') === 0
var gateway = /^\/ipns\/(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|[^.]+\.[^.]+)/.test(
window.location.pathname
) || /^\/ipfs\/Qm[1-9A-HJ-NP-Za-km-z]{44}/.test(
window.location.pathname
);
if (v !== '/ipns/boards.ydns.eu/' || !gateway) {
this.setState({ update: true })
}