From 0c0f9e1ce9c54d61b330d717ea096b807831440c Mon Sep 17 00:00:00 2001 From: yequari Date: Fri, 19 Apr 2024 17:28:27 -0700 Subject: [PATCH] basic api access --- config.yaml | 4 ++++ content/now.md | 3 +-- layouts/page/now.html | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 layouts/page/now.html diff --git a/config.yaml b/config.yaml index 0046d9e..31f5836 100644 --- a/config.yaml +++ b/config.yaml @@ -51,3 +51,7 @@ menu: class: email url: mailto:yequari@32bit.cafe weight: 30 +caches: + getresource: + dir: :cacheDir/:project + maxAge: 0 diff --git a/content/now.md b/content/now.md index ef81f6a..af81db6 100644 --- a/content/now.md +++ b/content/now.md @@ -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 diff --git a/layouts/page/now.html b/layouts/page/now.html new file mode 100644 index 0000000..4902a0b --- /dev/null +++ b/layouts/page/now.html @@ -0,0 +1,22 @@ +{{ define "main" }} +

Now

+{{ $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 }} +

+ {{ .Champion }} - {{ if .Win }} Victory {{ else }} Defeat {{ end }} - {{ .Kills }}/{{ .Deaths }}/{{ .Assists }} +

+ {{ end }} + {{ end }} +{{ else }} + {{ errorf "Unable to get remote resource %q" $url }} +{{ end }} + +{{ .Content }} +{{ end }}