From d92200a6d6a81ac0c6a739f0297935bb060a974f Mon Sep 17 00:00:00 2001 From: dogcraft Date: Sun, 10 Jul 2022 10:02:46 +0800 Subject: [PATCH 01/35] fix: QueryFailedError when logging user's IPs (#8973) * fix QueryFailedError when logging user's IPs * use `orIgnore` to fix --- packages/backend/src/server/api/api-handler.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/api-handler.ts b/packages/backend/src/server/api/api-handler.ts index 34ff970b4c..ec71ddd2c0 100644 --- a/packages/backend/src/server/api/api-handler.ts +++ b/packages/backend/src/server/api/api-handler.ts @@ -68,11 +68,11 @@ export default (endpoint: IEndpoint, ctx: Koa.Context) => new Promise((res } try { - UserIps.insert({ + UserIps.createQueryBuilder().insert().values({ createdAt: new Date(), userId: user.id, ip: ip, - }); + }).orIgnore(true).execute(); } catch { } } From fbd6b90bf8d7fca93ea43174842f6cc0fd8bbe0b Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 10 Jul 2022 11:14:41 +0900 Subject: [PATCH 02/35] chore(dev): remove duplicated lint rule --- packages/shared/.eslintrc.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/shared/.eslintrc.js b/packages/shared/.eslintrc.js index 3aef6484e9..aed822be9a 100644 --- a/packages/shared/.eslintrc.js +++ b/packages/shared/.eslintrc.js @@ -53,7 +53,6 @@ module.exports = { 'no-empty-pattern': ['warn'], 'no-async-promise-executor': ['off'], 'no-useless-escape': ['off'], - 'no-multi-spaces': ['warn'], 'no-multiple-empty-lines': ['error', { 'max': 1 }], 'no-control-regex': ['warn'], 'no-empty': ['warn'], From 7f808eaf426159c77e6ffbf8b246712a584d938b Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 10 Jul 2022 13:16:11 +0900 Subject: [PATCH 03/35] fix(client): fix style of mention --- packages/client/src/components/mention.vue | 39 +++++++++++----------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/packages/client/src/components/mention.vue b/packages/client/src/components/mention.vue index 2c8bc0c04e..e356522975 100644 --- a/packages/client/src/components/mention.vue +++ b/packages/client/src/components/mention.vue @@ -1,15 +1,15 @@ @@ -41,8 +41,8 @@ const bgCss = bg.toRgbString(); useCssModule(); - From 83ebe79a3fe5ddb22e80d3b47b9e8ec0701286ad Mon Sep 17 00:00:00 2001 From: tamaina Date: Sun, 10 Jul 2022 15:15:21 +0900 Subject: [PATCH 04/35] enhance(sw): If receiving a push notification issued more than a day, ignore it. (#8980) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * enhance(sw): ignore old push notification * :v: * 半日 * !== * 1日 --- packages/backend/src/services/push-notification.ts | 1 + packages/sw/src/sw.ts | 6 +++++- packages/sw/src/types.ts | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/services/push-notification.ts b/packages/backend/src/services/push-notification.ts index 5c3bafbb34..393a23d050 100644 --- a/packages/backend/src/services/push-notification.ts +++ b/packages/backend/src/services/push-notification.ts @@ -64,6 +64,7 @@ export async function pushNotification(u type, body: type === 'notification' ? truncateNotification(body as Packed<'Notification'>) : body, userId, + dateTime: (new Date()).getTime(), }), { proxy: config.proxy, }).catch((err: any) => { diff --git a/packages/sw/src/sw.ts b/packages/sw/src/sw.ts index 0ba6a6e4af..872692f903 100644 --- a/packages/sw/src/sw.ts +++ b/packages/sw/src/sw.ts @@ -42,8 +42,12 @@ self.addEventListener('push', ev => { // case 'driveFileCreated': case 'notification': case 'unreadMessagingMessage': + // 1日以上経過している場合は無視 + if ((new Date()).getTime() - data.dateTime > 1000 * 60 * 60 * 24) break; + // クライアントがあったらストリームに接続しているということなので通知しない - if (clients.length != 0) return; + if (clients.length !== 0) break; + return createNotification(data); case 'readAllNotifications': for (const n of await self.registration.getNotifications()) { diff --git a/packages/sw/src/types.ts b/packages/sw/src/types.ts index 6aa3726eac..0404e21e57 100644 --- a/packages/sw/src/types.ts +++ b/packages/sw/src/types.ts @@ -24,6 +24,7 @@ export type pushNotificationData type: K; body: pushNotificationDataSourceMap[K]; userId: string; + dateTime: number; }; export type pushNotificationDataMap = { From 5cdb9fb748ffed1081ba308ee271457eaba6c651 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 10 Jul 2022 15:35:43 +0900 Subject: [PATCH 05/35] chore(client): tweak style --- packages/client/src/components/visibility-picker.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/components/visibility-picker.vue b/packages/client/src/components/visibility-picker.vue index c717c3a461..7fe55858cc 100644 --- a/packages/client/src/components/visibility-picker.vue +++ b/packages/client/src/components/visibility-picker.vue @@ -105,7 +105,7 @@ function choose(visibility: typeof misskey.noteVisibilities[number]): void { } &.active { - color: #fff; + color: var(--fgOnAccent); background: var(--accent); } From bbe4824955d1533c8a466e791a269f30f1586a57 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 10 Jul 2022 15:36:02 +0900 Subject: [PATCH 06/35] enhance(client): update themes --- packages/client/src/scripts/theme.ts | 8 +- packages/client/src/themes/d-black.json5 | 17 ---- packages/client/src/themes/d-lime-green.json5 | 24 +++++ .../client/src/themes/d-orange-green.json5 | 24 +++++ packages/client/src/themes/d-pumpkin.json5 | 88 ------------------- 5 files changed, 52 insertions(+), 109 deletions(-) delete mode 100644 packages/client/src/themes/d-black.json5 create mode 100644 packages/client/src/themes/d-lime-green.json5 create mode 100644 packages/client/src/themes/d-orange-green.json5 delete mode 100644 packages/client/src/themes/d-pumpkin.json5 diff --git a/packages/client/src/scripts/theme.ts b/packages/client/src/scripts/theme.ts index dec9fb355c..eb82044b32 100644 --- a/packages/client/src/scripts/theme.ts +++ b/packages/client/src/scripts/theme.ts @@ -1,6 +1,6 @@ import { ref } from 'vue'; -import { globalEvents } from '@/events'; import tinycolor from 'tinycolor2'; +import { globalEvents } from '@/events'; export type Theme = { id: string; @@ -31,11 +31,11 @@ export const getBuiltinThemes = () => Promise.all( 'd-astro', 'd-future', 'd-botanical', + 'd-lime-green', + 'd-orange-green', 'd-cherry', 'd-ice', - 'd-pumpkin', - 'd-black', - ].map(name => import(`../themes/${name}.json5`).then(({ default: _default }): Theme => _default)) + ].map(name => import(`../themes/${name}.json5`).then(({ default: _default }): Theme => _default)), ); export const getBuiltinThemesRef = () => { diff --git a/packages/client/src/themes/d-black.json5 b/packages/client/src/themes/d-black.json5 deleted file mode 100644 index 3c18ebdaf1..0000000000 --- a/packages/client/src/themes/d-black.json5 +++ /dev/null @@ -1,17 +0,0 @@ -{ - id: '8c539dc1-0fab-4d47-9194-39c508e9bfe1', - - name: 'Mi Black', - author: 'syuilo', - - base: 'dark', - - props: { - divider: '#2d2d2d', - panel: '#131313', - panelHeaderBg: '@panel', - panelHeaderDivider: '@divider', - shadow: 'rgba(255, 255, 255, 0.05)', - modalBg: 'rgba(255, 255, 255, 0.1)', - }, -} diff --git a/packages/client/src/themes/d-lime-green.json5 b/packages/client/src/themes/d-lime-green.json5 new file mode 100644 index 0000000000..17617687b3 --- /dev/null +++ b/packages/client/src/themes/d-lime-green.json5 @@ -0,0 +1,24 @@ +{ + id: '02816013-8107-440f-877e-865083ffe194', + + name: 'Mi Lime+Green Dark', + author: 'syuilo', + + base: 'dark', + + props: { + accent: '#b4e900', + bg: '#0C1210', + fg: '#dee7e4', + fgHighlighted: '#fff', + fgOnAccent: '#192320', + divider: '#e7fffb24', + panel: '#192320', + panelHeaderBg: '@panel', + panelHeaderDivider: '@divider', + popup: '#293330', + renote: '@accent', + mentionMe: '#ffaa00', + link: '#2bceff', + }, +} diff --git a/packages/client/src/themes/d-orange-green.json5 b/packages/client/src/themes/d-orange-green.json5 new file mode 100644 index 0000000000..f0e15f4763 --- /dev/null +++ b/packages/client/src/themes/d-orange-green.json5 @@ -0,0 +1,24 @@ +{ + id: 'dc489603-27b5-424a-9b25-1ff6aec9824a', + + name: 'Mi Orange+Green Dark', + author: 'syuilo', + + base: 'dark', + + props: { + accent: '#e97f00', + bg: '#0C1210', + fg: '#dee7e4', + fgHighlighted: '#fff', + fgOnAccent: '#192320', + divider: '#e7fffb24', + panel: '#192320', + panelHeaderBg: '@panel', + panelHeaderDivider: '@divider', + popup: '#293330', + renote: '@accent', + mentionMe: '#ffaa00', + link: '#2bceff', + }, +} diff --git a/packages/client/src/themes/d-pumpkin.json5 b/packages/client/src/themes/d-pumpkin.json5 deleted file mode 100644 index 064ca4577b..0000000000 --- a/packages/client/src/themes/d-pumpkin.json5 +++ /dev/null @@ -1,88 +0,0 @@ -{ - id: '0b64fef3-02c7-20b5-dd87-b3f77e2b4301', - - name: 'Mi Pumpkin Dark', - author: 'syuilo', - - base: 'dark', - - props: { - X2: ':darken<2<@panel', - X3: 'rgba(255, 255, 255, 0.05)', - X4: 'rgba(255, 255, 255, 0.1)', - X5: 'rgba(255, 255, 255, 0.05)', - X6: 'rgba(255, 255, 255, 0.15)', - X7: 'rgba(255, 255, 255, 0.05)', - X8: ':lighten<5<@accent', - X9: ':darken<5<@accent', - bg: 'rgb(37, 32, 47)', - fg: '#e0d5c0', - X10: ':alpha<0.4<@accent', - X11: 'rgba(0, 0, 0, 0.3)', - X12: 'rgba(255, 255, 255, 0.1)', - X13: 'rgba(255, 255, 255, 0.15)', - X14: ':alpha<0.5<@navBg', - X15: ':alpha<0<@panel', - X16: ':alpha<0.7<@panel', - X17: ':alpha<0.8<@bg', - cwBg: '#687390', - cwFg: '#393f4f', - link: 'rgb(172, 193, 68)', - warn: '#ecb637', - badge: '#31b1ce', - error: '#ec4137', - focus: ':alpha<0.3<@accent', - navBg: '@panel', - navFg: '@fg', - panel: ':lighten<3<@bg', - popup: ':lighten<3<@panel', - accent: 'rgb(242, 133, 36)', - header: ':alpha<0.7<@panel', - infoBg: '#253142', - infoFg: '#fff', - renote: 'rgb(110, 179, 72)', - shadow: 'rgba(0, 0, 0, 0.3)', - divider: 'rgba(255, 255, 255, 0.1)', - hashtag: 'rgb(188, 90, 255)', - mention: 'rgb(72, 179, 139)', - modalBg: 'rgba(0, 0, 0, 0.5)', - success: '#86b300', - buttonBg: 'rgba(255, 255, 255, 0.05)', - switchBg: 'rgba(255, 255, 255, 0.15)', - acrylicBg: ':alpha<0.5<@bg', - cwHoverBg: '#707b97', - indicator: '@accent', - mentionMe: '@accent', - messageBg: '@bg', - navActive: '@accent', - accentedBg: ':alpha<0.15<@accent', - fgOnAccent: '#000', - infoWarnBg: '#42321c', - infoWarnFg: '#ffbd3e', - navHoverFg: ':lighten<17<@fg', - dateLabelFg: '@fg', - inputBorder: 'rgba(255, 255, 255, 0.1)', - panelBorder: '" solid 1px var(--divider)', - accentDarken: ':darken<10<@accent', - acrylicPanel: ':alpha<0.5<@panel', - navIndicator: '@indicator', - accentLighten: ':lighten<10<@accent', - buttonHoverBg: 'rgba(255, 255, 255, 0.1)', - driveFolderBg: ':alpha<0.3<@accent', - fgHighlighted: ':lighten<3<@fg', - fgTransparent: ':alpha<0.5<@fg', - panelHeaderBg: ':lighten<3<@panel', - panelHeaderFg: '@fg', - buttonGradateA: '@accent', - buttonGradateB: ':hue<20<@accent', - htmlThemeColor: '@bg', - panelHighlight: ':lighten<3<@panel', - listItemHoverBg: 'rgba(255, 255, 255, 0.03)', - scrollbarHandle: 'rgba(255, 255, 255, 0.2)', - inputBorderHover: 'rgba(255, 255, 255, 0.2)', - wallpaperOverlay: 'rgba(0, 0, 0, 0.5)', - fgTransparentWeak: ':alpha<0.75<@fg', - panelHeaderDivider: 'rgba(0, 0, 0, 0)', - scrollbarHandleHover: 'rgba(255, 255, 255, 0.4)', - }, -} From 9107de63b42970fa309fe0a3f6214627e84d06d3 Mon Sep 17 00:00:00 2001 From: yzhe819 <68207314+yzhe819@users.noreply.github.com> Date: Sun, 10 Jul 2022 22:47:29 +1200 Subject: [PATCH 07/35] chore: fix lint errors (#8981) --- .../src/queue/processors/db/export-custom-emojis.ts | 2 +- .../backend/src/remote/activitypub/models/question.ts | 2 +- packages/backend/src/remote/activitypub/renderer/like.ts | 2 +- packages/client/src/components/drive-window.vue | 2 +- packages/client/src/directives/size.ts | 4 ++-- packages/client/src/scripts/hpml/expr.ts | 2 +- packages/client/src/ui/deck/list-column.vue | 2 +- packages/client/src/widgets/activity.chart.vue | 8 ++++---- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/backend/src/queue/processors/db/export-custom-emojis.ts b/packages/backend/src/queue/processors/db/export-custom-emojis.ts index 8ce1d05272..3da887cda2 100644 --- a/packages/backend/src/queue/processors/db/export-custom-emojis.ts +++ b/packages/backend/src/queue/processors/db/export-custom-emojis.ts @@ -8,7 +8,7 @@ import { queueLogger } from '../../logger.js'; import { addFile } from '@/services/drive/add-file.js'; import { format as dateFormat } from 'date-fns'; import { Users, Emojis } from '@/models/index.js'; -import { } from '@/queue/types.js'; +import { } from '@/queue/types.js'; import { createTemp, createTempDir } from '@/misc/create-temp.js'; import { downloadUrl } from '@/misc/download-url.js'; import config from '@/config/index.js'; diff --git a/packages/backend/src/remote/activitypub/models/question.ts b/packages/backend/src/remote/activitypub/models/question.ts index 034501572a..f0321fdf2f 100644 --- a/packages/backend/src/remote/activitypub/models/question.ts +++ b/packages/backend/src/remote/activitypub/models/question.ts @@ -1,6 +1,6 @@ import config from '@/config/index.js'; import Resolver from '../resolver.js'; -import { IObject, IQuestion, isQuestion } from '../type.js'; +import { IObject, IQuestion, isQuestion } from '../type.js'; import { apLogger } from '../logger.js'; import { Notes, Polls } from '@/models/index.js'; import { IPoll } from '@/models/entities/poll.js'; diff --git a/packages/backend/src/remote/activitypub/renderer/like.ts b/packages/backend/src/remote/activitypub/renderer/like.ts index da1bfe6e8e..00fb72e8a3 100644 --- a/packages/backend/src/remote/activitypub/renderer/like.ts +++ b/packages/backend/src/remote/activitypub/renderer/like.ts @@ -8,7 +8,7 @@ import renderEmoji from './emoji.js'; export const renderLike = async (noteReaction: NoteReaction, note: Note) => { const reaction = noteReaction.reaction; - const object = { + const object = { type: 'Like', id: `${config.url}/likes/${noteReaction.id}`, actor: `${config.url}/users/${noteReaction.userId}`, diff --git a/packages/client/src/components/drive-window.vue b/packages/client/src/components/drive-window.vue index 5bbfca83c9..51ea2b5015 100644 --- a/packages/client/src/components/drive-window.vue +++ b/packages/client/src/components/drive-window.vue @@ -13,7 +13,7 @@ From 170b1b89bad60193c7da7a32d5df0fd31140fd76 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 13 Jul 2022 16:33:52 +0900 Subject: [PATCH 18/35] chore(client): fix type def --- packages/client/src/components/form/input.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/components/form/input.vue b/packages/client/src/components/form/input.vue index ec1ad20de3..1cc3912178 100644 --- a/packages/client/src/components/form/input.vue +++ b/packages/client/src/components/form/input.vue @@ -41,7 +41,7 @@ import { useInterval } from '@/scripts/use-interval'; const props = defineProps<{ modelValue: string | number; - type?: 'text' | 'number' | 'password' | 'email' | 'url' | 'date' | 'time'; + type?: 'text' | 'number' | 'password' | 'email' | 'url' | 'date' | 'time' | 'search'; required?: boolean; readonly?: boolean; disabled?: boolean; From 0bcfa2d04f308387aaa3a34ab7ec4804c9c34e09 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 13 Jul 2022 18:09:41 +0900 Subject: [PATCH 19/35] chore(client): tweak explore page --- packages/client/src/pages/explore.users.vue | 7 ++++++- packages/client/src/pages/explore.vue | 13 +++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/packages/client/src/pages/explore.users.vue b/packages/client/src/pages/explore.users.vue index bdc96b33a3..8af37ab529 100644 --- a/packages/client/src/pages/explore.users.vue +++ b/packages/client/src/pages/explore.users.vue @@ -1,5 +1,9 @@