Gate setting instructions behind domain entry

This commit is contained in:
akp 2025-02-15 14:10:10 +00:00
parent ec59805160
commit df2bbf58fc
No known key found for this signature in database
GPG key ID: CF8D58F3DEB20755

View file

@ -21,6 +21,8 @@ func ControlPanel(props ControlPanelProps) Node {
BodyContent: Group{
H1(Textf("Hi %s!", props.Username)),
If(props.Domain == "", P(Text("You must set the domain you wish to use NowPlaying on (eg. "), Code(Text("www.akpain.net")), Text(") before continuing."))),
Form(
Method("post"),
@ -35,15 +37,18 @@ func ControlPanel(props ControlPanelProps) Node {
Input(Type("hidden"), Name("csrf"), Value(props.CSRFToken)),
),
P(Text("Use the following code block to add support to your site:")),
Pre(Code(Textf(`<p>
If(props.Domain != "", Group{
Hr(),
P(Text("Use the following code block to add support to your site:")),
Pre(Code(Textf(`<p>
The last track I listened to on Spotify was
<span data-nowplaying="TrackLink">...</span>
by <span data-nowplaying="ArtistsLink">...</span>,
<span data-nowplaying="TimeSince">...</span>.
</p>
<script src="%s"></script>`, config.ExternalURL+routes.ReplacePlaceholder(routes.URLScript, routes.UserIDPlaceholder, props.UserID)))),
Raw(`<p>The script will detect elements with the <code>data-nowplaying</code> attribute set and fill them in with a value. Available options are:
Raw(`<p>The script will detect elements with the <code>data-nowplaying</code> attribute set and fill them in with a value. Available options are:
<ul>
<li><code>Track</code>: the name of the last track you played</li>
<li><code>TrackLink</code>: the name of the last track you played and a link to it on Spotify</li>
@ -53,6 +58,7 @@ func ControlPanel(props ControlPanelProps) Node {
<li><code>PlayedAt</code>: the raw timestamp of the time you played this track on Spotify</li>
<li><code>TimeSince</code>: the human-formatted time since you played this track on Spotify</li>
</ul>`),
}),
},
}
}