Merge branch 'develop' into iceshrimp_mastodon

This commit is contained in:
naskya 2024-07-05 16:41:23 +09:00
commit cdb890843a
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
26 changed files with 230 additions and 349 deletions

14
Cargo.lock generated
View file

@ -1808,14 +1808,14 @@ dependencies = [
[[package]]
name = "napi"
version = "2.16.8"
version = "3.0.0-alpha.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1bd081bbaef43600fd2c5dd4c525b8ecea7dfdacf40ebc674e87851dce6559e"
checksum = "53112614847625adf534655b35b7adcc66c4f6ca407284cca73fd5bb0cf8cde5"
dependencies = [
"bitflags 2.6.0",
"chrono",
"ctor",
"napi-derive",
"napi-build",
"napi-sys",
"once_cell",
"serde",
@ -1831,9 +1831,9 @@ checksum = "e1c0f5d67ee408a4685b61f5ab7e58605c8ae3f2b4189f0127d804ff13d5560a"
[[package]]
name = "napi-derive"
version = "2.16.8"
version = "3.0.0-alpha.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eafd2b920906ea5b1f5f1f9d1eff9cc74e4ff8124dca41b501c1413079589187"
checksum = "823fb2987af2446a2b4055604a920f2c1f1a028743c72adc8872d92da7e30d2b"
dependencies = [
"cfg-if",
"convert_case",
@ -1845,9 +1845,9 @@ dependencies = [
[[package]]
name = "napi-derive-backend"
version = "1.0.70"
version = "2.0.0-alpha.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b370b784440c65eb9001d839012eb912ee43e3a2d0361e2c30c13052372c39fe"
checksum = "abd42151b3c26b5cdde9cf9a8fc5f7240de0919f234e14c6f54e3571d56e4dab"
dependencies = [
"convert_case",
"once_cell",

View file

@ -6,8 +6,8 @@ resolver = "2"
macros = { path = "packages/macro-rs/macros" }
macros-impl = { path = "packages/macro-rs/macros-impl" }
napi = "2.16.8"
napi-derive = "2.16.8"
napi = "3.0.0-alpha.3"
napi-derive = "3.0.0-alpha.3"
napi-build = "2.1.3"
argon2 = { version = "0.5.3", default-features = false }

View file

@ -413,7 +413,7 @@ sudo --user=postgres psql --command='SHOW data_directory'
## Tune database configuration
The default PostgreSQL configuration not suitable for running a Firefish server. Thus, it is highly recommended that you use [PGTune](https://pgtune.leopard.in.ua/) to tweak the configuration.
The default PostgreSQL configuration is not suitable for running a Firefish server. So, it is highly recommended that you use [PGTune](https://pgtune.leopard.in.ua/) to tweak the configuration.
Here is an example set of parameters you can provide to PGTune:
@ -427,7 +427,7 @@ Here is an example set of parameters you can provide to PGTune:
| Number of connections | 200 |
| Data storage | SSD storage |
Since this is not a dedicated database server, be sure to leave some memory space for other software such as Firefish and Redis.
Since a Firefish server is not a dedicated database server, be sure to leave some memory space for other software such as Firefish, Redis, and reverse proxy.
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.

View file

@ -97,14 +97,12 @@ export interface Antenna {
excludeKeywords: Array<string>
}
export enum AntennaSrc {
All = 'all',
Group = 'group',
Home = 'home',
Instances = 'instances',
List = 'list',
Users = 'users'
}
export type AntennaSrc = 'all'|
'group'|
'home'|
'instances'|
'list'|
'users';
export interface App {
id: string
@ -166,17 +164,13 @@ export interface ChannelNotePining {
noteId: string
}
export enum ChatEvent {
Message = 0,
Read = 1,
Deleted = 2,
Typing = 3
}
export type ChatEvent = 'message'|
'read'|
'deleted'|
'typing';
export enum ChatIndexEvent {
Message = 0,
Read = 1
}
export type ChatIndexEvent = 'message'|
'read';
/**
* Returns whether `note` should be hard-muted.
@ -330,16 +324,12 @@ export interface DriveFile {
usageHint: DriveFileUsageHint | null
}
export enum DriveFileEvent {
Create = 0,
Update = 1,
Delete = 2
}
export type DriveFileEvent = 'create'|
'update'|
'delete';
export enum DriveFileUsageHint {
UserAvatar = 'userAvatar',
UserBanner = 'userBanner'
}
export type DriveFileUsageHint = 'userAvatar'|
'userBanner';
export interface DriveFolder {
id: string
@ -349,11 +339,9 @@ export interface DriveFolder {
parentId: string | null
}
export enum DriveFolderEvent {
Create = 0,
Update = 1,
Delete = 2
}
export type DriveFolderEvent = 'create'|
'update'|
'delete';
export interface EmailConfig {
managed?: boolean
@ -511,7 +499,7 @@ export interface ImageSize {
}
/** The third party sites this server can retrieve messages from for combined display with regular traffic. */
export enum Inbound {
export declare enum Inbound {
Atom1 = 0,
Gnusocial = 1,
Imap = 2,
@ -774,12 +762,10 @@ export interface MutedNote {
reason: MutedNoteReason
}
export enum MutedNoteReason {
Manual = 'manual',
Other = 'other',
Spam = 'spam',
Word = 'word'
}
export type MutedNoteReason = 'manual'|
'other'|
'spam'|
'word';
export interface Muting {
id: string
@ -901,13 +887,11 @@ export interface NoteUnread {
noteChannelId: string | null
}
export enum NoteVisibility {
Followers = 'followers',
Hidden = 'hidden',
Home = 'home',
Public = 'public',
Specified = 'specified'
}
export type NoteVisibility = 'followers'|
'hidden'|
'home'|
'public'|
'specified';
export interface NoteWatching {
id: string
@ -935,20 +919,18 @@ export interface Notification {
appAccessTokenId: string | null
}
export enum NotificationType {
App = 'app',
Follow = 'follow',
FollowRequestAccepted = 'followRequestAccepted',
GroupInvited = 'groupInvited',
Mention = 'mention',
PollEnded = 'pollEnded',
PollVote = 'pollVote',
Quote = 'quote',
Reaction = 'reaction',
ReceiveFollowRequest = 'receiveFollowRequest',
Renote = 'renote',
Reply = 'reply'
}
export type NotificationType = 'app'|
'follow'|
'followRequestAccepted'|
'groupInvited'|
'mention'|
'pollEnded'|
'pollVote'|
'quote'|
'reaction'|
'receiveFollowRequest'|
'renote'|
'reply';
/**
* Converts the given text into the cat language.
@ -987,7 +969,7 @@ export interface ObjectStorageConfig {
}
/** The third party sites this server can publish messages to on the behalf of a user. */
export enum Outbound {
export declare enum Outbound {
Atom1 = 0,
Blogger = 1,
Buddycloud = 2,
@ -1058,11 +1040,9 @@ export interface PageLike {
pageId: string
}
export enum PageVisibility {
Followers = 'followers',
Public = 'public',
Specified = 'specified'
}
export type PageVisibility = 'followers'|
'public'|
'specified';
export interface PartialNoteToCheckWordMute {
fileIds: Array<string>
@ -1090,12 +1070,10 @@ export interface Poll {
userHost: string | null
}
export enum PollNoteVisibility {
Followers = 'followers',
Home = 'home',
Public = 'public',
Specified = 'specified'
}
export type PollNoteVisibility = 'followers'|
'home'|
'public'|
'specified';
export interface PollVote {
id: string
@ -1118,7 +1096,7 @@ export interface PromoRead {
noteId: string
}
export enum Protocol {
export declare enum Protocol {
Activitypub = 0,
Buddycloud = 1,
Dfrn = 2,
@ -1161,15 +1139,13 @@ export interface PugArgs {
privateMode: boolean | null
}
export enum PushNotificationKind {
Generic = 0,
Chat = 1,
ReadAllChats = 2,
ReadAllChatsInTheRoom = 3,
ReadNotifications = 4,
ReadAllNotifications = 5,
Mastodon = 6
}
export type PushNotificationKind = 'generic'|
'chat'|
'readAllChats'|
'readAllChatsInTheRoom'|
'readNotifications'|
'readAllNotifications'|
'mastodon';
export enum PushSubscriptionType {
AdminReport = 'adminReport',
@ -1218,11 +1194,9 @@ export interface Relay {
status: RelayStatus
}
export enum RelayStatus {
Accepted = 'accepted',
Rejected = 'rejected',
Requesting = 'requesting'
}
export type RelayStatus = 'accepted'|
'rejected'|
'requesting';
/** Delete all entries in the [attestation_challenge] table created at more than 5 minutes ago */
export declare function removeOldAttestationChallenges(): Promise<void>
@ -1438,12 +1412,10 @@ export const USER_ACTIVE_THRESHOLD: number
export const USER_ONLINE_THRESHOLD: number
export enum UserEmojiModPerm {
Add = 'add',
Full = 'full',
Mod = 'mod',
Unauthorized = 'unauthorized'
}
export type UserEmojiModPerm = 'add'|
'full'|
'mod'|
'unauthorized';
export interface UserGroup {
id: string
@ -1556,26 +1528,22 @@ export interface UserProfile {
lang: string | null
}
export enum UserProfileFfvisibility {
Followers = 'followers',
Private = 'private',
Public = 'public'
}
export type UserProfileFfvisibility = 'followers'|
'private'|
'public';
export enum UserProfileMutingNotificationTypes {
App = 'app',
Follow = 'follow',
FollowRequestAccepted = 'followRequestAccepted',
GroupInvited = 'groupInvited',
Mention = 'mention',
PollEnded = 'pollEnded',
PollVote = 'pollVote',
Quote = 'quote',
Reaction = 'reaction',
ReceiveFollowRequest = 'receiveFollowRequest',
Renote = 'renote',
Reply = 'reply'
}
export type UserProfileMutingNotificationTypes = 'app'|
'follow'|
'followRequestAccepted'|
'groupInvited'|
'mention'|
'pollEnded'|
'pollVote'|
'quote'|
'reaction'|
'receiveFollowRequest'|
'renote'|
'reply';
export interface UserPublickey {
userId: string

View file

@ -7,7 +7,7 @@
"binaryName": "backend-rs"
},
"devDependencies": {
"@napi-rs/cli": "3.0.0-alpha.55"
"@napi-rs/cli": "3.0.0-alpha.56"
},
"scripts": {
"build": "napi build --features napi --no-const-enum --platform --release --output-dir ./built/",

View file

@ -42,7 +42,7 @@ fn get_client() -> Result<IsahcWebPushClient, Error> {
.cloned()?)
}
#[macros::export]
#[macros::export(string_enum = "camelCase")]
pub enum PushNotificationKind {
Generic,
Chat,

View file

@ -54,7 +54,7 @@ pub enum Stream {
},
}
#[macros::export]
#[macros::export(string_enum = "camelCase")]
pub enum ChatEvent {
Message,
Read,

View file

@ -1,6 +1,6 @@
use crate::service::stream::{publish_to_stream, Error, Stream};
#[macros::export]
#[macros::export(string_enum = "camelCase")]
pub enum ChatIndexEvent {
Message,
Read,

View file

@ -1,13 +1,13 @@
use crate::service::stream::{publish_to_stream, Error, Stream};
#[macros::export]
#[macros::export(string_enum = "camelCase")]
pub enum DriveFileEvent {
Create,
Update,
Delete,
}
#[macros::export]
#[macros::export(string_enum = "camelCase")]
pub enum DriveFolderEvent {
Create,
Update,

View file

@ -16,8 +16,10 @@ export const AntennaRepository = db.getRepository(Antenna).extend({
id: antenna.id,
createdAt: antenna.createdAt.toISOString(),
name: antenna.name,
keywords: antenna.keywords.map((row) => row.split(" ")),
excludeKeywords: antenna.excludeKeywords.map((row) => row.split(" ")),
keywords: antenna.keywords.map((row: string) => row.split(" ")),
excludeKeywords: antenna.excludeKeywords.map((row: string) =>
row.split(" "),
),
src: antenna.src,
userListId: antenna.userListId,
userGroupId: userGroupJoining ? userGroupJoining.userGroupId : null,

View file

@ -4,9 +4,6 @@ import {
publishToGroupChatStream,
publishToChatIndexStream,
sendPushNotification,
ChatEvent,
ChatIndexEvent,
PushNotificationKind,
} from "backend-rs";
import type { User, IRemoteUser } from "@/models/entities/user.js";
import type { MessagingMessage } from "@/models/entities/messaging-message.js";
@ -58,14 +55,14 @@ export async function readUserMessagingMessage(
// Publish event
await Promise.all([
publishToChatStream(otherpartyId, userId, ChatEvent.Read, messageIds),
publishToChatIndexStream(userId, ChatIndexEvent.Read, messageIds),
publishToChatStream(otherpartyId, userId, "read", messageIds),
publishToChatIndexStream(userId, "read", messageIds),
]);
if (!(await Users.getHasUnreadMessagingMessage(userId))) {
// 全ての(いままで未読だった)自分宛てのメッセージを(これで)読みましたよというイベントを発行
publishMainStream(userId, "readAllMessagingMessages");
await sendPushNotification(userId, PushNotificationKind.ReadAllChats, {});
await sendPushNotification(userId, "readAllChats", {});
} else {
// そのユーザーとのメッセージで未読がなければイベント発行
const hasUnread = await MessagingMessages.existsBy({
@ -75,13 +72,9 @@ export async function readUserMessagingMessage(
});
if (!hasUnread) {
await sendPushNotification(
userId,
PushNotificationKind.ReadAllChatsInTheRoom,
{
userId: otherpartyId,
},
);
await sendPushNotification(userId, "readAllChatsInTheRoom", {
userId: otherpartyId,
});
}
}
}
@ -133,17 +126,17 @@ export async function readGroupMessagingMessage(
// Publish events
await Promise.all([
publishToGroupChatStream(groupId, ChatEvent.Read, {
publishToGroupChatStream(groupId, "read", {
ids: reads,
userId,
}),
publishToChatIndexStream(userId, ChatIndexEvent.Read, reads),
publishToChatIndexStream(userId, "read", reads),
]);
if (!(await Users.getHasUnreadMessagingMessage(userId))) {
// 全ての(いままで未読だった)自分宛てのメッセージを(これで)読みましたよというイベントを発行
publishMainStream(userId, "readAllMessagingMessages");
await sendPushNotification(userId, PushNotificationKind.ReadAllChats, {});
await sendPushNotification(userId, "readAllChats", {});
} else {
// そのグループにおいて未読がなければイベント発行
const hasUnread = await MessagingMessages.createQueryBuilder("message")
@ -157,13 +150,9 @@ export async function readGroupMessagingMessage(
.then((x) => x != null);
if (!hasUnread) {
await sendPushNotification(
userId,
PushNotificationKind.ReadAllChatsInTheRoom,
{
groupId,
},
);
await sendPushNotification(userId, "readAllChatsInTheRoom", {
groupId,
});
}
}
}

View file

@ -1,6 +1,6 @@
import { In } from "typeorm";
import { publishMainStream } from "@/services/stream.js";
import { sendPushNotification, PushNotificationKind } from "backend-rs";
import { sendPushNotification } from "backend-rs";
import type { User } from "@/models/entities/user.js";
import type { Notification } from "@/models/entities/notification.js";
import { Notifications, Users } from "@/models/index.js";
@ -47,11 +47,7 @@ export async function readNotificationByQuery(
function postReadAllNotifications(userId: User["id"]) {
publishMainStream(userId, "readAllNotifications");
return sendPushNotification(
userId,
PushNotificationKind.ReadAllNotifications,
{},
);
return sendPushNotification(userId, "readAllNotifications", {});
}
function postReadNotifications(
@ -59,7 +55,7 @@ function postReadNotifications(
notificationIds: Notification["id"][],
) {
publishMainStream(userId, "readNotifications", notificationIds);
return sendPushNotification(userId, PushNotificationKind.ReadNotifications, {
return sendPushNotification(userId, "readNotifications", {
notificationIds,
});
}

View file

@ -1,5 +1,5 @@
import { deleteFile } from "@/services/drive/delete-file.js";
import { publishToDriveFileStream, DriveFileEvent } from "backend-rs";
import { publishToDriveFileStream } from "backend-rs";
import define from "@/server/api/define.js";
import { ApiError } from "@/server/api/error.js";
import { DriveFiles } from "@/models/index.js";
@ -51,5 +51,5 @@ export default define(meta, paramDef, async (ps, user) => {
await deleteFile(file);
// Publish fileDeleted event
publishToDriveFileStream(user.id, DriveFileEvent.Delete, file.id);
publishToDriveFileStream(user.id, "delete", file.id);
});

View file

@ -1,4 +1,4 @@
import { publishToDriveFileStream, DriveFileEvent } from "backend-rs";
import { publishToDriveFileStream } from "backend-rs";
import { DriveFiles, DriveFolders } from "@/models/index.js";
import { config } from "@/config.js";
import define from "@/server/api/define.js";
@ -111,7 +111,7 @@ export default define(meta, paramDef, async (ps, user) => {
const fileObj = await DriveFiles.pack(file, { self: true });
// Publish fileUpdated event
publishToDriveFileStream(user.id, DriveFileEvent.Update, toRustObject(file));
publishToDriveFileStream(user.id, "update", toRustObject(file));
return fileObj;
});

View file

@ -1,4 +1,4 @@
import { publishToDriveFolderStream, DriveFolderEvent } from "backend-rs";
import { publishToDriveFolderStream } from "backend-rs";
import define from "@/server/api/define.js";
import { ApiError } from "@/server/api/error.js";
import { DriveFolders } from "@/models/index.js";
@ -65,11 +65,7 @@ export default define(meta, paramDef, async (ps, user) => {
const folderObj = await DriveFolders.pack(folder);
// Publish folderCreated event
publishToDriveFolderStream(
user.id,
DriveFolderEvent.Create,
toRustObject(folder),
);
publishToDriveFolderStream(user.id, "create", toRustObject(folder));
return folderObj;
});

View file

@ -1,5 +1,5 @@
import define from "@/server/api/define.js";
import { publishToDriveFolderStream, DriveFolderEvent } from "backend-rs";
import { publishToDriveFolderStream } from "backend-rs";
import { ApiError } from "@/server/api/error.js";
import { DriveFolders, DriveFiles } from "@/models/index.js";
@ -56,5 +56,5 @@ export default define(meta, paramDef, async (ps, user) => {
await DriveFolders.delete(folder.id);
// Publish folderCreated event
publishToDriveFolderStream(user.id, DriveFolderEvent.Delete, folder.id);
publishToDriveFolderStream(user.id, "delete", folder.id);
});

View file

@ -1,4 +1,4 @@
import { publishToDriveFolderStream, DriveFolderEvent } from "backend-rs";
import { publishToDriveFolderStream } from "backend-rs";
import define from "@/server/api/define.js";
import { ApiError } from "@/server/api/error.js";
import { DriveFolders } from "@/models/index.js";
@ -85,10 +85,10 @@ export default define(meta, paramDef, async (ps, user) => {
id: folderId,
});
if (folder2!.id === folder!.id) {
if (folder2?.id === folder.id) {
return true;
} else if (folder2!.parentId) {
return await checkCircle(folder2!.parentId);
} else if (folder2?.parentId) {
return await checkCircle(folder2?.parentId);
} else {
return false;
}
@ -113,11 +113,7 @@ export default define(meta, paramDef, async (ps, user) => {
const folderObj = await DriveFolders.pack(folder);
// Publish folderUpdated event
publishToDriveFolderStream(
user.id,
DriveFolderEvent.Update,
toRustObject(folder),
);
publishToDriveFolderStream(user.id, "update", toRustObject(folder));
return folderObj;
});

View file

@ -1,5 +1,5 @@
import { publishMainStream } from "@/services/stream.js";
import { sendPushNotification, PushNotificationKind } from "backend-rs";
import { sendPushNotification } from "backend-rs";
import { Notifications } from "@/models/index.js";
import define from "@/server/api/define.js";
@ -31,9 +31,5 @@ export default define(meta, paramDef, async (_, user) => {
// 全ての通知を読みましたよというイベントを発行
publishMainStream(user.id, "readAllNotifications");
await sendPushNotification(
user.id,
PushNotificationKind.ReadAllNotifications,
{},
);
await sendPushNotification(user.id, "readAllNotifications", {});
});

View file

@ -18,7 +18,6 @@ import {
publishToChannelStream,
publishToChatStream,
publishToGroupChatStream,
ChatEvent,
} from "backend-rs";
import type { UserGroup } from "@/models/entities/user-group.js";
import type { Packed } from "@/misc/schema.js";
@ -378,15 +377,11 @@ export default class Connection {
await publishToChatStream(
param.partner,
this.user.id,
ChatEvent.Typing,
"typing",
this.user.id,
);
} else if (param.group != null) {
await publishToGroupChatStream(
param.group,
ChatEvent.Typing,
this.user.id,
);
await publishToGroupChatStream(param.group, "typing", this.user.id);
}
}
}

View file

@ -7,12 +7,7 @@ import {
Users,
Followings,
} from "@/models/index.js";
import {
genIdAt,
isSilencedServer,
sendPushNotification,
PushNotificationKind,
} from "backend-rs";
import { genIdAt, isSilencedServer, sendPushNotification } from "backend-rs";
import type { User } from "@/models/entities/user.js";
import type { Notification } from "@/models/entities/notification.js";
import { sendEmailNotification } from "./send-email-notification.js";
@ -89,17 +84,13 @@ export async function createNotification(
if (fresh == null) return; // 既に削除されているかもしれない
// We execute this before, because the server side "read" check doesnt work well with push notifications, the app and service worker will decide themself
// when it is best to show push notifications
await sendPushNotification(
notifieeId,
PushNotificationKind.Generic,
packed,
);
await sendPushNotification(notifieeId, "generic", packed);
const userProfileLang =
(await UserProfiles.findOneBy({ userId: notifieeId }))?.lang ?? undefined;
await sendPushNotification(
notifieeId,
PushNotificationKind.Mastodon,
"mastodon",
await NotificationConverter.encodePushNotificationPayloadForRust(
packed,
userProfileLang,

View file

@ -7,7 +7,6 @@ import sharp from "sharp";
import { IsNull } from "typeorm";
import { publishMainStream } from "@/services/stream.js";
import {
DriveFileEvent,
FILE_TYPE_BROWSERSAFE,
fetchMeta,
genId,
@ -669,11 +668,7 @@ export async function addFile({
DriveFiles.pack(file, { self: true }).then((packedFile) => {
// Publish driveFileCreated event
publishMainStream(user.id, "driveFileCreated", packedFile);
publishToDriveFileStream(
user.id,
DriveFileEvent.Create,
toRustObject(file),
);
publishToDriveFileStream(user.id, "create", toRustObject(file));
});
}

View file

@ -14,9 +14,6 @@ import {
publishToGroupChatStream,
publishToChatIndexStream,
toPuny,
ChatEvent,
ChatIndexEvent,
PushNotificationKind,
} from "backend-rs";
import type { MessagingMessage } from "@/models/entities/messaging-message.js";
import { publishMainStream } from "@/services/stream.js";
@ -61,14 +58,10 @@ export async function createMessage(
publishToChatStream(
message.userId,
recipientUser.id,
ChatEvent.Message,
messageObj,
),
publishToChatIndexStream(
message.userId,
ChatIndexEvent.Message,
"message",
messageObj,
),
publishToChatIndexStream(message.userId, "message", messageObj),
]);
publishMainStream(message.userId, "messagingMessage", messageObj);
}
@ -79,35 +72,23 @@ export async function createMessage(
publishToChatStream(
recipientUser.id,
message.userId,
ChatEvent.Message,
messageObj,
),
publishToChatIndexStream(
recipientUser.id,
ChatIndexEvent.Message,
"message",
messageObj,
),
publishToChatIndexStream(recipientUser.id, "message", messageObj),
]);
publishMainStream(recipientUser.id, "messagingMessage", messageObj);
}
} else if (recipientGroup != null) {
// group's stream
await publishToGroupChatStream(
recipientGroup.id,
ChatEvent.Message,
messageObj,
);
await publishToGroupChatStream(recipientGroup.id, "message", messageObj);
// member's stream
const joinings = await UserGroupJoinings.findBy({
userGroupId: recipientGroup.id,
});
for await (const joining of joinings) {
await publishToChatIndexStream(
joining.userId,
ChatIndexEvent.Message,
messageObj,
);
await publishToChatIndexStream(joining.userId, "message", messageObj);
publishMainStream(joining.userId, "messagingMessage", messageObj);
}
}
@ -128,11 +109,7 @@ export async function createMessage(
//#endregion
publishMainStream(recipientUser.id, "unreadMessagingMessage", messageObj);
await sendPushNotification(
recipientUser.id,
PushNotificationKind.Chat,
messageObj,
);
await sendPushNotification(recipientUser.id, "chat", messageObj);
} else if (recipientGroup) {
const joinings = await UserGroupJoinings.findBy({
userGroupId: recipientGroup.id,
@ -141,11 +118,7 @@ export async function createMessage(
for await (const joining of joinings) {
if (freshMessage.reads.includes(joining.userId)) return; // 既読
publishMainStream(joining.userId, "unreadMessagingMessage", messageObj);
await sendPushNotification(
joining.userId,
PushNotificationKind.Chat,
messageObj,
);
await sendPushNotification(joining.userId, "chat", messageObj);
}
}
}, 2000);

View file

@ -1,11 +1,7 @@
import { config } from "@/config.js";
import { MessagingMessages, Users } from "@/models/index.js";
import type { MessagingMessage } from "@/models/entities/messaging-message.js";
import {
publishToChatStream,
publishToGroupChatStream,
ChatEvent,
} from "backend-rs";
import { publishToChatStream, publishToGroupChatStream } from "backend-rs";
import { renderActivity } from "@/remote/activitypub/renderer/index.js";
import renderDelete from "@/remote/activitypub/renderer/delete.js";
import renderTombstone from "@/remote/activitypub/renderer/tombstone.js";
@ -27,14 +23,14 @@ async function postDeleteMessage(message: MessagingMessage) {
await publishToChatStream(
message.userId,
message.recipientId,
ChatEvent.Deleted,
"deleted",
message.id,
);
if (Users.isLocalUser(recipient))
await publishToChatStream(
message.recipientId,
message.userId,
ChatEvent.Deleted,
"deleted",
message.id,
);
@ -48,10 +44,6 @@ async function postDeleteMessage(message: MessagingMessage) {
deliver(user, activity, recipient.inbox);
}
} else if (message.groupId != null) {
await publishToGroupChatStream(
message.groupId,
ChatEvent.Deleted,
message.id,
);
await publishToGroupChatStream(message.groupId, "deleted", message.id);
}
}

View file

@ -391,7 +391,6 @@ export default async (
}
});
// type errors will be resolved by https://github.com/napi-rs/napi-rs/pull/2054
const _note = toRustObject(note);
if (note.renoteId == null || isQuote(_note)) {
await updateAntennasOnNewNote(_note, user, thisNoteIsMutedBy);

View file

@ -88,6 +88,6 @@
"vue-draggable-plus": "0.5.0",
"vue-plyr": "7.0.0",
"vue-prism-editor": "2.0.0-alpha.2",
"vue-tsc": "2.0.24"
"vue-tsc": "2.0.26"
}
}

View file

@ -506,8 +506,8 @@ importers:
packages/backend-rs:
devDependencies:
'@napi-rs/cli':
specifier: 3.0.0-alpha.55
version: 3.0.0-alpha.55(@emnapi/runtime@1.2.0)
specifier: 3.0.0-alpha.56
version: 3.0.0-alpha.56(@emnapi/runtime@1.2.0)
packages/client:
devDependencies:
@ -737,8 +737,8 @@ importers:
specifier: 2.0.0-alpha.2
version: 2.0.0-alpha.2(vue@3.4.31(typescript@5.5.3))
vue-tsc:
specifier: 2.0.24
version: 2.0.24(typescript@5.5.3)
specifier: 2.0.26
version: 2.0.26(typescript@5.5.3)
packages/firefish-js:
dependencies:
@ -1717,8 +1717,8 @@ packages:
cpu: [x64]
os: [win32]
'@napi-rs/cli@3.0.0-alpha.55':
resolution: {integrity: sha512-6XgBBTX8O28W5gcSzqYkI72UVJV6Y2YcyQNrEqak39JavJRLlXCv09uLF97raynXAOO50KeP6DEXFy5P8MR2sw==}
'@napi-rs/cli@3.0.0-alpha.56':
resolution: {integrity: sha512-a03KyEodiZD9+MIL8xnIAcnNzznZy+BT/IBtXZe/kIEUYv/zVcxwpcBuNme5r6zIyDqla8NkhsC6h8IZR+HAgg==}
engines: {node: '>= 16'}
hasBin: true
peerDependencies:
@ -2027,20 +2027,20 @@ packages:
resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
engines: {node: '>= 8'}
'@octokit/auth-token@4.0.0':
resolution: {integrity: sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==}
'@octokit/auth-token@5.1.1':
resolution: {integrity: sha512-rh3G3wDO8J9wSjfI436JUKzHIxq8NaiL0tVeB2aXmG6p/9859aUOAjA9pmSPNGGZxfwmaJ9ozOJImuNVJdpvbA==}
engines: {node: '>= 18'}
'@octokit/core@5.2.0':
resolution: {integrity: sha512-1LFfa/qnMQvEOAdzlQymH0ulepxbxnCYAKJZfMci/5XJyIHWgEYnDmgnKakbTh7CH2tFQ5O60oYDvns4i9RAIg==}
'@octokit/core@6.1.2':
resolution: {integrity: sha512-hEb7Ma4cGJGEUNOAVmyfdB/3WirWMg5hDuNFVejGEDFqupeOysLc2sG6HJxY2etBp5YQu5Wtxwi020jS9xlUwg==}
engines: {node: '>= 18'}
'@octokit/endpoint@9.0.5':
resolution: {integrity: sha512-ekqR4/+PCLkEBF6qgj8WqJfvDq65RH85OAgrtnVp1mSxaXF03u2xW/hUdweGS5654IlC0wkNYC18Z50tSYTAFw==}
'@octokit/endpoint@10.1.1':
resolution: {integrity: sha512-JYjh5rMOwXMJyUpj028cu0Gbp7qe/ihxfJMLc8VZBMMqSwLgOxDI1911gV4Enl1QSavAQNJcwmwBF9M0VvLh6Q==}
engines: {node: '>= 18'}
'@octokit/graphql@7.1.0':
resolution: {integrity: sha512-r+oZUH7aMFui1ypZnAvZmn0KSqAUgE1/tUXIWaqUCa1758ts/Jio84GZuzsvUkme98kv0WFY8//n0J1Z+vsIsQ==}
'@octokit/graphql@8.1.1':
resolution: {integrity: sha512-ukiRmuHTi6ebQx/HFRCXKbDlOh/7xEV6QUXaE7MJEKGNAncGI/STSbOkl12qVXZrfZdpXctx5O9X1AIaebiDBg==}
engines: {node: '>= 18'}
'@octokit/openapi-types@22.2.0':
@ -2052,11 +2052,11 @@ packages:
peerDependencies:
'@octokit/core': '5'
'@octokit/plugin-request-log@4.0.1':
resolution: {integrity: sha512-GihNqNpGHorUrO7Qa9JbAl0dbLnqJVrV8OXe2Zm5/Y4wFkZQDfTreBzVmiRfJVfE4mClXdihHnbpyyO9FSX4HA==}
'@octokit/plugin-request-log@5.3.0':
resolution: {integrity: sha512-FiGcyjdtYPlr03ExBk/0ysIlEFIFGJQAVoPPMxL19B24bVSEiZQnVGBunNtaAF1YnvE/EFoDpXmITtRnyCiypQ==}
engines: {node: '>= 18'}
peerDependencies:
'@octokit/core': '5'
'@octokit/core': '>=6'
'@octokit/plugin-rest-endpoint-methods@13.2.2':
resolution: {integrity: sha512-EI7kXWidkt3Xlok5uN43suK99VWqc8OaIMktY9d9+RNKl69juoTyxmLoWPIZgJYzi41qj/9zU7G/ljnNOJ5AFA==}
@ -2064,16 +2064,16 @@ packages:
peerDependencies:
'@octokit/core': ^5
'@octokit/request-error@5.1.0':
resolution: {integrity: sha512-GETXfE05J0+7H2STzekpKObFe765O5dlAKUTLNGeH+x47z7JjXHfsHKo5z21D/o/IOZTUEI6nyWyR+bZVP/n5Q==}
'@octokit/request-error@6.1.1':
resolution: {integrity: sha512-1mw1gqT3fR/WFvnoVpY/zUM2o/XkMs/2AszUUG9I69xn0JFLv6PGkPhNk5lbfvROs79wiS0bqiJNxfCZcRJJdg==}
engines: {node: '>= 18'}
'@octokit/request@8.4.0':
resolution: {integrity: sha512-9Bb014e+m2TgBeEJGEbdplMVWwPmL1FPtggHQRkV+WVsMggPtEkLKPlcVYm/o8xKLkpJ7B+6N8WfQMtDLX2Dpw==}
'@octokit/request@9.1.1':
resolution: {integrity: sha512-pyAguc0p+f+GbQho0uNetNQMmLG1e80WjkIaqqgUkihqUp0boRU6nKItXO4VWnr+nbZiLGEyy4TeKRwqaLvYgw==}
engines: {node: '>= 18'}
'@octokit/rest@20.1.1':
resolution: {integrity: sha512-MB4AYDsM5jhIHro/dq4ix1iWTLGToIGk6cWF5L6vanFaMble5jTX/UBQyiv05HsWnwUtY8JrfHy2LWfKwihqMw==}
'@octokit/rest@21.0.0':
resolution: {integrity: sha512-XudXXOmiIjivdjNZ+fN71NLrnDM00sxSZlhqmPR3v0dVoJwyP628tSlc12xqn8nX3N0965583RBw5GPo6r8u4Q==}
engines: {node: '>= 18'}
'@octokit/types@13.5.0':
@ -2574,14 +2574,14 @@ packages:
vite: ^5.0.0
vue: ^3.2.25
'@volar/language-core@2.4.0-alpha.5':
resolution: {integrity: sha512-CX+0vrNoCcO3tGZYIn7kNHug/u6+EImfbZe0tI6x/lCZc0MBJ7t9f6AKJT+mHJZ3ePhva6NVNv8mY1tNEURd5A==}
'@volar/language-core@2.4.0-alpha.15':
resolution: {integrity: sha512-mt8z4Fm2WxfQYoQHPcKVjLQV6PgPqyKLbkCVY2cr5RSaamqCHjhKEpsFX66aL4D/7oYguuaUw9Bx03Vt0TpIIA==}
'@volar/source-map@2.4.0-alpha.5':
resolution: {integrity: sha512-5OxMPGqbxaMuFXfj10k3xWwmJ2nb0b20kNaONAKxwUQxGY6nh6skX5AAFhIAbC8woplsVJpR0tAhgQR4S96VYQ==}
'@volar/source-map@2.4.0-alpha.15':
resolution: {integrity: sha512-8Htngw5TmBY4L3ClDqBGyfLhsB8EmoEXUH1xydyEtEoK0O6NX5ur4Jw8jgvscTlwzizyl/wsN1vn0cQXVbbXYg==}
'@volar/typescript@2.4.0-alpha.5':
resolution: {integrity: sha512-D9nzGP09afyLlsXC5rzVeLzEaMLOmW1GGPyOiuXRRGTLshX+/cp+MNsUbwUd3pih0OhRmpUFl4VHpUGA2M4iBw==}
'@volar/typescript@2.4.0-alpha.15':
resolution: {integrity: sha512-U3StRBbDuxV6Woa4hvGS4kz3XcOzrWUKgFdEFN+ba1x3eaYg7+ytau8ul05xgA+UNGLXXsKur7fTUhDFyISk0w==}
'@vue/compiler-core@3.4.31':
resolution: {integrity: sha512-skOiodXWTV3DxfDhB4rOf3OGalpITLlgCeOwb+Y9GJpfQ8ErigdBUHomBzvG78JoVE8MJoQsb+qhZiHfKeNeEg==}
@ -2598,8 +2598,8 @@ packages:
'@vue/compiler-ssr@3.4.31':
resolution: {integrity: sha512-RtefmITAje3fJ8FSg1gwgDhdKhZVntIVbwupdyZDSifZTRMiWxWehAOTCc8/KZDnBOcYQ4/9VWxsTbd3wT0hAA==}
'@vue/language-core@2.0.24':
resolution: {integrity: sha512-997YD6Lq/66LXr3ZOLNxDCmyn13z9NP8LU1UZn9hGCDWhzlbXAIP0hOgL3w3x4RKEaWTaaRtsHP9DzHvmduruQ==}
'@vue/language-core@2.0.26':
resolution: {integrity: sha512-/lt6SfQ3O1yDAhPsnLv9iSUgXd1dMHqUm/t3RctfqjuwQf1LnftZ414X3UBn6aXT4MiwXWtbNJ4Z0NZWwDWgJQ==}
peerDependencies:
typescript: '*'
peerDependenciesMeta:
@ -2893,8 +2893,8 @@ packages:
bcrypt-pbkdf@1.0.2:
resolution: {integrity: sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==}
before-after-hook@2.2.3:
resolution: {integrity: sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==}
before-after-hook@3.0.2:
resolution: {integrity: sha512-Nik3Sc0ncrMK4UUdXQmAnRtzmNQTAAXmXIopizwZ1W1t8QmfJj+zL4OA2I7XPTPW5z5TDqv4hRo/JzouDJnX3A==}
binary-extensions@2.3.0:
resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==}
@ -3657,9 +3657,6 @@ packages:
resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==}
engines: {node: '>= 0.8'}
deprecation@2.3.1:
resolution: {integrity: sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==}
destroy@1.2.0:
resolution: {integrity: sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==}
engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16}
@ -6587,8 +6584,8 @@ packages:
unicode-emoji-json@0.6.0:
resolution: {integrity: sha512-tAYF+EsOxa8jo/XPNYHRX7Nc8uoII+/edIpHM4DQI4nMp3AuRmwGZhL8fEBe0kUk0zHK+6wiwxxxNwfW5ap2Tg==}
universal-user-agent@6.0.1:
resolution: {integrity: sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==}
universal-user-agent@7.0.2:
resolution: {integrity: sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==}
universalify@0.1.2:
resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==}
@ -6732,8 +6729,8 @@ packages:
vue-template-compiler@2.7.16:
resolution: {integrity: sha512-AYbUWAJHLGGQM7+cNTELw+KsOG9nl2CnSv467WobS5Cv9uk3wFcnr1Etsz2sEIHEZvw1U+o9mRlEO6QbZvUPGQ==}
vue-tsc@2.0.24:
resolution: {integrity: sha512-1qi4P8L7yS78A7OJ7CDDxUIZPD6nVxoQEgX3DkRZNi1HI1qOfzOJwQlNpmwkogSVD6S/XcanbW9sktzpSxz6rA==}
vue-tsc@2.0.26:
resolution: {integrity: sha512-tOhuwy2bIXbMhz82ef37qeiaQHMXKQkD6mOF6CCPl3/uYtST3l6fdNyfMxipudrQTxTfXVPlgJdMENBFfC1CfQ==}
hasBin: true
peerDependencies:
typescript: '>=5.0.0'
@ -7910,11 +7907,11 @@ snapshots:
'@msgpackr-extract/msgpackr-extract-win32-x64@3.0.3':
optional: true
'@napi-rs/cli@3.0.0-alpha.55(@emnapi/runtime@1.2.0)':
'@napi-rs/cli@3.0.0-alpha.56(@emnapi/runtime@1.2.0)':
dependencies:
'@napi-rs/cross-toolchain': 0.0.16
'@napi-rs/wasm-tools': 0.0.2
'@octokit/rest': 20.1.1
'@octokit/rest': 21.0.0
clipanion: 3.2.1(typanion@3.14.0)
colorette: 2.0.20
debug: 4.3.5(supports-color@8.1.1)
@ -8144,64 +8141,62 @@ snapshots:
'@nodelib/fs.scandir': 2.1.5
fastq: 1.17.1
'@octokit/auth-token@4.0.0': {}
'@octokit/auth-token@5.1.1': {}
'@octokit/core@5.2.0':
'@octokit/core@6.1.2':
dependencies:
'@octokit/auth-token': 4.0.0
'@octokit/graphql': 7.1.0
'@octokit/request': 8.4.0
'@octokit/request-error': 5.1.0
'@octokit/auth-token': 5.1.1
'@octokit/graphql': 8.1.1
'@octokit/request': 9.1.1
'@octokit/request-error': 6.1.1
'@octokit/types': 13.5.0
before-after-hook: 2.2.3
universal-user-agent: 6.0.1
before-after-hook: 3.0.2
universal-user-agent: 7.0.2
'@octokit/endpoint@9.0.5':
'@octokit/endpoint@10.1.1':
dependencies:
'@octokit/types': 13.5.0
universal-user-agent: 6.0.1
universal-user-agent: 7.0.2
'@octokit/graphql@7.1.0':
'@octokit/graphql@8.1.1':
dependencies:
'@octokit/request': 8.4.0
'@octokit/request': 9.1.1
'@octokit/types': 13.5.0
universal-user-agent: 6.0.1
universal-user-agent: 7.0.2
'@octokit/openapi-types@22.2.0': {}
'@octokit/plugin-paginate-rest@11.3.1(@octokit/core@5.2.0)':
'@octokit/plugin-paginate-rest@11.3.1(@octokit/core@6.1.2)':
dependencies:
'@octokit/core': 5.2.0
'@octokit/core': 6.1.2
'@octokit/types': 13.5.0
'@octokit/plugin-request-log@4.0.1(@octokit/core@5.2.0)':
'@octokit/plugin-request-log@5.3.0(@octokit/core@6.1.2)':
dependencies:
'@octokit/core': 5.2.0
'@octokit/core': 6.1.2
'@octokit/plugin-rest-endpoint-methods@13.2.2(@octokit/core@5.2.0)':
'@octokit/plugin-rest-endpoint-methods@13.2.2(@octokit/core@6.1.2)':
dependencies:
'@octokit/core': 5.2.0
'@octokit/core': 6.1.2
'@octokit/types': 13.5.0
'@octokit/request-error@5.1.0':
'@octokit/request-error@6.1.1':
dependencies:
'@octokit/types': 13.5.0
deprecation: 2.3.1
once: 1.4.0
'@octokit/request@8.4.0':
'@octokit/request@9.1.1':
dependencies:
'@octokit/endpoint': 9.0.5
'@octokit/request-error': 5.1.0
'@octokit/endpoint': 10.1.1
'@octokit/request-error': 6.1.1
'@octokit/types': 13.5.0
universal-user-agent: 6.0.1
universal-user-agent: 7.0.2
'@octokit/rest@20.1.1':
'@octokit/rest@21.0.0':
dependencies:
'@octokit/core': 5.2.0
'@octokit/plugin-paginate-rest': 11.3.1(@octokit/core@5.2.0)
'@octokit/plugin-request-log': 4.0.1(@octokit/core@5.2.0)
'@octokit/plugin-rest-endpoint-methods': 13.2.2(@octokit/core@5.2.0)
'@octokit/core': 6.1.2
'@octokit/plugin-paginate-rest': 11.3.1(@octokit/core@6.1.2)
'@octokit/plugin-request-log': 5.3.0(@octokit/core@6.1.2)
'@octokit/plugin-rest-endpoint-methods': 13.2.2(@octokit/core@6.1.2)
'@octokit/types@13.5.0':
dependencies:
@ -8714,15 +8709,15 @@ snapshots:
vite: 5.3.3(@types/node@20.14.9)(sass@1.77.6)(stylus@0.57.0)(terser@5.31.0)
vue: 3.4.31(typescript@5.5.3)
'@volar/language-core@2.4.0-alpha.5':
'@volar/language-core@2.4.0-alpha.15':
dependencies:
'@volar/source-map': 2.4.0-alpha.5
'@volar/source-map': 2.4.0-alpha.15
'@volar/source-map@2.4.0-alpha.5': {}
'@volar/source-map@2.4.0-alpha.15': {}
'@volar/typescript@2.4.0-alpha.5':
'@volar/typescript@2.4.0-alpha.15':
dependencies:
'@volar/language-core': 2.4.0-alpha.5
'@volar/language-core': 2.4.0-alpha.15
path-browserify: 1.0.1
vscode-uri: 3.0.8
@ -8764,9 +8759,9 @@ snapshots:
'@vue/compiler-dom': 3.4.31
'@vue/shared': 3.4.31
'@vue/language-core@2.0.24(typescript@5.5.3)':
'@vue/language-core@2.0.26(typescript@5.5.3)':
dependencies:
'@volar/language-core': 2.4.0-alpha.5
'@volar/language-core': 2.4.0-alpha.15
'@vue/compiler-dom': 3.4.31
'@vue/shared': 3.4.31
computeds: 0.0.1
@ -9124,7 +9119,7 @@ snapshots:
dependencies:
tweetnacl: 0.14.5
before-after-hook@2.2.3: {}
before-after-hook@3.0.2: {}
binary-extensions@2.3.0: {}
@ -9787,8 +9782,6 @@ snapshots:
depd@2.0.0: {}
deprecation@2.3.1: {}
destroy@1.2.0: {}
detect-libc@2.0.3: {}
@ -13042,7 +13035,7 @@ snapshots:
unicode-emoji-json@0.6.0: {}
universal-user-agent@6.0.1: {}
universal-user-agent@7.0.2: {}
universalify@0.1.2: {}
@ -13162,10 +13155,10 @@ snapshots:
de-indent: 1.0.2
he: 1.2.0
vue-tsc@2.0.24(typescript@5.5.3):
vue-tsc@2.0.26(typescript@5.5.3):
dependencies:
'@volar/typescript': 2.4.0-alpha.5
'@vue/language-core': 2.0.24(typescript@5.5.3)
'@volar/typescript': 2.4.0-alpha.15
'@vue/language-core': 2.0.26(typescript@5.5.3)
semver: 7.6.2
typescript: 5.5.3