fix: migrate gifs to klipy service (#1220)

This commit is contained in:
Hampus
2026-06-30 01:19:57 +02:00
committed by GitHub
parent 99eedf6d1e
commit 4a741d8396
79 changed files with 3032 additions and 1653 deletions
+3 -19
View File
@@ -12594,20 +12594,8 @@
"properties": {
"gif": {
"type": "object",
"properties": {
"provider": {"nullable": true, "enum": ["tenor", "klipy"], "type": "string"},
"effective_provider": {"enum": ["tenor", "klipy"], "type": "string"},
"tenor_api_key_set": {"type": "boolean"},
"klipy_api_key_set": {"type": "boolean"},
"effective_available": {"type": "boolean"}
},
"required": [
"provider",
"effective_provider",
"tenor_api_key_set",
"klipy_api_key_set",
"effective_available"
]
"properties": {"klipy_api_key_set": {"type": "boolean"}, "effective_available": {"type": "boolean"}},
"required": ["klipy_api_key_set", "effective_available"]
},
"youtube": {
"type": "object",
@@ -12990,11 +12978,7 @@
"gif": {
"nullable": true,
"type": "object",
"properties": {
"provider": {"nullable": true, "enum": ["tenor", "klipy"], "type": "string"},
"tenor_api_key": {"nullable": true, "type": "string", "maxLength": 4096},
"klipy_api_key": {"nullable": true, "type": "string", "maxLength": 4096}
}
"properties": {"klipy_api_key": {"nullable": true, "type": "string", "maxLength": 4096}}
},
"youtube": {
"nullable": true,
@@ -100,12 +100,6 @@ pub struct InstanceIntegrationsResponse {
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct InstanceGifIntegrationResponse {
pub provider: Option<String>,
#[serde(default)]
pub effective_provider: String,
#[serde(default)]
pub tenor_api_key_set: bool,
#[serde(default)]
pub klipy_api_key_set: bool,
#[serde(default)]
pub effective_available: bool,
@@ -549,10 +543,6 @@ pub struct InstanceIntegrationsUpdateRequest {
#[derive(Clone, Debug, Default, Serialize)]
pub struct InstanceGifIntegrationUpdateRequest {
#[serde(skip_serializing_if = "Option::is_none")]
pub provider: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tenor_api_key: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub klipy_api_key: Option<String>,
}
@@ -603,8 +603,6 @@ fn build_integrations_update(form: &MultiValueForm) -> InstanceConfigUpdateReque
policy: None,
integrations: Some(InstanceIntegrationsUpdateRequest {
gif: Some(InstanceGifIntegrationUpdateRequest {
provider: clean("integration_gif_provider"),
tenor_api_key: clean("integration_tenor_api_key"),
klipy_api_key: clean("integration_klipy_api_key"),
}),
youtube: Some(InstanceYoutubeIntegrationUpdateRequest {
@@ -408,11 +408,6 @@ fn integrations_config_section(
csrf_token: &str,
integrations: &InstanceIntegrationsResponse,
) -> Markup {
let gif_provider = integrations
.gif
.provider
.as_deref()
.unwrap_or(integrations.gif.effective_provider.as_str());
let captcha_provider = integrations
.captcha
.provider
@@ -435,15 +430,9 @@ fn integrations_config_section(
div class="flex flex-wrap items-center gap-2" {
h3 class="text-sm font-semibold text-neutral-900" { "GIF provider" }
(secret_badge("KLIPY key", integrations.gif.klipy_api_key_set))
(secret_badge("Tenor key", integrations.gif.tenor_api_key_set))
}
div class="grid grid-cols-1 gap-4 sm:grid-cols-3" {
(select_input("integration_gif_provider", "Provider", &[
("klipy", "KLIPY"),
("tenor", "Tenor"),
], gif_provider))
div class="grid grid-cols-1 gap-4" {
(password_input("integration_klipy_api_key", "KLIPY API key", Some("Leave blank to keep the current key.")))
(password_input("integration_tenor_api_key", "Tenor API key", Some("Leave blank to keep the current key.")))
}
}