home to your local SPACEGIRL 💫 arimelody.space
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

improvements to LIVE tracker

ari melody 58127337 92747967

+45 -16
-3
controller/twitch.go
··· 4 4 "arimelody-web/model" 5 5 "bytes" 6 6 "encoding/json" 7 - "fmt" 8 7 "net/http" 9 8 "net/url" 10 9 "time" ··· 62 61 if lastStreamState != nil && time.Now().UTC().Before(lastStreamStateAt.Add(time.Minute)) { 63 62 return lastStreamState, nil 64 63 } 65 - 66 - fmt.Print("MAKING COSTLY REQUEST TO TWITCH.TV API...\n") 67 64 68 65 requestUrl, _ := url.Parse(TWITCH_API_BASE + "streams") 69 66 requestUrl.RawQuery = url.Values{
+5 -3
main.go
··· 460 460 // handle DB migrations 461 461 controller.CheckDBVersionAndMigrate(app.DB) 462 462 463 - err = controller.TwitchSetup(&app) 464 - if err != nil { 465 - fmt.Fprintf(os.Stderr, "WARN: Failed to set up Twitch integration: %v\n", err) 463 + if app.Config.Twitch != nil { 464 + err = controller.TwitchSetup(&app) 465 + if err != nil { 466 + fmt.Fprintf(os.Stderr, "WARN: Failed to set up Twitch integration: %v\n", err) 467 + } 466 468 } 467 469 468 470 // initial invite code
+2 -2
model/appstate.go
··· 34 34 DataDirectory string `toml:"data_dir"` 35 35 TrustedProxies []string `toml:"trusted_proxies"` 36 36 DB DBConfig `toml:"db"` 37 - Discord DiscordConfig `toml:"discord"` 38 - Twitch TwitchConfig `toml:"twitch"` 37 + Discord *DiscordConfig `toml:"discord"` 38 + Twitch *TwitchConfig `toml:"twitch"` 39 39 } 40 40 41 41 AppState struct {
+35 -6
public/style/index.css
··· 231 231 box-shadow: 0 0 8px var(--primary); 232 232 } 233 233 234 - #live-banner h2 { 235 - margin: 0 0 .4em 0; 236 - color: var(--on-background); 237 - } 238 - 239 234 #live-banner p { 240 235 margin: 0; 241 236 } ··· 252 247 } 253 248 254 249 .live-preview div:first-of-type { 255 - text-align: center; 250 + display: flex; 251 + flex-direction: column; 252 + justify-content: space-between; 253 + align-items: center; 254 + gap: .3em; 256 255 } 257 256 258 257 .live-thumbnail { ··· 281 280 flex-direction: column; 282 281 gap: .3em; 283 282 overflow-x: hidden; 283 + } 284 + 285 + #live-banner h2 { 286 + margin: 0; 287 + color: var(--on-background); 288 + font-family: 'Inter', sans-serif; 289 + font-weight: 800; 290 + font-style: italic; 291 + } 292 + 293 + .live-pinger { 294 + width: .5em; 295 + height: .5em; 296 + margin: .1em .2em; 297 + display: inline-block; 298 + border-radius: 100%; 299 + background-color: var(--primary); 300 + box-shadow: 0 0 4px var(--primary); 301 + animation: live-pinger-pulse 1s infinite alternate ease-in-out; 302 + } 303 + 304 + @keyframes live-pinger-pulse { 305 + from { 306 + opacity: .8; 307 + transform: scale(1.0); 308 + } 309 + to { 310 + opacity: 1; 311 + transform: scale(1.1); 312 + } 284 313 } 285 314 286 315 .live-game {
+1
public/style/main.css
··· 3 3 @import url("/style/footer.css"); 4 4 @import url("/style/prideflag.css"); 5 5 @import url("/style/cursor.css"); 6 + @import url("/font/inter/inter.css"); 6 7 7 8 @font-face { 8 9 font-family: "Monaspace Argon";
+1 -1
view/index.go
··· 22 22 23 23 var err error 24 24 var twitchStatus *model.TwitchStreamInfo = nil 25 - if len(app.Config.Twitch.Broadcaster) > 0 { 25 + if app.Twitch != nil && len(app.Config.Twitch.Broadcaster) > 0 { 26 26 twitchStatus, err = controller.GetTwitchStatus(app, app.Config.Twitch.Broadcaster) 27 27 if err != nil { 28 28 fmt.Fprintf(os.Stderr, "WARN: Failed to get Twitch status for %s: %v\n", app.Config.Twitch.Broadcaster, err)
+1 -1
views/index.html
··· 24 24 <main> 25 25 {{if .TwitchStatus}} 26 26 <div id="live-banner"> 27 - <h2>ari is <span class="live-highlight">LIVE</span> right now!</h2> 28 27 <div class="live-preview"> 29 28 <div> 30 29 <img src="{{.TwitchStatus.Thumbnail 144 81}}" alt="livestream thumbnail" class="live-thumbnail"> 31 30 <a href="https://twitch.tv/{{.TwitchStatus.UserName}}" class="live-button">join in!</a> 32 31 </div> 33 32 <div class="live-info"> 33 + <h2>ari melody <span class="live-highlight">LIVE</span> <i class="live-pinger"></i></h2> 34 34 <p class="live-game"><span class="live-game-prefix">streaming:</span> {{.TwitchStatus.GameName}}</p> 35 35 <p class="live-title">{{.TwitchStatus.Title}}</p> 36 36 <p class="live-viewers">{{.TwitchStatus.ViewerCount}} viewers</p>