Skip to content

Commit 3c73ec7

Browse files
committed
chore: run prettier fmt
1 parent 14c0d5a commit 3c73ec7

File tree

267 files changed

+2704
-2031
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

267 files changed

+2704
-2031
lines changed

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
src/locales
2+
src/emoji
3+
src/highlight-js-parser/*.json

src/chat-api/EventNames.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export const ClientEvents = {
33
NOTIFICATION_DISMISS: "notification:dismiss",
44

55
VOICE_SIGNAL_SEND: "voice:signal_send",
6-
UPDATE_ACTIVITY: "user:update_activity",
6+
UPDATE_ACTIVITY: "user:update_activity"
77
};
88

99
export const ServerEvents = {
@@ -81,5 +81,5 @@ export const ServerEvents = {
8181

8282
VOICE_USER_JOINED: "voice:user_joined",
8383
VOICE_USER_LEFT: "voice:user_left",
84-
VOICE_SIGNAL_RECEIVED: "voice:signal_received",
84+
VOICE_SIGNAL_RECEIVED: "voice:signal_received"
8585
} as const;

src/chat-api/emits/userEmits.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export function dismissChannelNotification(channelId: string) {
88

99
export function emitActivityStatus(activity: ActivityStatus | null) {
1010
socketClient.socket.emit(ClientEvents.UPDATE_ACTIVITY, activity);
11-
}
11+
}

src/chat-api/emits/voiceEmits.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ import type SimplePeer from "@thaunknown/simple-peer";
22
import { ClientEvents } from "../EventNames";
33
import socketClient from "../socketClient";
44

5-
export function emitVoiceSignal(channelId: string, toUserId: string, signal: SimplePeer.SignalData) {
6-
socketClient.socket.emit(ClientEvents.VOICE_SIGNAL_SEND, { channelId, toUserId, signal });
7-
}
5+
export function emitVoiceSignal(
6+
channelId: string,
7+
toUserId: string,
8+
signal: SimplePeer.SignalData
9+
) {
10+
socketClient.socket.emit(ClientEvents.VOICE_SIGNAL_SEND, {
11+
channelId,
12+
toUserId,
13+
signal
14+
});
15+
}

src/chat-api/events/connectionEventTypes.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
RawVoice,
1313
RawNotice,
1414
RawReminder,
15-
RawServerFolder,
15+
RawServerFolder
1616
} from "../RawData";
1717

1818
export interface AuthenticatedPayload {
@@ -41,18 +41,18 @@ interface MessageMention {
4141
export enum LastOnlineStatus {
4242
HIDDEN = 0,
4343
FRIENDS = 1,
44-
FRIENDS_AND_SERVERS = 2,
44+
FRIENDS_AND_SERVERS = 2
4545
}
4646

4747
export enum DmStatus {
4848
OPEN = 0,
4949
FRIENDS_AND_SERVERS = 1,
50-
FRIENDS = 2,
50+
FRIENDS = 2
5151
}
5252
export enum FriendRequestStatus {
5353
OPEN = 0,
5454
SERVERS = 1,
55-
CLOSED = 2,
55+
CLOSED = 2
5656
}
5757

5858
export interface SelfUser {
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { FriendStatus, RawFriend } from "../RawData";
22
import useFriends from "../store/useFriends";
33

4-
54
const friends = useFriends();
65

76
export const onFriendRequestSent = (payload: RawFriend) => {
@@ -12,10 +11,10 @@ export const onFriendRequestPending = (payload: RawFriend) => {
1211
friends.set(payload);
1312
};
1413

15-
export const onFriendRequestAccepted = (payload: {friendId: string}) => {
14+
export const onFriendRequestAccepted = (payload: { friendId: string }) => {
1615
friends.updateStatus(payload.friendId, FriendStatus.FRIENDS);
1716
};
1817

19-
export const onFriendRemoved = (payload: {friendId: string}) => {
18+
export const onFriendRemoved = (payload: { friendId: string }) => {
2019
friends.delete(payload.friendId);
21-
};
20+
};

src/chat-api/events/inboxEvents.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ import { RawChannel, RawInboxWithoutChannel } from "../RawData";
33
import useChannels from "../store/useChannels";
44
import useInbox from "../store/useInbox";
55

6-
7-
export const onInboxOpened = (payload: RawInboxWithoutChannel & {channel: RawChannel}) => {
6+
export const onInboxOpened = (
7+
payload: RawInboxWithoutChannel & { channel: RawChannel }
8+
) => {
89
const channels = useChannels();
910
const inbox = useInbox();
1011
batch(() => {
11-
channels.set({...payload.channel, lastSeen: payload.lastSeen});
12-
inbox.set({...payload, channelId: payload.channel.id});
12+
channels.set({ ...payload.channel, lastSeen: payload.lastSeen });
13+
inbox.set({ ...payload, channelId: payload.channel.id });
1314
});
1415
};
15-
export const onInboxClosed = (payload: {channelId: string}) => {
16+
export const onInboxClosed = (payload: { channelId: string }) => {
1617
const channels = useChannels();
1718
const inbox = useInbox();
1819
const channel = channels.get(payload.channelId);
1920
batch(() => {
2021
inbox.removeInbox(payload.channelId);
2122
channel?.recipient()?.setInboxChannelId(undefined);
2223
channels.deleteChannel(payload.channelId);
23-
2424
});
25-
};
25+
};

src/chat-api/events/userEvents.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
RawUser,
1212
RawUserConnection,
1313
RawNotice,
14-
RawReminder,
14+
RawReminder
1515
} from "../RawData";
1616
import useFriends from "../store/useFriends";
1717
import useAccount from "../store/useAccount";
@@ -38,7 +38,7 @@ export function onUserPresenceUpdate(payload: {
3838
...(payload.custom !== undefined ? { custom: payload.custom } : undefined),
3939
...(payload.activity !== undefined
4040
? { activity: payload.activity }
41-
: undefined),
41+
: undefined)
4242
});
4343
}
4444

@@ -95,7 +95,7 @@ export function onUserBlocked(payload: { user: RawUser }) {
9595
createdAt: Date.now(),
9696
recipient: payload.user,
9797
userId: account.user()?.id!,
98-
status: FriendStatus.BLOCKED,
98+
status: FriendStatus.BLOCKED
9999
});
100100
}
101101
export function onUserUnblocked(payload: { userId: string }) {
@@ -108,7 +108,7 @@ export function onUserConnectionAdded(payload: {
108108
}) {
109109
const account = useAccount();
110110
account.setUser({
111-
connections: [...(account.user()?.connections || []), payload.connection],
111+
connections: [...(account.user()?.connections || []), payload.connection]
112112
});
113113
}
114114

@@ -117,7 +117,7 @@ export function onUserConnectionRemoved(payload: { connectionId: string }) {
117117
account.setUser({
118118
connections: account
119119
.user()
120-
?.connections.filter((c) => c.id !== payload.connectionId),
120+
?.connections.filter((c) => c.id !== payload.connectionId)
121121
});
122122
}
123123

src/chat-api/services/ApplicationService.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const getApplication = async (id: string) => {
66
const data = await request<RawApplication>({
77
method: "GET",
88
url: env.SERVER_URL + "/api/applications/" + id,
9-
useToken: true,
9+
useToken: true
1010
});
1111
return data;
1212
};
@@ -15,7 +15,7 @@ export const getApplications = async () => {
1515
const data = await request<RawApplication[]>({
1616
method: "GET",
1717
url: env.SERVER_URL + "/api/applications",
18-
useToken: true,
18+
useToken: true
1919
});
2020
return data;
2121
};
@@ -24,7 +24,7 @@ export const createApplication = async () => {
2424
const data = await request<RawApplication>({
2525
method: "POST",
2626
url: env.SERVER_URL + "/api/applications",
27-
useToken: true,
27+
useToken: true
2828
});
2929
return data;
3030
};
@@ -33,7 +33,7 @@ export const createAppBotUser = async (appId: string) => {
3333
const data = await request<RawUser>({
3434
method: "POST",
3535
url: env.SERVER_URL + `/api/applications/${appId}/bot`,
36-
useToken: true,
36+
useToken: true
3737
});
3838
return data;
3939
};
@@ -45,7 +45,7 @@ export const updateAppBotUser = async (
4545
method: "PATCH",
4646
url: env.SERVER_URL + `/api/applications/${appId}/bot`,
4747
body: update,
48-
useToken: true,
48+
useToken: true
4949
});
5050
return data;
5151
};
@@ -57,7 +57,7 @@ export const updateApp = async (
5757
method: "PATCH",
5858
url: env.SERVER_URL + `/api/applications/${appId}`,
5959
body: update,
60-
useToken: true,
60+
useToken: true
6161
});
6262
return data;
6363
};
@@ -66,23 +66,23 @@ export const getAppBotToken = async (appId: string) => {
6666
const data = await request<{ token: string }>({
6767
method: "GET",
6868
url: env.SERVER_URL + `/api/applications/${appId}/token`,
69-
useToken: true,
69+
useToken: true
7070
});
7171
return data;
7272
};
7373
export const refreshAppBotToken = async (appId: string) => {
7474
const data = await request<{ status: true }>({
7575
method: "POST",
7676
url: env.SERVER_URL + `/api/applications/${appId}/token`,
77-
useToken: true,
77+
useToken: true
7878
});
7979
return data;
8080
};
8181
export const deleteApp = async (appId: string) => {
8282
const data = await request<{ success: string }>({
8383
method: "DELETE",
8484
url: env.SERVER_URL + `/api/applications/${appId}`,
85-
useToken: true,
85+
useToken: true
8686
});
8787
return data;
8888
};
@@ -102,7 +102,7 @@ export const getApplicationBot = async (
102102
method: "GET",
103103
url: env.SERVER_URL + `/api/applications/${appId}/bot`,
104104
params: { includeServers },
105-
useToken: true,
105+
useToken: true
106106
});
107107
return data;
108108
};
@@ -111,7 +111,7 @@ export const refreshAppClientSecret = async (appId: string) => {
111111
const data = await request<RawApplication>({
112112
method: "POST",
113113
url: env.SERVER_URL + `/api/applications/${appId}/client-secret-refresh`,
114-
useToken: true,
114+
useToken: true
115115
});
116116
return data;
117117
};

src/chat-api/services/ChannelService.ts

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,44 @@ import { RawChannelNotice } from "../RawData";
44
import env from "@/common/env";
55

66
export const getChannelNotice = async (channelId: string) => {
7-
const data = await request<{notice: RawChannelNotice}>({
7+
const data = await request<{ notice: RawChannelNotice }>({
88
method: "GET",
9-
url: env.SERVER_URL + "/api" + ServiceEndpoints.channel(channelId) + "/notice",
9+
url:
10+
env.SERVER_URL + "/api" + ServiceEndpoints.channel(channelId) + "/notice",
1011
useToken: true
1112
});
1213
return data;
1314
};
1415

15-
export const updateChannelNotice = async (serverId: string, channelId: string, content: string) => {
16-
const data = await request<{notice: RawChannelNotice}>({
16+
export const updateChannelNotice = async (
17+
serverId: string,
18+
channelId: string,
19+
content: string
20+
) => {
21+
const data = await request<{ notice: RawChannelNotice }>({
1722
method: "PUT",
18-
url: env.SERVER_URL + "/api" + ServiceEndpoints.serverChannel(serverId, channelId) + "/notice",
19-
body: {content},
23+
url:
24+
env.SERVER_URL +
25+
"/api" +
26+
ServiceEndpoints.serverChannel(serverId, channelId) +
27+
"/notice",
28+
body: { content },
2029
useToken: true
2130
});
2231
return data;
2332
};
2433

25-
export const deleteChannelNotice = async (serverId: string, channelId: string) => {
34+
export const deleteChannelNotice = async (
35+
serverId: string,
36+
channelId: string
37+
) => {
2638
const data = await request({
2739
method: "DELETE",
28-
url: env.SERVER_URL + "/api" + ServiceEndpoints.serverChannel(serverId, channelId) + "/notice",
40+
url:
41+
env.SERVER_URL +
42+
"/api" +
43+
ServiceEndpoints.serverChannel(serverId, channelId) +
44+
"/notice",
2945
useToken: true
3046
});
3147
return data;

0 commit comments

Comments
 (0)