basic api access

This commit is contained in:
yequari 2024-04-19 17:28:27 -07:00
parent c3eb73fe9d
commit 0c0f9e1ce9
3 changed files with 27 additions and 2 deletions

View File

@ -51,3 +51,7 @@ menu:
class: email
url: mailto:yequari@32bit.cafe
weight: 30
caches:
getresource:
dir: :cacheDir/:project
maxAge: 0

View File

@ -1,9 +1,8 @@
---
title: "Now"
date: 2023-04-17T15:00:46-07:00
layout: now
---
# Now
One day this page will pull some info from APIs to create a more interesting page but for now I just manually update it as needed.
**Games I'm playing**: Cyberpunk 2077, Honkai Star Rail, Baldur's Gate 3

22
layouts/page/now.html Normal file
View File

@ -0,0 +1,22 @@
{{ define "main" }}
<h1>Now</h1>
{{ $data := dict }}
{{ $url := "http://localhost:8000/v1/now" }}
{{ with resources.GetRemote $url }}
{{ with .Err }}
{{ errorf "%s" . }}
{{ else }}
{{ $data = .Content | transform.Unmarshal }}
{{ $data.SummonerName }} -- {{ $data.SummonerLvl }}
{{ range $data.RankedMatchs }}
<p>
{{ .Champion }} - {{ if .Win }} Victory {{ else }} Defeat {{ end }} - {{ .Kills }}/{{ .Deaths }}/{{ .Assists }}
</p>
{{ end }}
{{ end }}
{{ else }}
{{ errorf "Unable to get remote resource %q" $url }}
{{ end }}
{{ .Content }}
{{ end }}