Merge branch 'dev' into feature/blog

This commit is contained in:
ari melody 2025-06-22 18:01:31 +01:00
commit 053faeb493
Signed by: ari
GPG key ID: CF99829C92678188
25 changed files with 789 additions and 182 deletions

View file

@ -2,7 +2,12 @@
<footer>
<div id="footer">
<small><em>*made with <span aria-label="love"></span> by ari, 2025*</em></small>
<small>
<em>
*made with <span aria-label="love"></span> by ari, 2025*
<a href="https://git.arimelody.me/ari/arimelody.me" target="_blank">source</a>
</em>
</small>
</div>
</footer>

View file

@ -23,9 +23,6 @@
<li>
<a href="/music" preload="mouseover">music</a>
</li>
<li>
<a href="https://git.arimelody.me/ari/arimelody.me" target="_blank">source</a>
</li>
<li>
<!-- coming later! -->
<span title="coming later!">blog</span>

45
view/index.go Normal file
View file

@ -0,0 +1,45 @@
package view
import (
"arimelody-web/controller"
"arimelody-web/model"
"arimelody-web/templates"
"fmt"
"net/http"
"os"
)
func IndexHandler(app *model.AppState) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodHead {
w.WriteHeader(http.StatusOK)
return
}
type IndexData struct {
TwitchStatus *model.TwitchStreamInfo
}
var err error
var twitchStatus *model.TwitchStreamInfo = nil
if app.Twitch != nil && len(app.Config.Twitch.Broadcaster) > 0 {
twitchStatus, err = controller.GetTwitchStatus(app, app.Config.Twitch.Broadcaster)
if err != nil {
fmt.Fprintf(os.Stderr, "WARN: Failed to get Twitch status for %s: %v\n", app.Config.Twitch.Broadcaster, err)
}
}
if r.URL.Path == "/" || r.URL.Path == "/index.html" {
err := templates.IndexTemplate.Execute(w, IndexData{
TwitchStatus: twitchStatus,
})
if err != nil {
fmt.Fprintf(os.Stderr, "WARN: Failed to render index page: %v\n", err)
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
}
return
}
StaticHandler("public").ServeHTTP(w, r)
})
}

View file

@ -6,8 +6,8 @@
<meta property="og:title" content="ari melody">
<meta property="og:type" content="website">
<meta property="og:url" content="www.arimelody.me">
<meta property="og:image" content="https://www.arimelody.me/img/favicon.png">
<meta property="og:url" content="www.arimelody.space">
<meta property="og:image" content="https://www.arimelody.space/img/favicon.png">
<meta property="og:site_name" content="ari melody">
<meta property="og:description" content="home to your local SPACEGIRL 💫">
@ -17,11 +17,28 @@
<link rel="me" href="https://ice.arimelody.me/@ari">
<link rel="me" href="https://wetdry.world/@ari">
<script type="module" src="/script/index.js" defer> </script>
<script type="module" src="/script/index.js" defer></script>
{{end}}
{{define "content"}}
<main>
{{if .TwitchStatus}}
<div id="live-banner">
<div class="live-preview">
<div>
<img src="{{.TwitchStatus.Thumbnail 144 81}}" alt="livestream thumbnail" class="live-thumbnail">
<a href="https://twitch.tv/{{.TwitchStatus.UserName}}" class="live-button">join in!</a>
</div>
<div class="live-info">
<h2>ari melody <span class="live-highlight">LIVE</span> <i class="live-pinger"></i></h2>
<p class="live-game"><span class="live-game-prefix">streaming:</span> {{.TwitchStatus.GameName}}</p>
<p class="live-title">{{.TwitchStatus.Title}}</p>
<p class="live-viewers">{{.TwitchStatus.ViewerCount}} viewers</p>
</div>
</div>
</div>
{{end}}
<h1 class="typeout">
# hello, world!
</h1>
@ -33,7 +50,7 @@
</p>
<p>
i'm a <a href="/music">musician</a>, <a href="https://github.com/arimelody?tab=repositories">developer</a>,
i'm a <a href="/music">musician</a>, <a href="https://codeberg.org/arimelody?tab=repositories">developer</a>,
<a href="https://twitch.tv/arispacegirl">streamer</a>, <a href="https://youtube.com/@arispacegirl">youtuber</a>,
and probably a bunch of other things i forgot to mention!
</p>
@ -44,7 +61,7 @@
<p>
if you're looking to support me financially, that's so cool of you!!
if you like, you can buy some of my music over on
<a href="https://arimelody.bandcamp.com" target="_blank">bandcamp</a>
<a href="https://arimelody.bandcamp.com">bandcamp</a>
so you can at least get something for your money.
thank you very much either way!! 💕
</p>
@ -84,57 +101,97 @@
<p>
<strong>where to find me 🛰️</strong>
</p>
<ul class="links">
<ul class="platform-links">
<li>
<a href="https://youtube.com/@arispacegirl" target="_blank">youtube</a>
<a href="https://youtube.com/@arispacegirl" title="youtube">
<img src="/img/brand/youtube.svg" alt="youtube" width="32" height="32"/>
youtube
</a>
</li>
<li>
<a href="https://twitch.tv/arispacegirl" target="_blank">twitch</a>
<a href="https://twitch.tv/arispacegirl" title="twitch">
<img src="/img/brand/twitch.svg" alt="twitch" width="32" height="32"/>
twitch
</a>
</li>
<li>
<a href="https://sptfy.com/mellodoot" target="_blank">spotify</a>
<a href="https://arimelody.bandcamp.com" title="bandcamp">
<img src="/img/brand/bandcamp.svg" alt="bandcamp" width="32" height="32"/>
bandcamp
</a>
</li>
<li>
<a href="https://arimelody.bandcamp.com" target="_blank">bandcamp</a>
<a href="https://codeberg.org/arimelody" title="codeberg">
<img src="/img/brand/codeberg.svg" alt="codeberg" width="32" height="32"/>
codeberg
</a>
</li>
<li>
<a href="https://github.com/arimelody" target="_blank">github</a>
<a href="https://bsky.app/profile/arimelody.space" title="bluesky">
<img src="/img/brand/bluesky.svg" alt="bluesky" width="32" height="32"/>
bluesky
</a>
</li>
<li>
<a href="https://discord.gg/MmJtBebF28" title="discord">
<img src="/img/brand/discord.svg" alt="discord" width="32" height="32"/>
discord
</a>
</li>
</ul>
<p>
<strong>projects i've worked on 🛠️</strong>
</p>
<ul class="links">
<li>
<a href="https://catdance.arimelody.me" target="_blank">
catdance
</a>
<ul id="projects">
<li class="project-item">
<span aria-hidden=true class="project-icon">⛏️</span>
<div class="project-info">
<a href="https://mcq.bliss.town">McStatusFace</a>
<p>minecraft server query utility</p>
</div>
</li>
<li>
<a href="https://git.arimelody.me/ari/prideflag" target="_blank">
pride flag
</a>
<li class="project-item">
<img src="https://catdance.arimelody.me/img/favicon.png" alt="catdance icon" aria-hidden=true class="project-icon" width="64" height="64">
<div class="project-info">
<a href="https://catdance.arimelody.me">catdance</a>
<p>watch the cat dance 🐱</p>
</div>
</li>
<li>
<a href="https://github.com/arimelody/ipaddrgen" target="_blank">
ipaddrgen
</a>
<li class="project-item">
<img src="https://git.arimelody.me/repo-avatars/6b0a1ffb78cbc6f906f83152ea42a710220174e8f48a3e44f159ae58dacd7a2f" alt="pride flag icon" aria-hidden=true class="project-icon" width="64" height="64">
<div class="project-info">
<a href="https://git.arimelody.me/ari/prideflag">pride flag</a>
<p>progressive pride flag widget for websites</p>
</div>
</li>
<li>
<a href="https://impact.arimelody.me/" target="_blank">
impact meme
</a>
<li class="project-item">
<span aria-hidden=true class="project-icon">👩‍💻</span>
<div class="project-info">
<a href="https://github.com/arimelody/ipaddrgen">ipaddrgen</a>
<p>silly hackerman IP address generator</p>
</div>
</li>
<li>
<a href="https://term.arimelody.me/" target="_blank">
OpenTerminal
</a>
<li class="project-item">
<img src="https://impact.arimelody.me/favicon.png" alt="impact meme icon" aria-hidden=true class="project-icon" width="64" height="64">
<div class="project-info">
<a href="https://impact.arimelody.me/">impact meme</a>
<p>impact meme generator</p>
</div>
</li>
<li>
<a href="https://silver.bliss.town/" target="_blank">
Silver.js
</a>
<li class="project-item">
<img src="https://codeberg.org/repo-avatars/e67303eeda4fa6d268948e71b7b0837357d8c519772701ffc36b84ae7975319f" alt="OpenTerminal icon" aria-hidden=true class="project-icon" width="64" height="64">
<div class="project-info">
<a href="https://term.arimelody.me/">OpenTerminal</a>
<p>communal online text buffer</p>
</div>
</li>
<li class="project-item">
<span aria-hidden=true class="project-icon">📜</span>
<div class="project-info">
<a href="https://silver.bliss.town/">Silver.js</a>
<p>lightweight reactive state library</p>
</div>
</li>
</ul>
@ -148,40 +205,40 @@
<a href="https://arimelody.me">
<img src="/img/buttons/ari melody.gif" alt="ari melody web button" width="88" height="31">
</a>
<a href="https://supitszaire.com" target="_blank">
<a href="https://supitszaire.com">
<img src="/img/buttons/zaire.gif" alt="zaire web button" width="88" height="31">
</a>
<a href="https://mae.wtf" target="_blank">
<a href="https://mae.wtf">
<img src="/img/buttons/mae.png" alt="vimae web button" width="88" height="31">
</a>
<a href="https://zvava.org" target="_blank">
<img src="/img/buttons/zvava.png" alt="zvava web button" width="88" height="31">
<a href="https://girlthi.ng/~thermia/">
<img src="/img/buttons/thermia.gif" alt="thermia web button" width="88" height="31">
</a>
<a href="https://elke.cafe" target="_blank">
<a href="https://elke.cafe">
<img src="/img/buttons/elke.gif" alt="elke web button" width="88" height="31">
</a>
<a href="https://invoxiplaygames.uk/" target="_blank">
<a href="https://invoxiplaygames.uk/">
<img src="/img/buttons/ipg.png" alt="InvoxiPlayGames web button" width="88" height="31">
</a>
<a href="https://ioletsgo.gay" target="_blank">
<a href="https://ioletsgo.gay">
<img src="/img/buttons/ioletsgo.gif" alt="ioletsgo web button" width="88" height="31">
</a>
<a href="https://notnite.com/" target="_blank">
<a href="https://notnite.com/">
<img src="/img/buttons/notnite.png" alt="notnite web button" width="88" height="31">
</a>
<a href="https://www.da.vidbuchanan.co.uk/" target="_blank">
<a href="https://www.da.vidbuchanan.co.uk/">
<img src="/img/buttons/retr0id_now.gif" alt="retr0id web button" width="88" height="31">
</a>
<a href="https://aikoyori.xyz" target="_blank">
<a href="https://aikoyori.xyz">
<img src="/img/buttons/aikoyori.gif" alt="aikoyori web button" width="88" height="31">
</a>
<a href="https://xenia.blahaj.land/" target="_blank">
<a href="https://xenia.blahaj.land/">
<img src="/img/buttons/xenia.png" alt="xenia web button" width="88" height="31">
</a>
<a href="https://stardust.elysium.gay/" target="_blank">
<a href="https://stardust.elysium.gay/">
<img src="/img/buttons/stardust.png" alt="stardust web button" width="88" height="31">
</a>
<a href="https://isabelroses.com/" target="_blank">
<a href="https://isabelroses.com/">
<img src="/img/buttons/isabelroses.gif" alt="isabel roses web button" width="88" height="31">
</a>
@ -197,16 +254,16 @@
<img src="/img/buttons/misc/sprunk.gif" alt="sprunk" width="88" height="31">
<img src="/img/buttons/misc/tohell.gif" alt="go straight to hell" width="88" height="31">
<img src="/img/buttons/misc/virusalert.gif" alt="virus alert! click here" onclick="alert('meow :3')" width="88" height="31">
<a href="http://wiishopchannel.net/" target="_blank">
<a href="http://wiishopchannel.net/">
<img src="/img/buttons/misc/wii.gif" alt="wii" width="88" height="31">
</a>
<img src="/img/buttons/misc/www2.gif" alt="www" width="88" height="31">
<img src="/img/buttons/misc/iemandatory.gif" alt="get mandatory internet explorer" width="88" height="31">
<img src="/img/buttons/misc/learn_html.gif" alt="HTML - learn it today!" width="88" height="31">
<a href="https://smokepowered.com" target="_blank">
<a href="https://smokepowered.com">
<img src="/img/buttons/misc/smokepowered.gif" alt="high on SMOKE" width="88" height="31">
</a>
<a href="https://epicblazed.com" target="_blank">
<a href="https://epicblazed.com">
<img src="/img/buttons/misc/epicblazed.png" alt="epic blazed" width="88" height="31">
</a>
<img src="/img/buttons/misc/blink.gif" alt="closeup anime blink" width="88" height="31">

31
view/static.go Normal file
View file

@ -0,0 +1,31 @@
package view
import (
"errors"
"net/http"
"os"
"path/filepath"
)
func StaticHandler(directory string) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
info, err := os.Stat(filepath.Join(directory, filepath.Clean(r.URL.Path)))
// does the file exist?
if err != nil {
if errors.Is(err, os.ErrNotExist) {
http.NotFound(w, r)
return
}
}
// is thjs a directory? (forbidden)
if info.IsDir() {
http.NotFound(w, r)
return
}
http.FileServer(http.Dir(directory)).ServeHTTP(w, r)
})
}