Merge branch 'develop' into iceshrimp_mastodon

This commit is contained in:
naskya 2024-07-04 02:41:46 +09:00
commit 1778952af8
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
8 changed files with 76 additions and 35 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -2137,3 +2137,15 @@ replies: Ответы
quotes: Цитаты
clickToShowPatterns: Нажмите, чтобы показать модуль шаблонов
renotes: Репосты
markLocalFilesNsfwByDefaultDescription: Независимо от данной настройки, пользователи
могут самостоятельно удалять метку NSFW. Не применяется на существующие файлы.
toEdit: Редактировать
attachedToNotes: Посты с этим файлом
showAttachedNotes: Показывать посты с этим файлом
strongPassword: Хороший пароль
toReply: Ответить
toPost: Выложить
sentFollowRequests: Отправленные запросы на подписку
toQuote: Цитировать
cannotEditVisibility: Вы не можете изменить видимость
noSentFollowRequests: Вы не отправляли никаких запросов на подписку

View file

@ -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();

View file

@ -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<Note> = {};
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(),

View file

@ -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<Note> = {};
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(),

View file

@ -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)