tamaina 2021-04-24 00:36:43 +09:00
parent 524c213ba2
commit d24fedc018
1 changed files with 36 additions and 27 deletions

View File

@ -94,7 +94,9 @@ export default defineComponent({
if (localOnly === '0') this.localOnly = false; if (localOnly === '0') this.localOnly = false;
else if (localOnly === '1') this.localOnly = true; else if (localOnly === '1') this.localOnly = true;
await Promise.all([(async () => {
try {
//#region Reply
const replyId = urlParams.get('replyId'); const replyId = urlParams.get('replyId');
const replyUri = urlParams.get('replyUri'); const replyUri = urlParams.get('replyUri');
if (replyId) { if (replyId) {
@ -109,33 +111,40 @@ export default defineComponent({
this.reply = obj.object; this.reply = obj.object;
} }
} }
})(),(async () => { //#endregion
const renoteId = urlParams.get('renoteId');
const renoteUri = urlParams.get('renoteUri'); //#region Renote
if (renoteId) { const renoteId = urlParams.get('renoteId');
this.renote = await os.api('notes/show', { const renoteUri = urlParams.get('renoteUri');
noteId: renoteId if (renoteId) {
}); this.renote = await os.api('notes/show', {
} else if (renoteUri) { noteId: renoteId
const obj = await os.api('ap/show', { });
uri: renoteUri } else if (renoteUri) {
}) as any; const obj = await os.api('ap/show', {
if (obj.type === 'Note') { uri: renoteUri
this.renote = obj.object; }) as any;
if (obj.type === 'Note') {
this.renote = obj.object;
}
} }
} //#endregion
})(),(async () => {
const fileIds = urlParams.get('fileIds'); //#region Drive files
if (fileIds) { const fileIds = urlParams.get('fileIds');
const promises = Promise.all(fileIds.split(',') if (fileIds) {
.map(fileId => os.api('drive/files/show', { fileId }).catch(() => Error(`invalid fileId: ${fileId}`)))); const promises = Promise.all(fileIds.split(',')
await promises.then(files => this.files = files); .map(fileId => os.api('drive/files/show', { fileId }).catch(() => Error(`invalid fileId: ${fileId}`))));
} await promises.then(files => this.files = files);
})(),]).catch(e => os.dialog({ }
type: 'error', //#endregion
title: e.message, } catch (e) {
text: e.name os.dialog({
})); type: 'error',
title: e.message,
text: e.name
});
}
this.state = 'writing'; this.state = 'writing';
}, },