Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
c5d734f9ad | |||
ee12d887ae | |||
b78d24be1e | |||
d5379e2b36 | |||
58f3c6aab7 | |||
22e79675ad | |||
e5c350d740 | |||
7f9a35d7ac | |||
9d6641be3a |
@ -710,6 +710,7 @@ desktop/views/components/settings.vue:
|
||||
show-reply-target: "リプライ先を表示する"
|
||||
show-my-renotes: "自分の行ったRenoteをタイムラインに表示する"
|
||||
show-renoted-my-notes: "Renoteされた自分の投稿をタイムラインに表示する"
|
||||
show-local-renotes: "Renoteされたローカルの投稿の投稿をタイムラインに表示する"
|
||||
show-maps: "マップの自動展開"
|
||||
show-maps-desc: "位置情報が添付された投稿のマップを自動的に展開します。"
|
||||
|
||||
@ -1294,6 +1295,7 @@ mobile/views/pages/settings.vue:
|
||||
show-reply-target: "リプライ先を表示する"
|
||||
show-my-renotes: "自分の行ったRenoteを表示する"
|
||||
show-renoted-my-notes: "Renoteされた自分の投稿を表示する"
|
||||
show-local-renotes: "Renoteされたローカルの投稿の投稿をタイムラインに表示する"
|
||||
post-style: "投稿の表示スタイル"
|
||||
post-style-standard: "標準"
|
||||
post-style-smart: "スマート"
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "misskey",
|
||||
"author": "syuilo <i@syuilo.com>",
|
||||
"version": "6.0.1",
|
||||
"clientVersion": "1.0.8367",
|
||||
"version": "6.1.0",
|
||||
"clientVersion": "1.0.8377",
|
||||
"codename": "nighthike",
|
||||
"main": "./built/index.js",
|
||||
"private": true,
|
||||
|
@ -135,6 +135,12 @@ export default Vue.extend({
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.$store.state.settings.showLocalRenotes === false) {
|
||||
if (isPureRenote && (note.renote.user.host == null)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
// 投稿が自分のものではないかつ、タブが非表示またはスクロール位置が最上部ではないならタイトルで通知
|
||||
|
@ -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.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.showLocalRenotes" @change="onChangeShowLocalRenotes" text="%i18n:@show-local-renotes%"/>
|
||||
<mk-switch v-model="$store.state.settings.showMaps" @change="onChangeShowMaps" text="%i18n:@show-maps%">
|
||||
<span>%i18n:@show-maps-desc%</span>
|
||||
</mk-switch>
|
||||
@ -353,6 +354,12 @@ export default Vue.extend({
|
||||
value: v
|
||||
});
|
||||
},
|
||||
onChangeShowLocalRenotes(v) {
|
||||
this.$store.dispatch('settings/set', {
|
||||
key: 'showLocalRenotes',
|
||||
value: v
|
||||
});
|
||||
},
|
||||
onChangeShowMaps(v) {
|
||||
this.$store.dispatch('settings/set', {
|
||||
key: 'showMaps',
|
||||
|
@ -100,7 +100,8 @@ export default Vue.extend({
|
||||
limit: fetchLimit + 1,
|
||||
untilDate: this.date ? this.date.getTime() : undefined,
|
||||
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 => {
|
||||
if (notes.length == fetchLimit + 1) {
|
||||
notes.pop();
|
||||
@ -122,7 +123,8 @@ export default Vue.extend({
|
||||
limit: fetchLimit + 1,
|
||||
untilId: (this.$refs.timeline as any).tail().id,
|
||||
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 => {
|
||||
|
@ -47,7 +47,8 @@ export default Vue.extend({
|
||||
listId: this.list.id,
|
||||
limit: fetchLimit + 1,
|
||||
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 => {
|
||||
if (notes.length == fetchLimit + 1) {
|
||||
notes.pop();
|
||||
@ -67,7 +68,8 @@ export default Vue.extend({
|
||||
limit: fetchLimit + 1,
|
||||
untilId: (this.$refs.timeline as any).tail().id,
|
||||
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 => {
|
||||
|
@ -70,7 +70,8 @@ export default Vue.extend({
|
||||
limit: fetchLimit + 1,
|
||||
mediaOnly: this.mediaOnly,
|
||||
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 => {
|
||||
if (notes.length == fetchLimit + 1) {
|
||||
notes.pop();
|
||||
@ -91,7 +92,8 @@ export default Vue.extend({
|
||||
untilId: (this.$refs.timeline as any).tail().id,
|
||||
mediaOnly: this.mediaOnly,
|
||||
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 => {
|
||||
|
@ -140,6 +140,12 @@ export default Vue.extend({
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.$store.state.settings.showLocalRenotes === false) {
|
||||
if (isPureRenote && (note.renote.user.host == null)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
if (this.isScrollTop()) {
|
||||
|
@ -98,7 +98,8 @@ export default Vue.extend({
|
||||
limit: fetchLimit + 1,
|
||||
mediaOnly: this.mediaOnly,
|
||||
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 => {
|
||||
if (notes.length == fetchLimit + 1) {
|
||||
notes.pop();
|
||||
@ -119,7 +120,8 @@ export default Vue.extend({
|
||||
mediaOnly: this.mediaOnly,
|
||||
untilId: (this.$refs.timeline as any).tail().id,
|
||||
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 => {
|
||||
|
@ -139,6 +139,12 @@ export default Vue.extend({
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.$store.state.settings.showLocalRenotes === false) {
|
||||
if (isPureRenote && (note.renote.user.host == null)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
// 投稿が自分のものではないかつ、タブが非表示またはスクロール位置が最上部ではないならタイトルで通知
|
||||
|
@ -59,7 +59,8 @@ export default Vue.extend({
|
||||
listId: this.list.id,
|
||||
limit: fetchLimit + 1,
|
||||
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 => {
|
||||
if (notes.length == fetchLimit + 1) {
|
||||
notes.pop();
|
||||
@ -82,7 +83,8 @@ export default Vue.extend({
|
||||
limit: fetchLimit + 1,
|
||||
untilId: (this.$refs.timeline as any).tail().id,
|
||||
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 => {
|
||||
|
@ -95,7 +95,8 @@ export default Vue.extend({
|
||||
limit: fetchLimit + 1,
|
||||
untilDate: this.date ? this.date.getTime() : undefined,
|
||||
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 => {
|
||||
if (notes.length == fetchLimit + 1) {
|
||||
notes.pop();
|
||||
@ -117,7 +118,8 @@ export default Vue.extend({
|
||||
limit: fetchLimit + 1,
|
||||
untilId: (this.$refs.timeline as any).tail().id,
|
||||
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 => {
|
||||
|
@ -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.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.showLocalRenotes" @change="onChangeShowLocalRenotes">%i18n:@show-local-renotes%</ui-switch>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@ -221,6 +222,13 @@ export default Vue.extend({
|
||||
});
|
||||
},
|
||||
|
||||
onChangeShowLocalRenotes(v) {
|
||||
this.$store.dispatch('settings/set', {
|
||||
key: 'showLocalRenotes',
|
||||
value: v
|
||||
});
|
||||
},
|
||||
|
||||
checkForUpdate() {
|
||||
this.checkingForUpdate = true;
|
||||
checkForUpdate((this as any).os, true, true).then(newer => {
|
||||
|
@ -16,6 +16,7 @@ const defaultSettings = {
|
||||
showReplyTarget: true,
|
||||
showMyRenotes: true,
|
||||
showRenotedMyNotes: true,
|
||||
showLocalRenotes: true,
|
||||
loadRemoteMedia: true,
|
||||
disableViaMobile: false,
|
||||
memo: null,
|
||||
|
@ -165,7 +165,7 @@ export const pack = (
|
||||
_target = Object.assign(_target, _file.metadata);
|
||||
|
||||
_target.url = _file.metadata.url ? _file.metadata.url : `${config.drive_url}/${_target.id}/${encodeURIComponent(_target.name)}`;
|
||||
_target.thumbnailUrl = _file.metadata.thumbnailUrl ? _file.metadata.thumbnailUrl : `${config.drive_url}/${_target.id}/${encodeURIComponent(_target.name)}?thumbnail`;
|
||||
_target.thumbnailUrl = _file.metadata.thumbnailUrl ? _file.metadata.thumbnailUrl : _file.metadata.url ? _file.metadata.url : `${config.drive_url}/${_target.id}/${encodeURIComponent(_target.name)}?thumbnail`;
|
||||
_target.isRemote = _file.metadata.isRemote;
|
||||
|
||||
if (_target.properties == null) _target.properties = {};
|
||||
|
@ -59,6 +59,13 @@ export const meta = {
|
||||
}
|
||||
}),
|
||||
|
||||
includeLocalRenotes: $.bool.optional.note({
|
||||
default: true,
|
||||
desc: {
|
||||
ja: 'Renoteされたローカルの投稿を含めるかどうか'
|
||||
}
|
||||
}),
|
||||
|
||||
mediaOnly: $.bool.optional.note({
|
||||
desc: {
|
||||
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) {
|
||||
query.$and.push({
|
||||
mediaIds: { $exists: true, $ne: [] }
|
||||
|
@ -60,6 +60,13 @@ export const meta = {
|
||||
}
|
||||
}),
|
||||
|
||||
includeLocalRenotes: $.bool.optional.note({
|
||||
default: true,
|
||||
desc: {
|
||||
ja: 'Renoteされたローカルの投稿を含めるかどうか'
|
||||
}
|
||||
}),
|
||||
|
||||
mediaOnly: $.bool.optional.note({
|
||||
desc: {
|
||||
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) {
|
||||
query.$and.push({
|
||||
mediaIds: { $exists: true, $ne: [] }
|
||||
|
@ -4,6 +4,7 @@ import Mute from '../../../../models/mute';
|
||||
import { pack } from '../../../../models/note';
|
||||
import UserList from '../../../../models/user-list';
|
||||
import { ILocalUser } from '../../../../models/user';
|
||||
import getParams from '../../get-params';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
@ -11,56 +12,84 @@ export const meta = {
|
||||
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) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
||||
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 [ps, psErr] = getParams(meta, params);
|
||||
if (psErr) throw psErr;
|
||||
|
||||
const [list, mutedUserIds] = await Promise.all([
|
||||
// リストを取得
|
||||
// Fetch the list
|
||||
UserList.findOne({
|
||||
_id: listId,
|
||||
_id: ps.listId,
|
||||
userId: user._id
|
||||
}),
|
||||
|
||||
@ -122,7 +151,7 @@ export default async (params: any, user: ILocalUser) => {
|
||||
// つまり、「『自分の投稿かつRenote』ではない」を「『自分の投稿ではない』または『Renoteではない』」と表現します。
|
||||
// for details: https://en.wikipedia.org/wiki/De_Morgan%27s_laws
|
||||
|
||||
if (includeMyRenotes === false) {
|
||||
if (ps.includeMyRenotes === false) {
|
||||
query.$and.push({
|
||||
$or: [{
|
||||
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({
|
||||
$or: [{
|
||||
'_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({
|
||||
mediaIds: { $exists: true, $ne: [] }
|
||||
});
|
||||
}
|
||||
|
||||
if (sinceId) {
|
||||
if (ps.sinceId) {
|
||||
sort._id = 1;
|
||||
query._id = {
|
||||
$gt: sinceId
|
||||
$gt: ps.sinceId
|
||||
};
|
||||
} else if (untilId) {
|
||||
} else if (ps.untilId) {
|
||||
query._id = {
|
||||
$lt: untilId
|
||||
$lt: ps.untilId
|
||||
};
|
||||
} else if (sinceDate) {
|
||||
} else if (ps.sinceDate) {
|
||||
sort._id = 1;
|
||||
query.createdAt = {
|
||||
$gt: new Date(sinceDate)
|
||||
$gt: new Date(ps.sinceDate)
|
||||
};
|
||||
} else if (untilDate) {
|
||||
} else if (ps.untilDate) {
|
||||
query.createdAt = {
|
||||
$lt: new Date(untilDate)
|
||||
$lt: new Date(ps.untilDate)
|
||||
};
|
||||
}
|
||||
//#endregion
|
||||
@ -184,7 +229,7 @@ export default async (params: any, user: ILocalUser) => {
|
||||
// Issue query
|
||||
const timeline = await Note
|
||||
.find(query, {
|
||||
limit: limit,
|
||||
limit: ps.limit,
|
||||
sort: sort
|
||||
});
|
||||
|
||||
|
@ -16,17 +16,13 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
|
||||
if (usernameErr) return rej('invalid username param');
|
||||
|
||||
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
|
||||
const [host, hostErr] = $.str.optional.get(params.host);
|
||||
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
|
||||
const [includeReplies = true, includeRepliesErr] = $.bool.optional.get(params.includeReplies);
|
||||
if (includeRepliesErr) return rej('invalid includeReplies param');
|
||||
|
@ -92,7 +92,7 @@ export default async (ctx: Koa.Context) => {
|
||||
weight: null
|
||||
},
|
||||
settings: {
|
||||
autoWatch: true
|
||||
autoWatch: false
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -35,20 +35,19 @@ async function save(path: string, name: string, type: string, hash: string, size
|
||||
|
||||
if (config.drive && config.drive.storage == 'minio') {
|
||||
const minio = new Minio.Client(config.drive.config);
|
||||
const id = uuid.v4();
|
||||
const obj = `${config.drive.prefix}/${id}`;
|
||||
const thumbnailObj = `${obj}-thumbnail`;
|
||||
const key = `${config.drive.prefix}/${uuid.v4()}/${name}`;
|
||||
const thumbnailKey = `${config.drive.prefix}/${uuid.v4()}/${name}.thumbnail.jpg`;
|
||||
|
||||
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 }`;
|
||||
|
||||
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,
|
||||
'Cache-Control': 'max-age=31536000, immutable'
|
||||
});
|
||||
|
||||
if (thumbnail) {
|
||||
await minio.putObject(config.drive.bucket, thumbnailObj, thumbnail, size, {
|
||||
await minio.putObject(config.drive.bucket, thumbnailKey, thumbnail, size, {
|
||||
'Content-Type': 'image/jpeg',
|
||||
'Cache-Control': 'max-age=31536000, immutable'
|
||||
});
|
||||
@ -58,10 +57,11 @@ async function save(path: string, name: string, type: string, hash: string, size
|
||||
withoutChunks: true,
|
||||
storage: 'minio',
|
||||
storageProps: {
|
||||
id: id
|
||||
key: key,
|
||||
thumbnailKey: thumbnailKey
|
||||
},
|
||||
url: `${ baseUrl }/${ obj }`,
|
||||
thumbnailUrl: thumbnail ? `${ baseUrl }/${ thumbnailObj }` : null
|
||||
url: `${ baseUrl }/${ key }`,
|
||||
thumbnailUrl: thumbnail ? `${ baseUrl }/${ thumbnailKey }` : null
|
||||
});
|
||||
|
||||
const file = await DriveFile.insert({
|
||||
|
@ -7,11 +7,15 @@ export default async function(file: IDriveFile, isExpired = false) {
|
||||
if (file.metadata.storage == 'minio') {
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -328,8 +328,18 @@ async function insertNote(user: IUser, data: Option, tokens: ReturnType<typeof p
|
||||
: [],
|
||||
|
||||
// 以下非正規化データ
|
||||
_reply: data.reply ? { userId: data.reply.userId } : null,
|
||||
_renote: data.renote ? { userId: data.renote.userId } : null,
|
||||
_reply: data.reply ? {
|
||||
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: {
|
||||
host: user.host,
|
||||
inbox: isRemoteUser(user) ? user.inbox : undefined
|
||||
|
Reference in New Issue
Block a user