dynamically update icon on account management page w/ user's icon

i made an api for this :)
This commit is contained in:
Jill 2023-01-13 20:57:09 +03:00
parent e18157d418
commit 095c3123ab
2 changed files with 5 additions and 2 deletions

View File

@ -91,7 +91,7 @@
<a href="/"><img src="/favicon.png" width="64" height="auto" class="spinny favicon"></a><br> <a href="/"><img src="/favicon.png" width="64" height="auto" class="spinny favicon"></a><br>
<div class="greeting"> <div class="greeting">
<img src="https://cdn.discordapp.com/attachments/902195395264905217/1062706739969019984/ball_35.png" width="150" height="150" class="greeting-l"> <img src="https://gdicon.oat.zone/icon.png?type=<%=type_str%>&value=<%=icon_value%>&color1=<%=color1%>&color2=<%=color2%><%=glow ? "&glow=1" : ""%>" width="150" height="150" class="greeting-l">
<div class="greeting-r"> <div class="greeting-r">
<div class="greeting-top"> <div class="greeting-top">
<div class="greeting-top-left"> <div class="greeting-top-left">

View File

@ -12,7 +12,10 @@ CrystalGauntlet.template_endpoints["/accounts"] = ->(context : HTTP::Server::Con
username = nil username = nil
Templates.auth() Templates.auth()
stars, demons, coins, user_coins, diamonds, creator_points = DATABASE.query_one("select stars, demons, coins, user_coins, diamonds, creator_points from users where id = ?", user_id, as: {Int32, Int32, Int32, Int32, Int32, Int32}) stars, demons, coins, user_coins, diamonds, creator_points, icon_type, color1, color2, cube, ship, ball, ufo, wave, robot, spider, glow = DATABASE.query_one("select stars, demons, coins, user_coins, diamonds, creator_points, icon_type, color1, color2, cube, ship, ball, ufo, wave, robot, spider, glow from users where id = ?", user_id, as: {Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32})
icon_value = [cube, ship, ball, ufo, wave, robot, spider][icon_type]
type_str = ["cube", "ship", "ball", "ufo", "wave", "robot", "spider"][icon_type]
ECR.embed("./public/template/account_management.ecr", context.response) ECR.embed("./public/template/account_management.ecr", context.response)
} }