Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Team Fortress Key Price #2899

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/tfkeyprice/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
id: tf-key-price
name: TF Key Price
summary: Team Fortress 2 Key Price
desc: Display price of team fortress 2 keys via backpack.tf website.
author: Trevor Underwood
Binary file added apps/tfkeyprice/tf_key_price.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions apps/tfkeyprice/tf_key_price.star
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
load("render.star", "render")
load("http.star", "http")
load("encoding/base64.star", "base64")

KEY_PRICE_URL = "https://backpack.tf/api/IGetCurrencies/v1?raw=1&key=6594beeaba29d5eb6204c3ab"

TF2_ICON = base64.decode("""/9j/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFjcHJ0AAABUAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFlaAAACGAAAABRnWFlaAAACLAAAABRiWFlaAAACQAAAABRkbW5kAAACVAAAAHBkbWRkAAACxAAAAIh2dWVkAAADTAAAAIZ2aWV3AAAD1AAAACRsdW1pAAAD+AA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NU8I9f8FtO7oU4u6yg0Afhn//2Q==""")
def main(config):
rep = http.get(KEY_PRICE_URL, ttl_seconds = 240)
if rep.status_code != 200:
fail("Bakcpack.tf request failed with status %d", rep.status_code)

rate = rep.json()["response"]["currencies"]["keys"]["price"]["value_raw"]

return render.Root(
child = render.Row(
children = [
render.Image(src = TF2_ICON),
render.Column(
children = [
render.Marquee(
width = 32,
child = render.Text("Mann Co. Supply Crate Key"),
),
render.Text("%d REF" % rate),
],
expanded = True,
main_align = "space_evenly",
cross_align = "center",
),
],
main_align = "space_between",
cross_align = "center",
),
)
Loading