diff --git a/docs/changelog.md b/docs/changelog.md index 3413ee6aa4..3beafdcf3f 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -7,6 +7,7 @@ Critical security updates are indicated by the :warning: icon. ## Unreleased +- Fix bugs - Mastodon API implementation was ported from Iceshrimp, with added Firefish extensions including push notifications, post languages, schedule post support, and more. (#10880) ### Acknowledgement diff --git a/docs/install.md b/docs/install.md index c13594e3ac..6a2079fd73 100644 --- a/docs/install.md +++ b/docs/install.md @@ -374,7 +374,7 @@ cd ~/firefish ## Rotate logs -If the server runs long, the size of log files increases, filling up disk space. To prevent this, you should set up a log rotation (removing old logs automatically). +As the server runs longer and longer, the size of the log files increases, filling up the disk space. To prevent this, you should set up a log rotation (removing old logs automatically). You can edit the `SystemMaxUse` value in the `[journal]` section of `/etc/systemd/journald.conf` to do it: @@ -402,13 +402,13 @@ pgroonga.log_level = error You can check the `postgresql.conf` location by this command: ```sh -psql --user postgres --command 'SHOW config_file' +sudo --user=postgres psql --command='SHOW config_file' ``` The PGroonga log file (`pgroonga.log`) is located under this directory: ```sh -psql --user postgres --command 'SHOW data_directory' +sudo --user=postgres psql --command='SHOW data_directory' ``` ## Tune database configuration @@ -431,9 +431,17 @@ Since this is not a dedicated database server, be sure to leave some memory spac Once you have entered the appropriate values for your environment, click the "Generate" button to generate a configuration and replace the values in `postgresql.conf` with the suggested values. +After that, you need to restart the PostgreSQL service. + +```sh +sudo systemctl stop firefish +sudo systemctl restart postgresql +sudo systemctl start firefish +``` + ## VACUUM your database -If the database runs long, "garbage" can degrade its performance or cause problems. To prevent this, you should execute the following commands regularly. +If the database runs long, accumulated "garbage" can degrade its performance or cause problems. To prevent this, you should `VACUUM` your database regularly. ```sh sudo systemctl stop firefish diff --git a/docs/notice-for-admins.md b/docs/notice-for-admins.md index 35fd0731fb..83bdf39d8b 100644 --- a/docs/notice-for-admins.md +++ b/docs/notice-for-admins.md @@ -8,7 +8,9 @@ Please take a look at #10947. ## Unreleased -This is not related to the recent changes, but we have added a new section called "[Maintain the server](https://firefish.dev/firefish/firefish/-/blob/develop/docs/install.md#maintain-the-server)" in the installation guide. We suggest that you take a look at it. +### For all users + +This is not related to the recent changes, but we have added a new section called "[Maintain the server](https://firefish.dev/firefish/firefish/-/blob/develop/docs/install.md#maintain-the-server)" in the installation guide. We suggest that you take a look at it. (and we welcome your docs contributions!) ### For systemd/pm2 users diff --git a/locales/ru-RU.yml b/locales/ru-RU.yml index 551db955d4..e360b5ae27 100644 --- a/locales/ru-RU.yml +++ b/locales/ru-RU.yml @@ -2137,3 +2137,15 @@ replies: Ответы quotes: Цитаты clickToShowPatterns: Нажмите, чтобы показать модуль шаблонов renotes: Репосты +markLocalFilesNsfwByDefaultDescription: Независимо от данной настройки, пользователи + могут самостоятельно удалять метку NSFW. Не применяется на существующие файлы. +toEdit: Редактировать +attachedToNotes: Посты с этим файлом +showAttachedNotes: Показывать посты с этим файлом +strongPassword: Хороший пароль +toReply: Ответить +toPost: Выложить +sentFollowRequests: Отправленные запросы на подписку +toQuote: Цитировать +cannotEditVisibility: Вы не можете изменить видимость +noSentFollowRequests: Вы не отправляли никаких запросов на подписку diff --git a/packages/backend/src/misc/process-masto-notes.ts b/packages/backend/src/misc/process-masto-notes.ts index 03968944ec..01c438f97d 100644 --- a/packages/backend/src/misc/process-masto-notes.ts +++ b/packages/backend/src/misc/process-masto-notes.ts @@ -53,7 +53,11 @@ function processMastoFile(fn: string, path: string, dir: string, uid: string) { continue; } for (const attachment of note.object.attachment) { - const url = attachment.url.replaceAll("..", ""); + // The url in some Mastodon import files do not start with /media_attachments/. + // If this is not handled properly, these users not be able to import images in their posts. + const url = attachment.url + .replaceAll("..", "") + .replaceAll(/.*\/media_attachments\//g, "/media_attachments/"); if (url.indexOf("\0") !== -1) { logger.error(`Found Poison Null Bytes Attack: ${url}`); reject(); diff --git a/packages/backend/src/queue/processors/db/import-firefish-post.ts b/packages/backend/src/queue/processors/db/import-firefish-post.ts index 88356c2458..34a27c4c7a 100644 --- a/packages/backend/src/queue/processors/db/import-firefish-post.ts +++ b/packages/backend/src/queue/processors/db/import-firefish-post.ts @@ -59,18 +59,27 @@ export async function importCkPost( userId: user.id, }); - // FIXME: What is this condition? - if (note != null && (note.fileIds?.length || 0) < files.length) { + // If an import is completely successful at once, the order should not be out of order. + // If it takes multiple imports to complete, the order is not guaranteed to be consistent. + if (note != null && files.length > 0) { + const addFiles: DriveFile[] = []; + for (const file of files) { + if (!note.fileIds.includes(file.id)) { + addFiles.push(file); + } + } + const update: Partial = {}; - update.fileIds = files.map((x) => x.id); + update.fileIds = addFiles.map((x) => x.id); if (update.fileIds != null) { - await NoteFiles.delete({ noteId: note.id }); await NoteFiles.insert( update.fileIds.map((fileId) => ({ noteId: note?.id, fileId })), ); } + update.fileIds = note.fileIds.concat(update.fileIds); + await Notes.update(note.id, update); await NoteEdits.insert({ id: genId(), diff --git a/packages/backend/src/queue/processors/db/import-masto-post.ts b/packages/backend/src/queue/processors/db/import-masto-post.ts index 6a39290741..532c288dba 100644 --- a/packages/backend/src/queue/processors/db/import-masto-post.ts +++ b/packages/backend/src/queue/processors/db/import-masto-post.ts @@ -85,18 +85,27 @@ export async function importMastoPost( userId: user.id, }); - // FIXME: What is this condition? - if (note != null && (note.fileIds?.length || 0) < files.length) { + // If an import is completely successful at once, the order should not be out of order. + // If it takes multiple imports to complete, the order is not guaranteed to be consistent. + if (note != null && files.length > 0) { + const addFiles: DriveFile[] = []; + for (const file of files) { + if (!note.fileIds.includes(file.id)) { + addFiles.push(file); + } + } + const update: Partial = {}; - update.fileIds = files.map((x) => x.id); + update.fileIds = addFiles.map((x) => x.id); if (update.fileIds != null) { - await NoteFiles.delete({ noteId: note.id }); await NoteFiles.insert( update.fileIds.map((fileId) => ({ noteId: note?.id, fileId })), ); } + update.fileIds = note.fileIds.concat(update.fileIds); + await Notes.update(note.id, update); await NoteEdits.insert({ id: genId(), diff --git a/packages/client/src/init.ts b/packages/client/src/init.ts index 9ae1db8496..16750c26e0 100644 --- a/packages/client/src/init.ts +++ b/packages/client/src/init.ts @@ -69,6 +69,8 @@ function checkForSplash() { (async () => { await initializeInstanceCache(); + const instance = getInstanceInfo(); + console.info(`Firefish v${version}`); if (_DEV_) { @@ -178,7 +180,7 @@ function checkForSplash() { } // #endregion - localStorage.setItem("v", getInstanceInfo().version); + localStorage.setItem("v", instance.version); // Init service worker initializeSw(); @@ -240,26 +242,20 @@ function checkForSplash() { // テーマリビルドするため localStorage.removeItem("theme"); - try { - // 変なバージョン文字列来るとcompareVersionsでエラーになるため - // If a strange version string comes, an error will occur in compareVersions. - if ( - lastVersion != null && - lastVersion < version && - defaultStore.state.showUpdates - ) { - // ログインしてる場合だけ - if (me) { - popup( - defineAsyncComponent(() => import("@/components/MkUpdated.vue")), - {}, - {}, - "closed", - ); - } + if ( + lastVersion != null && + lastVersion < version && + defaultStore.state.showUpdates + ) { + // ログインしてる場合だけ + if (me) { + popup( + defineAsyncComponent(() => import("@/components/MkUpdated.vue")), + {}, + {}, + "closed", + ); } - } catch (err) { - console.error(err); } } @@ -338,7 +334,7 @@ function checkForSplash() { }; // #endregion - const { defaultLightTheme, defaultDarkTheme } = getInstanceInfo(); + const { defaultLightTheme, defaultDarkTheme } = instance; if (defaultStore.state.themeInitial) { if (defaultLightTheme != null)