Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
87091a2e03 | |||
59d67d3140 | |||
7b4c307c46 | |||
92484be87f | |||
56b8f8b07d | |||
722de35037 | |||
d93f76c1af | |||
cba0dd5e17 | |||
a2e2d5ba77 | |||
61e05cb50e | |||
49e82adc6c | |||
e4e668b327 | |||
8028c85c67 |
@ -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.58.0",
|
||||
"clientVersion": "1.0.9945",
|
||||
"version": "8.61.0",
|
||||
"clientVersion": "1.0.9958",
|
||||
"codename": "nighthike",
|
||||
"main": "./built/index.js",
|
||||
"private": true,
|
||||
|
@ -10,7 +10,8 @@ export default Vue.extend({
|
||||
computed: {
|
||||
keymap(): any {
|
||||
return {
|
||||
'h|slash': this.help
|
||||
'h|slash': this.help,
|
||||
'd': this.dark
|
||||
};
|
||||
}
|
||||
},
|
||||
@ -18,6 +19,13 @@ export default Vue.extend({
|
||||
methods: {
|
||||
help() {
|
||||
window.open(`${url}/docs/${lang}/keyboard-shortcut`, '_blank');
|
||||
},
|
||||
|
||||
dark() {
|
||||
this.$store.commit('device/set', {
|
||||
key: 'darkmode',
|
||||
value: !this.$store.state.device.darkmode
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -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
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Misskeyキーボードショートカットまとめ
|
||||
# キーボードショートカット
|
||||
|
||||
## グローバル
|
||||
これらのショートカットは基本的にどこでも使えます。
|
||||
@ -11,6 +11,7 @@
|
||||
<tr><td><kbd class="key">T</kbd></td><td>タイムラインの最も新しい投稿にフォーカス</td><td><b>T</b>imeline, <b>T</b>op</td></tr>
|
||||
<tr><td><kbd class="group"><kbd class="key">Shift</kbd> + <kbd class="key">N</kbd></kbd></td><td>通知を表示/隠す</td><td><b>N</b>otifications</td></tr>
|
||||
<tr><td><kbd class="key">A</kbd>, <kbd class="key">M</kbd></td><td>アカウントメニューを表示/隠す</td><td><b>A</b>ccount, <b>M</b>y, <b>M</b>e, <b>M</b>enu</td></tr>
|
||||
<tr><td><kbd class="key">D</kbd></td><td>ダークモード切り替え</td><td><b>D</b>ark</td></tr>
|
||||
<tr><td><kbd class="key">Z</kbd></td><td>上部のバーを隠す</td><td><b>Z</b>en</td></tr>
|
||||
<tr><td><kbd class="key">H</kbd>, <kbd class="key">?</kbd></td><td>ヘルプを表示</td><td><b>H</b>elp</td></tr>
|
||||
</tbody>
|
||||
|
@ -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 || (
|
||||
|
@ -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) {
|
||||
|
@ -4,6 +4,7 @@ import { getFriendIds } from '../../common/get-friends';
|
||||
import { pack } from '../../../../models/note';
|
||||
import { ILocalUser } from '../../../../models/user';
|
||||
import getParams from '../../get-params';
|
||||
import read from '../../../../services/note/read';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
@ -85,6 +86,8 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
|
||||
sort: sort
|
||||
});
|
||||
|
||||
mentions.forEach(note => read(user._id, note._id));
|
||||
|
||||
// Serialize
|
||||
res(await Promise.all(mentions.map(mention => pack(mention, user))));
|
||||
});
|
||||
|
@ -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();
|
||||
|
@ -20,11 +20,15 @@ export default (
|
||||
: new mongo.ObjectID(note);
|
||||
|
||||
// Remove document
|
||||
await NoteUnread.remove({
|
||||
const res = await NoteUnread.remove({
|
||||
userId: userId,
|
||||
noteId: noteId
|
||||
});
|
||||
|
||||
if (res.deletedCount == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const count1 = await NoteUnread
|
||||
.count({
|
||||
userId: userId,
|
||||
|
Reference in New Issue
Block a user