Merge remote-tracking branch 'misskey-dev/develop' into prismisskey

# Conflicts:
#	package.json
#	packages/frontend/src/pages/settings/general.vue
This commit is contained in:
mattyatea 2023-09-22 20:03:34 +09:00
commit a63bef2d8f
58 changed files with 741 additions and 517 deletions

View file

@ -94,16 +94,12 @@ withDefaults(defineProps<{
const usePasswordLessLogin = $computed(() => $i?.usePasswordLessLogin ?? false);
async function registerTOTP(): Promise<void> {
const password = await os.inputText({
title: i18n.ts._2fa.registerTOTP,
text: i18n.ts._2fa.passwordToTOTP,
type: 'password',
autocomplete: 'current-password',
});
if (password.canceled) return;
const auth = await os.authenticateDialog();
if (auth.canceled) return;
const twoFactorData = await os.apiWithDialog('i/2fa/register', {
password: password.result,
password: auth.result.password,
token: auth.result.token,
});
os.popup(defineAsyncComponent(() => import('./2fa.qrdialog.vue')), {
@ -111,20 +107,17 @@ async function registerTOTP(): Promise<void> {
}, {}, 'closed');
}
function unregisterTOTP(): void {
os.inputText({
title: i18n.ts.password,
type: 'password',
autocomplete: 'current-password',
}).then(({ canceled, result: password }) => {
if (canceled) return;
os.apiWithDialog('i/2fa/unregister', {
password: password,
}).catch(error => {
os.alert({
type: 'error',
text: error,
});
async function unregisterTOTP(): Promise<void> {
const auth = await os.authenticateDialog();
if (auth.canceled) return;
os.apiWithDialog('i/2fa/unregister', {
password: auth.result.password,
token: auth.result.token,
}).catch(error => {
os.alert({
type: 'error',
text: error,
});
});
}
@ -150,15 +143,12 @@ async function unregisterKey(key) {
});
if (confirm.canceled) return;
const password = await os.inputText({
title: i18n.ts.password,
type: 'password',
autocomplete: 'current-password',
});
if (password.canceled) return;
const auth = await os.authenticateDialog();
if (auth.canceled) return;
await os.apiWithDialog('i/2fa/remove-key', {
password: password.result,
password: auth.result.password,
token: auth.result.token,
credentialId: key.id,
});
os.success();
@ -181,16 +171,13 @@ async function renameKey(key) {
}
async function addSecurityKey() {
const password = await os.inputText({
title: i18n.ts.password,
type: 'password',
autocomplete: 'current-password',
});
if (password.canceled) return;
const auth = await os.authenticateDialog();
if (auth.canceled) return;
const registrationOptions = parseCreationOptionsFromJSON({
publicKey: await os.apiWithDialog('i/2fa/register-key', {
password: password.result,
password: auth.result.password,
token: auth.result.token,
}),
});
@ -211,8 +198,12 @@ async function addSecurityKey() {
);
if (!credential) return;
const auth2 = await os.authenticateDialog();
if (auth2.canceled) return;
await os.apiWithDialog('i/2fa/key-done', {
password: password.result,
password: auth.result.password,
token: auth.result.token,
name: name.result,
credential: credential.toJSON(),
});

View file

@ -67,18 +67,16 @@ const onChangeReceiveAnnouncementEmail = (v) => {
});
};
const saveEmailAddress = () => {
os.inputText({
title: i18n.ts.password,
type: 'password',
}).then(({ canceled, result: password }) => {
if (canceled) return;
os.apiWithDialog('i/update-email', {
password: password,
email: emailAddress.value,
});
async function saveEmailAddress() {
const auth = await os.authenticateDialog();
if (auth.canceled) return;
os.apiWithDialog('i/update-email', {
password: auth.result.password,
token: auth.result.token,
email: emailAddress.value,
});
};
}
const emailNotification_mention = ref($i!.emailNotificationTypes.includes('mention'));
const emailNotification_reply = ref($i!.emailNotificationTypes.includes('reply'));

View file

@ -116,6 +116,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSwitch v-model="useBlurEffect">{{ i18n.ts.useBlurEffect }}</MkSwitch>
<MkSwitch v-model="useBlurEffectForModal">{{ i18n.ts.useBlurEffectForModal }}</MkSwitch>
<MkSwitch v-model="disableShowingAnimatedImages">{{ i18n.ts.disableShowingAnimatedImages }}</MkSwitch>
<MkSwitch v-model="highlightSensitiveMedia">{{ i18n.ts.highlightSensitiveMedia }}</MkSwitch>
<MkSwitch v-model="squareAvatars">{{ i18n.ts.squareAvatars }}</MkSwitch>
<MkSwitch v-model="useSystemFont">{{ i18n.ts.useSystemFont }}</MkSwitch>
<MkSwitch v-model="disableDrawer">{{ i18n.ts.disableDrawer }}</MkSwitch>
@ -243,6 +244,7 @@ const enableDataSaverMode = computed(defaultStore.makeGetterSetter('enableDataSa
const enableCellularWithDataSaver = computed(defaultStore.makeGetterSetter('enableCellularWithDataSaver'));
const enableUltimateDataSaverMode = computed(defaultStore.makeGetterSetter('enableUltimateDataSaverMode'))
const enableCellularWithUltimateDataSaver = computed(defaultStore.makeGetterSetter('enableCellularWithUltimateDataSaver'));
const highlightSensitiveMedia = computed(defaultStore.makeGetterSetter('highlightSensitiveMedia'));
const imageNewTab = computed(defaultStore.makeGetterSetter('imageNewTab'));
const nsfw = computed(defaultStore.makeGetterSetter('nsfw'));
const showFixedPostForm = computed(defaultStore.makeGetterSetter('showFixedPostForm'));
@ -293,6 +295,7 @@ watch([
overridedDeviceKind,
mediaListWithOneImageAppearance,
reactionsDisplaySize,
highlightSensitiveMedia,
keepScreenOn,
], async () => {
await reloadAsk();

View file

@ -113,14 +113,12 @@ async function deleteAccount() {
if (canceled) return;
}
const { canceled, result: password } = await os.inputText({
title: i18n.ts.password,
type: 'password',
});
if (canceled) return;
const auth = await os.authenticateDialog();
if (auth.canceled) return;
await os.apiWithDialog('i/delete-account', {
password: password,
password: auth.result.password,
token: auth.result.token,
});
await os.alert({

View file

@ -55,13 +55,6 @@ const pagination = {
};
async function change() {
const { canceled: canceled1, result: currentPassword } = await os.inputText({
title: i18n.ts.currentPassword,
type: 'password',
autocomplete: 'current-password',
});
if (canceled1) return;
const { canceled: canceled2, result: newPassword } = await os.inputText({
title: i18n.ts.newPassword,
type: 'password',
@ -84,21 +77,23 @@ async function change() {
return;
}
const auth = await os.authenticateDialog();
if (auth.canceled) return;
os.apiWithDialog('i/change-password', {
currentPassword,
currentPassword: auth.result.password,
token: auth.result.token,
newPassword,
});
}
function regenerateToken() {
os.inputText({
title: i18n.ts.password,
type: 'password',
}).then(({ canceled, result: password }) => {
if (canceled) return;
os.api('i/regenerate-token', {
password: password,
});
async function regenerateToken() {
const auth = await os.authenticateDialog();
if (auth.canceled) return;
os.api('i/regenerate-token', {
password: auth.result.password,
token: auth.result.token,
});
}