Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
f6e4a1770e | |||
31006507c0 | |||
9ca6a6bf06 | |||
afdacf14b7 | |||
5da18ba535 | |||
e6cc937ac2 | |||
87091a2e03 | |||
59d67d3140 | |||
7b4c307c46 | |||
92484be87f | |||
56b8f8b07d | |||
722de35037 | |||
d93f76c1af | |||
cba0dd5e17 | |||
a2e2d5ba77 |
@ -328,6 +328,7 @@ common/views/components/note-menu.vue:
|
||||
copy-link: "リンクをコピー"
|
||||
favorite: "お気に入り"
|
||||
pin: "ピン留め"
|
||||
unpin: "ピン留め解除"
|
||||
delete: "削除"
|
||||
delete-confirm: "この投稿を削除しますか?"
|
||||
remote: "投稿元で見る"
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "misskey",
|
||||
"author": "syuilo <i@syuilo.com>",
|
||||
"version": "8.59.0",
|
||||
"clientVersion": "1.0.9949",
|
||||
"version": "8.62.0",
|
||||
"clientVersion": "1.0.9964",
|
||||
"codename": "nighthike",
|
||||
"main": "./built/index.js",
|
||||
"private": true,
|
||||
|
@ -59,7 +59,7 @@ export default {
|
||||
|
||||
el.dataset.reservedKeys = reservedKeys.map(key => `'${key}'`).join(' ');
|
||||
|
||||
el._keyHandler = e => {
|
||||
el._keyHandler = (e: KeyboardEvent) => {
|
||||
const key = e.code.toLowerCase();
|
||||
|
||||
const targetReservedKeys = document.activeElement ? ((document.activeElement as any).dataset || {}).reservedKeys || '' : '';
|
||||
@ -72,7 +72,8 @@ export default {
|
||||
const matched = pattern.which.includes(key) &&
|
||||
pattern.ctrl == e.ctrlKey &&
|
||||
pattern.shift == e.shiftKey &&
|
||||
pattern.alt == e.altKey;
|
||||
pattern.alt == e.altKey &&
|
||||
e.metaKey == false;
|
||||
|
||||
if (matched) {
|
||||
e.preventDefault();
|
||||
|
@ -1,8 +1,8 @@
|
||||
require('fuckadblock');
|
||||
|
||||
declare const fuckAdBlock: any;
|
||||
|
||||
export default (os) => {
|
||||
require('fuckadblock');
|
||||
|
||||
function adBlockDetected() {
|
||||
os.apis.dialog({
|
||||
title: '%fa:exclamation-triangle%%i18n:common.adblock.detected%',
|
||||
|
@ -1,5 +1,6 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
import instance from './instance.vue';
|
||||
import cwButton from './cw-button.vue';
|
||||
import tagCloud from './tag-cloud.vue';
|
||||
import trends from './trends.vue';
|
||||
@ -43,6 +44,7 @@ import uiSelect from './ui/select.vue';
|
||||
import formButton from './ui/form/button.vue';
|
||||
import formRadio from './ui/form/radio.vue';
|
||||
|
||||
Vue.component('mk-instance', instance);
|
||||
Vue.component('mk-cw-button', cwButton);
|
||||
Vue.component('mk-tag-cloud', tagCloud);
|
||||
Vue.component('mk-trends', trends);
|
||||
|
57
src/client/app/common/views/components/instance.vue
Normal file
57
src/client/app/common/views/components/instance.vue
Normal file
@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<div class="nhasjydimbopojusarffqjyktglcuxjy" v-if="meta">
|
||||
<div class="banner" :style="{ backgroundImage: meta.bannerUrl ? `url(${meta.bannerUrl})` : null }"></div>
|
||||
|
||||
<h1>{{ meta.name }}</h1>
|
||||
<p v-html="meta.description || '%i18n:common.about%'"></p>
|
||||
<router-link to="/">%i18n:@start%</router-link>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
|
||||
export default Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
meta: null
|
||||
}
|
||||
},
|
||||
created() {
|
||||
(this as any).os.getMeta().then(meta => {
|
||||
this.meta = meta;
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
root(isDark)
|
||||
color isDark ? #fff : #5b646f
|
||||
background isDark ? #21242f : #fff
|
||||
text-align center
|
||||
|
||||
> .banner
|
||||
height 100px
|
||||
background-position center
|
||||
background-size cover
|
||||
|
||||
> h1
|
||||
margin 16px
|
||||
font-size 16px
|
||||
|
||||
> p
|
||||
margin 16px
|
||||
font-size 14px
|
||||
|
||||
> a
|
||||
display block
|
||||
padding-bottom 16px
|
||||
|
||||
.nhasjydimbopojusarffqjyktglcuxjy[data-darkmode]
|
||||
root(true)
|
||||
|
||||
.nhasjydimbopojusarffqjyktglcuxjy:not([data-darkmode])
|
||||
root(false)
|
||||
|
||||
</style>
|
@ -2,6 +2,8 @@
|
||||
<span class="mk-nav">
|
||||
<a :href="aboutUrl">%i18n:@about%</a>
|
||||
<i>・</i>
|
||||
<a href="/stats">%i18n:@stats%</a>
|
||||
<i>・</i>
|
||||
<a :href="repositoryUrl">%i18n:@repository%</a>
|
||||
<i>・</i>
|
||||
<a :href="feedbackUrl" target="_blank">%i18n:@feedback%</a>
|
||||
|
@ -28,11 +28,19 @@ export default Vue.extend({
|
||||
}];
|
||||
|
||||
if (this.note.userId == this.$store.state.i.id) {
|
||||
items.push({
|
||||
icon: '%fa:thumbtack%',
|
||||
text: '%i18n:@pin%',
|
||||
action: this.pin
|
||||
});
|
||||
if ((this.$store.state.i.pinnedNoteIds || []).includes(this.note.id)) {
|
||||
items.push({
|
||||
icon: '%fa:thumbtack%',
|
||||
text: '%i18n:@unpin%',
|
||||
action: this.unpin
|
||||
});
|
||||
} else {
|
||||
items.push({
|
||||
icon: '%fa:thumbtack%',
|
||||
text: '%i18n:@pin%',
|
||||
action: this.pin
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (this.note.userId == this.$store.state.i.id || this.$store.state.i.isAdmin) {
|
||||
@ -56,6 +64,7 @@ export default Vue.extend({
|
||||
return items;
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
detail() {
|
||||
this.$router.push(`/notes/${ this.note.id }`);
|
||||
@ -73,6 +82,14 @@ export default Vue.extend({
|
||||
});
|
||||
},
|
||||
|
||||
unpin() {
|
||||
(this as any).api('i/unpin', {
|
||||
noteId: this.note.id
|
||||
}).then(() => {
|
||||
this.destroyDom();
|
||||
});
|
||||
},
|
||||
|
||||
del() {
|
||||
if (!window.confirm('%i18n:@delete-confirm%')) return;
|
||||
(this as any).api('notes/delete', {
|
||||
|
@ -87,10 +87,12 @@ init(async (launch) => {
|
||||
updateBanner: updateBanner(os)
|
||||
}));
|
||||
|
||||
/**
|
||||
* Fuck AD Block
|
||||
*/
|
||||
fuckAdBlock(os);
|
||||
if (os.store.getters.isSignedIn) {
|
||||
/**
|
||||
* Fuck AD Block
|
||||
*/
|
||||
fuckAdBlock(os);
|
||||
}
|
||||
|
||||
/**
|
||||
* Init Notification
|
||||
|
@ -360,8 +360,8 @@ root(isDark)
|
||||
|
||||
> .form
|
||||
margin-bottom 16px
|
||||
border solid 1px rgba(#000, 0.075)
|
||||
border-radius 4px
|
||||
box-shadow var(--shadow)
|
||||
border-radius var(--round)
|
||||
|
||||
@media (max-width 700px)
|
||||
padding 0
|
||||
|
@ -10,6 +10,7 @@
|
||||
<x-timeline class="timeline" ref="tl" :user="user"/>
|
||||
</div>
|
||||
<div class="side">
|
||||
<div class="instance" v-if="!$store.getters.isSignedIn"><mk-instance/></div>
|
||||
<x-profile :user="user"/>
|
||||
<x-twitter :user="user" v-if="user.host === null && user.twitter"/>
|
||||
<mk-calendar @chosen="warp" :start="new Date(user.createdAt)"/>
|
||||
@ -131,6 +132,10 @@ root(isDark)
|
||||
font-size 0.8em
|
||||
color #aaa
|
||||
|
||||
> .instance
|
||||
box-shadow var(--shadow)
|
||||
border-radius var(--round)
|
||||
|
||||
> .nav
|
||||
padding 16px
|
||||
font-size 12px
|
||||
|
@ -187,6 +187,7 @@ export default Vue.extend({
|
||||
|
||||
(this as any).api('notes/local-timeline', {
|
||||
fileType: image,
|
||||
excludeNsfw: true,
|
||||
limit: 6
|
||||
}).then((notes: any[]) => {
|
||||
const files = concat(notes.map((n: any): any[] => n.files));
|
||||
|
@ -265,7 +265,7 @@ export default class MiOS extends EventEmitter {
|
||||
// When success
|
||||
.then(res => {
|
||||
// When failed to authenticate user
|
||||
if (res.status !== 200) {
|
||||
if (res.status !== 200 && res.status < 500) {
|
||||
return this.signout();
|
||||
}
|
||||
|
||||
|
@ -111,6 +111,7 @@ export default Vue.extend({
|
||||
|
||||
(this as any).api('notes/local-timeline', {
|
||||
fileType: image,
|
||||
excludeNsfw: true,
|
||||
limit: 6
|
||||
}).then((notes: any[]) => {
|
||||
const files = concat(notes.map((n: any): any[] => n.files));
|
||||
|
@ -20,6 +20,7 @@ Note.createIndex('userId');
|
||||
Note.createIndex('mentions');
|
||||
Note.createIndex('visibleUserIds');
|
||||
Note.createIndex('tagsLower');
|
||||
Note.createIndex('_files._id');
|
||||
Note.createIndex('_files.contentType');
|
||||
Note.createIndex({
|
||||
createdAt: -1
|
||||
|
@ -55,6 +55,8 @@ export default class Resolver {
|
||||
Accept: 'application/activity+json, application/ld+json'
|
||||
},
|
||||
json: true
|
||||
}).catch(e => {
|
||||
throw new Error(`request error: ${e.message}`);
|
||||
});
|
||||
|
||||
if (object === null || (
|
||||
|
@ -4,6 +4,7 @@ import DriveFile, { validateFileName, pack } from '../../../../../models/drive-f
|
||||
import { publishDriveStream } from '../../../../../stream';
|
||||
import { ILocalUser } from '../../../../../models/user';
|
||||
import getParams from '../../../get-params';
|
||||
import Note from '../../../../../models/note';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
@ -93,6 +94,18 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
|
||||
}
|
||||
});
|
||||
|
||||
// ドライブのファイルが非正規化されているドキュメントも更新
|
||||
Note.find({
|
||||
'_files._id': file._id
|
||||
}).then(notes => {
|
||||
notes.forEach(note => {
|
||||
note._files[note._files.findIndex(f => f._id.equals(file._id))] = file;
|
||||
Note.findOneAndUpdate({ _id: note._id }, {
|
||||
_files: note._files
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Serialize
|
||||
const fileObj = await pack(file);
|
||||
|
||||
|
@ -1,21 +1,35 @@
|
||||
import * as mongo from 'mongodb';
|
||||
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||
import User, { ILocalUser } from '../../../../models/user';
|
||||
import Note from '../../../../models/note';
|
||||
import { pack } from '../../../../models/user';
|
||||
import { deliverPinnedChange } from '../../../../services/i/pin';
|
||||
import getParams from '../../get-params';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
'ja-JP': '指定した投稿をピン留めします。'
|
||||
},
|
||||
|
||||
requireCredential: true,
|
||||
|
||||
kind: 'account-write',
|
||||
|
||||
params: {
|
||||
noteId: $.type(ID).note({
|
||||
desc: {
|
||||
'ja-JP': '対象の投稿のID'
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Pin note
|
||||
*/
|
||||
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||
// Get 'noteId' parameter
|
||||
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
|
||||
if (noteIdErr) return rej('invalid noteId param');
|
||||
const [ps, psErr] = getParams(meta, params);
|
||||
if (psErr) return rej(psErr);
|
||||
|
||||
// Fetch pinee
|
||||
const note = await Note.findOne({
|
||||
_id: noteId,
|
||||
_id: ps.noteId,
|
||||
userId: user._id
|
||||
});
|
||||
|
||||
@ -23,21 +37,17 @@ export default async (params: any, user: ILocalUser) => new Promise(async (res,
|
||||
return rej('note not found');
|
||||
}
|
||||
|
||||
let addedId: mongo.ObjectID;
|
||||
let removedId: mongo.ObjectID;
|
||||
|
||||
const pinnedNoteIds = user.pinnedNoteIds || [];
|
||||
|
||||
if (pinnedNoteIds.length > 5) {
|
||||
return rej('cannot pin more notes');
|
||||
}
|
||||
|
||||
if (pinnedNoteIds.some(id => id.equals(note._id))) {
|
||||
return rej('already exists');
|
||||
}
|
||||
|
||||
pinnedNoteIds.unshift(note._id);
|
||||
addedId = note._id;
|
||||
|
||||
if (pinnedNoteIds.length > 5) {
|
||||
removedId = pinnedNoteIds.pop();
|
||||
}
|
||||
|
||||
await User.update(user._id, {
|
||||
$set: {
|
||||
@ -45,14 +55,13 @@ export default async (params: any, user: ILocalUser) => new Promise(async (res,
|
||||
}
|
||||
});
|
||||
|
||||
// Serialize
|
||||
const iObj = await pack(user, user, {
|
||||
detail: true
|
||||
});
|
||||
|
||||
// Send Add/Remove to followers
|
||||
deliverPinnedChange(user._id, removedId, addedId);
|
||||
|
||||
// Send response
|
||||
res(iObj);
|
||||
|
||||
// Send Add to followers
|
||||
deliverPinnedChange(user._id, note._id, true);
|
||||
});
|
||||
|
57
src/server/api/endpoints/i/unpin.ts
Normal file
57
src/server/api/endpoints/i/unpin.ts
Normal file
@ -0,0 +1,57 @@
|
||||
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||
import User, { ILocalUser } from '../../../../models/user';
|
||||
import Note from '../../../../models/note';
|
||||
import { pack } from '../../../../models/user';
|
||||
import { deliverPinnedChange } from '../../../../services/i/pin';
|
||||
import getParams from '../../get-params';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
'ja-JP': '指定した投稿のピン留めを解除します。'
|
||||
},
|
||||
|
||||
requireCredential: true,
|
||||
|
||||
kind: 'account-write',
|
||||
|
||||
params: {
|
||||
noteId: $.type(ID).note({
|
||||
desc: {
|
||||
'ja-JP': '対象の投稿のID'
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||
const [ps, psErr] = getParams(meta, params);
|
||||
if (psErr) return rej(psErr);
|
||||
|
||||
// Fetch unpinee
|
||||
const note = await Note.findOne({
|
||||
_id: ps.noteId,
|
||||
userId: user._id
|
||||
});
|
||||
|
||||
if (note === null) {
|
||||
return rej('note not found');
|
||||
}
|
||||
|
||||
const pinnedNoteIds = (user.pinnedNoteIds || []).filter(id => !id.equals(note._id));
|
||||
|
||||
await User.update(user._id, {
|
||||
$set: {
|
||||
pinnedNoteIds: pinnedNoteIds
|
||||
}
|
||||
});
|
||||
|
||||
const iObj = await pack(user, user, {
|
||||
detail: true
|
||||
});
|
||||
|
||||
// Send response
|
||||
res(iObj);
|
||||
|
||||
// Send Remove to followers
|
||||
deliverPinnedChange(user._id, note._id, false);
|
||||
});
|
@ -2,6 +2,7 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
|
||||
import Favorite from '../../../../../models/favorite';
|
||||
import Note from '../../../../../models/note';
|
||||
import { ILocalUser } from '../../../../../models/user';
|
||||
import getParams from '../../../get-params';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
@ -11,17 +12,24 @@ export const meta = {
|
||||
|
||||
requireCredential: true,
|
||||
|
||||
kind: 'favorite-write'
|
||||
kind: 'favorite-write',
|
||||
|
||||
params: {
|
||||
noteId: $.type(ID).note({
|
||||
desc: {
|
||||
'ja-JP': '対象の投稿のID'
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||
// Get 'noteId' parameter
|
||||
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
|
||||
if (noteIdErr) return rej('invalid noteId param');
|
||||
const [ps, psErr] = getParams(meta, params);
|
||||
if (psErr) return rej(psErr);
|
||||
|
||||
// Get favoritee
|
||||
const note = await Note.findOne({
|
||||
_id: noteId
|
||||
_id: ps.noteId
|
||||
});
|
||||
|
||||
if (note === null) {
|
||||
|
@ -30,6 +30,13 @@ export const meta = {
|
||||
}
|
||||
}),
|
||||
|
||||
excludeNsfw: $.bool.optional.note({
|
||||
default: false,
|
||||
desc: {
|
||||
'ja-JP': 'true にすると、NSFW指定されたファイルを除外します(fileTypeが指定されている場合のみ有効)'
|
||||
}
|
||||
}),
|
||||
|
||||
limit: $.num.optional.range(1, 100).note({
|
||||
default: 10
|
||||
}),
|
||||
@ -97,6 +104,12 @@ export default async (params: any, user: ILocalUser) => {
|
||||
query['_files.contentType'] = {
|
||||
$in: ps.fileType
|
||||
};
|
||||
|
||||
if (ps.excludeNsfw) {
|
||||
query['_files.metadata.isSensitive'] = {
|
||||
$ne: true
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (ps.sinceId) {
|
||||
|
@ -7,7 +7,7 @@ import renderRemove from '../../remote/activitypub/renderer/remove';
|
||||
import packAp from '../../remote/activitypub/renderer';
|
||||
import { deliver } from '../../queue';
|
||||
|
||||
export async function deliverPinnedChange(userId: mongo.ObjectID, oldId?: mongo.ObjectID, newId?: mongo.ObjectID) {
|
||||
export async function deliverPinnedChange(userId: mongo.ObjectID, noteId: mongo.ObjectID, isAddition: boolean) {
|
||||
const user = await User.findOne({
|
||||
_id: userId
|
||||
});
|
||||
@ -20,21 +20,11 @@ export async function deliverPinnedChange(userId: mongo.ObjectID, oldId?: mongo.
|
||||
|
||||
const target = `${config.url}/users/${user._id}/collections/featured`;
|
||||
|
||||
if (oldId) {
|
||||
const oldItem = `${config.url}/notes/${oldId}`;
|
||||
const content = packAp(renderRemove(user, target, oldItem));
|
||||
queue.forEach(inbox => {
|
||||
deliver(user, content, inbox);
|
||||
});
|
||||
}
|
||||
|
||||
if (newId) {
|
||||
const newItem = `${config.url}/notes/${newId}`;
|
||||
const content = packAp(renderAdd(user, target, newItem));
|
||||
queue.forEach(inbox => {
|
||||
deliver(user, content, inbox);
|
||||
});
|
||||
}
|
||||
const item = `${config.url}/notes/${noteId}`;
|
||||
const content = packAp(isAddition ? renderAdd(user, target, item) : renderRemove(user, target, item));
|
||||
queue.forEach(inbox => {
|
||||
deliver(user, content, inbox);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,6 +118,11 @@ export default async (user: IUser, data: Option, silent = false) => new Promise<
|
||||
return rej();
|
||||
}
|
||||
|
||||
// Renote対象が「ホームまたは全体」以外の公開範囲ならreject
|
||||
if (data.renote && data.renote.visibility != 'public' && data.renote.visibility != 'home') {
|
||||
return rej();
|
||||
}
|
||||
|
||||
// リプライ対象が自分以外の非公開の投稿なら禁止
|
||||
if (data.reply && data.reply.visibility == 'private' && !data.reply.userId.equals(user._id)) {
|
||||
return rej();
|
||||
|
@ -5,7 +5,6 @@
|
||||
import * as fs from 'fs';
|
||||
import * as webpack from 'webpack';
|
||||
import chalk from 'chalk';
|
||||
import rndstr from 'rndstr';
|
||||
const { VueLoaderPlugin } = require('vue-loader');
|
||||
const minifyHtml = require('html-minifier').minify;
|
||||
const WebpackOnBuildPlugin = require('on-build-webpack');
|
||||
@ -19,7 +18,7 @@ const constants = require('./src/const.json');
|
||||
|
||||
const locales = require('./locales');
|
||||
const meta = require('./package.json');
|
||||
const version = `${meta.clientVersion}-${rndstr({ length: 8, chars: '0-9a-z' })}`;
|
||||
const version = meta.clientVersion;
|
||||
const codename = meta.codename;
|
||||
|
||||
declare var global: {
|
||||
|
Reference in New Issue
Block a user