add: apps api
This commit is contained in:
parent
2a99d49c8a
commit
ebded00fd3
33 changed files with 698 additions and 31 deletions
|
@ -94,6 +94,7 @@
|
|||
]);
|
||||
|
||||
if (res.ok) {
|
||||
e.target.reset();
|
||||
setTimeout(() => {
|
||||
window.location.href = `/community/${res.payload}`;
|
||||
}, 100);
|
||||
|
|
|
@ -595,7 +595,7 @@
|
|||
("style" "display: none;")
|
||||
(text "{{ self::theme_color(color=user.settings.theme_color_surface, css=\"color-surface\") }} {{ self::theme_color(color=user.settings.theme_color_text, css=\"color-text\") }} {{ self::theme_color(color=user.settings.theme_color_text_link, css=\"color-link\") }} {{ self::theme_color(color=user.settings.theme_color_lowered, css=\"color-lowered\") }} {{ self::theme_color(color=user.settings.theme_color_text_lowered, css=\"color-text-lowered\") }} {{ self::theme_color(color=user.settings.theme_color_super_lowered, css=\"color-super-lowered\") }} {{ self::theme_color(color=user.settings.theme_color_raised, css=\"color-raised\") }} {{ self::theme_color(color=user.settings.theme_color_text_raised, css=\"color-text-raised\") }} {{ self::theme_color(color=user.settings.theme_color_super_raised, css=\"color-super-raised\") }} {{ self::theme_color(color=user.settings.theme_color_primary, css=\"color-primary\") }} {{ self::theme_color(color=user.settings.theme_color_text_primary, css=\"color-text-primary\") }} {{ self::theme_color(color=user.settings.theme_color_primary_lowered, css=\"color-primary-lowered\") }} {{ self::theme_color(color=user.settings.theme_color_secondary, css=\"color-secondary\") }} {{ self::theme_color(color=user.settings.theme_color_text_secondary, css=\"color-text-secondary\") }} {{ self::theme_color(color=user.settings.theme_color_secondary_lowered, css=\"color-secondary-lowered\") }} {% if user.permissions|has_supporter -%}")
|
||||
(style
|
||||
(text "{{ user.settings.theme_custom_css|safe|remove_script_tags }}"))
|
||||
(text "{{ user.settings.theme_custom_css|remove_script_tags|safe }}"))
|
||||
(text "{%- endif %}"))
|
||||
|
||||
(text "{%- endif %} {%- endmacro %} {% macro theme_color(color, css) -%} {% if color -%}")
|
||||
|
@ -1001,20 +1001,20 @@
|
|||
(span
|
||||
(text "{{ text \"general:link.stats\" }}")))
|
||||
(text "{%- endif %}")
|
||||
(b
|
||||
("class" "title")
|
||||
(text "{{ config.name }}"))
|
||||
(b ("class" "title") (text "{{ config.name }}"))
|
||||
(a
|
||||
("href" "https://trisua.com/t/tetratto")
|
||||
(text "{{ icon \"code\" }}")
|
||||
(span
|
||||
(text "{{ text \"general:link.source_code\" }}")))
|
||||
; <a href="https://trisuaso.github.io/tetratto">
|
||||
; {{ icon "book" }}
|
||||
; <span>{{ text "general:link.reference" }}</span>
|
||||
; </a>
|
||||
(div
|
||||
("class" "title"))
|
||||
("class" "button")
|
||||
(icon (text "code"))
|
||||
(str (text "general:link.source_code")))
|
||||
|
||||
(a
|
||||
("href" "/reference/tetratto/index.html")
|
||||
("class" "button")
|
||||
("data-turbo" "false")
|
||||
(icon (text "rabbit"))
|
||||
(str (text "general:link.reference")))
|
||||
(b ("class" "title") (str (text "general:label.account")))
|
||||
(button
|
||||
("onclick" "trigger('me::switch_account')")
|
||||
(text "{{ icon \"ellipsis\" }}")
|
||||
|
|
121
crates/app/src/public/html/developer/home.lisp
Normal file
121
crates/app/src/public/html/developer/home.lisp
Normal file
|
@ -0,0 +1,121 @@
|
|||
(text "{% extends \"root.html\" %} {% block head %}")
|
||||
(title
|
||||
(text "Developer panel - {{ config.name }}"))
|
||||
|
||||
(text "{% endblock %} {% block body %} {{ macros::nav(selected=\"\") }}")
|
||||
(main
|
||||
("class" "flex flex-col gap-2")
|
||||
; create new
|
||||
(text "{{ components::supporter_ad(body=\"Become a supporter to create multiple apps!\") }}")
|
||||
|
||||
(div
|
||||
("class" "card-nest")
|
||||
(div
|
||||
("class" "card small")
|
||||
(b
|
||||
(text "{{ text \"developer:label.create_new\" }}")))
|
||||
(form
|
||||
("class" "card flex flex-col gap-2")
|
||||
("onsubmit" "create_app_from_form(event)")
|
||||
(div
|
||||
("class" "flex flex-col gap-1")
|
||||
(label
|
||||
("for" "title")
|
||||
(text "{{ text \"communities:label.name\" }}"))
|
||||
(input
|
||||
("type" "text")
|
||||
("name" "title")
|
||||
("id" "title")
|
||||
("placeholder" "name")
|
||||
("required" "")
|
||||
("minlength" "2")
|
||||
("maxlength" "32")))
|
||||
(div
|
||||
("class" "flex flex-col gap-1")
|
||||
(label
|
||||
("for" "title")
|
||||
(text "{{ text \"developer:label.homepage\" }}"))
|
||||
(input
|
||||
("type" "url")
|
||||
("name" "homepage")
|
||||
("id" "homepage")
|
||||
("placeholder" "homepage")
|
||||
("required" "")
|
||||
("minlength" "2")
|
||||
("maxlength" "32")))
|
||||
(div
|
||||
("class" "flex flex-col gap-1")
|
||||
(label
|
||||
("for" "title")
|
||||
(text "{{ text \"developer:label.redirect\" }}"))
|
||||
(input
|
||||
("type" "url")
|
||||
("name" "redirect")
|
||||
("id" "redirect")
|
||||
("placeholder" "redirect URL")
|
||||
("required" "")
|
||||
("minlength" "2")
|
||||
("maxlength" "32")))
|
||||
(button
|
||||
("class" "primary")
|
||||
(text "{{ text \"communities:action.create\" }}"))))
|
||||
|
||||
; app listing
|
||||
(div
|
||||
("class" "card-nest")
|
||||
(div
|
||||
("class" "card small flex items-center gap-2")
|
||||
(icon (text "bot"))
|
||||
(str (text "developer:label.my_apps")))
|
||||
|
||||
(div
|
||||
("class" "card flex flex-col gap-2")
|
||||
(text "{% for item in list %}")
|
||||
(a
|
||||
("href" "/developer/app/{{ item.id }}")
|
||||
("class" "card secondary flex flex-col gap-2")
|
||||
(div
|
||||
("class" "flex items-center gap-2")
|
||||
(text "{{ icon \"code\" }}")
|
||||
(b
|
||||
(text "{{ item.title }}")))
|
||||
(span
|
||||
(text "Created ")
|
||||
(span
|
||||
("class" "date")
|
||||
(text "{{ item.created }}"))
|
||||
(text "; {{ item.quota_status }} mode; {{ item.grants }} users")))
|
||||
(text "{% endfor %}"))))
|
||||
|
||||
(script
|
||||
(text "async function create_app_from_form(e) {
|
||||
e.preventDefault();
|
||||
await trigger(\"atto::debounce\", [\"apps::create\"]);
|
||||
|
||||
fetch(\"/api/v1/apps\", {
|
||||
method: \"POST\",
|
||||
headers: {
|
||||
\"Content-Type\": \"application/json\",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
title: e.target.title.value,
|
||||
homepage: e.target.homepage.value,
|
||||
redirect: e.target.redirect.value,
|
||||
}),
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
trigger(\"atto::toast\", [
|
||||
res.ok ? \"success\" : \"error\",
|
||||
res.message,
|
||||
]);
|
||||
|
||||
if (res.ok) {
|
||||
e.target.reset();
|
||||
setTimeout(() => {
|
||||
window.location.href = `/developer/app/${res.payload}`;
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
}"))
|
||||
(text "{% endblock %}")
|
|
@ -71,6 +71,7 @@
|
|||
]);
|
||||
|
||||
if (res.ok) {
|
||||
e.target.reset();
|
||||
setTimeout(() => {
|
||||
window.location.href = `/forge/${res.payload}`;
|
||||
}, 100);
|
||||
|
|
|
@ -100,12 +100,19 @@
|
|||
(icon (text "user-plus"))
|
||||
(str (text "auth:action.register")))
|
||||
|
||||
(div ("class" "title"))
|
||||
(b ("class" "title") (text "{{ config.name }}"))
|
||||
(a
|
||||
("href" "https://trisua.com/t/tetratto")
|
||||
("class" "button")
|
||||
(icon (text "code"))
|
||||
(text "View source")))))
|
||||
(str (text "general:link.source_code")))
|
||||
|
||||
(a
|
||||
("href" "/reference/tetratto/index.html")
|
||||
("class" "button")
|
||||
("data-turbo" "false")
|
||||
(icon (text "rabbit"))
|
||||
(str (text "general:link.reference"))))))
|
||||
(text "{%- endif %}")))
|
||||
(text "{%- endmacro %}")
|
||||
|
||||
|
|
|
@ -561,7 +561,9 @@
|
|||
(li
|
||||
(text "Ability to search through all posts"))
|
||||
(li
|
||||
(text "Ability to create forges")))
|
||||
(text "Ability to create forges"))
|
||||
(li
|
||||
(text "Ability to create more than 1 app")))
|
||||
(a
|
||||
("href" "{{ config.stripe.payment_link }}?client_reference_id={{ user.id }}")
|
||||
("class" "button")
|
||||
|
|
|
@ -57,8 +57,7 @@
|
|||
(span
|
||||
("class" "date")
|
||||
(text "{{ item.created }}"))
|
||||
(text "; {{
|
||||
item.privacy }}; {{ item.users|length }} users")))
|
||||
(text "; {{ item.privacy }}; {{ item.users|length }} users")))
|
||||
(text "{% endfor %}"))))
|
||||
|
||||
(script
|
||||
|
|
BIN
crates/app/src/public/images/tetratto_bunny.webp
Normal file
BIN
crates/app/src/public/images/tetratto_bunny.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
Loading…
Add table
Add a link
Reference in a new issue