Update Libera.Chat IRC links to be able to point to plumbed Matrix rooms
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
DataHoarder 2023-07-19 20:22:28 +02:00
parent f5dbf6203a
commit 03ebb10400
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk
3 changed files with 18 additions and 8 deletions

View file

@ -18,7 +18,7 @@ SITE_TITLE=
SITE_PORT=8189
# If specified, these IRC details will be shown on site. If the network is supported a Matrix link will be provided.
#SITE_IRC_URL=ircs://irc.libera.chat:6697/#p2pool-observer
#SITE_IRC_URL=ircs://irc.libera.chat:6697/#p2pool-observer/monero.social
# Change for mini if you want public reachable address
P2POOL_PORT=37889

View file

@ -9,7 +9,7 @@
<br/>
Donate to P2Pool Observer developer on <a class="mono" style="font-weight: bold" href="monero:{%s ctx.DonationAddress %}?tx_description=P2Pool Observer">{%s ctx.DonationAddress %}</a> or OpenAlias <span class="mono">p2pool.observer</span> :: <a href="https://github.com/SChernykh/p2pool#donations">Donate to P2Pool Development</a>
<br/>
<strong>NOTE:</strong> This site is in development. You might find errors, incomplete or invalid data. :: <a target="_blank" href="{%s ctx.GetUrl("git.gammaspectra.live") %}/P2Pool/p2pool-observer/issues?state=open">Report issue on tracker</a>, via IRC on <a target="_blank" href="ircs://irc.libera.chat:6697/#p2pool-observer">#p2pool-observer@libera.chat</a>, or via <a rel="nofollow" href="https://matrix.to/#/#p2pool-observer:libera.chat">Matrix</a>
<strong>NOTE:</strong> This site is in development. You might find errors, incomplete or invalid data. :: <a target="_blank" href="{%s ctx.GetUrl("git.gammaspectra.live") %}/P2Pool/p2pool-observer/issues?state=open">Report issue on tracker</a>, via IRC on <a target="_blank" href="ircs://irc.libera.chat:6697/#p2pool-observer">#p2pool-observer@libera.chat</a>, or via <a rel="nofollow" href="https://matrix.to/#/#p2pool-observer:monero.social">Matrix</a>
</footer>
</div>
{% endfunc %}

View file

@ -147,16 +147,26 @@ func main() {
if err == nil && ircUrl.Host != "" {
ircLink = ircUrl.String()
humanHost := ircUrl.Host
splitChan := strings.Split(ircUrl.Fragment, "/")
switch strings.Split(humanHost, ":")[0] {
case "irc.libera.chat":
humanHost = "libera.chat"
matrixLink = fmt.Sprintf("https://matrix.to/#/#%s:%s", ircUrl.Fragment, humanHost)
webchatLink = fmt.Sprintf("https://web.libera.chat/?nick=Guest?#%s", ircUrl.Fragment)
if len(splitChan) > 1 {
matrixLink = fmt.Sprintf("https://matrix.to/#/#%s:%s", splitChan[0], splitChan[1])
webchatLink = fmt.Sprintf("https://web.libera.chat/?nick=Guest?#%s", splitChan[0])
} else {
humanHost = "libera.chat"
matrixLink = fmt.Sprintf("https://matrix.to/#/#%s:%s", ircUrl.Fragment, humanHost)
webchatLink = fmt.Sprintf("https://web.libera.chat/?nick=Guest?#%s", ircUrl.Fragment)
}
case "irc.hackint.org":
humanHost = "hackint.org"
matrixLink = fmt.Sprintf("https://matrix.to/#/#%s:%s", ircUrl.Fragment, humanHost)
if len(splitChan) > 1 {
matrixLink = fmt.Sprintf("https://matrix.to/#/#%s:%s", splitChan[0], splitChan[1])
} else {
humanHost = "hackint.org"
matrixLink = fmt.Sprintf("https://matrix.to/#/#%s:%s", ircUrl.Fragment, humanHost)
}
}
ircLinkTitle = fmt.Sprintf("#%s@%s", ircUrl.Fragment, humanHost)
ircLinkTitle = fmt.Sprintf("#%s@%s", splitChan[0], humanHost)
}
var basePoolInfo *cmdutils.PoolInfoResult