ui: link to mobile setup in UI drop-down

Updates #1120

Change-Id: I2185c656038637aec04a44a5754e67a6de20fee0
This commit is contained in:
Brad Fitzpatrick 2018-04-27 17:22:13 -07:00
parent 2c05f1a3d9
commit f8bc4ac6e5
4 changed files with 15 additions and 8 deletions

View File

@ -190,10 +190,20 @@ func (rh *RootHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/ui/", http.StatusMovedPermanently)
return
}
if r.URL.Path == "/favicon.ico" {
switch r.URL.Path {
case "/favicon.ico":
ServeStaticFile(w, r, Files, "favicon.ico")
return
case "/mobile-setup":
http.Redirect(w, r, "/ui/mobile.html", http.StatusFound)
return
case "/":
break
default:
http.NotFound(w, r)
return
}
f := func(p string, a ...interface{}) {
fmt.Fprintf(w, p, a...)
}

View File

@ -52,6 +52,7 @@ cam.Header = React.createClass({
height: React.PropTypes.number.isRequired,
helpURL: React.PropTypes.instanceOf(goog.Uri).isRequired,
homeURL: React.PropTypes.instanceOf(goog.Uri).isRequired,
mobileSetupURL: React.PropTypes.instanceOf(goog.Uri).isRequired,
importersURL: React.PropTypes.instanceOf(goog.Uri).isRequired,
mainControls: React.PropTypes.arrayOf(React.PropTypes.node),
onNewPermanode: React.PropTypes.func,
@ -224,6 +225,7 @@ cam.Header = React.createClass({
this.getMenuItem_('Importers', this.props.importersURL),
this.getMenuItem_('Server status', this.props.statusURL),
this.getMenuItem_('Favorites', this.props.favoritesURL),
this.getMenuItem_('Mobile Setup', this.props.mobileSetupURL),
this.getMenuItem_('Help', this.props.helpURL),
// We could use getMenuItem_, and only implement
// the onClick part with Go, but we're instead also

View File

@ -678,6 +678,7 @@ cam.IndexPage = React.createClass({
pendingQuery: this.state.pendingQuery,
height: 38,
helpURL: this.baseURL_.resolve(new goog.Uri(this.props.config.helpRoot)),
mobileSetupURL: this.baseURL_.resolve(new goog.Uri("/mobile-setup")),
homeURL: this.baseURL_,
importersURL: this.baseURL_.resolve(new goog.Uri(this.props.config.importerRoot)),
mainControls: chooser.map(function(val, idx) {

View File

@ -83,7 +83,7 @@ cam.MobileSetupView = React.createClass({
React.DOM.div({},
React.DOM.img({src:this.getQRURL_()}),
React.DOM.form({ref:'form', onSubmit:this.handleChange_},
React.DOM.label({}, 'Camlistore Server:',
React.DOM.label({}, 'Perkeep Server:',
React.DOM.input({
defaultValue: this.state.server,
onChange: this.handleServerChange_,
@ -113,12 +113,6 @@ cam.MobileSetupView = React.createClass({
type: 'text'
}),
'MB'),
React.DOM.label({}, 'Self-signed cert fingerprint:',
React.DOM.input({
onChange: this.handleCertFingerprintChange_,
placeholder: '<unset; optional 20 hex SHA-256 prefix>',
type: 'text'
}))
)));
},