add: apps rust sdk

This commit is contained in:
trisua 2025-07-19 15:31:06 -04:00
parent f05074ffc5
commit fe1e53c47a
11 changed files with 461 additions and 11 deletions

View file

@ -193,7 +193,13 @@ macro_rules! user_banned {
macro_rules! check_user_blocked_or_private {
($user:expr, $other_user:ident, $data:ident, $jar:ident) => {
// check is_deactivated
if $other_user.is_deactivated {
if ($user.is_none() && $other_user.is_deactivated)
| !$user
.as_ref()
.unwrap()
.permissions
.check(tetratto_core::model::permissions::FinePermission::MANAGE_USERS)
{
return Err(Html(
render_error(
Error::GeneralNotFound("user".to_string()),

View file

@ -117,6 +117,29 @@ export default function tetratto({
);
}
async function update(id, value) {
if (!api_key) {
throw Error("No API key provided.");
}
return api_promise(
json_parse(
await (
await fetch(`${host}/api/v1/app_data/${id}/value`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Atto-Secret-Key": api_key,
},
body: json_stringify({
value,
}),
})
).text(),
),
);
}
async function remove(id) {
if (!api_key) {
throw Error("No API key provided.");
@ -241,6 +264,7 @@ export default function tetratto({
app,
query,
insert,
update,
remove,
remove_query,
// user connection