1
0
mirror of https://git.boykissers.com/pawkey/pawkey-sk.git synced 2025-12-20 04:04:16 +00:00

merge upstream again

This commit is contained in:
Hazelnoot
2025-04-24 14:23:45 -04:00
167 changed files with 6779 additions and 3952 deletions

View File

@@ -9,16 +9,16 @@
"lint": "pnpm typecheck && pnpm eslint"
},
"dependencies": {
"esbuild": "0.25.1",
"esbuild": "0.25.2",
"idb-keyval": "6.2.1",
"misskey-js": "workspace:*"
},
"devDependencies": {
"@typescript-eslint/parser": "8.27.0",
"@typescript-eslint/parser": "8.29.1",
"@typescript/lib-webworker": "npm:@types/serviceworker@0.0.74",
"eslint-plugin-import": "2.31.0",
"nodemon": "3.1.9",
"typescript": "5.8.2"
"typescript": "5.8.3"
},
"type": "module"
}

View File

@@ -291,6 +291,24 @@ async function composeNotification(data: PushNotificationDataMap[keyof PushNotif
data,
renotify: true,
}];
case 'newChatMessage':
if (data.body.toRoom != null) {
return [`${data.body.toRoom.name}: ${getUserName(data.body.fromUser)}: ${data.body.text}`, {
icon: data.body.fromUser.avatarUrl ?? undefined,
badge: iconUrl('messages'),
tag: `chat:room:${data.body.toRoomId}`,
data,
renotify: true,
}];
} else {
return [`${getUserName(data.body.fromUser)}: ${data.body.text}`, {
icon: data.body.fromUser.avatarUrl ?? undefined,
badge: iconUrl('messages'),
tag: `chat:user:${data.body.fromUserId}`,
data,
renotify: true,
}];
}
default:
return null;
}

View File

@@ -16,7 +16,7 @@ export const cli = new Misskey.api.APIClient({ origin, fetch: (...args): Promise
export async function api<
E extends keyof Misskey.Endpoints,
P extends Misskey.Endpoints[E]['req']
P extends Misskey.Endpoints[E]['req'],
>(endpoint: E, userId?: string, params?: P): Promise<Misskey.api.SwitchCaseResponseType<E, P> | undefined> {
let account: Pick<Misskey.entities.SignupResponse, 'id' | 'token'> | undefined;
@@ -60,6 +60,14 @@ export function openAntenna(antennaId: string, loginId: string): ReturnType<type
return openClient('push', `/timeline/antenna/${antennaId}`, loginId, { antennaId });
}
export function openChat(body: any, loginId: string): ReturnType<typeof openClient> {
if (body.toRoomId != null) {
return openClient('push', `/chat/room/${body.toRoomId}`, loginId, { body });
} else {
return openClient('push', `/chat/user/${body.toUserId}`, loginId, { body });
}
}
// post-formのオプションから投稿フォームを開く
export async function openPost(options: { initialText?: string; reply?: Misskey.entities.Note; renote?: Misskey.entities.Note }, loginId?: string): ReturnType<typeof openClient> {
// クエリを作成しておく

View File

@@ -76,6 +76,7 @@ globalThis.addEventListener('push', ev => {
// case 'driveFileCreated':
case 'notification':
case 'unreadAntennaNote':
case 'newChatMessage':
// 1日以上経過している場合は無視
if (Date.now() - data.dateTime > 1000 * 60 * 60 * 24) break;
@@ -158,6 +159,9 @@ globalThis.addEventListener('notificationclick', (ev: ServiceWorkerGlobalScopeEv
case 'unreadAntennaNote':
client = await swos.openAntenna(data.body.antenna.id, loginId);
break;
case 'newChatMessage':
client = await swos.openChat(data.body, loginId);
break;
default:
switch (action) {
case 'markAllAsRead':

View File

@@ -23,6 +23,7 @@ type PushNotificationDataSourceMap = {
note: Misskey.entities.Note;
};
readAllNotifications: undefined;
newChatMessage: Misskey.entities.ChatMessage;
};
export type PushNotificationData<K extends keyof PushNotificationDataSourceMap> = {