From 466c9a098299239a27cc85e2fceb705ebc385eb7 Mon Sep 17 00:00:00 2001 From: Ramdziana F Y Date: Thu, 3 Aug 2023 16:11:06 +0000 Subject: [PATCH 1/7] chore: Translated using Weblate (Indonesian) Currently translated at 100.0% (1846 of 1846 strings) Translation: Firefish/locales Translate-URL: https://hosted.weblate.org/projects/firefish/locales/id/ --- locales/id-ID.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/locales/id-ID.yml b/locales/id-ID.yml index 7085571aae..ca40947b32 100644 --- a/locales/id-ID.yml +++ b/locales/id-ID.yml @@ -1002,6 +1002,7 @@ _aboutFirefish: pleaseDonateToHost: Silakan pertimbangkan juga berdonasi ke server rumah kamu, {host}, untuk membantu dengan biaya operasi. donateHost: Berdonasi ke {host} + misskeyContributors: Kontributor Misskey _nsfw: respect: "Sembunyikan media NSFW" ignore: "Jangan sembunyikan media NSFW" @@ -2163,3 +2164,4 @@ delete2fa: Nonaktifkan 2FA delete2faConfirm: Ini akan menghapus 2FA secara permanen pada akun ini. Lanjutkan? deletePasskeysConfirm: Ini akan menghapus semua passkeys dan kunci keamanan pada akun ini secara permanen. Lanjutkan? +addRe: Tambahkan "re:" pada awal komentar balasan postingan dengan peringatan konten From fcf237729f0c93da6a46189a80353ab488c25a5b Mon Sep 17 00:00:00 2001 From: gbieging Date: Fri, 4 Aug 2023 02:49:49 +0000 Subject: [PATCH 2/7] chore: Translated using Weblate (Portuguese (Brazil)) Currently translated at 12.0% (222 of 1846 strings) Translation: Firefish/locales Translate-URL: https://hosted.weblate.org/projects/firefish/locales/pt_BR/ --- locales/pt_BR.yml | 136 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 135 insertions(+), 1 deletion(-) diff --git a/locales/pt_BR.yml b/locales/pt_BR.yml index 599ef3bb5f..f8fb651182 100644 --- a/locales/pt_BR.yml +++ b/locales/pt_BR.yml @@ -5,7 +5,7 @@ headlineFirefish: Uma plataforma de mídia social descentralizada e de código a que é gratuita para sempre! 🚀 search: Pesquisar gotIt: Entendi! -introFirefish: Bem vinde! Firefish é uma plataforma de mídia social descentralizada +introFirefish: Bem vindo! Firefish é uma plataforma de mídia social descentralizada e de código aberto que é gratuita para sempre! 🚀 searchPlaceholder: Pesquise no Firefish notifications: Notificações @@ -110,3 +110,137 @@ followRequests: Pedidos de seguimento unfollow: Parar de seguir followRequestPending: Pedido de seguimento pendente enterEmoji: Insira um emoji +itsOff: Desativado +itsOn: Ativado +removeReaction: Retirar sua reação +reactionSettingDescription2: Arraste para reordenar, clique para deletar, pressione + “+” para adicionar. +rememberNoteVisibility: Lembrar configurações de visibilidade de postagem +enterFileName: Preencha o nome do arquivo +block: Bloquear +unblock: Desbloquear +suspend: Suspender +blockConfirm: Você tem certeza de que quer bloquear esta conta? +unblockConfirm: Você tem certeza de que quer desbloquear esta conta? +suspendConfirm: Você tem certeza de que quer suspender esta conta? +selectList: Selecione uma lista +selectChannel: Selecione um canal +addEmoji: Adicionar Emoji +settingGuide: Configurações recomendadas +cacheRemoteFilesDescription: Quando esta configuração está desativada, arquivos remotos + serão carregados diretamente do servidor remoto. Desativar isso irá diminuir o uso + de armazenamento, mas aumentar o tráfego, já que as thumbnails não serão geradas. +flagAsBot: Marcar esta conta como robô +flagAsCat: Você é um gato? 😺 +flagAsCatDescription: Você receberá orelhas de gato e falará como um! +flagSpeakAsCat: Falar como um gato +dashboard: Painel +showFeaturedNotesInTimeline: Mostrar postagens em destaque nas linhas do tempo +objectStorage: Armazenamento de objetos +useObjectStorage: Utilizar armazenamento de objetos +objectStorageBaseUrl: URL base +objectStorageBucket: Balde +objectStorageBucketDesc: Por favor, especifique o nome do balde usado no seu provedor. +objectStorageRegion: Região +objectStorageRegionDesc: Especifique uma região como "xx-east-1". Se o seu serviço + não distingue entre as regiões, deixe esta em branco ou insira 'us-east-1'. +objectStorageUseSSL: Utilizar SSL +objectStorageUseSSLDesc: Desligue isso se você não utilizará HTTPS para conexões de + API +objectStorageUseProxy: Conecte-se por Proxy +lastUsedDate: Última utilização em +state: Estado +objectStorageUseProxyDesc: Desligue isso se você não utilizará um Proxy para conexões + com API +serverLogs: Logs de Servidor +details: Detalhes +nothing: Não há nada para ver aqui +installedDate: Autorizado em +sort: Ordenar +ascendingOrder: Ascendente +descendingOrder: Descendente +output: Saída +expandOnNoteClick: Abrir postagem ao clicar +updateRemoteUser: Atualizar informações do usuário remoto +deleteAllFiles: Excluir todos os arquivos +deleteAllFilesConfirm: Você tem certeza de que deseja excluir todos os arquivos? +yourAccountSuspendedTitle: Esta conta está suspensa +yourAccountSuspendedDescription: Esta conta foi suspensa por quebrar os termos de + serviço do servidor ou similares. Entre em contato com o administrador se você quiser + saber um motivo mais detalhado. Por favor, não crie uma nova conta. +menu: Menu +divider: Divisor +addItem: Adicionar Item +inboxUrl: URL da caixa de entrada +left: Esquerda +center: Centro +wide: Largo +narrow: Estreito +isModerator: Moderador +monthAndDay: '{day}/{month}' +pinned: Fixar ao perfil +pinnedNote: Postagem fixada +you: Você +clickToShow: Clique para exibir +showEmojisInReactionNotifications: Mostrar emojis nas notificações de reação +reactionSetting: Reações a exibir no seletor de reações +customEmojis: Emojis personalizados +emojis: Emojis +emojiName: Nome do Emoji +emoji: Emoji +emojiUrl: URL do Emoji +editWidgetsExit: Pronto +userSilenced: Este usuário está sendo silenciado. +objectStoragePrefix: Prefixo +volume: Volume +objectStorageS3ForcePathStyle: Use URLs de endpoint baseadas em caminho +none: Nenhum +masterVolume: Volume mestre +showInPage: Mostrar na página +expandOnNoteClickDesc: Se desativado, você ainda pode abrir postagens no menu do botão + direito do mouse ou clicando no timestamp. +disablePagesScript: Desativar o AiScript nas Páginas +isPatron: Patrono do Firefish +invite: Convite +inMb: Em megabytes +iconUrl: URL do Ícone +basicInfo: Informações básicas +pinnedUsers: Usuários fixados +fontSize: Tamanho da fonte +noFollowRequests: Você não tem nenhuma solicitação de seguimento pendente +openImageInNewTab: Abrir imagens em nova guia +local: Local +remote: Remoto +total: Total +appearance: Aparência +accessibility: Acessibilidade +accountSettings: Configurações de Conta +numberOfDays: Número de dias +hideThisNote: Esconder esta postagem +objectStoragePrefixDesc: Os arquivos serão armazenados em diretórios com este prefixo. +objectStorageEndpointDesc: Deixe isso vazio se você estiver usando AWS S3, de outra + forma especifique o endpoint como '' ou ':', dependendo do serviço + que você está usando. +deleteAll: Excluir tudo +showFixedPostForm: Exibir o formulário de postagem no topo da linha do tempo +newNoteRecived: Há novas postagens +sounds: Sons +chooseEmoji: Selecione um emoji +unableToProcess: A operação não pôde ser concluída +recentUsed: Recentemente usado +install: Instalar +uninstall: Desinstalar +installedApps: Aplicações Autorizadas +removeAllFollowing: Parar de seguir todos os usuários seguidos +removeAllFollowingDescription: Executar isso faz parar de seguir todas as contas de + {host}. Por favor, execute isso se o servidor, por exemplo, não existir mais. +userSuspended: Este usuário foi suspenso. +isAdmin: Administrador +receiveFollowRequest: Solicitação de seguir recebida +followRequestAccepted: Solicitação de seguir aceita +add: Adicionar +reaction: Reações +enableEmojiReactions: Ativar reações com emoji +attachCancel: Remover anexo +flagShowTimelineReplies: Mostrar respostas na linha do tempo +addAccount: Adicionar conta From 738b4933ae008c38275ab44526a201f91dd7683f Mon Sep 17 00:00:00 2001 From: Namekuji Date: Sun, 6 Aug 2023 02:34:44 -0400 Subject: [PATCH 3/7] fix: generate stream id with timestamp --- packages/backend/native-utils/Cargo.lock | 14 +++++------ packages/backend/native-utils/Cargo.toml | 2 +- .../backend/native-utils/migration/Cargo.toml | 4 +-- .../m20230709_000510_move_antenna_to_cache.rs | 5 ++-- packages/backend/native-utils/src/util/id.rs | 25 ++++++++++++++++--- packages/backend/src/misc/gen-id.ts | 5 ++++ .../server/api/endpoints/antennas/notes.ts | 18 ++++++++++--- .../src/services/add-note-to-antenna.ts | 4 +-- 8 files changed, 57 insertions(+), 20 deletions(-) diff --git a/packages/backend/native-utils/Cargo.lock b/packages/backend/native-utils/Cargo.lock index e5f8af37a7..f2f3745b1c 100644 --- a/packages/backend/native-utils/Cargo.lock +++ b/packages/backend/native-utils/Cargo.lock @@ -196,6 +196,12 @@ version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +[[package]] +name = "basen" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dbe4bb73fd931c4d1aaf53b35d1286c8a948ad00ec92c8e3c856f15fd027f43" + [[package]] name = "bigdecimal" version = "0.3.1" @@ -1399,6 +1405,7 @@ name = "native-utils" version = "0.0.0" dependencies = [ "async-trait", + "basen", "cfg-if", "chrono", "cuid2", @@ -1410,7 +1417,6 @@ dependencies = [ "once_cell", "parse-display", "pretty_assertions", - "radix_fmt", "rand", "schemars", "sea-orm", @@ -1831,12 +1837,6 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" -[[package]] -name = "radix_fmt" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce082a9940a7ace2ad4a8b7d0b1eac6aa378895f18be598230c5f2284ac05426" - [[package]] name = "rand" version = "0.8.5" diff --git a/packages/backend/native-utils/Cargo.toml b/packages/backend/native-utils/Cargo.toml index 6f4dd91759..2b8aaaa8e4 100644 --- a/packages/backend/native-utils/Cargo.toml +++ b/packages/backend/native-utils/Cargo.toml @@ -31,11 +31,11 @@ serde_json = "1.0.96" thiserror = "1.0.40" tokio = { version = "1.28.1", features = ["full"] } utoipa = "3.3.0" -radix_fmt = "1.0.0" # Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix napi = { version = "2.13.1", default-features = false, features = ["napi6", "tokio_rt"], optional = true } napi-derive = { version = "2.12.0", optional = true } +basen = "0.1.0" [dev-dependencies] pretty_assertions = "1.3.0" diff --git a/packages/backend/native-utils/migration/Cargo.toml b/packages/backend/native-utils/migration/Cargo.toml index 9bf793e042..32adb62c81 100644 --- a/packages/backend/native-utils/migration/Cargo.toml +++ b/packages/backend/native-utils/migration/Cargo.toml @@ -10,11 +10,11 @@ path = "src/lib.rs" [features] default = [] -convert = ["dep:native-utils", "dep:indicatif", "dep:futures"] +convert = ["dep:indicatif", "dep:futures"] [dependencies] serde_json = "1.0.96" -native-utils = { path = "../", optional = true } +native-utils = { path = "../" } indicatif = { version = "0.17.4", features = ["tokio"], optional = true } tokio = { version = "1.28.2", features = ["full"] } futures = { version = "0.3.28", optional = true } diff --git a/packages/backend/native-utils/migration/src/m20230709_000510_move_antenna_to_cache.rs b/packages/backend/native-utils/migration/src/m20230709_000510_move_antenna_to_cache.rs index 83bd0448ab..046dc45f6c 100644 --- a/packages/backend/native-utils/migration/src/m20230709_000510_move_antenna_to_cache.rs +++ b/packages/backend/native-utils/migration/src/m20230709_000510_move_antenna_to_cache.rs @@ -1,3 +1,4 @@ +use native_utils::util::id; use redis::streams::StreamMaxlen; use sea_orm::Statement; use sea_orm_migration::prelude::*; @@ -80,12 +81,12 @@ impl MigrationTrait for Migration { pipe.xadd_maxlen( format!("{}:antennaTimeline:{}", prefix, v.1), StreamMaxlen::Approx(200), - "*", + format!("{}-*", id::get_timestamp(&v.2)), &[("note", v.2.to_owned())], ) .ignore(); } - pipe.query::<()>(&mut redis_conn).unwrap(); + pipe.query::<()>(&mut redis_conn).unwrap_or(()); } let copied = total_num - remaining; diff --git a/packages/backend/native-utils/src/util/id.rs b/packages/backend/native-utils/src/util/id.rs index b18637fdbb..2fd94e9019 100644 --- a/packages/backend/native-utils/src/util/id.rs +++ b/packages/backend/native-utils/src/util/id.rs @@ -1,9 +1,9 @@ //! ID generation utility based on [cuid2] +use basen::BASE36; use cfg_if::cfg_if; use chrono::Utc; use once_cell::sync::OnceCell; -use radix_fmt::radix_36; use std::cmp; use crate::impl_into_napi_error; @@ -46,13 +46,21 @@ pub fn create_id(date_num: i64) -> Result { let time = cmp::max(date_num - TIME_2000, 0); Ok(format!( "{:0>8}{}", - radix_36(time).to_string(), + BASE36.encode_var_len(&(time as u64)), gen.create_id() )) } } } +pub fn get_timestamp(id: &str) -> i64 { + let n: Option = BASE36.decode_var_len(&id[0..8]); + match n { + None => -1, + Some(n) => n as i64 + TIME_2000, + } +} + cfg_if! { if #[cfg(feature = "napi")] { use napi_derive::napi; @@ -68,17 +76,23 @@ cfg_if! { pub fn native_create_id(date_num: i64) -> String { create_id(date_num).unwrap() } + + #[napi] + pub fn native_get_timestamp(id: String) -> i64 { + get_timestamp(&id) + } } } #[cfg(test)] mod unit_test { use crate::util::id; + use chrono::Utc; use pretty_assertions::{assert_eq, assert_ne}; use std::thread; #[test] - fn can_generate_unique_ids() { + fn can_create_and_decode() { assert_eq!(id::create_id(0), Err(id::ErrorUninitialized)); id::init_id(16, ""); assert_eq!(id::create_id(0).unwrap().len(), 16); @@ -86,5 +100,10 @@ mod unit_test { let id1 = thread::spawn(|| id::create_id(0).unwrap()); let id2 = thread::spawn(|| id::create_id(0).unwrap()); assert_ne!(id1.join().unwrap(), id2.join().unwrap()); + + let now = Utc::now().timestamp_millis(); + let test_id = id::create_id(now).unwrap(); + let timestamp = id::get_timestamp(&test_id); + assert_eq!(now, timestamp); } } diff --git a/packages/backend/src/misc/gen-id.ts b/packages/backend/src/misc/gen-id.ts index 580c39c3c1..737bbe488f 100644 --- a/packages/backend/src/misc/gen-id.ts +++ b/packages/backend/src/misc/gen-id.ts @@ -2,6 +2,7 @@ import config from "@/config/index.js"; import { nativeCreateId, nativeInitIdGenerator, + nativeGetTimestamp, } from "native-utils/built/index.js"; const length = Math.min(Math.max(config.cuid?.length ?? 16, 16), 24); @@ -19,3 +20,7 @@ nativeInitIdGenerator(length, fingerprint); export function genId(date?: Date): string { return nativeCreateId((date ?? new Date()).getTime()); } + +export function getTimestamp(id: string): number { + return nativeGetTimestamp(id); +} diff --git a/packages/backend/src/server/api/endpoints/antennas/notes.ts b/packages/backend/src/server/api/endpoints/antennas/notes.ts index 69e77eed0b..149f98ea9b 100644 --- a/packages/backend/src/server/api/endpoints/antennas/notes.ts +++ b/packages/backend/src/server/api/endpoints/antennas/notes.ts @@ -2,7 +2,7 @@ import define from "../../define.js"; import readNote from "@/services/note/read.js"; import { Antennas, Notes } from "@/models/index.js"; import { redisClient } from "@/db/redis.js"; -import { genId } from "@/misc/gen-id.js"; +import { genId, getTimestamp } from "@/misc/gen-id.js"; import { makePaginationQuery } from "../../common/make-pagination-query.js"; import { generateVisibilityQuery } from "../../common/generate-visibility-query.js"; import { generateMutedUserQuery } from "../../common/generate-muted-user-query.js"; @@ -61,10 +61,22 @@ export default define(meta, paramDef, async (ps, user) => { } const limit = ps.limit + (ps.untilId ? 1 : 0) + (ps.sinceId ? 1 : 0); // untilIdに指定したものも含まれるため+1 + let end = "+"; + if (ps.untilDate) { + end = ps.untilDate.toString(); + } else if (ps.untilId) { + end = getTimestamp(ps.untilId).toString(); + } + let start = "-"; + if (ps.sinceDate) { + start = ps.sinceDate.toString(); + } else if (ps.sinceId) { + start = getTimestamp(ps.sinceId).toString(); + } const noteIdsRes = await redisClient.xrevrange( `antennaTimeline:${antenna.id}`, - ps.untilDate ?? "+", - ps.sinceDate ?? "-", + end, + start, "COUNT", limit, ); diff --git a/packages/backend/src/services/add-note-to-antenna.ts b/packages/backend/src/services/add-note-to-antenna.ts index 8d6d3e84d0..499418000d 100644 --- a/packages/backend/src/services/add-note-to-antenna.ts +++ b/packages/backend/src/services/add-note-to-antenna.ts @@ -1,6 +1,6 @@ import type { Antenna } from "@/models/entities/antenna.js"; import type { Note } from "@/models/entities/note.js"; -import { genId } from "@/misc/gen-id.js"; +import { getTimestamp } from "@/misc/gen-id.js"; import { redisClient } from "@/db/redis.js"; import { publishAntennaStream } from "@/services/stream.js"; import type { User } from "@/models/entities/user.js"; @@ -15,7 +15,7 @@ export async function addNoteToAntenna( "MAXLEN", "~", "200", - "*", + `${getTimestamp(note.id)}-*`, "note", note.id, ); From 1a34dee3664d0a44477f2961c26a378bfc9072ce Mon Sep 17 00:00:00 2001 From: Namekuji Date: Sun, 6 Aug 2023 13:45:32 -0400 Subject: [PATCH 4/7] add migration to fix corrupted stream ids --- .../backend/native-utils/migration/src/lib.rs | 2 + .../m20230709_000510_move_antenna_to_cache.rs | 3 +- ...m20230806_170616_fix_antenna_stream_ids.rs | 59 +++++++++++++++++++ 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 packages/backend/native-utils/migration/src/m20230806_170616_fix_antenna_stream_ids.rs diff --git a/packages/backend/native-utils/migration/src/lib.rs b/packages/backend/native-utils/migration/src/lib.rs index 5ad23f1625..dbe2ce1a0c 100644 --- a/packages/backend/native-utils/migration/src/lib.rs +++ b/packages/backend/native-utils/migration/src/lib.rs @@ -3,6 +3,7 @@ pub use sea_orm_migration::prelude::*; mod m20230531_180824_drop_reversi; mod m20230627_185451_index_note_url; mod m20230709_000510_move_antenna_to_cache; +mod m20230806_170616_fix_antenna_stream_ids; pub struct Migrator; @@ -13,6 +14,7 @@ impl MigratorTrait for Migrator { Box::new(m20230531_180824_drop_reversi::Migration), Box::new(m20230627_185451_index_note_url::Migration), Box::new(m20230709_000510_move_antenna_to_cache::Migration), + Box::new(m20230806_170616_fix_antenna_stream_ids::Migration), ] } } diff --git a/packages/backend/native-utils/migration/src/m20230709_000510_move_antenna_to_cache.rs b/packages/backend/native-utils/migration/src/m20230709_000510_move_antenna_to_cache.rs index 046dc45f6c..76ae721769 100644 --- a/packages/backend/native-utils/migration/src/m20230709_000510_move_antenna_to_cache.rs +++ b/packages/backend/native-utils/migration/src/m20230709_000510_move_antenna_to_cache.rs @@ -1,4 +1,3 @@ -use native_utils::util::id; use redis::streams::StreamMaxlen; use sea_orm::Statement; use sea_orm_migration::prelude::*; @@ -81,7 +80,7 @@ impl MigrationTrait for Migration { pipe.xadd_maxlen( format!("{}:antennaTimeline:{}", prefix, v.1), StreamMaxlen::Approx(200), - format!("{}-*", id::get_timestamp(&v.2)), + "*", &[("note", v.2.to_owned())], ) .ignore(); diff --git a/packages/backend/native-utils/migration/src/m20230806_170616_fix_antenna_stream_ids.rs b/packages/backend/native-utils/migration/src/m20230806_170616_fix_antenna_stream_ids.rs new file mode 100644 index 0000000000..d8261b9a25 --- /dev/null +++ b/packages/backend/native-utils/migration/src/m20230806_170616_fix_antenna_stream_ids.rs @@ -0,0 +1,59 @@ +use std::env; + +use native_utils::util::id; +use redis::Commands; +use sea_orm_migration::prelude::*; + +#[derive(DeriveMigrationName)] +pub struct Migration; + +#[async_trait::async_trait] +impl MigrationTrait for Migration { + async fn up(&self, _manager: &SchemaManager) -> Result<(), DbErr> { + // Replace the sample below with your own migration scripts + let cache_url = env::var("CACHE_URL").unwrap(); + let prefix = env::var("CACHE_PREFIX").unwrap(); + + let client = redis::Client::open(cache_url).unwrap(); + let mut redis_conn = client.get_connection().unwrap(); + + let keys: Vec = redis_conn + .keys(format!("{}:antennaTimeline:*", prefix)) + .unwrap(); + let key_len = keys.len(); + + println!( + "Fixing corrupted stream IDs: {} timelines to be fixed", + key_len + ); + + for (i, key) in keys.iter().enumerate() { + let all_elems: Vec>> = redis_conn.xrange_all(key).unwrap(); // Get all post IDs in stream + let stream_ids = all_elems + .iter() + .map(|v| format!("{}-*", id::get_timestamp(&v[1][1]))); // Get correct stream id with timestamp + redis_conn.del::<_, ()>(key).unwrap(); + for (j, v) in stream_ids.enumerate() { + redis_conn + .xadd(key, v, &[("note", &all_elems[j])]) + .unwrap_or(()); + } + + if i % 10 == 0 { + println!( + "Fixing streams [{:.2}%]", + (i as f64 / key_len as f64) * 100_f64 + ); + } + } + + println!("Fixing streams [100.00%]"); + + Ok(()) + } + + async fn down(&self, _manager: &SchemaManager) -> Result<(), DbErr> { + // Replace the sample below with your own migration scripts + Ok(()) + } +} From 10e81de1a62678b72827c93ee52d04509973d899 Mon Sep 17 00:00:00 2001 From: Namekuji Date: Sun, 6 Aug 2023 15:04:14 -0400 Subject: [PATCH 5/7] fix: add original id to the stream --- .../migration/src/m20230806_170616_fix_antenna_stream_ids.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/native-utils/migration/src/m20230806_170616_fix_antenna_stream_ids.rs b/packages/backend/native-utils/migration/src/m20230806_170616_fix_antenna_stream_ids.rs index d8261b9a25..ea23f4319f 100644 --- a/packages/backend/native-utils/migration/src/m20230806_170616_fix_antenna_stream_ids.rs +++ b/packages/backend/native-utils/migration/src/m20230806_170616_fix_antenna_stream_ids.rs @@ -35,7 +35,7 @@ impl MigrationTrait for Migration { redis_conn.del::<_, ()>(key).unwrap(); for (j, v) in stream_ids.enumerate() { redis_conn - .xadd(key, v, &[("note", &all_elems[j])]) + .xadd(key, v, &[("note", &all_elems[j][1][1])]) .unwrap_or(()); } From 2448b2ce99d2f921e58e960fd75aabab62fb80c5 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sun, 6 Aug 2023 12:30:00 -0700 Subject: [PATCH 6/7] fix: :bug: double-slash in proxy url --- packages/backend/src/server/proxy/proxy-media.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/server/proxy/proxy-media.ts b/packages/backend/src/server/proxy/proxy-media.ts index b3bb031244..ed607daa0e 100644 --- a/packages/backend/src/server/proxy/proxy-media.ts +++ b/packages/backend/src/server/proxy/proxy-media.ts @@ -14,13 +14,15 @@ import { serverLogger } from "../index.js"; import { isMimeImage } from "@/misc/is-mime-image.js"; export async function proxyMedia(ctx: Koa.Context) { - const url = "url" in ctx.query ? ctx.query.url : `https://${ctx.params.url}`; + let url = "url" in ctx.query ? ctx.query.url : `https://${ctx.params.url}`; if (typeof url !== "string") { ctx.status = 400; return; } + url = url.replace("//", "/"); + const { hostname } = new URL(url); let resolvedIps; try { From 3ffee23a3e3be1ce1c5e94656fe2d582ac8d5002 Mon Sep 17 00:00:00 2001 From: naskya Date: Mon, 7 Aug 2023 22:08:51 +0000 Subject: [PATCH 7/7] delete 10 posts at once on account deletion --- packages/backend/src/queue/processors/db/delete-account.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/queue/processors/db/delete-account.ts b/packages/backend/src/queue/processors/db/delete-account.ts index 1cd7642ba5..adb93484bd 100644 --- a/packages/backend/src/queue/processors/db/delete-account.ts +++ b/packages/backend/src/queue/processors/db/delete-account.ts @@ -29,7 +29,7 @@ export async function deleteAccount( userId: user.id, ...(cursor ? { id: MoreThan(cursor) } : {}), }, - take: 100, + take: 10, order: { id: 1, },