forked from FoundKeyGang/FoundKey
Resolve #3431
This commit is contained in:
parent
f379a721f1
commit
16b81fff38
4 changed files with 56 additions and 0 deletions
|
@ -26,6 +26,7 @@ unreleased
|
|||
* APNGサポート
|
||||
* アバターファイル選択でimage以外は表示しないように
|
||||
* データベース手動バキューム機能
|
||||
* メールサーバー設定が正しいか確認できるように
|
||||
* ピン止めの上限に達したときエラーを表示するように
|
||||
* AP: attributedTo, to, cc が Array や Object のパターンに対応
|
||||
* AP: object type が Audio, Document, Image, Page, Video のパターンに対応
|
||||
|
|
|
@ -1389,6 +1389,8 @@ admin/views/instance.vue:
|
|||
smtp-auth: "SMTP認証を行う"
|
||||
smtp-user: "SMTPユーザー"
|
||||
smtp-pass: "SMTPパスワード"
|
||||
test-email: "テスト"
|
||||
test-email-to: "テストメールの送信先アドレス"
|
||||
serviceworker-config: "ServiceWorker"
|
||||
enable-serviceworker: "ServiceWorkerを有効にする"
|
||||
serviceworker-info: "プッシュ通知を行うには有効する必要があります。"
|
||||
|
|
|
@ -129,6 +129,7 @@
|
|||
<ui-input v-model="smtpPass" type="password" :with-password-toggle="true" :disabled="!enableEmail || !smtpAuth">{{ $t('smtp-pass') }}</ui-input>
|
||||
</ui-horizon-group>
|
||||
<ui-switch v-model="smtpSecure" :disabled="!enableEmail">{{ $t('smtp-secure') }}<template #desc>{{ $t('smtp-secure-info') }}</template></ui-switch>
|
||||
<ui-button @click="testEmail()">{{ $t('test-email') }}</ui-button>
|
||||
</template>
|
||||
</section>
|
||||
<section>
|
||||
|
@ -424,6 +425,32 @@ export default Vue.extend({
|
|||
});
|
||||
},
|
||||
|
||||
async testEmail() {
|
||||
const { canceled, result: to } = await this.$root.dialog({
|
||||
title: this.$t('test-email-to'),
|
||||
input: {
|
||||
type: 'email',
|
||||
},
|
||||
showCancelButton: true
|
||||
});
|
||||
if (canceled) return;
|
||||
this.$root.api('admin/send-email', {
|
||||
to: to,
|
||||
subject: 'Test email',
|
||||
text: 'Yo'
|
||||
}).then(x => {
|
||||
this.$root.dialog({
|
||||
type: 'success',
|
||||
splash: true
|
||||
});
|
||||
}).catch(e => {
|
||||
this.$root.dialog({
|
||||
type: 'error',
|
||||
text: e
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
updateMeta() {
|
||||
this.$root.api('admin/update-meta', {
|
||||
maintainerName: this.maintainerName,
|
||||
|
|
26
src/server/api/endpoints/admin/send-email.ts
Normal file
26
src/server/api/endpoints/admin/send-email.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
import $ from 'cafy';
|
||||
import define from '../../define';
|
||||
import { sendEmail } from '../../../../services/send-email';
|
||||
|
||||
export const meta = {
|
||||
tags: ['admin'],
|
||||
|
||||
requireCredential: true,
|
||||
requireModerator: true,
|
||||
|
||||
params: {
|
||||
to: {
|
||||
validator: $.str,
|
||||
},
|
||||
subject: {
|
||||
validator: $.str,
|
||||
},
|
||||
text: {
|
||||
validator: $.str,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export default define(meta, async (ps) => {
|
||||
await sendEmail(ps.to, ps.subject, ps.text);
|
||||
});
|
Loading…
Reference in a new issue