Compare commits

...

8 Commits
6.0.2 ... 6.1.0

Author SHA1 Message Date
c5d734f9ad 6.1.0 2018-08-17 00:09:01 +09:00
ee12d887ae typo 2018-08-17 00:07:23 +09:00
b78d24be1e Fix bug 2018-08-17 00:05:57 +09:00
d5379e2b36 autoWatchをデフォルトでfalseに 2018-08-17 00:04:07 +09:00
58f3c6aab7 Merge branch 'master' of https://github.com/syuilo/misskey 2018-08-16 23:59:25 +09:00
22e79675ad #2263 2018-08-16 23:59:22 +09:00
e5c350d740 Fix bug 2018-08-16 23:33:11 +09:00
7f9a35d7ac Improve object storage key 2018-08-16 21:23:31 +09:00
22 changed files with 235 additions and 86 deletions

View File

@ -710,6 +710,7 @@ desktop/views/components/settings.vue:
show-reply-target: "リプライ先を表示する" show-reply-target: "リプライ先を表示する"
show-my-renotes: "自分の行ったRenoteをタイムラインに表示する" show-my-renotes: "自分の行ったRenoteをタイムラインに表示する"
show-renoted-my-notes: "Renoteされた自分の投稿をタイムラインに表示する" show-renoted-my-notes: "Renoteされた自分の投稿をタイムラインに表示する"
show-local-renotes: "Renoteされたローカルの投稿の投稿をタイムラインに表示する"
show-maps: "マップの自動展開" show-maps: "マップの自動展開"
show-maps-desc: "位置情報が添付された投稿のマップを自動的に展開します。" show-maps-desc: "位置情報が添付された投稿のマップを自動的に展開します。"
@ -1294,6 +1295,7 @@ mobile/views/pages/settings.vue:
show-reply-target: "リプライ先を表示する" show-reply-target: "リプライ先を表示する"
show-my-renotes: "自分の行ったRenoteを表示する" show-my-renotes: "自分の行ったRenoteを表示する"
show-renoted-my-notes: "Renoteされた自分の投稿を表示する" show-renoted-my-notes: "Renoteされた自分の投稿を表示する"
show-local-renotes: "Renoteされたローカルの投稿の投稿をタイムラインに表示する"
post-style: "投稿の表示スタイル" post-style: "投稿の表示スタイル"
post-style-standard: "標準" post-style-standard: "標準"
post-style-smart: "スマート" post-style-smart: "スマート"

View File

@ -1,8 +1,8 @@
{ {
"name": "misskey", "name": "misskey",
"author": "syuilo <i@syuilo.com>", "author": "syuilo <i@syuilo.com>",
"version": "6.0.2", "version": "6.1.0",
"clientVersion": "1.0.8367", "clientVersion": "1.0.8377",
"codename": "nighthike", "codename": "nighthike",
"main": "./built/index.js", "main": "./built/index.js",
"private": true, "private": true,

View File

@ -135,6 +135,12 @@ export default Vue.extend({
return; return;
} }
} }
if (this.$store.state.settings.showLocalRenotes === false) {
if (isPureRenote && (note.renote.user.host == null)) {
return;
}
}
//#endregion //#endregion
// 投稿が自分のものではないかつ、タブが非表示またはスクロール位置が最上部ではないならタイトルで通知 // 投稿が自分のものではないかつ、タブが非表示またはスクロール位置が最上部ではないならタイトルで通知

View File

@ -51,6 +51,7 @@
<mk-switch v-model="$store.state.settings.showReplyTarget" @change="onChangeShowReplyTarget" text="%i18n:@show-reply-target%"/> <mk-switch v-model="$store.state.settings.showReplyTarget" @change="onChangeShowReplyTarget" text="%i18n:@show-reply-target%"/>
<mk-switch v-model="$store.state.settings.showMyRenotes" @change="onChangeShowMyRenotes" text="%i18n:@show-my-renotes%"/> <mk-switch v-model="$store.state.settings.showMyRenotes" @change="onChangeShowMyRenotes" text="%i18n:@show-my-renotes%"/>
<mk-switch v-model="$store.state.settings.showRenotedMyNotes" @change="onChangeShowRenotedMyNotes" text="%i18n:@show-renoted-my-notes%"/> <mk-switch v-model="$store.state.settings.showRenotedMyNotes" @change="onChangeShowRenotedMyNotes" text="%i18n:@show-renoted-my-notes%"/>
<mk-switch v-model="$store.state.settings.showLocalRenotes" @change="onChangeShowLocalRenotes" text="%i18n:@show-local-renotes%"/>
<mk-switch v-model="$store.state.settings.showMaps" @change="onChangeShowMaps" text="%i18n:@show-maps%"> <mk-switch v-model="$store.state.settings.showMaps" @change="onChangeShowMaps" text="%i18n:@show-maps%">
<span>%i18n:@show-maps-desc%</span> <span>%i18n:@show-maps-desc%</span>
</mk-switch> </mk-switch>
@ -353,6 +354,12 @@ export default Vue.extend({
value: v value: v
}); });
}, },
onChangeShowLocalRenotes(v) {
this.$store.dispatch('settings/set', {
key: 'showLocalRenotes',
value: v
});
},
onChangeShowMaps(v) { onChangeShowMaps(v) {
this.$store.dispatch('settings/set', { this.$store.dispatch('settings/set', {
key: 'showMaps', key: 'showMaps',

View File

@ -100,7 +100,8 @@ export default Vue.extend({
limit: fetchLimit + 1, limit: fetchLimit + 1,
untilDate: this.date ? this.date.getTime() : undefined, untilDate: this.date ? this.date.getTime() : undefined,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
}).then(notes => { }).then(notes => {
if (notes.length == fetchLimit + 1) { if (notes.length == fetchLimit + 1) {
notes.pop(); notes.pop();
@ -122,7 +123,8 @@ export default Vue.extend({
limit: fetchLimit + 1, limit: fetchLimit + 1,
untilId: (this.$refs.timeline as any).tail().id, untilId: (this.$refs.timeline as any).tail().id,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
}); });
promise.then(notes => { promise.then(notes => {

View File

@ -47,7 +47,8 @@ export default Vue.extend({
listId: this.list.id, listId: this.list.id,
limit: fetchLimit + 1, limit: fetchLimit + 1,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
}).then(notes => { }).then(notes => {
if (notes.length == fetchLimit + 1) { if (notes.length == fetchLimit + 1) {
notes.pop(); notes.pop();
@ -67,7 +68,8 @@ export default Vue.extend({
limit: fetchLimit + 1, limit: fetchLimit + 1,
untilId: (this.$refs.timeline as any).tail().id, untilId: (this.$refs.timeline as any).tail().id,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
}); });
promise.then(notes => { promise.then(notes => {

View File

@ -70,7 +70,8 @@ export default Vue.extend({
limit: fetchLimit + 1, limit: fetchLimit + 1,
mediaOnly: this.mediaOnly, mediaOnly: this.mediaOnly,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
}).then(notes => { }).then(notes => {
if (notes.length == fetchLimit + 1) { if (notes.length == fetchLimit + 1) {
notes.pop(); notes.pop();
@ -91,7 +92,8 @@ export default Vue.extend({
untilId: (this.$refs.timeline as any).tail().id, untilId: (this.$refs.timeline as any).tail().id,
mediaOnly: this.mediaOnly, mediaOnly: this.mediaOnly,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
}); });
promise.then(notes => { promise.then(notes => {

View File

@ -140,6 +140,12 @@ export default Vue.extend({
return; return;
} }
} }
if (this.$store.state.settings.showLocalRenotes === false) {
if (isPureRenote && (note.renote.user.host == null)) {
return;
}
}
//#endregion //#endregion
if (this.isScrollTop()) { if (this.isScrollTop()) {

View File

@ -98,7 +98,8 @@ export default Vue.extend({
limit: fetchLimit + 1, limit: fetchLimit + 1,
mediaOnly: this.mediaOnly, mediaOnly: this.mediaOnly,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
}).then(notes => { }).then(notes => {
if (notes.length == fetchLimit + 1) { if (notes.length == fetchLimit + 1) {
notes.pop(); notes.pop();
@ -119,7 +120,8 @@ export default Vue.extend({
mediaOnly: this.mediaOnly, mediaOnly: this.mediaOnly,
untilId: (this.$refs.timeline as any).tail().id, untilId: (this.$refs.timeline as any).tail().id,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
}); });
promise.then(notes => { promise.then(notes => {

View File

@ -139,6 +139,12 @@ export default Vue.extend({
return; return;
} }
} }
if (this.$store.state.settings.showLocalRenotes === false) {
if (isPureRenote && (note.renote.user.host == null)) {
return;
}
}
//#endregion //#endregion
// 投稿が自分のものではないかつ、タブが非表示またはスクロール位置が最上部ではないならタイトルで通知 // 投稿が自分のものではないかつ、タブが非表示またはスクロール位置が最上部ではないならタイトルで通知

View File

@ -59,7 +59,8 @@ export default Vue.extend({
listId: this.list.id, listId: this.list.id,
limit: fetchLimit + 1, limit: fetchLimit + 1,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
}).then(notes => { }).then(notes => {
if (notes.length == fetchLimit + 1) { if (notes.length == fetchLimit + 1) {
notes.pop(); notes.pop();
@ -82,7 +83,8 @@ export default Vue.extend({
limit: fetchLimit + 1, limit: fetchLimit + 1,
untilId: (this.$refs.timeline as any).tail().id, untilId: (this.$refs.timeline as any).tail().id,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
}); });
promise.then(notes => { promise.then(notes => {

View File

@ -95,7 +95,8 @@ export default Vue.extend({
limit: fetchLimit + 1, limit: fetchLimit + 1,
untilDate: this.date ? this.date.getTime() : undefined, untilDate: this.date ? this.date.getTime() : undefined,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
}).then(notes => { }).then(notes => {
if (notes.length == fetchLimit + 1) { if (notes.length == fetchLimit + 1) {
notes.pop(); notes.pop();
@ -117,7 +118,8 @@ export default Vue.extend({
limit: fetchLimit + 1, limit: fetchLimit + 1,
untilId: (this.$refs.timeline as any).tail().id, untilId: (this.$refs.timeline as any).tail().id,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
}); });
promise.then(notes => { promise.then(notes => {

View File

@ -21,6 +21,7 @@
<ui-switch v-model="$store.state.settings.showReplyTarget" @change="onChangeShowReplyTarget">%i18n:@show-reply-target%</ui-switch> <ui-switch v-model="$store.state.settings.showReplyTarget" @change="onChangeShowReplyTarget">%i18n:@show-reply-target%</ui-switch>
<ui-switch v-model="$store.state.settings.showMyRenotes" @change="onChangeShowMyRenotes">%i18n:@show-my-renotes%</ui-switch> <ui-switch v-model="$store.state.settings.showMyRenotes" @change="onChangeShowMyRenotes">%i18n:@show-my-renotes%</ui-switch>
<ui-switch v-model="$store.state.settings.showRenotedMyNotes" @change="onChangeShowRenotedMyNotes">%i18n:@show-renoted-my-notes%</ui-switch> <ui-switch v-model="$store.state.settings.showRenotedMyNotes" @change="onChangeShowRenotedMyNotes">%i18n:@show-renoted-my-notes%</ui-switch>
<ui-switch v-model="$store.state.settings.showLocalRenotes" @change="onChangeShowLocalRenotes">%i18n:@show-local-renotes%</ui-switch>
</div> </div>
<div> <div>
@ -221,6 +222,13 @@ export default Vue.extend({
}); });
}, },
onChangeShowLocalRenotes(v) {
this.$store.dispatch('settings/set', {
key: 'showLocalRenotes',
value: v
});
},
checkForUpdate() { checkForUpdate() {
this.checkingForUpdate = true; this.checkingForUpdate = true;
checkForUpdate((this as any).os, true, true).then(newer => { checkForUpdate((this as any).os, true, true).then(newer => {

View File

@ -16,6 +16,7 @@ const defaultSettings = {
showReplyTarget: true, showReplyTarget: true,
showMyRenotes: true, showMyRenotes: true,
showRenotedMyNotes: true, showRenotedMyNotes: true,
showLocalRenotes: true,
loadRemoteMedia: true, loadRemoteMedia: true,
disableViaMobile: false, disableViaMobile: false,
memo: null, memo: null,

View File

@ -59,6 +59,13 @@ export const meta = {
} }
}), }),
includeLocalRenotes: $.bool.optional.note({
default: true,
desc: {
ja: 'Renoteされたローカルの投稿を含めるかどうか'
}
}),
mediaOnly: $.bool.optional.note({ mediaOnly: $.bool.optional.note({
desc: { desc: {
ja: 'true にすると、メディアが添付された投稿だけ取得します' ja: 'true にすると、メディアが添付された投稿だけ取得します'
@ -180,6 +187,22 @@ export default async (params: any, user: ILocalUser) => {
}); });
} }
if (ps.includeLocalRenotes === false) {
query.$and.push({
$or: [{
'_renote.user.host': { $ne: null }
}, {
renoteId: null
}, {
text: { $ne: null }
}, {
mediaIds: { $ne: [] }
}, {
poll: { $ne: null }
}]
});
}
if (ps.mediaOnly) { if (ps.mediaOnly) {
query.$and.push({ query.$and.push({
mediaIds: { $exists: true, $ne: [] } mediaIds: { $exists: true, $ne: [] }

View File

@ -60,6 +60,13 @@ export const meta = {
} }
}), }),
includeLocalRenotes: $.bool.optional.note({
default: true,
desc: {
ja: 'Renoteされたローカルの投稿を含めるかどうか'
}
}),
mediaOnly: $.bool.optional.note({ mediaOnly: $.bool.optional.note({
desc: { desc: {
ja: 'true にすると、メディアが添付された投稿だけ取得します' ja: 'true にすると、メディアが添付された投稿だけ取得します'
@ -170,6 +177,22 @@ export default async (params: any, user: ILocalUser) => {
}); });
} }
if (ps.includeLocalRenotes === false) {
query.$and.push({
$or: [{
'_renote.user.host': { $ne: null }
}, {
renoteId: null
}, {
text: { $ne: null }
}, {
mediaIds: { $ne: [] }
}, {
poll: { $ne: null }
}]
});
}
if (ps.mediaOnly) { if (ps.mediaOnly) {
query.$and.push({ query.$and.push({
mediaIds: { $exists: true, $ne: [] } mediaIds: { $exists: true, $ne: [] }

View File

@ -4,6 +4,7 @@ import Mute from '../../../../models/mute';
import { pack } from '../../../../models/note'; import { pack } from '../../../../models/note';
import UserList from '../../../../models/user-list'; import UserList from '../../../../models/user-list';
import { ILocalUser } from '../../../../models/user'; import { ILocalUser } from '../../../../models/user';
import getParams from '../../get-params';
export const meta = { export const meta = {
desc: { desc: {
@ -11,56 +12,84 @@ export const meta = {
en: 'Get timeline of a user list.' en: 'Get timeline of a user list.'
}, },
requireCredential: true requireCredential: true,
params: {
listId: $.type(ID).note({
desc: {
ja: 'リストのID'
}
}),
limit: $.num.optional.range(1, 100).note({
default: 10,
desc: {
ja: '最大数'
}
}),
sinceId: $.type(ID).optional.note({
desc: {
ja: '指定すると、この投稿を基点としてより新しい投稿を取得します'
}
}),
untilId: $.type(ID).optional.note({
desc: {
ja: '指定すると、この投稿を基点としてより古い投稿を取得します'
}
}),
sinceDate: $.num.optional.note({
desc: {
ja: '指定した時間を基点としてより新しい投稿を取得します。数値は、1970年1月1日 00:00:00 UTC から指定した日時までの経過時間をミリ秒単位で表します。'
}
}),
untilDate: $.num.optional.note({
desc: {
ja: '指定した時間を基点としてより古い投稿を取得します。数値は、1970年1月1日 00:00:00 UTC から指定した日時までの経過時間をミリ秒単位で表します。'
}
}),
includeMyRenotes: $.bool.optional.note({
default: true,
desc: {
ja: '自分の行ったRenoteを含めるかどうか'
}
}),
includeRenotedMyNotes: $.bool.optional.note({
default: true,
desc: {
ja: 'Renoteされた自分の投稿を含めるかどうか'
}
}),
includeLocalRenotes: $.bool.optional.note({
default: true,
desc: {
ja: 'Renoteされたローカルの投稿を含めるかどうか'
}
}),
mediaOnly: $.bool.optional.note({
desc: {
ja: 'true にすると、メディアが添付された投稿だけ取得します'
}
}),
}
}; };
export default async (params: any, user: ILocalUser) => { export default async (params: any, user: ILocalUser) => {
// Get 'limit' parameter const [ps, psErr] = getParams(meta, params);
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit); if (psErr) throw psErr;
if (limitErr) throw 'invalid limit param';
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $.type(ID).optional.get(params.sinceId);
if (sinceIdErr) throw 'invalid sinceId param';
// Get 'untilId' parameter
const [untilId, untilIdErr] = $.type(ID).optional.get(params.untilId);
if (untilIdErr) throw 'invalid untilId param';
// Get 'sinceDate' parameter
const [sinceDate, sinceDateErr] = $.num.optional.get(params.sinceDate);
if (sinceDateErr) throw 'invalid sinceDate param';
// Get 'untilDate' parameter
const [untilDate, untilDateErr] = $.num.optional.get(params.untilDate);
if (untilDateErr) throw 'invalid untilDate param';
// Check if only one of sinceId, untilId, sinceDate, untilDate specified
if ([sinceId, untilId, sinceDate, untilDate].filter(x => x != null).length > 1) {
throw 'only one of sinceId, untilId, sinceDate, untilDate can be specified';
}
// Get 'includeMyRenotes' parameter
const [includeMyRenotes = true, includeMyRenotesErr] = $.bool.optional.get(params.includeMyRenotes);
if (includeMyRenotesErr) throw 'invalid includeMyRenotes param';
// Get 'includeRenotedMyNotes' parameter
const [includeRenotedMyNotes = true, includeRenotedMyNotesErr] = $.bool.optional.get(params.includeRenotedMyNotes);
if (includeRenotedMyNotesErr) throw 'invalid includeRenotedMyNotes param';
// Get 'mediaOnly' parameter
const [mediaOnly, mediaOnlyErr] = $.bool.optional.get(params.mediaOnly);
if (mediaOnlyErr) throw 'invalid mediaOnly param';
// Get 'listId' parameter
const [listId, listIdErr] = $.type(ID).get(params.listId);
if (listIdErr) throw 'invalid listId param';
const [list, mutedUserIds] = await Promise.all([ const [list, mutedUserIds] = await Promise.all([
// リストを取得 // リストを取得
// Fetch the list // Fetch the list
UserList.findOne({ UserList.findOne({
_id: listId, _id: ps.listId,
userId: user._id userId: user._id
}), }),
@ -122,7 +151,7 @@ export default async (params: any, user: ILocalUser) => {
// つまり、「『自分の投稿かつRenote』ではない」を「『自分の投稿ではない』または『Renoteではない』」と表現します。 // つまり、「『自分の投稿かつRenote』ではない」を「『自分の投稿ではない』または『Renoteではない』」と表現します。
// for details: https://en.wikipedia.org/wiki/De_Morgan%27s_laws // for details: https://en.wikipedia.org/wiki/De_Morgan%27s_laws
if (includeMyRenotes === false) { if (ps.includeMyRenotes === false) {
query.$and.push({ query.$and.push({
$or: [{ $or: [{
userId: { $ne: user._id } userId: { $ne: user._id }
@ -138,7 +167,7 @@ export default async (params: any, user: ILocalUser) => {
}); });
} }
if (includeRenotedMyNotes === false) { if (ps.includeRenotedMyNotes === false) {
query.$and.push({ query.$and.push({
$or: [{ $or: [{
'_renote.userId': { $ne: user._id } '_renote.userId': { $ne: user._id }
@ -154,29 +183,45 @@ export default async (params: any, user: ILocalUser) => {
}); });
} }
if (mediaOnly) { if (ps.includeLocalRenotes === false) {
query.$and.push({
$or: [{
'_renote.user.host': { $ne: null }
}, {
renoteId: null
}, {
text: { $ne: null }
}, {
mediaIds: { $ne: [] }
}, {
poll: { $ne: null }
}]
});
}
if (ps.mediaOnly) {
query.$and.push({ query.$and.push({
mediaIds: { $exists: true, $ne: [] } mediaIds: { $exists: true, $ne: [] }
}); });
} }
if (sinceId) { if (ps.sinceId) {
sort._id = 1; sort._id = 1;
query._id = { query._id = {
$gt: sinceId $gt: ps.sinceId
}; };
} else if (untilId) { } else if (ps.untilId) {
query._id = { query._id = {
$lt: untilId $lt: ps.untilId
}; };
} else if (sinceDate) { } else if (ps.sinceDate) {
sort._id = 1; sort._id = 1;
query.createdAt = { query.createdAt = {
$gt: new Date(sinceDate) $gt: new Date(ps.sinceDate)
}; };
} else if (untilDate) { } else if (ps.untilDate) {
query.createdAt = { query.createdAt = {
$lt: new Date(untilDate) $lt: new Date(ps.untilDate)
}; };
} }
//#endregion //#endregion
@ -184,7 +229,7 @@ export default async (params: any, user: ILocalUser) => {
// Issue query // Issue query
const timeline = await Note const timeline = await Note
.find(query, { .find(query, {
limit: limit, limit: ps.limit,
sort: sort sort: sort
}); });

View File

@ -16,17 +16,13 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
if (usernameErr) return rej('invalid username param'); if (usernameErr) return rej('invalid username param');
if (userId === undefined && username === undefined) { if (userId === undefined && username === undefined) {
return rej('userId or pair of username and host is required'); return rej('userId or username is required');
} }
// Get 'host' parameter // Get 'host' parameter
const [host, hostErr] = $.str.optional.get(params.host); const [host, hostErr] = $.str.optional.get(params.host);
if (hostErr) return rej('invalid host param'); if (hostErr) return rej('invalid host param');
if (userId === undefined && host === undefined) {
return rej('userId or pair of username and host is required');
}
// Get 'includeReplies' parameter // Get 'includeReplies' parameter
const [includeReplies = true, includeRepliesErr] = $.bool.optional.get(params.includeReplies); const [includeReplies = true, includeRepliesErr] = $.bool.optional.get(params.includeReplies);
if (includeRepliesErr) return rej('invalid includeReplies param'); if (includeRepliesErr) return rej('invalid includeReplies param');

View File

@ -92,7 +92,7 @@ export default async (ctx: Koa.Context) => {
weight: null weight: null
}, },
settings: { settings: {
autoWatch: true autoWatch: false
} }
}); });

View File

@ -35,20 +35,19 @@ async function save(path: string, name: string, type: string, hash: string, size
if (config.drive && config.drive.storage == 'minio') { if (config.drive && config.drive.storage == 'minio') {
const minio = new Minio.Client(config.drive.config); const minio = new Minio.Client(config.drive.config);
const id = uuid.v4(); const key = `${config.drive.prefix}/${uuid.v4()}/${name}`;
const obj = `${config.drive.prefix}/${id}`; const thumbnailKey = `${config.drive.prefix}/${uuid.v4()}/${name}.thumbnail.jpg`;
const thumbnailObj = `${obj}-thumbnail`;
const baseUrl = config.drive.baseUrl const baseUrl = config.drive.baseUrl
|| `${ config.drive.config.secure ? 'https' : 'http' }://${ config.drive.config.endPoint }${ config.drive.config.port ? ':' + config.drive.config.port : '' }/${ config.drive.bucket }`; || `${ config.drive.config.secure ? 'https' : 'http' }://${ config.drive.config.endPoint }${ config.drive.config.port ? ':' + config.drive.config.port : '' }/${ config.drive.bucket }`;
await minio.putObject(config.drive.bucket, obj, fs.createReadStream(path), size, { await minio.putObject(config.drive.bucket, key, fs.createReadStream(path), size, {
'Content-Type': type, 'Content-Type': type,
'Cache-Control': 'max-age=31536000, immutable' 'Cache-Control': 'max-age=31536000, immutable'
}); });
if (thumbnail) { if (thumbnail) {
await minio.putObject(config.drive.bucket, thumbnailObj, thumbnail, size, { await minio.putObject(config.drive.bucket, thumbnailKey, thumbnail, size, {
'Content-Type': 'image/jpeg', 'Content-Type': 'image/jpeg',
'Cache-Control': 'max-age=31536000, immutable' 'Cache-Control': 'max-age=31536000, immutable'
}); });
@ -58,10 +57,11 @@ async function save(path: string, name: string, type: string, hash: string, size
withoutChunks: true, withoutChunks: true,
storage: 'minio', storage: 'minio',
storageProps: { storageProps: {
id: id key: key,
thumbnailKey: thumbnailKey
}, },
url: `${ baseUrl }/${ obj }`, url: `${ baseUrl }/${ key }`,
thumbnailUrl: thumbnail ? `${ baseUrl }/${ thumbnailObj }` : null thumbnailUrl: thumbnail ? `${ baseUrl }/${ thumbnailKey }` : null
}); });
const file = await DriveFile.insert({ const file = await DriveFile.insert({

View File

@ -7,11 +7,15 @@ export default async function(file: IDriveFile, isExpired = false) {
if (file.metadata.storage == 'minio') { if (file.metadata.storage == 'minio') {
const minio = new Minio.Client(config.drive.config); const minio = new Minio.Client(config.drive.config);
const obj = `${config.drive.prefix}/${file.metadata.storageProps.id}`; // 後方互換性のため、file.metadata.storageProps.key があるかどうかチェックしています。
// 将来的には const obj = file.metadata.storageProps.key; とします。
const obj = file.metadata.storageProps.key ? file.metadata.storageProps.key : `${config.drive.prefix}/${file.metadata.storageProps.id}`;
await minio.removeObject(config.drive.bucket, obj); await minio.removeObject(config.drive.bucket, obj);
if (file.metadata.thumbnailUrl) { if (file.metadata.thumbnailUrl) {
const thumbnailObj = `${config.drive.prefix}/${file.metadata.storageProps.id}-thumbnail`; // 後方互換性のため、file.metadata.storageProps.thumbnailKey があるかどうかチェックしています。
// 将来的には const thumbnailObj = file.metadata.storageProps.thumbnailKey; とします。
const thumbnailObj = file.metadata.storageProps.thumbnailKey ? file.metadata.storageProps.thumbnailKey : `${config.drive.prefix}/${file.metadata.storageProps.id}-thumbnail`;
await minio.removeObject(config.drive.bucket, thumbnailObj); await minio.removeObject(config.drive.bucket, thumbnailObj);
} }
} }

View File

@ -328,8 +328,18 @@ async function insertNote(user: IUser, data: Option, tokens: ReturnType<typeof p
: [], : [],
// 以下非正規化データ // 以下非正規化データ
_reply: data.reply ? { userId: data.reply.userId } : null, _reply: data.reply ? {
_renote: data.renote ? { userId: data.renote.userId } : null, userId: data.reply.userId,
user: {
host: data.reply._user.host
}
} : null,
_renote: data.renote ? {
userId: data.renote.userId,
user: {
host: data.renote._user.host
}
} : null,
_user: { _user: {
host: user.host, host: user.host,
inbox: isRemoteUser(user) ? user.inbox : undefined inbox: isRemoteUser(user) ? user.inbox : undefined