From e409abdd400111e5ddef4c8c6f0ef3550f81d8f5 Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Tue, 7 Nov 2023 11:38:50 +0100 Subject: [PATCH] upd: add frontend option to export data --- locales/en-US.yml | 6 +++++ locales/index.d.ts | 6 +++++ locales/ja-JP.yml | 6 +++++ .../frontend/src/pages/settings/other.vue | 25 +++++++++++++++++++ 4 files changed, 43 insertions(+) diff --git a/locales/en-US.yml b/locales/en-US.yml index 041ac21783..730e7450dc 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -2401,3 +2401,9 @@ _animatedMFM: _alert: text: "Animated MFMs could include flashing lights and fast moving text/emojis." confirm: "Animate" + +_dataRequest: + title: "Request Data" + warn: "Data requests are only possible every 3 days." + text: "Once the data is ready to download, an email will be sent to the email address registered to this account." + button: "Request" diff --git a/locales/index.d.ts b/locales/index.d.ts index 56a9f9bc2d..d4934b77a5 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -2509,6 +2509,12 @@ export interface Locale { "confirm": string; }; }; + "_dataRequest": { + "title": string; + "warn": string; + "text": string; + "button": string; + }; } declare const locales: { [lang: string]: Locale; diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index c45a820e3b..36521c8817 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -2395,3 +2395,9 @@ _animatedMFM: _alert: text: "アニメーションMFMには、点滅するライトや高速で動くテキスト/絵文字を含めることができる。" confirm: "アニメイト" + +_dataRequest: + title: "リクエストデータ" + warn: "データのリクエストは3日ごとにしかできない。" + text: "データのダウンロードが完了すると、このアカウントに登録されているEメールアドレスにEメールが送信されます。" + button: "リクエスト" diff --git a/packages/frontend/src/pages/settings/other.vue b/packages/frontend/src/pages/settings/other.vue index 3bd3ddbe9b..eb2ee27602 100644 --- a/packages/frontend/src/pages/settings/other.vue +++ b/packages/frontend/src/pages/settings/other.vue @@ -34,6 +34,17 @@ SPDX-License-Identifier: AGPL-3.0-only + + + + +
+ {{ i18n.ts._dataRequest.warn }} + {{ i18n.ts._dataRequest.text }} + {{ i18n.ts._dataRequest.button }} +
+
+ @@ -156,6 +167,20 @@ async function updateRepliesAll(withReplies: boolean) { await os.api('following/update-all', { withReplies }); } +const exportData = () => { + os.api('i/export-data', {}).then(() => { + os.alert({ + type: 'info', + text: i18n.ts.exportRequested, + }); + }).catch((ev) => { + os.alert({ + type: 'error', + text: ev.message, + }); + }); +}; + watch([ enableCondensedLineForAcct, ], async () => {