Merge tag '13.12.1' into merge-upstream
This commit is contained in:
commit
0b29445222
388 changed files with 12041 additions and 6800 deletions
|
|
@ -60,6 +60,7 @@ export const ACHIEVEMENT_TYPES = [
|
|||
'iLoveMisskey',
|
||||
'foundTreasure',
|
||||
'client30min',
|
||||
'client60min',
|
||||
'noteDeletedWithin1min',
|
||||
'postedAtLateNight',
|
||||
'postedAt0min0sec',
|
||||
|
|
@ -343,6 +344,11 @@ export const ACHIEVEMENT_BADGES = {
|
|||
bg: 'linear-gradient(0deg, rgb(220 223 225), rgb(172 192 207))',
|
||||
frame: 'bronze',
|
||||
},
|
||||
'client60min': {
|
||||
img: '/fluent-emoji/1f552.png',
|
||||
bg: 'linear-gradient(0deg, rgb(220 223 225), rgb(172 192 207))',
|
||||
frame: 'silver',
|
||||
},
|
||||
'noteDeletedWithin1min': {
|
||||
img: '/fluent-emoji/1f5d1.png',
|
||||
bg: 'linear-gradient(0deg, rgb(220 223 225), rgb(172 192 207))',
|
||||
|
|
@ -458,6 +464,7 @@ const claimingQueue = new Set<string>();
|
|||
|
||||
export async function claimAchievement(type: typeof ACHIEVEMENT_TYPES[number]) {
|
||||
if ($i == null) return;
|
||||
if ($i.movedTo) return;
|
||||
if (claimedAchievements.includes(type)) return;
|
||||
claimingQueue.add(type);
|
||||
claimedAchievements.push(type);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ export function createAiScriptEnv(opts) {
|
|||
title: title.value,
|
||||
text: text.value,
|
||||
});
|
||||
return values.NULL;
|
||||
}),
|
||||
'Mk:confirm': values.FN_NATIVE(async ([title, text, type]) => {
|
||||
const confirm = await os.confirm({
|
||||
|
|
|
|||
|
|
@ -36,6 +36,12 @@ function toggleSensitive(file: Misskey.entities.DriveFile) {
|
|||
os.api('drive/files/update', {
|
||||
fileId: file.id,
|
||||
isSensitive: !file.isSensitive,
|
||||
}).catch(err => {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
title: i18n.ts.error,
|
||||
text: err.message,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -74,6 +80,12 @@ export function getDriveFileMenu(file: Misskey.entities.DriveFile) {
|
|||
icon: 'ti ti-text-caption',
|
||||
action: () => describe(file),
|
||||
}, null, {
|
||||
text: i18n.ts.createNoteFromTheFile,
|
||||
icon: 'ti ti-pencil',
|
||||
action: () => os.post({
|
||||
initialFiles: [file],
|
||||
}),
|
||||
}, {
|
||||
text: i18n.ts.copyUrl,
|
||||
icon: 'ti ti-link',
|
||||
action: () => copyUrl(file),
|
||||
|
|
|
|||
|
|
@ -211,6 +211,12 @@ export function getNoteMenu(props: {
|
|||
}, {}, 'closed');
|
||||
}
|
||||
|
||||
function showRenotes(): void {
|
||||
os.popup(defineAsyncComponent(() => import('@/components/MkRenotedUsersDialog.vue')), {
|
||||
noteId: appearNote.id,
|
||||
}, {}, 'closed');
|
||||
}
|
||||
|
||||
async function translate(): Promise<void> {
|
||||
if (props.translation.value != null) return;
|
||||
props.translating.value = true;
|
||||
|
|
@ -241,8 +247,12 @@ export function getNoteMenu(props: {
|
|||
text: i18n.ts.details,
|
||||
action: openDetail,
|
||||
}, {
|
||||
icon: 'ti ti-users',
|
||||
text: i18n.ts.reactions,
|
||||
icon: 'ti ti-repeat',
|
||||
text: i18n.ts.renotesList,
|
||||
action: showRenotes,
|
||||
}, {
|
||||
icon: 'ti ti-icons',
|
||||
text: i18n.ts.reactionsList,
|
||||
action: showReactions,
|
||||
}, {
|
||||
icon: 'ti ti-copy',
|
||||
|
|
|
|||
|
|
@ -98,6 +98,27 @@ export function getUserMenu(user: misskey.entities.UserDetailed, router: Router
|
|||
});
|
||||
}
|
||||
|
||||
async function editMemo(): Promise<void> {
|
||||
const userDetailed = await os.api('users/show', {
|
||||
userId: user.id,
|
||||
});
|
||||
const { canceled, result } = await os.form(i18n.ts.editMemo, {
|
||||
memo: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
multiline: true,
|
||||
label: i18n.ts.memo,
|
||||
default: userDetailed.memo,
|
||||
},
|
||||
});
|
||||
if (canceled) return;
|
||||
|
||||
os.apiWithDialog('users/update-memo', {
|
||||
memo: result.memo,
|
||||
userId: user.id,
|
||||
});
|
||||
}
|
||||
|
||||
let menu = [{
|
||||
icon: 'ti ti-at',
|
||||
text: i18n.ts.copyUsername,
|
||||
|
|
@ -123,6 +144,12 @@ export function getUserMenu(user: misskey.entities.UserDetailed, router: Router
|
|||
os.post({ specified: user, initialText: `@${user.username} ` });
|
||||
},
|
||||
}, null, {
|
||||
icon: 'ti ti-pencil',
|
||||
text: i18n.ts.editMemo,
|
||||
action: () => {
|
||||
editMemo();
|
||||
},
|
||||
}, {
|
||||
type: 'parent',
|
||||
icon: 'ti ti-list',
|
||||
text: i18n.ts.addToList,
|
||||
|
|
|
|||
|
|
@ -17,5 +17,5 @@ export function pleaseLogin(path?: string) {
|
|||
},
|
||||
}, 'closed');
|
||||
|
||||
if (!path) throw new Error('signin required');
|
||||
throw new Error('signin required');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,71 +6,77 @@ import { i18n } from '@/i18n';
|
|||
import { defaultStore } from '@/store';
|
||||
import { uploadFile } from '@/scripts/upload';
|
||||
|
||||
function select(src: any, label: string | null, multiple: boolean): Promise<DriveFile | DriveFile[]> {
|
||||
export function chooseFileFromPc(multiple: boolean, keepOriginal = false): Promise<DriveFile[]> {
|
||||
return new Promise((res, rej) => {
|
||||
const input = document.createElement('input');
|
||||
input.type = 'file';
|
||||
input.multiple = multiple;
|
||||
input.onchange = () => {
|
||||
const promises = Array.from(input.files).map(file => uploadFile(file, defaultStore.state.uploadFolder, undefined, keepOriginal));
|
||||
|
||||
Promise.all(promises).then(driveFiles => {
|
||||
res(driveFiles);
|
||||
}).catch(err => {
|
||||
// アップロードのエラーは uploadFile 内でハンドリングされているためアラートダイアログを出したりはしてはいけない
|
||||
});
|
||||
|
||||
// 一応廃棄
|
||||
(window as any).__misskey_input_ref__ = null;
|
||||
};
|
||||
|
||||
// https://qiita.com/fukasawah/items/b9dc732d95d99551013d
|
||||
// iOS Safari で正常に動かす為のおまじない
|
||||
(window as any).__misskey_input_ref__ = input;
|
||||
|
||||
input.click();
|
||||
});
|
||||
}
|
||||
|
||||
export function chooseFileFromDrive(multiple: boolean): Promise<DriveFile[]> {
|
||||
return new Promise((res, rej) => {
|
||||
os.selectDriveFile(multiple).then(files => {
|
||||
res(files);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export function chooseFileFromUrl(): Promise<DriveFile> {
|
||||
return new Promise((res, rej) => {
|
||||
os.inputText({
|
||||
title: i18n.ts.uploadFromUrl,
|
||||
type: 'url',
|
||||
placeholder: i18n.ts.uploadFromUrlDescription,
|
||||
}).then(({ canceled, result: url }) => {
|
||||
if (canceled) return;
|
||||
|
||||
const marker = Math.random().toString(); // TODO: UUIDとか使う
|
||||
|
||||
const connection = stream.useChannel('main');
|
||||
connection.on('urlUploadFinished', urlResponse => {
|
||||
if (urlResponse.marker === marker) {
|
||||
res(urlResponse.file);
|
||||
connection.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
os.api('drive/files/upload-from-url', {
|
||||
url: url,
|
||||
folderId: defaultStore.state.uploadFolder,
|
||||
marker,
|
||||
});
|
||||
|
||||
os.alert({
|
||||
title: i18n.ts.uploadFromUrlRequested,
|
||||
text: i18n.ts.uploadFromUrlMayTakeTime,
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function select(src: any, label: string | null, multiple: boolean): Promise<DriveFile[]> {
|
||||
return new Promise((res, rej) => {
|
||||
const keepOriginal = ref(defaultStore.state.keepOriginalUploading);
|
||||
|
||||
const chooseFileFromPc = () => {
|
||||
const input = document.createElement('input');
|
||||
input.type = 'file';
|
||||
input.multiple = multiple;
|
||||
input.onchange = () => {
|
||||
const promises = Array.from(input.files).map(file => uploadFile(file, defaultStore.state.uploadFolder, undefined, keepOriginal.value));
|
||||
|
||||
Promise.all(promises).then(driveFiles => {
|
||||
res(multiple ? driveFiles : driveFiles[0]);
|
||||
}).catch(err => {
|
||||
// アップロードのエラーは uploadFile 内でハンドリングされているためアラートダイアログを出したりはしてはいけない
|
||||
});
|
||||
|
||||
// 一応廃棄
|
||||
(window as any).__misskey_input_ref__ = null;
|
||||
};
|
||||
|
||||
// https://qiita.com/fukasawah/items/b9dc732d95d99551013d
|
||||
// iOS Safari で正常に動かす為のおまじない
|
||||
(window as any).__misskey_input_ref__ = input;
|
||||
|
||||
input.click();
|
||||
};
|
||||
|
||||
const chooseFileFromDrive = () => {
|
||||
os.selectDriveFile(multiple).then(files => {
|
||||
res(files);
|
||||
});
|
||||
};
|
||||
|
||||
const chooseFileFromUrl = () => {
|
||||
os.inputText({
|
||||
title: i18n.ts.uploadFromUrl,
|
||||
type: 'url',
|
||||
placeholder: i18n.ts.uploadFromUrlDescription,
|
||||
}).then(({ canceled, result: url }) => {
|
||||
if (canceled) return;
|
||||
|
||||
const marker = Math.random().toString(); // TODO: UUIDとか使う
|
||||
|
||||
const connection = stream.useChannel('main');
|
||||
connection.on('urlUploadFinished', urlResponse => {
|
||||
if (urlResponse.marker === marker) {
|
||||
res(multiple ? [urlResponse.file] : urlResponse.file);
|
||||
connection.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
os.api('drive/files/upload-from-url', {
|
||||
url: url,
|
||||
folderId: defaultStore.state.uploadFolder,
|
||||
marker,
|
||||
});
|
||||
|
||||
os.alert({
|
||||
title: i18n.ts.uploadFromUrlRequested,
|
||||
text: i18n.ts.uploadFromUrlMayTakeTime,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
os.popupMenu([label ? {
|
||||
text: label,
|
||||
type: 'label',
|
||||
|
|
@ -81,23 +87,23 @@ function select(src: any, label: string | null, multiple: boolean): Promise<Driv
|
|||
}, {
|
||||
text: i18n.ts.upload,
|
||||
icon: 'ti ti-upload',
|
||||
action: chooseFileFromPc,
|
||||
action: () => chooseFileFromPc(multiple, keepOriginal.value).then(files => res(files)),
|
||||
}, {
|
||||
text: i18n.ts.fromDrive,
|
||||
icon: 'ti ti-cloud',
|
||||
action: chooseFileFromDrive,
|
||||
action: () => chooseFileFromDrive(multiple).then(files => res(files)),
|
||||
}, {
|
||||
text: i18n.ts.fromUrl,
|
||||
icon: 'ti ti-link',
|
||||
action: chooseFileFromUrl,
|
||||
action: () => chooseFileFromUrl().then(file => res([file])),
|
||||
}], src);
|
||||
});
|
||||
}
|
||||
|
||||
export function selectFile(src: any, label: string | null = null): Promise<DriveFile> {
|
||||
return select(src, label, false) as Promise<DriveFile>;
|
||||
return select(src, label, false).then(files => files[0]);
|
||||
}
|
||||
|
||||
export function selectFiles(src: any, label: string | null = null): Promise<DriveFile[]> {
|
||||
return select(src, label, true) as Promise<DriveFile[]>;
|
||||
return select(src, label, true);
|
||||
}
|
||||
|
|
|
|||
16
packages/frontend/src/scripts/show-moved-dialog.ts
Normal file
16
packages/frontend/src/scripts/show-moved-dialog.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import * as os from '@/os';
|
||||
import { $i } from '@/account';
|
||||
import { i18n } from '@/i18n';
|
||||
|
||||
export function showMovedDialog() {
|
||||
if (!$i) return;
|
||||
if (!$i.movedTo) return;
|
||||
|
||||
os.alert({
|
||||
type: 'error',
|
||||
title: i18n.ts.accountMovedShort,
|
||||
text: i18n.ts.operationForbidden,
|
||||
});
|
||||
|
||||
throw new Error('account moved');
|
||||
}
|
||||
|
|
@ -83,7 +83,13 @@ export function uploadFile(
|
|||
// TODO: 消すのではなくて(ネットワーク的なエラーなら)再送できるようにしたい
|
||||
uploads.value = uploads.value.filter(x => x.id !== id);
|
||||
|
||||
if (ev.target?.response) {
|
||||
if (xhr.status === 413) {
|
||||
alert({
|
||||
type: 'error',
|
||||
title: i18n.ts.failedToUpload,
|
||||
text: i18n.ts.cannotUploadBecauseExceedsFileSizeLimit,
|
||||
});
|
||||
} else if (ev.target?.response) {
|
||||
const res = JSON.parse(ev.target.response);
|
||||
if (res.error?.id === 'bec5bd69-fba3-43c9-b4fb-2894b66ad5d2') {
|
||||
alert({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue