add: developer panel

This commit is contained in:
trisua 2025-06-14 20:26:54 -04:00
parent ebded00fd3
commit 39574df691
44 changed files with 982 additions and 84 deletions

View file

@ -845,7 +845,57 @@
("class" "w-content"))
(span
(text "Shown on profile")))))
(text "{% endfor %}"))
(text "{% endfor %}")
(text "{% for grant in profile_grants %}")
(div
("class" "card-nest")
(div
("class" "card small flex items-center gap-4")
(div
("class" "flex items-center gap-2")
(icon (text "bot"))
(a
("class" "flush")
("href" "{{ grant[0].homepage }}")
("target" "_blank")
(b
("class" "flex items-center gap-2")
(text "{{ grant[0].title }}"))))
(span
("class" "fade flex items-center gap-2")
(icon (text "clock"))
(span ("class" "date") (text "{{ grant[1].last_updated }}"))))
(div
("class" "card flex flex-col gap-2")
(details
(summary (icon (text "scan-eye")) (text "{{ grant[1].scopes|length }} scope{{ grant[1].scopes|length|pluralize }}"))
(div
("class" "card lowered w-full")
(ul
(text "{% for scope in grant[1].scopes -%}")
(li
(a
("href" "https://tetratto.com/reference/tetratto/model/oauth/enum.AppScope.html#variant.{{ scope }}")
("target" "_blank")
(text "{{ scope }}")))
(text "{%- endfor %}"))))
(button
("class" "lowered red small")
("onclick" "remove_grant('{{ grant[0].id }}')")
(text "{{ text \"general:action.delete\" }}"))))
(text "{% endfor %}")
(hr)
(a
("class" "button")
("href" "/developer")
(icon (text "code"))
(span
(text "{{ config.name }} ")
(str (text "developer:label.for_developers")))))
(script
("type" "application/json")
("id" "settings_json")
@ -897,6 +947,27 @@
});
};
globalThis.remove_grant = async (id) => {
if (
!(await trigger(\"atto::confirm\", [
\"Are you sure you would like to do this?\",
]))
) {
return;
}
fetch(`/api/v1/auth/user/{{ profile.id }}/grants/${id}`, {
method: \"DELETE\",
})
.then((res) => res.json())
.then((res) => {
trigger(\"atto::toast\", [
res.ok ? \"success\" : \"error\",
res.message,
]);
});
};
globalThis.save_settings = () => {
fetch(\"/api/v1/auth/user/{{ profile.id }}/settings\", {
method: \"POST\",