fix await eating array, make document
This commit is contained in:
parent
8e5fdc7851
commit
491e414032
|
@ -1,7 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="">
|
<div class="">
|
||||||
<section class="_section">
|
<section class="_section">
|
||||||
<div class="_title" v-if="title">{{ title }}</div>
|
|
||||||
<div class="_content">
|
<div class="_content">
|
||||||
<XPostForm
|
<XPostForm
|
||||||
v-if="state === 'writing'"
|
v-if="state === 'writing'"
|
||||||
|
@ -24,7 +23,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
// SPECIFICATION: https://wiki.misskey.io/ja/advanced-functions/share
|
// SPECIFICATION: /src/docs/ja-JP/advanced/share-page.md
|
||||||
|
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import MkButton from '@client/components/ui/button.vue';
|
import MkButton from '@client/components/ui/button.vue';
|
||||||
|
@ -68,7 +67,7 @@ export default defineComponent({
|
||||||
const url = urlParams.get('url');
|
const url = urlParams.get('url');
|
||||||
|
|
||||||
let noteText = '';
|
let noteText = '';
|
||||||
if (this.title) noteText += `【${this.title}】\n`;
|
if (this.title) noteText += `[ ${this.title} ]\n`;
|
||||||
// Googleニュース対策
|
// Googleニュース対策
|
||||||
if (text?.startsWith(`${this.title}.\n`)) noteText += text.replace(`${this.title}.\n`, '');
|
if (text?.startsWith(`${this.title}.\n`)) noteText += text.replace(`${this.title}.\n`, '');
|
||||||
else if (text && this.title !== text) noteText += `${text}\n`;
|
else if (text && this.title !== text) noteText += `${text}\n`;
|
||||||
|
@ -83,18 +82,17 @@ export default defineComponent({
|
||||||
if (this.visibility === 'specified') {
|
if (this.visibility === 'specified') {
|
||||||
const visibleUserIds = urlParams.get('visibleUserIds');
|
const visibleUserIds = urlParams.get('visibleUserIds');
|
||||||
const visibleAccts = urlParams.get('visibleAccts');
|
const visibleAccts = urlParams.get('visibleAccts');
|
||||||
this.visibleUsers = await [
|
this.visibleUsers = await Promise.all([
|
||||||
...(visibleUserIds ? visibleUserIds.split(',').map(userId => ({ userId })) : []),
|
...(visibleUserIds ? visibleUserIds.split(',').map(userId => ({ userId })) : []),
|
||||||
...(visibleAccts ? visibleAccts.split(',').map(parseAcct) : [])
|
...(visibleAccts ? visibleAccts.split(',').map(parseAcct) : [])
|
||||||
].map(q => os.api('users/show', q)
|
].map(q => os.api('users/show', q)
|
||||||
.catch(() => Error(`invalid user query: ${JSON.stringify(q)}`)));
|
.catch(() => console.error(`invalid user query: ${JSON.stringify(q)}`))));
|
||||||
}
|
}
|
||||||
|
|
||||||
const localOnly = urlParams.get('localOnly');
|
const localOnly = urlParams.get('localOnly');
|
||||||
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;
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//#region Reply
|
//#region Reply
|
||||||
const replyId = urlParams.get('replyId');
|
const replyId = urlParams.get('replyId');
|
||||||
|
@ -114,29 +112,28 @@ export default defineComponent({
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region Renote
|
//#region Renote
|
||||||
const renoteId = urlParams.get('renoteId');
|
const renoteId = urlParams.get('renoteId');
|
||||||
const renoteUri = urlParams.get('renoteUri');
|
const renoteUri = urlParams.get('renoteUri');
|
||||||
if (renoteId) {
|
if (renoteId) {
|
||||||
this.renote = await os.api('notes/show', {
|
this.renote = await os.api('notes/show', {
|
||||||
noteId: renoteId
|
noteId: renoteId
|
||||||
});
|
});
|
||||||
} else if (renoteUri) {
|
} else if (renoteUri) {
|
||||||
const obj = await os.api('ap/show', {
|
const obj = await os.api('ap/show', {
|
||||||
uri: renoteUri
|
uri: renoteUri
|
||||||
}) as any;
|
}) as any;
|
||||||
if (obj.type === 'Note') {
|
if (obj.type === 'Note') {
|
||||||
this.renote = obj.object;
|
this.renote = obj.object;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region Drive files
|
//#region Drive files
|
||||||
const fileIds = urlParams.get('fileIds');
|
const fileIds = urlParams.get('fileIds');
|
||||||
if (fileIds) {
|
if (fileIds) {
|
||||||
const promises = Promise.all(fileIds.split(',')
|
const promises = fileIds.split(',').map(fileId => os.api('drive/files/show', { fileId }).catch(() => console.error(`invalid fileId: ${fileId}`)));
|
||||||
.map(fileId => os.api('drive/files/show', { fileId }).catch(() => Error(`invalid fileId: ${fileId}`))));
|
await Promise.all(promises).then(files => this.files = files);
|
||||||
await promises.then(files => this.files = files);
|
}
|
||||||
}
|
|
||||||
//#endregion
|
//#endregion
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
os.dialog({
|
os.dialog({
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
# シェアページ
|
||||||
|
`/share`を開くと、共有用の投稿フォームを開くことができます。
|
||||||
|
ここではシェアページで利用できるクエリ文字列の一覧を示します。
|
||||||
|
|
||||||
|
## クエリ文字列一覧
|
||||||
|
### 文字
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt>title</dt>
|
||||||
|
<dd>タイトルです。本文の先頭に[ … ]と挿入されます。</dd>
|
||||||
|
<dt>text</dt>
|
||||||
|
<dd>本文です。</dd>
|
||||||
|
<dt>url</dt>
|
||||||
|
<dd>URLです。末尾に挿入されます。</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
### リプライ情報
|
||||||
|
以下のいずれか
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt>replyId</dt>
|
||||||
|
<dd>リプライ先のノートid</dd>
|
||||||
|
<dt>replyUri</dt>
|
||||||
|
<dd>リプライ先のUrl(リモートのノートオブジェクトを指定)</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
### Renote情報
|
||||||
|
以下のいずれか
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt>renoteId</dt>
|
||||||
|
<dd>Renote先のノートid</dd>
|
||||||
|
<dt>renoteUri</dt>
|
||||||
|
<dd>Renote先のUrl(リモートのノートオブジェクトを指定)</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
### 公開範囲
|
||||||
|
※specifiedに相当する値はvisibility=specifiedとvisibleAccts/visibleUserIdsで指定する
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt>visibility</dt>
|
||||||
|
<dd>公開範囲 ['public' | 'home' | 'followers' | 'specified']</dd>
|
||||||
|
<dt>localOnly</dt>
|
||||||
|
<dd>0(false) or 1(true)</dd>
|
||||||
|
<dt>visibleUserIds</dt>
|
||||||
|
<dd>specified時のダイレクト先のユーザーid カンマ区切りで</dd>
|
||||||
|
<dt>visibleAccts</dt>
|
||||||
|
<dd>specified時のダイレクト先のacct(@?username[@host]) カンマ区切りで</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
### ファイル
|
||||||
|
<dl>
|
||||||
|
<dt>fileIds</dt>
|
||||||
|
<dd>添付したいファイルのid(カンマ区切りで)</dd>
|
||||||
|
</dl>
|
Loading…
Reference in New Issue