diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 32bafcd661..b49d872a0b 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -920,6 +920,10 @@ like: "いいね!" unlike: "いいねを解除" numberOfLikes: "いいね数" show: "表示" +neverShow: "今後表示しない" +remindMeLater: "また後で" +didYouLikeMisskey: "Misskeyを気に入っていただけましたか?" +pleaseDonate: "Misskeyは{host}が使用している無料のソフトウェアです。これからも開発を続けられるように、ぜひ寄付をお願いします!" _sensitiveMediaDetection: description: "機械学習を使って自動でセンシティブなメディアを検出し、モデレーションに役立てることができます。サーバーの負荷が少し増えます。" diff --git a/packages/frontend/src/components/MkDonation.vue b/packages/frontend/src/components/MkDonation.vue new file mode 100644 index 0000000000..707444abc9 --- /dev/null +++ b/packages/frontend/src/components/MkDonation.vue @@ -0,0 +1,109 @@ + + + + + + + + + + + + + {{ i18n.ts.didYouLikeMisskey }} + + + + {{ $instance.name ?? host }} + + + + {{ i18n.ts.learnMore }} + + + + {{ i18n.ts.remindMeLater }} + {{ i18n.ts.neverShow }} + + + + + + + + + diff --git a/packages/frontend/src/init.ts b/packages/frontend/src/init.ts index bd515f47ea..e10315e1ad 100644 --- a/packages/frontend/src/init.ts +++ b/packages/frontend/src/init.ts @@ -357,6 +357,14 @@ import { miLocalStorage } from './local-storage'; } miLocalStorage.setItem('lastUsed', Date.now().toString()); + const latestDonationInfoShownAt = miLocalStorage.getItem('latestDonationInfoShownAt'); + const neverShowDonationInfo = miLocalStorage.getItem('neverShowDonationInfo'); + if (neverShowDonationInfo !== 'true' && (new Date($i.createdAt).getTime() < (Date.now() - (1000 * 60 * 60 * 24 * 3)))) { + if (latestDonationInfoShownAt == null || (new Date(latestDonationInfoShownAt).getTime() < (Date.now() - (1000 * 60 * 60 * 24 * 30)))) { + popup(defineAsyncComponent(() => import('@/components/MkDonation.vue')), {}, {}, 'closed'); + } + } + if ('Notification' in window) { // 許可を得ていなかったらリクエスト if (Notification.permission === 'default') { diff --git a/packages/frontend/src/local-storage.ts b/packages/frontend/src/local-storage.ts index 5286a6f3a7..50e28d621f 100644 --- a/packages/frontend/src/local-storage.ts +++ b/packages/frontend/src/local-storage.ts @@ -4,6 +4,8 @@ type Keys = 'instance' | 'account' | 'accounts' | + 'latestDonationInfoShownAt' | + 'neverShowDonationInfo' | 'lastUsed' | 'lang' | 'drafts' | diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts index 97b6ebc188..b2bf8db646 100644 --- a/packages/frontend/src/store.ts +++ b/packages/frontend/src/store.ts @@ -86,14 +86,6 @@ export const defaultStore = markRaw(new Storage('base', { where: 'account', default: [] as string[], }, - latestDonateDialogShowAt: { - where: 'account', - default: null, - }, - neverShowDonateDialog: { - where: 'account', - default: false, - }, menu: { where: 'deviceAccount',