add: tawny beta

This commit is contained in:
trisua 2025-09-01 20:17:55 -04:00
parent 140a11ff72
commit 918d47d873
19 changed files with 69 additions and 65 deletions

4
Cargo.lock generated
View file

@ -3452,7 +3452,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"tera", "tera",
"tetratto-core 16.0.0", "tetratto-core 16.0.2",
"tetratto-l10n 12.0.0", "tetratto-l10n 12.0.0",
"tetratto-shared 12.0.6", "tetratto-shared 12.0.6",
"tokio", "tokio",
@ -3489,7 +3489,7 @@ dependencies = [
[[package]] [[package]]
name = "tetratto-core" name = "tetratto-core"
version = "16.0.0" version = "16.0.2"
dependencies = [ dependencies = [
"async-recursion", "async-recursion",
"base16ct", "base16ct",

View file

@ -1,4 +1,5 @@
@import url("utility.css"); @import url("utility.css");
@import url("https://repodelivery.tetratto.com/tetratto-aux/lexend.css");
:root { :root {
color-scheme: light dark; color-scheme: light dark;
@ -85,12 +86,6 @@
box-sizing: border-box; box-sizing: border-box;
} }
@font-face {
font-family: "Lexend";
src: url("https://repodelivery.tetratto.com/fonts/lexend_variable.woff2")
format("woff2");
}
html, html,
body { body {
line-height: 1.5; line-height: 1.5;
@ -193,43 +188,6 @@ p {
margin-bottom: var(--pad-4); margin-bottom: var(--pad-4);
} }
body:not(.use_system_font) {
& p:not(b *),
& span:not(.notification, .name, b *, button *, a *, .dropdown *, nav *),
& input,
& textarea {
font-variation-settings: "wght" 325;
& h1 {
font-variation-settings: "wght" 600;
}
& h2 {
font-variation-settings: "wght" 550;
}
& h3 {
font-variation-settings: "wght" 500;
}
& h4 {
font-variation-settings: "wght" 450;
}
& h5 {
font-variation-settings: "wght" 400;
}
& h6 {
font-variation-settings: "wght" 350;
}
& b {
font-variation-settings: "wght" 500;
}
}
}
.no_p_margin p:last-child { .no_p_margin p:last-child {
margin-bottom: 0; margin-bottom: 0;
} }

View file

@ -101,6 +101,9 @@
atto[\"hooks::spotify_time_text\"](); // spotify durations atto[\"hooks::spotify_time_text\"](); // spotify durations
atto[\"hooks::verify_emoji\"](); atto[\"hooks::verify_emoji\"]();
globalThis.CURRENT_USER = \"{% if user -%} {{ user.username }} {%- endif %}\";
trigger(\"me::token_links\");
fix_atto_links(); fix_atto_links();
if (document.getElementById(\"tokens\")) { if (document.getElementById(\"tokens\")) {

View file

@ -706,7 +706,9 @@
("cy" "12") ("cy" "12")
("r" "6")))) ("r" "6"))))
(text "{%- endif %} {%- endmacro %} {% macro theme(user, theme_preference) -%} {% if user %} {% if user.settings.theme_hue -%}") (text "{%- endif %} {%- endmacro %}")
(text "{% macro theme(user, theme_preference) -%} {% if user %} {% if user.settings.theme_hue -%}")
(style (style
(text ":root, * { (text ":root, * {
--hue: {{ user.settings.theme_hue }} !important; --hue: {{ user.settings.theme_hue }} !important;
@ -739,7 +741,6 @@
setTimeout(() => { setTimeout(() => {
match_user_theme(); match_user_theme();
}, 150);")) }, 150);"))
(text "{%- endif %}") (text "{%- endif %}")
(div (div
("style" "display: none;") ("style" "display: none;")
@ -748,7 +749,6 @@
(style (style
(text "{{ user.settings.theme_custom_css|remove_script_tags|safe }}")) (text "{{ user.settings.theme_custom_css|remove_script_tags|safe }}"))
(text "{%- endif %}")) (text "{%- endif %}"))
(text "{%- endif %} {%- endmacro %} {% macro theme_color(color, css) -%} {% if color -%}") (text "{%- endif %} {%- endmacro %} {% macro theme_color(color, css) -%} {% if color -%}")
(style (style
(text ":root, (text ":root,
@ -756,7 +756,9 @@
--{{ css }}: {{ color|color }} !important; --{{ css }}: {{ color|color }} !important;
}")) }"))
(text "{%- endif %} {%- endmacro %} {% macro question(question, owner, asking_about=false, show_community=true, secondary=false, profile=false) -%}") (text "{%- endif %} {%- endmacro %}")
(text "{% macro question(question, owner, asking_about=false, show_community=true, secondary=false, profile=false) -%}")
(div (div
("class" "card question {% if secondary -%}secondary{%- endif %} flex gap_2") ("class" "card question {% if secondary -%}secondary{%- endif %} flex gap_2")
(text "{% if owner.id == 0 or question.context.mask_owner -%}") (text "{% if owner.id == 0 or question.context.mask_owner -%}")
@ -860,8 +862,8 @@
(div (div
("class" "card_nest") ("class" "card_nest")
(div (div
("class" "card small flex items_center gap_2") ("class" "card small flex items_center gap_2 flex_wrap")
(text "{{ icon \"message-circle-heart\" }}") (icon (text "message-circle-heart"))
(span (span
("class" "no_p_margin") ("class" "no_p_margin")
(text "{% if header -%} {{ header|markdown|safe }} {% else %} {{ text \"requests:label.ask_question\" }} {%- endif %}"))) (text "{% if header -%} {{ header|markdown|safe }} {% else %} {{ text \"requests:label.ask_question\" }} {%- endif %}")))

View file

@ -72,6 +72,13 @@
("href" "/chats/0/0") ("href" "/chats/0/0")
(icon (text "message-circle")) (icon (text "message-circle"))
(str (text "communities:label.chats"))) (str (text "communities:label.chats")))
(text "{% if config.service_hosts.tawny -%}")
(a
("href" "{{ config.service_hosts.tawny }}/api/v1/auth/set_token?token=")
(icon (text "message-circle"))
(str (text "communities:label.chats"))
(span ("class" "chip") (text "beta")))
(text "{%- endif %}")
(a (a
("href" "/mail") ("href" "/mail")
(icon (text "mail")) (icon (text "mail"))

View file

@ -162,12 +162,12 @@
(text "{{ profile.settings.biography|markdown|safe }}") (text "{{ profile.settings.biography|markdown|safe }}")
(text "{% if profile.settings.location|length > 0 -%}") (text "{% if profile.settings.location|length > 0 -%}")
(span ("class" "flex items_center gap_2") (icon (text "map-pin")) (text "{{ profile.settings.location }}")) (span ("class" "flex items_center gap_2 flex_wrap") (icon (text "map-pin")) (text "{{ profile.settings.location }}"))
(text "{%- endif %}") (text "{%- endif %}")
(text "{% for link in profile.settings.links -%}") (text "{% for link in profile.settings.links -%}")
(span (span
("class" "flex items_center gap_2") ("class" "flex items_center gap_2 flex_wrap")
(icon (text "link")) (icon (text "link"))
(a (a
("href" "{{ link[1] }}") ("href" "{{ link[1] }}")
@ -278,12 +278,18 @@
(span (span
(text "{{ text \"auth:action.unblock\" }}"))) (text "{{ text \"auth:action.unblock\" }}")))
(text "{%- endif %} {% if not profile.settings.private_chats or is_following_you %}") (text "{%- endif %} {% if not profile.settings.private_chats or is_following_you %}")
(button (text "{% if config.service_hosts.tawny -%}")
("onclick" "create_group_chat()") (a
("class" "lowered") ("href" "{{ config.service_hosts.tawny }}/@{{ profile.username }}")
(text "{{ icon \"message-circle\" }}") ("class" "button lowered")
(span (icon (text "egg"))
(text "{{ text \"auth:action.message\" }}"))) (span (text "Tawny")))
(a
("href" "{{ config.service_hosts.tawny }}/@{{ profile.username }}/confirm_dm")
("class" "button lowered")
(icon (text "message-circle"))
(span (str (text "auth:action.message"))))
(text "{%- endif %}")
(text "{%- endif %} {% if not profile.settings.private_mails or is_following_you %}") (text "{%- endif %} {% if not profile.settings.private_mails or is_following_you %}")
(a (a
("href" "/mail/compose?receivers={{ profile.username }}") ("href" "/mail/compose?receivers={{ profile.username }}")

View file

@ -2,7 +2,6 @@
(div (div
("style" "display: contents") ("style" "display: contents")
(text "{{ components::create_question_form(receiver=profile.id, header=profile.settings.motivational_header, drawing_enabled=profile.settings.enable_drawings, allow_anonymous=profile.settings.allow_anonymous_questions) }}")) (text "{{ components::create_question_form(receiver=profile.id, header=profile.settings.motivational_header, drawing_enabled=profile.settings.enable_drawings, allow_anonymous=profile.settings.allow_anonymous_questions) }}"))
(text "{%- endif %}") (text "{%- endif %}")
(text "{{ macros::profile_nav(selected=\"posts\") }}") (text "{{ macros::profile_nav(selected=\"posts\") }}")
(div (div

View file

@ -24,5 +24,4 @@
(div (div
("class" "card flex flex_col gap_4") ("class" "card flex flex_col gap_4")
(text "{% for post in posts %} {% if post[2].read_access == \"Everybody\" -%} {% if post[0].context.repost and post[0].context.repost.reposting -%} {{ components::repost(repost=post[3], post=post[0], owner=post[1], secondary=true, community=post[2], show_community=true, can_manage_post=is_self) }} {% else %} {{ components::post(post=post[0], owner=post[1], question=post[4], secondary=true, community=post[2], can_manage_post=is_self, poll=post[5]) }} {%- endif %} {%- endif %} {% endfor %} {{ components::pagination(page=page, items=posts|length) }}"))) (text "{% for post in posts %} {% if post[2].read_access == \"Everybody\" -%} {% if post[0].context.repost and post[0].context.repost.reposting -%} {{ components::repost(repost=post[3], post=post[0], owner=post[1], secondary=true, community=post[2], show_community=true, can_manage_post=is_self) }} {% else %} {{ components::post(post=post[0], owner=post[1], question=post[4], secondary=true, community=post[2], can_manage_post=is_self, poll=post[5]) }} {%- endif %} {%- endif %} {% endfor %} {{ components::pagination(page=page, items=posts|length) }}")))
(text "{% endblock %}") (text "{% endblock %}")

View file

@ -33,6 +33,7 @@
classes: {}, classes: {},
service_hosts: { service_hosts: {
buckets: \"{{ config.service_hosts.buckets|safe }}\", buckets: \"{{ config.service_hosts.buckets|safe }}\",
tawny: \"{{ config.service_hosts.tawny|safe }}\",
} }
}; };

View file

@ -860,7 +860,8 @@ media_theme_pref();
anchor.href.startsWith("https://buy.stripe.com") || anchor.href.startsWith("https://buy.stripe.com") ||
anchor.href.startsWith("https://billing.stripe.com") || anchor.href.startsWith("https://billing.stripe.com") ||
anchor.href.startsWith("https://last.fm") || anchor.href.startsWith("https://last.fm") ||
anchor.href.startsWith("atto://") anchor.href.startsWith("atto://") ||
anchor.href.startsWith(_app_base.service_hosts.tawny)
) { ) {
continue; continue;
} }

View file

@ -662,6 +662,15 @@
}); });
// token switcher // token switcher
self.define("token_links", ({ $ }) => {
for (const anchor of Array.from(document.querySelectorAll("a"))) {
if (anchor.href.endsWith("/set_token?token=")) {
anchor.href += $.LOGIN_ACCOUNT_TOKENS[globalThis.CURRENT_USER];
continue;
}
}
});
self.define("append_associations", (_, tokens) => { self.define("append_associations", (_, tokens) => {
fetch("/api/v1/auth/user/me/append_associations", { fetch("/api/v1/auth/user/me/append_associations", {
method: "PUT", method: "PUT",

View file

@ -1,7 +1,7 @@
[package] [package]
name = "tetratto-core" name = "tetratto-core"
description = "The core behind Tetratto" description = "The core behind Tetratto"
version = "16.0.0" version = "16.0.2"
edition = "2024" edition = "2024"
readme = "../../README.md" readme = "../../README.md"
authors.workspace = true authors.workspace = true

View file

@ -264,6 +264,9 @@ pub struct ServiceHostsConfig {
/// Littleweb browser host. /// Littleweb browser host.
#[serde(default)] #[serde(default)]
pub littleweb: String, pub littleweb: String,
/// Tawny host <https://trisua.com/t/tawny>.
#[serde(default)]
pub tawny: String,
} }
impl Default for ServiceHostsConfig { impl Default for ServiceHostsConfig {
@ -271,6 +274,7 @@ impl Default for ServiceHostsConfig {
Self { Self {
buckets: String::new(), buckets: String::new(),
littleweb: String::new(), littleweb: String::new(),
tawny: String::new(),
} }
} }
} }

View file

@ -131,6 +131,7 @@ impl DataManager {
applied_configurations: serde_json::from_str(&get!(x->33(String)).to_string()).unwrap(), applied_configurations: serde_json::from_str(&get!(x->33(String)).to_string()).unwrap(),
last_policy_consent: get!(x->34(i64)) as usize, last_policy_consent: get!(x->34(i64)) as usize,
close_friends_stack: get!(x->35(i64)) as usize, close_friends_stack: get!(x->35(i64)) as usize,
missed_messages_count: get!(x->36(i32)) as usize,
} }
} }
@ -1165,4 +1166,8 @@ impl DataManager {
auto_method!(decr_user_request_count()@get_user_by_id -> "UPDATE users SET request_count = request_count - 1 WHERE id = $1" --cache-key-tmpl=cache_clear_user --decr=request_count); auto_method!(decr_user_request_count()@get_user_by_id -> "UPDATE users SET request_count = request_count - 1 WHERE id = $1" --cache-key-tmpl=cache_clear_user --decr=request_count);
auto_method!(get_user_by_invite_code(i64)@get_user_from_row -> "SELECT * FROM users WHERE invite_code = $1" --name="user" --returns=User); auto_method!(get_user_by_invite_code(i64)@get_user_from_row -> "SELECT * FROM users WHERE invite_code = $1" --name="user" --returns=User);
auto_method!(update_user_missed_messages_count(i32)@get_user_by_id -> "UPDATE users SET missed_messages_count = $1 WHERE id = $2" --cache-key-tmpl=cache_clear_user);
auto_method!(incr_user_missed_messages()@get_user_by_id -> "UPDATE users SET missed_messages_count = missed_messages_count + 1 WHERE id = $1" --cache-key-tmpl=cache_clear_user --incr);
auto_method!(decr_user_missed_messages()@get_user_by_id -> "UPDATE users SET missed_messages_count = missed_messages_count - 1 WHERE id = $1" --cache-key-tmpl=cache_clear_user --decr=notification_count);
} }

View file

@ -34,5 +34,6 @@ CREATE TABLE IF NOT EXISTS users (
checkouts TEXT NOT NULL, checkouts TEXT NOT NULL,
applied_configurations TEXT NOT NULL, applied_configurations TEXT NOT NULL,
last_policy_consent BIGINT NOT NULL, last_policy_consent BIGINT NOT NULL,
close_friends_stack BIGINT NOT NULL close_friends_stack BIGINT NOT NULL,
missed_messages_count INT NOT NULL
) )

View file

@ -85,3 +85,7 @@ ADD COLUMN IF NOT EXISTS close_friends_stack BIGINT DEFAULT 0;
-- stacks is_locked -- stacks is_locked
ALTER TABLE stacks ALTER TABLE stacks
ADD COLUMN IF NOT EXISTS is_locked INT DEFAULT 0; ADD COLUMN IF NOT EXISTS is_locked INT DEFAULT 0;
-- users missed_messages_count
ALTER TABLE users
ADD COLUMN IF NOT EXISTS missed_messages_count INT DEFAULT 0;

View file

@ -116,6 +116,9 @@ pub struct User {
/// (the user) to post to it. /// (the user) to post to it.
#[serde(default)] #[serde(default)]
pub close_friends_stack: usize, pub close_friends_stack: usize,
/// The number of messages this user has missed.
#[serde(default)]
pub missed_messages_count: usize,
} }
pub type UserConnections = pub type UserConnections =
@ -466,6 +469,7 @@ impl User {
applied_configurations: Vec::new(), applied_configurations: Vec::new(),
last_policy_consent: created, last_policy_consent: created,
close_friends_stack: 0, close_friends_stack: 0,
missed_messages_count: 0,
} }
} }

View file

@ -24,6 +24,7 @@ system_user = 211903918383300608
[service_hosts] [service_hosts]
buckets = "http://localhost:8020" buckets = "http://localhost:8020"
littleweb = "http://localhost:4119" littleweb = "http://localhost:4119"
tawny = "http://localhost:8021"
[security] [security]
registration_enabled = true registration_enabled = true