Compare commits

...

24 Commits

Author SHA1 Message Date
d52cf46cc1 10.1.0 2018-10-09 01:52:18 +09:00
c6110dd996 Fix bug
Closes #2855
2018-10-09 01:50:49 +09:00
51d8de2c38 Improve readability 2018-10-09 01:33:40 +09:00
4455a1aa9d Fix bug 2018-10-09 01:33:31 +09:00
040d395ddb 🎨 2018-10-09 01:26:04 +09:00
8296cac636 Merge branch 'develop' of https://github.com/syuilo/misskey into develop 2018-10-09 01:02:04 +09:00
3eafe8b87d Better api definition 2018-10-09 01:01:48 +09:00
c01512e261 Merge pull request #2854 from syuilo/greenkeeper/style-loader-0.23.1
Update style-loader to the latest version 🚀
2018-10-09 00:56:03 +09:00
e5cf3aecd5 Merge pull request #2830 from sei0o/fix-2346
fix #2346
2018-10-09 00:55:47 +09:00
a8f90b41b7 fix(package): update style-loader to version 0.23.1 2018-10-08 13:43:10 +00:00
b79169b975 Deleted dump.rdb 2018-10-08 22:26:26 +09:00
437d52e2ed Improve theme 2018-10-08 18:42:19 +09:00
1329721440 Merge pull request #2828 from hakaba-hitoyo/feature/external-user-recommendation
External user recommendation
2018-10-08 18:31:00 +09:00
6affb4fe97 Merge pull request #2851 from mei23/mei-1008-fix-apshow2
ap/showが返ってこないことがあるのを修正
2018-10-08 17:33:46 +09:00
15395686aa ap/showが返ってこないことがあるのを修正 2018-10-08 16:01:38 +09:00
5cf1956135 Added CSS variables for background of reactions-viewer 2018-10-06 22:14:30 +09:00
fff307d4bb fix #2346 2018-10-06 17:51:59 +09:00
2b7782ba03 replace var by const 2018-10-06 17:38:57 +09:00
96d961ee80 better readable code 2018-10-06 17:23:32 +09:00
9f064d76d9 better readable code 2018-10-06 17:21:27 +09:00
2e39106c4b better config handling 2018-10-06 17:19:41 +09:00
04650464f3 debug 2018-10-06 16:34:52 +09:00
3bc7e1e35c remove follow buttons in the friends-maker component/widget 2018-10-06 16:31:21 +09:00
7019ddbfc7 external user recommendation 2018-10-06 16:03:18 +09:00
18 changed files with 182 additions and 117 deletions

View File

@ -159,3 +159,10 @@ drive:
# Summaly proxy
# summalyProxy: "http://example.com"
# User recommendation
user_recommendation:
external: true
engine: http://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-misskey-api.cgi?{{host}}+{{user}}+{{limit}}+{{offset}}
timeout: 300000

View File

@ -1,8 +1,8 @@
{
"name": "misskey",
"author": "syuilo <i@syuilo.com>",
"version": "10.0.0",
"clientVersion": "1.0.10328",
"version": "10.1.0",
"clientVersion": "1.0.10352",
"codename": "nighthike",
"main": "./built/index.js",
"private": true,
@ -191,7 +191,7 @@
"single-line-log": "1.1.2",
"speakeasy": "2.0.0",
"stringz": "1.0.0",
"style-loader": "0.23.0",
"style-loader": "0.23.1",
"stylus": "0.54.5",
"stylus-loader": "3.0.2",
"summaly": "2.2.0",

View File

@ -13,14 +13,14 @@ export default prop => ({
},
$_ns_isRenote(): boolean {
return (this.$_ns_note_.renote &&
return (this.$_ns_note_.renote != null &&
this.$_ns_note_.text == null &&
this.$_ns_note_.fileIds.length == 0 &&
this.$_ns_note_.poll == null);
},
$_ns_target(): any {
return this._ns_isRenote ? this.$_ns_note_.renote : this.$_ns_note_;
return this.$_ns_isRenote ? this.$_ns_note_.renote : this.$_ns_note_;
},
},
@ -86,8 +86,16 @@ export default prop => ({
switch (type) {
case 'reacted': {
const reaction = body.reaction;
if (this.$_ns_target.reactionCounts == null) Vue.set(this.$_ns_target, 'reactionCounts', {});
if (this.$_ns_target.reactionCounts == null) {
Vue.set(this.$_ns_target, 'reactionCounts', {});
}
this.$_ns_target.reactionCounts[reaction] = (this.$_ns_target.reactionCounts[reaction] || 0) + 1;
if (body.userId == this.$store.state.i.id) {
Vue.set(this.$_ns_target, 'myReaction', reaction);
}
break;
}

View File

@ -253,14 +253,13 @@ abstract class Connection extends EventEmitter {
@autobind
public send(typeOrPayload, payload?) {
const data = payload === undefined ? typeOrPayload : {
type: typeOrPayload,
body: payload
};
const type = payload === undefined ? typeOrPayload.type : typeOrPayload;
const body = payload === undefined ? typeOrPayload.body : payload;
this.stream.send('channel', {
id: this.id,
body: data
type: type,
body: body
});
}

View File

@ -186,9 +186,8 @@ export default Vue.extend({
if (this.game.isStarted && !this.game.isEnded) {
this.pollingClock = setInterval(() => {
const crc32 = CRC32.str(this.logs.map(x => x.pos.toString()).join(''));
this.connection.send({
type: 'check',
crc32
this.connection.send('check', {
crc32: crc32
});
}, 3000);
}
@ -224,9 +223,8 @@ export default Vue.extend({
sound.play();
}
this.connection.send({
type: 'set',
pos
this.connection.send('set', {
pos: pos
});
this.checkEnd();

View File

@ -149,9 +149,9 @@ export default Vue.extend({
},
created() {
this.connection.on('change-accepts', this.onChangeAccepts);
this.connection.on('update-settings', this.onUpdateSettings);
this.connection.on('init-form', this.onInitForm);
this.connection.on('changeAccepts', this.onChangeAccepts);
this.connection.on('updateSettings', this.onUpdateSettings);
this.connection.on('initForm', this.onInitForm);
this.connection.on('message', this.onMessage);
if (this.game.user1Id != this.$store.state.i.id && this.game.settings.form1) this.form = this.game.settings.form1;
@ -159,9 +159,9 @@ export default Vue.extend({
},
beforeDestroy() {
this.connection.off('change-accepts', this.onChangeAccepts);
this.connection.off('update-settings', this.onUpdateSettings);
this.connection.off('init-form', this.onInitForm);
this.connection.off('changeAccepts', this.onChangeAccepts);
this.connection.off('updateSettings', this.onUpdateSettings);
this.connection.off('initForm', this.onInitForm);
this.connection.off('message', this.onMessage);
},
@ -171,15 +171,11 @@ export default Vue.extend({
},
accept() {
this.connection.send({
type: 'accept'
});
this.connection.send('accept', {});
},
cancel() {
this.connection.send({
type: 'cancel-accept'
});
this.connection.send('cancelAccept', {});
},
onChangeAccepts(accepts) {
@ -189,8 +185,7 @@ export default Vue.extend({
},
updateSettings() {
this.connection.send({
type: 'update-settings',
this.connection.send('updateSettings', {
settings: this.game.settings
});
},
@ -216,8 +211,7 @@ export default Vue.extend({
},
onChangeForm(item) {
this.connection.send({
type: 'update-form',
this.connection.send('updateForm', {
id: item.id,
value: item.value
});
@ -238,9 +232,9 @@ export default Vue.extend({
const y = Math.floor(pos / this.game.settings.map[0].length);
const newPixel =
pixel == ' ' ? '-' :
pixel == '-' ? 'b' :
pixel == 'b' ? 'w' :
' ';
pixel == '-' ? 'b' :
pixel == 'b' ? 'w' :
' ';
const line = this.game.settings.map[y].split('');
line[x] = newPixel;
this.$set(this.game.settings.map, y, line.join(''));

View File

@ -174,8 +174,7 @@ export default Vue.extend({
this.messages.push(message);
if (message.userId != this.$store.state.i.id && !document.hidden) {
this.connection.send({
type: 'read',
this.connection.send('read', {
id: message.id
});
}
@ -247,8 +246,7 @@ export default Vue.extend({
if (document.hidden) return;
this.messages.forEach(message => {
if (message.userId !== this.$store.state.i.id && !message.isRead) {
this.connection.send({
type: 'read',
this.connection.send('read', {
id: message.id
});
}

View File

@ -1,16 +1,16 @@
<template>
<div class="mk-reactions-viewer">
<template v-if="reactions">
<span :class="{notReacted}" @click="react('like')" v-if="reactions.like"><mk-reaction-icon reaction="like"/><span>{{ reactions.like }}</span></span>
<span :class="{notReacted}" @click="react('love')" v-if="reactions.love"><mk-reaction-icon reaction="love"/><span>{{ reactions.love }}</span></span>
<span :class="{notReacted}" @click="react('laugh')" v-if="reactions.laugh"><mk-reaction-icon reaction="laugh"/><span>{{ reactions.laugh }}</span></span>
<span :class="{notReacted}" @click="react('hmm')" v-if="reactions.hmm"><mk-reaction-icon reaction="hmm"/><span>{{ reactions.hmm }}</span></span>
<span :class="{notReacted}" @click="react('surprise')" v-if="reactions.surprise"><mk-reaction-icon reaction="surprise"/><span>{{ reactions.surprise }}</span></span>
<span :class="{notReacted}" @click="react('congrats')" v-if="reactions.congrats"><mk-reaction-icon reaction="congrats"/><span>{{ reactions.congrats }}</span></span>
<span :class="{notReacted}" @click="react('angry')" v-if="reactions.angry"><mk-reaction-icon reaction="angry"/><span>{{ reactions.angry }}</span></span>
<span :class="{notReacted}" @click="react('confused')" v-if="reactions.confused"><mk-reaction-icon reaction="confused"/><span>{{ reactions.confused }}</span></span>
<span :class="{notReacted}" @click="react('rip')" v-if="reactions.rip"><mk-reaction-icon reaction="rip"/><span>{{ reactions.rip }}</span></span>
<span :class="{notReacted}" @click="react('pudding')" v-if="reactions.pudding"><mk-reaction-icon reaction="pudding"/><span>{{ reactions.pudding }}</span></span>
<span :class="{ reacted: note.myReaction == 'like' }" @click="react('like')" v-if="reactions.like"><mk-reaction-icon reaction="like"/><span>{{ reactions.like }}</span></span>
<span :class="{ reacted: note.myReaction == 'love' }" @click="react('love')" v-if="reactions.love"><mk-reaction-icon reaction="love"/><span>{{ reactions.love }}</span></span>
<span :class="{ reacted: note.myReaction == 'laugh' }" @click="react('laugh')" v-if="reactions.laugh"><mk-reaction-icon reaction="laugh"/><span>{{ reactions.laugh }}</span></span>
<span :class="{ reacted: note.myReaction == 'hmm' }" @click="react('hmm')" v-if="reactions.hmm"><mk-reaction-icon reaction="hmm"/><span>{{ reactions.hmm }}</span></span>
<span :class="{ reacted: note.myReaction == 'surprise' }" @click="react('surprise')" v-if="reactions.surprise"><mk-reaction-icon reaction="surprise"/><span>{{ reactions.surprise }}</span></span>
<span :class="{ reacted: note.myReaction == 'congrats' }" @click="react('congrats')" v-if="reactions.congrats"><mk-reaction-icon reaction="congrats"/><span>{{ reactions.congrats }}</span></span>
<span :class="{ reacted: note.myReaction == 'angry' }" @click="react('angry')" v-if="reactions.angry"><mk-reaction-icon reaction="angry"/><span>{{ reactions.angry }}</span></span>
<span :class="{ reacted: note.myReaction == 'confused' }" @click="react('confused')" v-if="reactions.confused"><mk-reaction-icon reaction="confused"/><span>{{ reactions.confused }}</span></span>
<span :class="{ reacted: note.myReaction == 'rip' }" @click="react('rip')" v-if="reactions.rip"><mk-reaction-icon reaction="rip"/><span>{{ reactions.rip }}</span></span>
<span :class="{ reacted: note.myReaction == 'pudding' }" @click="react('pudding')" v-if="reactions.pudding"><mk-reaction-icon reaction="pudding"/><span>{{ reactions.pudding }}</span></span>
</template>
</div>
</template>
@ -22,9 +22,6 @@ export default Vue.extend({
computed: {
reactions(): number {
return this.note.reactionCounts;
},
notReacted(): boolean {
return this.note.myReaction == null;
}
},
methods: {
@ -40,25 +37,42 @@ export default Vue.extend({
<style lang="stylus" scoped>
.mk-reactions-viewer
border-top dashed 1px var(--reactionViewerBorder)
border-bottom dashed 1px var(--reactionViewerBorder)
margin 4px 0
margin 6px 0
&:empty
display none
> span
margin-right 8px
display inline-block
height 32px
margin-right 6px
padding 0 6px
border-radius 4px
&.notReacted
*
user-select none
pointer-events none
&.reacted
background var(--primary)
> span
color var(--primaryForeground)
&:not(.reacted)
cursor pointer
background var(--reactionViewerButtonBg)
&:hover
background var(--reactionViewerButtonHoverBg)
> .mk-reaction-icon
font-size 1.4em
> span
margin-left 4px
font-size 1.2em
font-size 1.1em
line-height 32px
vertical-align middle
color var(--text)
</style>

View File

@ -8,7 +8,6 @@
<router-link class="name" :to="user | userPage" v-user-preview="user.id">{{ user | userName }}</router-link>
<p class="username">@{{ user | acct }}</p>
</div>
<mk-follow-button :user="user"/>
</div>
</div>
<p class="empty" v-if="!fetching && users.length == 0">%i18n:@empty%</p>

View File

@ -13,7 +13,6 @@
<router-link class="name" :to="_user | userPage" v-user-preview="_user.id">{{ _user | userName }}</router-link>
<p class="username">@{{ _user | acct }}</p>
</div>
<mk-follow-button :user="_user"/>
</div>
</template>
<p class="empty" v-else>%i18n:@no-one%</p>

View File

@ -26,7 +26,7 @@
face: '$secondary',
faceText: '#fff',
faceHeader: ':lighten<5<$secondary',
faceHeaderText: '#e3e5e8',
faceHeaderText: '$text',
faceDivider: 'rgba(0, 0, 0, 0.3)',
faceTextButton: '$text',
faceTextButtonHover: ':lighten<10<$text',
@ -84,7 +84,8 @@
reactionPickerButtonHoverBg: 'rgba(255, 255, 255, 0.18)',
reactionViewerBorder: 'rgba(255, 255, 255, 0.1)',
reactionViewerButtonBg: 'rgba(255, 255, 255, 0.1)',
reactionViewerButtonHoverBg: 'rgba(255, 255, 255, 0.2)',
pollEditorInputBg: 'rgba(0, 0, 0, 0.25)',

View File

@ -84,7 +84,8 @@
reactionPickerButtonHoverBg: '#eee',
reactionViewerBorder: 'rgba(0, 0, 0, 0.1)',
reactionViewerButtonBg: 'rgba(0, 0, 0, 0.05)',
reactionViewerButtonHoverBg: 'rgba(0, 0, 0, 0.1)',
pollEditorInputBg: '#fff',

View File

@ -96,6 +96,12 @@ export type Source = {
google_maps_api_key: string;
clusterLimit?: number;
user_recommendation: {
external: boolean;
engine: string;
timeout: number;
};
};
/**

View File

@ -24,15 +24,15 @@ export const meta = {
},
};
export default (params: any) => new Promise(async (res, rej) => {
export default async (params: any) => {
const [ps, psErr] = getParams(meta, params);
if (psErr) return rej(psErr);
if (psErr) throw psErr;
const object = await fetchAny(ps.uri);
if (object !== null) return res(object);
if (object !== null) return object;
return rej('object not found');
});
throw new Error('object not found');
};
/***
* URIからUserかNoteを解決する

View File

@ -1,6 +1,3 @@
/**
* Module dependencies
*/
import * as os from 'os';
import config from '../../../config';
import Meta from '../../../models/meta';
@ -9,9 +6,17 @@ import { ILocalUser } from '../../../models/user';
const pkg = require('../../../../package.json');
const client = require('../../../../built/client/meta.json');
/**
* Show core info
*/
export const meta = {
desc: {
'ja-JP': 'インスタンス情報を取得します。',
'en-US': 'Get the information of this instance.'
},
requireCredential: false,
params: {},
};
export default (params: any, me: ILocalUser) => new Promise(async (res, rej) => {
const meta: any = (await Meta.findOne()) || {};
@ -28,10 +33,12 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
machine: os.hostname(),
os: os.platform(),
node: process.version,
cpu: {
model: os.cpus()[0].model,
cores: os.cpus().length
},
broadcasts: meta.broadcasts || [],
disableRegistration: meta.disableRegistration,
disableLocalTimeline: meta.disableLocalTimeline,
@ -40,6 +47,7 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
swPublickey: config.sw ? config.sw.public_key : null,
hidedTags: (me && me.isAdmin) ? meta.hidedTags : undefined,
bannerUrl: meta.bannerUrl,
features: {
registration: !meta.disableRegistration,
localTimeLine: !meta.disableLocalTimeline,

View File

@ -3,6 +3,8 @@ import $ from 'cafy';
import User, { pack, ILocalUser } from '../../../../models/user';
import { getFriendIds } from '../../common/get-friends';
import Mute from '../../../../models/mute';
import * as request from 'request'
import config from '../../../../config'
export const meta = {
desc: {
@ -15,44 +17,74 @@ export const meta = {
};
export default (params: any, me: ILocalUser) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
if (limitErr) return rej('invalid limit param');
// Get 'offset' parameter
const [offset = 0, offsetErr] = $.num.optional.min(0).get(params.offset);
if (offsetErr) return rej('invalid offset param');
// ID list of the user itself and other users who the user follows
const followingIds = await getFriendIds(me._id);
// ミュートしているユーザーを取得
const mutedUserIds = (await Mute.find({
muterId: me._id
})).map(m => m.muteeId);
const users = await User
.find({
_id: {
$nin: followingIds.concat(mutedUserIds)
if (config.user_recommendation && config.user_recommendation.external) {
const userName = me.username
const hostName = config.hostname
const limit = params.limit
const offset = params.offset
const timeout = config.user_recommendation.timeout
const engine = config.user_recommendation.engine
const url = engine
.replace('{{host}}', hostName)
.replace('{{user}}', userName)
.replace('{{limit}}', limit)
.replace('{{offset}}', offset)
request(
{
url: url,
timeout: timeout,
json: true,
followRedirect: true,
followAllRedirects: true
},
isLocked: false,
$or: [{
lastUsedAt: {
$gte: new Date(Date.now() - ms('7days'))
(error: any, response: any, body: any) => {
if (!error && response.statusCode == 200) {
res(body)
} else {
res([])
}
}, {
host: null
}]
}, {
limit: limit,
skip: offset,
sort: {
followersCount: -1
}
});
)
} else {
// Get 'limit' parameter
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
if (limitErr) return rej('invalid limit param');
// Serialize
res(await Promise.all(users.map(async user =>
await pack(user, me, { detail: true }))));
// Get 'offset' parameter
const [offset = 0, offsetErr] = $.num.optional.min(0).get(params.offset);
if (offsetErr) return rej('invalid offset param');
// ID list of the user itself and other users who the user follows
const followingIds = await getFriendIds(me._id);
// ミュートしているユーザーを取得
const mutedUserIds = (await Mute.find({
muterId: me._id
})).map(m => m.muteeId);
const users = await User
.find({
_id: {
$nin: followingIds.concat(mutedUserIds)
},
isLocked: false,
$or: [{
lastUsedAt: {
$gte: new Date(Date.now() - ms('7days'))
}
}, {
host: null
}]
}, {
limit: limit,
skip: offset,
sort: {
followersCount: -1
}
});
// Serialize
res(await Promise.all(users.map(async user =>
await pack(user, me, { detail: true }))));
}
});

View File

@ -23,10 +23,10 @@ export default class extends Channel {
public onMessage(type: string, body: any) {
switch (type) {
case 'accept': this.accept(true); break;
case 'cancel-accept': this.accept(false); break;
case 'update-settings': this.updateSettings(body.settings); break;
case 'init-form': this.initForm(body); break;
case 'update-form': this.updateForm(body.id, body.value); break;
case 'cancelAccept': this.accept(false); break;
case 'updateSettings': this.updateSettings(body.settings); break;
case 'initForm': this.initForm(body); break;
case 'updateForm': this.updateForm(body.id, body.value); break;
case 'message': this.message(body); break;
case 'set': this.set(body.pos); break;
case 'check': this.check(body.crc32); break;

View File

@ -44,7 +44,8 @@ export default async (user: IUser, note: INote, reaction: string) => new Promise
});
publishNoteStream(note._id, 'reacted', {
reaction: reaction
reaction: reaction,
userId: user._id
});
// リアクションされたユーザーがローカルユーザーなら通知を作成