gnosisguild / zodiac-modifier-roles

Smart account toolkit for role-based access control
https://roles.gnosisguild.org
GNU Lesser General Public License v3.0
80 stars 39 forks source link

Use hash router to support domain use #107

Closed samepant closed 2 years ago

samepant commented 2 years ago

Right now, deep linking into the app is not possible as navigating to https://roles.dev.gnosisguild.org/rin:0xE4E5237B3BE947FB99C491238cFEE3E5f190451F/roles/new results in an ipfs gateway error:

ipfs resolve -r /ipns/roles.dev.gnosisguild.org/rin:0xE4E5237B3BE947FB99C491238cFEE3E5f190451F/roles/new: no link named "rin:0xE4E5237B3BE947FB99C491238cFEE3E5f190451F" under QmaChLj3n2Nv7jcVUQw7uq24zFufqtMRqUT9FxuWYVtHmF

Using the HashRouter from react-router will solve this

asgeir-s commented 2 years ago

This turns out to be more complicated than expected because when we use the HashRouter instead of the BrowserRouter, the routes do not work as expected when it is opened as a Gnosis Safe app.

Everything behind the # is ignored in the Gnosis Safe app (while it works as expected when opening the app directly) 🤔

Investigating...

Can probably be solved with some sort of escape or custom encoding of the # character in the URL.

asgeir-s commented 2 years ago

@juliopavila: It still seems to be a problem.

I think the solution might be using the HashRouter (like sam proposed), then finding some sort of escape or custom encoding of the # character in the URL (to use when the app is used as a Gnosis Safe app).

asgeir-s commented 2 years ago

@juliopavila Fixed in commit https://github.com/gnosis/zodiac-modifier-roles/commit/214719caf31cdf9b4ec80021a7164932586dd09b.

Some samples of how to use it: