Skip to content

Commit

Permalink
Only show spark wallet link if lightning is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
schulterklopfer committed Apr 6, 2019
1 parent 4f345fa commit b36b3e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type TemplateData struct {
Features []InstallationInfoFeature `json:"features"`
Containers []InstallationInfoContainer `json:"containers"`
ForwardedPrefix string
FeatureByName map[string]bool
}

var auth *cnAuth.CnAuth
Expand Down Expand Up @@ -142,6 +143,12 @@ func getInstallatioInfo() (*TemplateData,error) {
return nil,err
}

// map features to FeatureByName
installationInfo.FeatureByName = make( map[string]bool, 0 )
for f := 0 ; f< len(installationInfo.Features); f++ {
installationInfo.FeatureByName[installationInfo.Features[f].Name] = installationInfo.Features[f].Working
}

log.Info("getInstallatioInfo: json done")

return installationInfo,nil
Expand Down
4 changes: 3 additions & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
<ul>
<li><a href="config.7z">Download your Cyphernode <b>configurations</b>, can be used for another Cyphernode deployment</a></li>
<li><a href="certs.7z">Download Client <b>API ID's and keys</b>, needed in your client apps</a></li>
<li><a href="/sparkwallet">Your Lightning Network Wallet (Spark Wallet)</a> <b>if LN installed during setup</b></li>
{{if index .FeatureByName "lightning" }}
<li><a href="/sparkwallet">Your Lightning Network Wallet (Spark Wallet)</a></li>
{{end}}
</ul>
</div>
</section>
Expand Down

0 comments on commit b36b3e1

Please sign in to comment.