Merge branch 'more-share-page-querys' into swn
This commit is contained in:
		@@ -14,6 +14,7 @@
 | 
			
		||||
- API: notifications/readは配列でも受け付けるように
 | 
			
		||||
- localStorageのaccountsはindexedDBで保持するように
 | 
			
		||||
- API: sw/unregisterを追加
 | 
			
		||||
- /share のクエリでリプライやファイル等の情報を渡せるように
 | 
			
		||||
 | 
			
		||||
### Bugfixes
 | 
			
		||||
- チャンネルを作成しているとアカウントを削除できないのを修正
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,6 @@
 | 
			
		||||
<template>
 | 
			
		||||
<div class="">
 | 
			
		||||
	<section class="_section">
 | 
			
		||||
		<div class="_title" v-if="title">{{ title }}</div>
 | 
			
		||||
		<div class="_content">
 | 
			
		||||
			<XPostForm
 | 
			
		||||
				v-if="state === 'writing'"
 | 
			
		||||
@@ -24,7 +23,7 @@
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<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 MkButton from '@client/components/ui/button.vue';
 | 
			
		||||
@@ -68,7 +67,7 @@ export default defineComponent({
 | 
			
		||||
		const url = urlParams.get('url');
 | 
			
		||||
 | 
			
		||||
		let noteText = '';
 | 
			
		||||
		if (this.title) noteText += `【${this.title}】\n`;
 | 
			
		||||
		if (this.title) noteText += `[ ${this.title} ]\n`;
 | 
			
		||||
		// Googleニュース対策
 | 
			
		||||
		if (text?.startsWith(`${this.title}.\n`)) noteText += text.replace(`${this.title}.\n`, '');
 | 
			
		||||
		else if (text && this.title !== text) noteText += `${text}\n`;
 | 
			
		||||
@@ -83,18 +82,17 @@ export default defineComponent({
 | 
			
		||||
		if (this.visibility === 'specified') {
 | 
			
		||||
			const visibleUserIds = urlParams.get('visibleUserIds');
 | 
			
		||||
			const visibleAccts = urlParams.get('visibleAccts');
 | 
			
		||||
			this.visibleUsers = await [
 | 
			
		||||
			this.visibleUsers = await Promise.all([
 | 
			
		||||
				...(visibleUserIds ? visibleUserIds.split(',').map(userId => ({ userId })) : []),
 | 
			
		||||
				...(visibleAccts ? visibleAccts.split(',').map(parseAcct) : [])
 | 
			
		||||
			].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');
 | 
			
		||||
		if (localOnly === '0') this.localOnly = false;
 | 
			
		||||
		else if (localOnly === '1') this.localOnly = true;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		try {
 | 
			
		||||
			//#region Reply
 | 
			
		||||
			const replyId = urlParams.get('replyId');
 | 
			
		||||
@@ -114,29 +112,28 @@ export default defineComponent({
 | 
			
		||||
			//#endregion
 | 
			
		||||
 | 
			
		||||
			//#region Renote
 | 
			
		||||
				const renoteId = urlParams.get('renoteId');
 | 
			
		||||
				const renoteUri = urlParams.get('renoteUri');
 | 
			
		||||
				if (renoteId) {
 | 
			
		||||
					this.renote = await os.api('notes/show', {
 | 
			
		||||
						noteId: renoteId
 | 
			
		||||
					});
 | 
			
		||||
				} else if (renoteUri) {
 | 
			
		||||
					const obj = await os.api('ap/show', {
 | 
			
		||||
						uri: renoteUri
 | 
			
		||||
					}) as any;
 | 
			
		||||
					if (obj.type === 'Note') {
 | 
			
		||||
						this.renote = obj.object;
 | 
			
		||||
					}
 | 
			
		||||
			const renoteId = urlParams.get('renoteId');
 | 
			
		||||
			const renoteUri = urlParams.get('renoteUri');
 | 
			
		||||
			if (renoteId) {
 | 
			
		||||
				this.renote = await os.api('notes/show', {
 | 
			
		||||
					noteId: renoteId
 | 
			
		||||
				});
 | 
			
		||||
			} else if (renoteUri) {
 | 
			
		||||
				const obj = await os.api('ap/show', {
 | 
			
		||||
					uri: renoteUri
 | 
			
		||||
				}) as any;
 | 
			
		||||
				if (obj.type === 'Note') {
 | 
			
		||||
					this.renote = obj.object;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			//#endregion
 | 
			
		||||
 | 
			
		||||
			//#region Drive files
 | 
			
		||||
				const fileIds = urlParams.get('fileIds');
 | 
			
		||||
				if (fileIds) {
 | 
			
		||||
					const promises = Promise.all(fileIds.split(',')
 | 
			
		||||
						.map(fileId => os.api('drive/files/show', { fileId }).catch(() => Error(`invalid fileId: ${fileId}`))));
 | 
			
		||||
					await promises.then(files => this.files = files);
 | 
			
		||||
				}
 | 
			
		||||
			const fileIds = urlParams.get('fileIds');
 | 
			
		||||
			if (fileIds) {
 | 
			
		||||
				const promises = fileIds.split(',').map(fileId => os.api('drive/files/show', { fileId }).catch(() => console.error(`invalid fileId: ${fileId}`)));
 | 
			
		||||
				await Promise.all(promises).then(files => this.files = files);
 | 
			
		||||
			}
 | 
			
		||||
			//#endregion
 | 
			
		||||
		} catch (e) {
 | 
			
		||||
			os.dialog({
 | 
			
		||||
 
 | 
			
		||||
@@ -99,7 +99,7 @@ export default defineComponent({
 | 
			
		||||
			type: Object,
 | 
			
		||||
			required: false
 | 
			
		||||
		},
 | 
			
		||||
		instant: {
 | 
			
		||||
		share: {
 | 
			
		||||
			type: Boolean,
 | 
			
		||||
			required: false,
 | 
			
		||||
			default: false
 | 
			
		||||
@@ -276,7 +276,7 @@ export default defineComponent({
 | 
			
		||||
 | 
			
		||||
		this.$nextTick(() => {
 | 
			
		||||
			// 書きかけの投稿を復元
 | 
			
		||||
			if (!this.instant && !this.mention && !this.specified) {
 | 
			
		||||
			if (!this.share && !this.mention && !this.specified) {
 | 
			
		||||
				const draft = JSON.parse(localStorage.getItem('drafts') || '{}')[this.draftKey];
 | 
			
		||||
				if (draft) {
 | 
			
		||||
					this.text = draft.data.text;
 | 
			
		||||
@@ -506,8 +506,6 @@ export default defineComponent({
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		saveDraft() {
 | 
			
		||||
			if (this.instant) return;
 | 
			
		||||
 | 
			
		||||
			const data = JSON.parse(localStorage.getItem('drafts') || '{}');
 | 
			
		||||
 | 
			
		||||
			data[this.draftKey] = {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										56
									
								
								src/docs/ja-JP/advanced/share-page.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								src/docs/ja-JP/advanced/share-page.md
									
									
									
									
									
										Normal file
									
								
							@@ -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>
 | 
			
		||||
		Reference in New Issue
	
	Block a user