Compare commits
55 Commits
Author | SHA1 | Date | |
---|---|---|---|
23c32f1211 | |||
c8a5d693ed | |||
4a54d01ca8 | |||
359a7a7b98 | |||
aaa25deaa9 | |||
cd07ae4d2e | |||
1e8c1efe2f | |||
ce405fc4f6 | |||
50a6efd568 | |||
2c6f881093 | |||
e4bf0392af | |||
fcb9133f27 | |||
5c6f24dc39 | |||
ce562f3bca | |||
9ef477f04b | |||
5268fee5b5 | |||
68e28faedc | |||
12f63db62e | |||
08e1c87fa6 | |||
8ee962b729 | |||
3d8b45ecdd | |||
2347d9cea2 | |||
8a57f490ce | |||
a880f5cbb8 | |||
df5a7c7e0c | |||
b7b82456d8 | |||
6b19e54c23 | |||
75d04858e6 | |||
9332551791 | |||
32117a573b | |||
d4d3316d18 | |||
43a7eb233c | |||
178093861b | |||
3fb26534b7 | |||
19a9fdfd38 | |||
6438e97324 | |||
b29492e8eb | |||
5ab4f10230 | |||
80b251e12c | |||
bfd8b12a4f | |||
1c2e94658b | |||
286da28cd6 | |||
a4ee93a355 | |||
ab56cb1788 | |||
32435e4d8e | |||
900cdf9d9a | |||
e79019266f | |||
deee7361f0 | |||
bdcf09c618 | |||
7b5d6dcd9b | |||
0595d87759 | |||
fab0a0d6e2 | |||
3eb6b36866 | |||
50327158e2 | |||
a99756ef85 |
@ -131,3 +131,6 @@ drive:
|
||||
# Ghost account is an account used for the purpose of delegating
|
||||
# followers when putting users in the list.
|
||||
# ghost: user-id-of-your-ghost-account
|
||||
|
||||
# Clustering
|
||||
# clusterLimit: 1
|
||||
|
@ -43,9 +43,9 @@ If you want to...
|
||||
|
||||
:heart: Backers & Sponsors
|
||||
----------------------------------------------------------------
|
||||
| <img src="https://c10.patreonusercontent.com/3/eyJoIjoxMDAsInciOjEwMH0%3D/patreon-media/p/user/619786/32cf01444db24e578cd1982c197f6fc6/1?token-time=2145916800&token-hash=tB1e_r8RlZ5sFL0KV_e8dugapxatNBRK1Z3h67TO1g8%3D"> | <img src="https://c10.patreonusercontent.com/3/eyJoIjoxMDAsInciOjEwMH0%3D/patreon-media/p/user/12378075/0156f769e20f412594fa6b87d85fe228/1?token-time=2145916800&token-hash=IsIJRUXszzoD6-7pDnRY8I05T9nSznc4GTaxj7C9SwU%3D"> | <img src="https://c10.patreonusercontent.com/3/eyJoIjoxMDAsInciOjEwMH0%3D/patreon-media/p/user/4503830/ccf2cc867ea64de0b524bb2e24b9a1cb/1?token-time=2145916800&token-hash=S1zP0QyLU52Dqq6dtc9qNYyWfW86XrYHiR4NMbeOrnA%3D"> |
|
||||
|:-:|:-:|:-:|
|
||||
| [Gargron](https://www.patreon.com/mastodon) | [39ff](https://www.patreon.com/user/creators?u=12378075) | [dansup](https://www.patreon.com/dansup) |
|
||||
| <img src="https://c10.patreonusercontent.com/3/eyJoIjoxMDAsInciOjEwMH0%3D/patreon-media/p/user/619786/32cf01444db24e578cd1982c197f6fc6/1?token-time=2145916800&token-hash=tB1e_r8RlZ5sFL0KV_e8dugapxatNBRK1Z3h67TO1g8%3D"> | <img src="https://c10.patreonusercontent.com/3/eyJoIjoxMDAsInciOjEwMH0%3D/patreon-media/p/user/12378075/0156f769e20f412594fa6b87d85fe228/1?token-time=2145916800&token-hash=IsIJRUXszzoD6-7pDnRY8I05T9nSznc4GTaxj7C9SwU%3D"> | <img src="https://c10.patreonusercontent.com/3/eyJoIjoxMDAsInciOjEwMH0%3D/patreon-media/p/user/4503830/ccf2cc867ea64de0b524bb2e24b9a1cb/1?token-time=2145916800&token-hash=S1zP0QyLU52Dqq6dtc9qNYyWfW86XrYHiR4NMbeOrnA%3D"> | <img src="https://c10.patreonusercontent.com/3/eyJoIjoxMDAsInciOjEwMH0%3D/patreon-media/p/user/12531784/93a45137841849329ba692da92ac7c60/1?token-time=2145916800&token-hash=tMosUojzUYJCH_3t--tvYA-SMCyrS__hzSndyaRSnbo%3D"> |
|
||||
|:-:|:-:|:-:|:-:|
|
||||
| [Gargron](https://www.patreon.com/mastodon) | [39ff](https://www.patreon.com/user/creators?u=12378075) | [dansup](https://www.patreon.com/dansup) | [Takashi Shibuya](https://www.patreon.com/user/creators?u=12531784) |
|
||||
|
||||
:four_leaf_clover: Copyright
|
||||
----------------------------------------------------------------
|
||||
|
29
cli/reset-password.js
Normal file
29
cli/reset-password.js
Normal file
@ -0,0 +1,29 @@
|
||||
const mongo = require('mongodb');
|
||||
const bcrypt = require('bcryptjs');
|
||||
const User = require('../built/models/user').default;
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
const user = args[0];
|
||||
|
||||
const q = user.startsWith('@') ? {
|
||||
username: user.split('@')[1],
|
||||
host: user.split('@')[2] || null
|
||||
} : { _id: new mongo.ObjectID(user) };
|
||||
|
||||
console.log(`Resetting password for ${user}...`);
|
||||
|
||||
const passwd = 'yo';
|
||||
|
||||
// Generate hash of password
|
||||
const hash = bcrypt.hashSync(passwd);
|
||||
|
||||
User.update(q, {
|
||||
$set: {
|
||||
password: hash
|
||||
}
|
||||
}).then(() => {
|
||||
console.log(`Password of ${user} is now '${passwd}'`);
|
||||
}, e => {
|
||||
console.error(e);
|
||||
});
|
@ -29,6 +29,11 @@ node cli/suspend @syuilo
|
||||
node cli/suspend @syuilo@misskey.xyz
|
||||
```
|
||||
|
||||
## Reset password
|
||||
``` shell
|
||||
node cli/reset-password (User-ID or Username)
|
||||
```
|
||||
|
||||
## Clean up cached remote files
|
||||
``` shell
|
||||
node cli/clean-cached-remote-files
|
||||
|
@ -29,6 +29,11 @@ node cli/suspend @syuilo
|
||||
node cli/suspend @syuilo@misskey.xyz
|
||||
```
|
||||
|
||||
## ユーザーのパスワードをリセットする
|
||||
``` shell
|
||||
node cli/reset-password (ユーザーID または ユーザー名)
|
||||
```
|
||||
|
||||
## キャッシュされたリモートファイルをクリーンアップする
|
||||
``` shell
|
||||
node cli/clean-cached-remote-files
|
||||
|
@ -218,8 +218,8 @@ common/views/components/visibility-chooser.vue:
|
||||
public: "Public"
|
||||
home: "Accueil"
|
||||
home-desc: "Publier sur le fil d'Accueil uniquement"
|
||||
followers: "Abonnés"
|
||||
followers-desc: "Publier à vos abonnés uniquement"
|
||||
followers: "Abonné·e·s"
|
||||
followers-desc: "Publier à vos abonné·e·s uniquement"
|
||||
specified: "Direct"
|
||||
specified-desc: "Publier aux utilisateurs mentionnés"
|
||||
private: "Privé"
|
||||
@ -346,9 +346,9 @@ desktop/views/components/follow-button.vue:
|
||||
request-pending: "En attente d'approbation"
|
||||
follow-request: "Demande d'abonnement"
|
||||
desktop/views/components/followers-window.vue:
|
||||
followers: "{} abonnés"
|
||||
followers: "{} abonné·e·s"
|
||||
desktop/views/components/followers.vue:
|
||||
empty: "Il semble que vous n'avez pas encore d'abonnés."
|
||||
empty: "Il semble que vous n'avez pas encore d'abonné·e·s."
|
||||
desktop/views/components/following-window.vue:
|
||||
following: "Suit {}"
|
||||
desktop/views/components/following.vue:
|
||||
@ -604,7 +604,7 @@ desktop/views/components/user-lists-window.vue:
|
||||
desktop/views/components/user-preview.vue:
|
||||
notes: "Publications"
|
||||
following: "Abonné à"
|
||||
followers: "Abonnés"
|
||||
followers: "Abonné·e·s"
|
||||
desktop/views/components/users-list.vue:
|
||||
all: "Tout"
|
||||
iknow: "Vous connaissez"
|
||||
@ -650,7 +650,7 @@ desktop/views/pages/user-list.users.vue:
|
||||
add-user: "Ajouter un utilisateur"
|
||||
username: "Nom d'utilisateur"
|
||||
desktop/views/pages/user/user.followers-you-know.vue:
|
||||
title: "Abonnés que vous connaissez"
|
||||
title: "Abonné·e·s que vous connaissez"
|
||||
loading: "Chargement en cours"
|
||||
no-users: "Pas d'utilisateurs"
|
||||
desktop/views/pages/user/user.friends.vue:
|
||||
@ -678,7 +678,7 @@ desktop/views/pages/user/user.profile.vue:
|
||||
desktop/views/pages/user/user.header.vue:
|
||||
posts: "Notes"
|
||||
following: "Suit"
|
||||
followers: "Abonnés"
|
||||
followers: "Abonné·e·s"
|
||||
is-bot: "Ce compte est un Bot"
|
||||
desktop/views/pages/user/user.timeline.vue:
|
||||
default: "Publications"
|
||||
@ -831,7 +831,7 @@ mobile/views/pages/drive.vue:
|
||||
drive: "Drive"
|
||||
more: "Afficher plus ..."
|
||||
mobile/views/pages/followers.vue:
|
||||
followers-of: "Abonnés de {}"
|
||||
followers-of: "Abonné·e·s de {}"
|
||||
mobile/views/pages/following.vue:
|
||||
following-of: "Abonnements de {}"
|
||||
mobile/views/pages/home.vue:
|
||||
@ -914,7 +914,7 @@ mobile/views/pages/settings.vue:
|
||||
mobile/views/pages/user.vue:
|
||||
follows-you: "vous suit"
|
||||
following: "Abonnements"
|
||||
followers: "Abonnés"
|
||||
followers: "Abonné·e·s"
|
||||
notes: "Posts"
|
||||
overview: "Aperçu"
|
||||
timeline: "Fil d'actualité"
|
||||
@ -929,7 +929,7 @@ mobile/views/pages/user/home.vue:
|
||||
keywords: "Mot clés"
|
||||
domains: "Domaines"
|
||||
frequently-replied-users: "Utilisateurs qui interagissent souvent"
|
||||
followers-you-know: "Abonnés que vous connaissez"
|
||||
followers-you-know: "Abonné·e·s que vous connaissez"
|
||||
last-used-at: "Dernière connexion il y a"
|
||||
mobile/views/pages/user/home.followers-you-know.vue:
|
||||
loading: "Chargement"
|
||||
|
@ -21,7 +21,7 @@ const langs = {
|
||||
|
||||
Object.values(langs).forEach(locale => {
|
||||
// Extend native language (Japanese)
|
||||
Object.assign(locale, native);
|
||||
locale = Object.assign({}, native, locale);
|
||||
});
|
||||
|
||||
module.exports = langs;
|
||||
|
16
package.json
16
package.json
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "misskey",
|
||||
"author": "syuilo <i@syuilo.com>",
|
||||
"version": "5.3.0",
|
||||
"clientVersion": "1.0.7588",
|
||||
"version": "5.6.2",
|
||||
"clientVersion": "1.0.7643",
|
||||
"codename": "nighthike",
|
||||
"main": "./built/index.js",
|
||||
"private": true,
|
||||
@ -51,7 +51,7 @@
|
||||
"@types/koa-logger": "3.1.0",
|
||||
"@types/koa-mount": "3.0.1",
|
||||
"@types/koa-multer": "1.0.0",
|
||||
"@types/koa-router": "7.0.30",
|
||||
"@types/koa-router": "7.0.31",
|
||||
"@types/koa-send": "4.1.1",
|
||||
"@types/koa-views": "2.0.3",
|
||||
"@types/koa__cors": "2.2.2",
|
||||
@ -60,7 +60,7 @@
|
||||
"@types/mocha": "5.2.3",
|
||||
"@types/mongodb": "3.1.2",
|
||||
"@types/ms": "0.7.30",
|
||||
"@types/node": "10.5.3",
|
||||
"@types/node": "10.5.4",
|
||||
"@types/parse5": "5.0.0",
|
||||
"@types/portscanner": "2.1.0",
|
||||
"@types/pug": "2.0.4",
|
||||
@ -75,6 +75,7 @@
|
||||
"@types/showdown": "1.7.5",
|
||||
"@types/single-line-log": "1.1.0",
|
||||
"@types/speakeasy": "2.0.2",
|
||||
"@types/systeminformation": "3.23.0",
|
||||
"@types/tmp": "0.0.33",
|
||||
"@types/uuid": "3.4.3",
|
||||
"@types/webpack": "4.4.8",
|
||||
@ -131,7 +132,7 @@
|
||||
"is-url": "1.2.4",
|
||||
"jquery": "3.3.1",
|
||||
"js-yaml": "3.12.0",
|
||||
"jsdom": "11.11.0",
|
||||
"jsdom": "11.12.0",
|
||||
"koa": "2.5.1",
|
||||
"koa-bodyparser": "4.2.1",
|
||||
"koa-compress": "3.0.0",
|
||||
@ -187,6 +188,7 @@
|
||||
"stylus": "0.54.5",
|
||||
"stylus-loader": "3.0.2",
|
||||
"summaly": "2.0.6",
|
||||
"systeminformation": "3.42.4",
|
||||
"syuilo-password-strength": "0.0.1",
|
||||
"textarea-caret": "3.1.0",
|
||||
"tmp": "0.0.33",
|
||||
@ -194,7 +196,7 @@
|
||||
"ts-node": "7.0.0",
|
||||
"tslint": "5.10.0",
|
||||
"typescript": "2.9.2",
|
||||
"typescript-eslint-parser": "17.0.0",
|
||||
"typescript-eslint-parser": "17.0.1",
|
||||
"uglify-es": "3.3.9",
|
||||
"url-loader": "1.0.1",
|
||||
"uuid": "3.3.2",
|
||||
@ -212,7 +214,7 @@
|
||||
"vuex-persistedstate": "2.5.4",
|
||||
"web-push": "3.3.2",
|
||||
"webfinger.js": "2.6.6",
|
||||
"webpack": "4.16.2",
|
||||
"webpack": "4.16.3",
|
||||
"webpack-cli": "3.1.0",
|
||||
"websocket": "1.0.26",
|
||||
"ws": "6.0.0",
|
||||
|
@ -105,7 +105,8 @@ export default Vue.extend({
|
||||
}
|
||||
},
|
||||
isMyTurn(): boolean {
|
||||
if (this.turnUser == null) return null;
|
||||
if (!this.iAmPlayer) return false;
|
||||
if (this.turnUser == null) return false;
|
||||
return this.turnUser.id == this.$store.state.i.id;
|
||||
},
|
||||
cellsStyle(): any {
|
||||
|
@ -67,7 +67,9 @@ export default Vue.extend({
|
||||
components: {
|
||||
XGameroom
|
||||
},
|
||||
|
||||
props: ['initGame'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
game: null,
|
||||
@ -82,54 +84,63 @@ export default Vue.extend({
|
||||
pingClock: null
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
game(g) {
|
||||
this.$emit('gamed', g);
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
if (this.initGame) {
|
||||
this.game = this.initGame;
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.connection = (this as any).os.streams.reversiStream.getConnection();
|
||||
this.connectionId = (this as any).os.streams.reversiStream.use();
|
||||
if (this.$store.getters.isSignedIn) {
|
||||
this.connection = (this as any).os.streams.reversiStream.getConnection();
|
||||
this.connectionId = (this as any).os.streams.reversiStream.use();
|
||||
|
||||
this.connection.on('matched', this.onMatched);
|
||||
this.connection.on('invited', this.onInvited);
|
||||
this.connection.on('matched', this.onMatched);
|
||||
this.connection.on('invited', this.onInvited);
|
||||
|
||||
(this as any).api('games/reversi/games', {
|
||||
my: true
|
||||
}).then(games => {
|
||||
this.myGames = games;
|
||||
});
|
||||
(this as any).api('games/reversi/games', {
|
||||
my: true
|
||||
}).then(games => {
|
||||
this.myGames = games;
|
||||
});
|
||||
|
||||
(this as any).api('games/reversi/invitations').then(invitations => {
|
||||
this.invitations = this.invitations.concat(invitations);
|
||||
});
|
||||
|
||||
this.pingClock = setInterval(() => {
|
||||
if (this.matching) {
|
||||
this.connection.send({
|
||||
type: 'ping',
|
||||
id: this.matching.id
|
||||
});
|
||||
}
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
(this as any).api('games/reversi/games').then(games => {
|
||||
this.games = games;
|
||||
this.gamesFetching = false;
|
||||
});
|
||||
|
||||
(this as any).api('games/reversi/invitations').then(invitations => {
|
||||
this.invitations = this.invitations.concat(invitations);
|
||||
});
|
||||
|
||||
this.pingClock = setInterval(() => {
|
||||
if (this.matching) {
|
||||
this.connection.send({
|
||||
type: 'ping',
|
||||
id: this.matching.id
|
||||
});
|
||||
}
|
||||
}, 3000);
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
this.connection.off('matched', this.onMatched);
|
||||
this.connection.off('invited', this.onInvited);
|
||||
(this as any).os.streams.reversiStream.dispose(this.connectionId);
|
||||
if (this.connection) {
|
||||
this.connection.off('matched', this.onMatched);
|
||||
this.connection.off('invited', this.onInvited);
|
||||
(this as any).os.streams.reversiStream.dispose(this.connectionId);
|
||||
|
||||
clearInterval(this.pingClock);
|
||||
clearInterval(this.pingClock);
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
go(game) {
|
||||
(this as any).api('games/reversi/games/show', {
|
||||
@ -139,6 +150,7 @@ export default Vue.extend({
|
||||
this.game = game;
|
||||
});
|
||||
},
|
||||
|
||||
match() {
|
||||
(this as any).apis.input({
|
||||
title: 'ユーザー名を入力してください'
|
||||
@ -158,10 +170,12 @@ export default Vue.extend({
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
cancel() {
|
||||
this.matching = null;
|
||||
(this as any).api('games/reversi/match/cancel');
|
||||
},
|
||||
|
||||
accept(invitation) {
|
||||
(this as any).api('games/reversi/match', {
|
||||
userId: invitation.parent.id
|
||||
@ -172,10 +186,12 @@ export default Vue.extend({
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onMatched(game) {
|
||||
this.matching = null;
|
||||
this.game = game;
|
||||
},
|
||||
|
||||
onInvited(invite) {
|
||||
this.invitations.unshift(invite);
|
||||
}
|
||||
|
@ -69,25 +69,25 @@ class Autocomplete {
|
||||
*/
|
||||
private onInput() {
|
||||
const caretPos = this.textarea.selectionStart;
|
||||
const text = this.text.substr(0, caretPos);
|
||||
const text = this.text.substr(0, caretPos).split('\n').pop();
|
||||
|
||||
const mentionIndex = text.lastIndexOf('@');
|
||||
const hashtagIndex = text.lastIndexOf('#');
|
||||
const emojiIndex = text.lastIndexOf(':');
|
||||
|
||||
const start = Math.min(
|
||||
mentionIndex == -1 ? Infinity : mentionIndex,
|
||||
hashtagIndex == -1 ? Infinity : hashtagIndex,
|
||||
emojiIndex == -1 ? Infinity : emojiIndex);
|
||||
const max = Math.max(
|
||||
mentionIndex,
|
||||
hashtagIndex,
|
||||
emojiIndex);
|
||||
|
||||
if (start == Infinity) {
|
||||
if (max == -1) {
|
||||
this.close();
|
||||
return;
|
||||
}
|
||||
|
||||
const isMention = mentionIndex == start;
|
||||
const isHashtag = hashtagIndex == start;
|
||||
const isEmoji = emojiIndex == start;
|
||||
const isMention = mentionIndex != -1;
|
||||
const isHashtag = hashtagIndex != -1;
|
||||
const isEmoji = emojiIndex != -1;
|
||||
|
||||
let opened = false;
|
||||
|
||||
@ -99,15 +99,15 @@ class Autocomplete {
|
||||
}
|
||||
}
|
||||
|
||||
if (isHashtag || opened == false) {
|
||||
if (isHashtag && opened == false) {
|
||||
const hashtag = text.substr(hashtagIndex + 1);
|
||||
if (!hashtag.includes(' ') && !hashtag.includes('\n')) {
|
||||
if (!hashtag.includes(' ')) {
|
||||
this.open('hashtag', hashtag);
|
||||
opened = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isEmoji || opened == false) {
|
||||
if (isEmoji && opened == false) {
|
||||
const emoji = text.substr(emojiIndex + 1);
|
||||
if (emoji != '' && emoji.match(/^[\+\-a-z0-9_]+$/)) {
|
||||
this.open('emoji', emoji);
|
||||
|
@ -102,7 +102,6 @@ export default Vue.extend({
|
||||
},
|
||||
methods: {
|
||||
onStats(stats) {
|
||||
stats.mem.used = stats.mem.total - stats.mem.free;
|
||||
this.stats.push(stats);
|
||||
if (this.stats.length > 50) this.stats.shift();
|
||||
|
||||
@ -111,8 +110,8 @@ export default Vue.extend({
|
||||
this.cpuPolylinePoints = cpuPolylinePoints.map(xy => `${xy[0]},${xy[1]}`).join(' ');
|
||||
this.memPolylinePoints = memPolylinePoints.map(xy => `${xy[0]},${xy[1]}`).join(' ');
|
||||
|
||||
this.cpuPolygonPoints = `${this.viewBoxX - (this.stats.length - 1)},${ this.viewBoxY } ${ this.cpuPolylinePoints } ${ this.viewBoxX },${ this.viewBoxY }`;
|
||||
this.memPolygonPoints = `${this.viewBoxX - (this.stats.length - 1)},${ this.viewBoxY } ${ this.memPolylinePoints } ${ this.viewBoxX },${ this.viewBoxY }`;
|
||||
this.cpuPolygonPoints = `${this.viewBoxX - (this.stats.length - 1)},${this.viewBoxY} ${this.cpuPolylinePoints} ${this.viewBoxX},${this.viewBoxY}`;
|
||||
this.memPolygonPoints = `${this.viewBoxX - (this.stats.length - 1)},${this.viewBoxY} ${this.memPolylinePoints} ${this.viewBoxX},${this.viewBoxY}`;
|
||||
|
||||
this.cpuHeadX = cpuPolylinePoints[cpuPolylinePoints.length - 1][0];
|
||||
this.cpuHeadY = cpuPolylinePoints[cpuPolylinePoints.length - 1][1];
|
||||
|
@ -35,7 +35,7 @@ export default Vue.extend({
|
||||
},
|
||||
methods: {
|
||||
onStats(stats) {
|
||||
stats.mem.used = stats.mem.total - stats.mem.free;
|
||||
stats.mem.free = stats.mem.total - stats.mem.used;
|
||||
this.usage = stats.mem.used / stats.mem.total;
|
||||
this.total = stats.mem.total;
|
||||
this.used = stats.mem.used;
|
||||
|
@ -35,7 +35,7 @@ import Vue from 'vue';
|
||||
const eachMonthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
||||
|
||||
function isLeapYear(year) {
|
||||
return !(year % (year % 25 ? 4 : 16));
|
||||
return !(year & (year % 25 ? 3 : 15));
|
||||
}
|
||||
|
||||
export default Vue.extend({
|
||||
|
@ -34,7 +34,13 @@
|
||||
<button class="poll" @click="poll = true">%fa:chart-pie%</button>
|
||||
<button class="poll" @click="useCw = !useCw">%fa:eye-slash%</button>
|
||||
<button class="geo" @click="geo ? removeGeo() : setGeo()">%fa:map-marker-alt%</button>
|
||||
<button class="visibility" @click="setVisibility" ref="visibilityButton">%fa:lock%</button>
|
||||
<button class="visibility" @click="setVisibility" ref="visibilityButton">
|
||||
<span v-if="visibility === 'public'">%fa:globe%</span>
|
||||
<span v-if="visibility === 'home'">%fa:home%</span>
|
||||
<span v-if="visibility === 'followers'">%fa:unlock%</span>
|
||||
<span v-if="visibility === 'specified'">%fa:envelope%</span>
|
||||
<span v-if="visibility === 'private'">%fa:lock%</span>
|
||||
</button>
|
||||
</footer>
|
||||
<input ref="file" class="file" type="file" accept="image/*" multiple="multiple" @change="onChangeFile"/>
|
||||
</div>
|
||||
|
@ -92,6 +92,8 @@ export type Source = {
|
||||
};
|
||||
|
||||
google_maps_api_key: string;
|
||||
|
||||
clusterLimit?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,8 @@
|
||||
import * as os from 'os';
|
||||
const osUtils = require('os-utils');
|
||||
import * as sysUtils from 'systeminformation';
|
||||
import * as diskusage from 'diskusage';
|
||||
import Xev from 'xev';
|
||||
const osUtils = require('os-utils');
|
||||
|
||||
const ev = new Xev();
|
||||
|
||||
@ -18,25 +19,58 @@ export default function() {
|
||||
});
|
||||
|
||||
async function tick() {
|
||||
osUtils.cpuUsage((cpuUsage: number) => {
|
||||
const disk = diskusage.checkSync(os.platform() == 'win32' ? 'c:' : '/');
|
||||
const stats = {
|
||||
cpu_usage: cpuUsage,
|
||||
mem: {
|
||||
total: os.totalmem(),
|
||||
free: os.freemem()
|
||||
},
|
||||
disk,
|
||||
os_uptime: os.uptime(),
|
||||
process_uptime: process.uptime()
|
||||
};
|
||||
ev.emit('serverStats', stats);
|
||||
log.push(stats);
|
||||
if (log.length > 50) log.shift();
|
||||
});
|
||||
const cpu = await cpuUsage();
|
||||
const usedmem = await usedMem();
|
||||
const totalmem = await totalMem();
|
||||
const disk = diskusage.checkSync(os.platform() == 'win32' ? 'c:' : '/');
|
||||
|
||||
const stats = {
|
||||
cpu_usage: cpu,
|
||||
mem: {
|
||||
total: totalmem,
|
||||
used: usedmem
|
||||
},
|
||||
disk,
|
||||
os_uptime: os.uptime(),
|
||||
process_uptime: process.uptime()
|
||||
};
|
||||
ev.emit('serverStats', stats);
|
||||
log.push(stats);
|
||||
if (log.length > 50) log.shift();
|
||||
}
|
||||
|
||||
tick();
|
||||
|
||||
setInterval(tick, interval);
|
||||
}
|
||||
|
||||
// CPU STAT
|
||||
function cpuUsage() {
|
||||
return new Promise((res, rej) => {
|
||||
osUtils.cpuUsage((cpuUsage: number) => {
|
||||
res(cpuUsage);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// MEMORY(excl buffer + cache) STAT
|
||||
async function usedMem() {
|
||||
try {
|
||||
const data = await sysUtils.mem();
|
||||
return data.active;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
// TOTAL MEMORY STAT
|
||||
async function totalMem() {
|
||||
try {
|
||||
const data = await sysUtils.mem();
|
||||
return data.total;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ const nativeDbConn = async (): Promise<mongodb.Db> => {
|
||||
if (mdb) return mdb;
|
||||
|
||||
const db = await ((): Promise<mongodb.Db> => new Promise((resolve, reject) => {
|
||||
mongodb.MongoClient.connect(uri, (e: Error, client: any) => {
|
||||
mongodb.MongoClient.connect(uri, { useNewUrlParser: true }, (e: Error, client: any) => {
|
||||
if (e) return reject(e);
|
||||
resolve(client.db(config.mongodb.db));
|
||||
});
|
||||
|
@ -71,6 +71,9 @@ APIの詳しい使用法は「Misskey APIの利用」セクションをご覧く
|
||||
|
||||
## Misskey APIの利用
|
||||
APIはすべてリクエストのパラメータ・レスポンスともにJSON形式です。また、すべてのエンドポイントはPOSTメソッドのみ受け付けます。
|
||||
|
||||
ストリーミングAPIも提供しています。
|
||||
|
||||
APIリファレンスもご確認ください。
|
||||
|
||||
### レートリミット
|
||||
|
183
src/docs/stream.ja.md
Normal file
183
src/docs/stream.ja.md
Normal file
@ -0,0 +1,183 @@
|
||||
# ストリーミングAPI
|
||||
|
||||
ストリーミングAPIを使うと、リアルタイムで様々な情報(例えばタイムラインに新しい投稿が流れてきた、メッセージが届いた、フォローされた、など)を受け取ったり、HTTPリクエストを発生させることなくAPIにアクセスしたりすることができます。
|
||||
|
||||
ストリーミングAPIは複数の種類がありますが、ここではメインとなる「ホームストリーム」について説明します。
|
||||
|
||||
## ストリームに接続する
|
||||
|
||||
以下のURLに**websocket**接続します。
|
||||
```
|
||||
%URL%
|
||||
```
|
||||
|
||||
接続する際は、`i`というパラメータ名で認証情報を含めます。例:
|
||||
```
|
||||
%URL%/?i=xxxxxxxxxxxxxxx
|
||||
```
|
||||
|
||||
認証情報は、自分のAPIキーや、アプリケーションからストリームに接続する際はユーザーのアクセストークンのことを指します。
|
||||
|
||||
<div class="ui info">
|
||||
<p><i class="fas fa-info-circle"></i> 認証情報の取得については、<a href="./api">こちらのドキュメント</a>をご確認ください。</p>
|
||||
</div>
|
||||
|
||||
|
||||
## ストリームを経由してAPIリクエストする
|
||||
|
||||
ストリームを経由してAPIリクエストすると、HTTPリクエストを発生させずにAPIを利用できます。そのため、コードを簡潔にできたり、パフォーマンスの向上を見込めるかもしれません。
|
||||
|
||||
ストリームを経由してAPIリクエストするには、次のようなメッセージをストリームに送信します:
|
||||
```json
|
||||
{
|
||||
type: 'api',
|
||||
id: 'xxxxxxxxxxxxxxxx',
|
||||
endpoint: 'notes/create',
|
||||
data: {
|
||||
text: 'yee haw!'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`id`には、APIのレスポンスを識別するための、APIリクエストごとの一意なIDを設定する必要があります。UUIDや、簡単な乱数のようなもので構いません。
|
||||
|
||||
`endpoint`には、あなたがリクエストしたいAPIのエンドポイントを指定します。
|
||||
|
||||
`data`には、エンドポイントのパラメータを含めます。
|
||||
|
||||
<div class="ui info">
|
||||
<p><i class="fas fa-info-circle"></i> APIのエンドポイントやパラメータについてはAPIリファレンスをご確認ください。</p>
|
||||
</div>
|
||||
|
||||
### レスポンスの受信
|
||||
|
||||
APIへリクエストすると、レスポンスがストリームから次のような形式で流れてきます。
|
||||
|
||||
```json
|
||||
{
|
||||
type: 'api-res:xxxxxxxxxxxxxxxx',
|
||||
body: {
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`xxxxxxxxxxxxxxxx`の部分には、リクエストの際に設定された`id`が含まれています。これにより、どのリクエストに対するレスポンスなのか判別することができます。
|
||||
|
||||
`body`には、レスポンスが含まれています。
|
||||
|
||||
## 投稿のキャプチャ
|
||||
|
||||
Misskeyは投稿のキャプチャと呼ばれる仕組みを提供しています。これは、指定した投稿のイベントをストリームで受け取る機能です。
|
||||
|
||||
例えばタイムラインを取得してユーザーに表示したとします。ここで誰かがそのタイムラインに含まれるどれかの投稿に対してリアクションしたとします。
|
||||
|
||||
しかし、クライアントからするとある投稿にリアクションが付いたことなどは知る由がないため、リアルタイムでリアクションをタイムライン上の投稿に反映して表示するといったことができません。
|
||||
|
||||
この問題を解決するために、Misskeyは投稿のキャプチャ機構を用意しています。投稿をキャプチャすると、その投稿に関するイベントを受け取ることができるため、リアルタイムでリアクションを反映させたりすることが可能になります。
|
||||
|
||||
### 投稿をキャプチャする
|
||||
|
||||
投稿をキャプチャするには、ストリームに次のようなメッセージを送信します:
|
||||
|
||||
```json
|
||||
{
|
||||
type: 'capture',
|
||||
id: 'xxxxxxxxxxxxxxxx'
|
||||
}
|
||||
```
|
||||
|
||||
`id`には、キャプチャしたい投稿の`id`を設定します。
|
||||
|
||||
このメッセージを送信すると、Misskeyにキャプチャを要請したことになり、以後、その投稿に関するイベントが流れてくるようになります。
|
||||
|
||||
例えば投稿にリアクションが付いたとすると、次のようなメッセージが流れてきます:
|
||||
|
||||
```json
|
||||
{
|
||||
type: 'note-updated',
|
||||
body: {
|
||||
note: {
|
||||
...
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`body`内の`note`には、その投稿の最新の情報が含まれています。
|
||||
|
||||
---
|
||||
|
||||
このように、投稿の情報が更新されると、`note-updated`イベントが流れてくるようになります。`note-updated`イベントが発生するのは、以下の場合です:
|
||||
|
||||
- 投稿にリアクションが付いた
|
||||
- 投稿に添付されたアンケートに投票がされた
|
||||
- 投稿が削除された
|
||||
|
||||
### 投稿のキャプチャを解除する
|
||||
|
||||
その投稿がもう画面に表示されなくなったりして、その投稿に関するイベントをもう受け取る必要がなくなったときは、キャプチャの解除を申請してください。
|
||||
|
||||
次のメッセージを送信します:
|
||||
|
||||
```json
|
||||
{
|
||||
type: 'decapture',
|
||||
id: 'xxxxxxxxxxxxxxxx'
|
||||
}
|
||||
```
|
||||
|
||||
`id`には、キャプチャを解除したい投稿の`id`を設定します。
|
||||
|
||||
このメッセージを送信すると、以後、その投稿に関するイベントは流れてこないようになります。
|
||||
|
||||
## 流れてくるイベント一覧
|
||||
|
||||
流れてくるすべてのメッセージはJSON形式で、必ず`type`というプロパティが含まれています。これにより、メッセージの種類(イベント)を判別することができます。
|
||||
|
||||
### `note`
|
||||
|
||||
タイムラインに新しい投稿が流れてきたときに発生するイベントです。
|
||||
|
||||
`body`プロパティの中に、投稿情報が含まれています。
|
||||
|
||||
### `renote`
|
||||
|
||||
自分の投稿がRenoteされた時に発生するイベントです。自分自身の投稿をRenoteしたときは発生しません。
|
||||
|
||||
`body`プロパティの中に、Renoteされた投稿情報が含まれています。
|
||||
|
||||
### `mention`
|
||||
|
||||
誰かからメンションされたときに発生するイベントです。
|
||||
|
||||
`body`プロパティの中に、投稿情報が含まれています。
|
||||
|
||||
### `read_all_notifications`
|
||||
|
||||
自分宛ての通知がすべて既読になったことを表すイベントです。このイベントを利用して、「通知があることを示すアイコン」のようなものをオフにしたりする等のケースが想定されます。
|
||||
|
||||
### `meUpdated`
|
||||
|
||||
自分の情報が更新されたことを表すイベントです。
|
||||
|
||||
`body`プロパティの中に、最新の自分のアカウントの情報が含まれています。
|
||||
|
||||
### `follow`
|
||||
|
||||
自分が誰かをフォローしたときに発生するイベントです。
|
||||
|
||||
`body`プロパティの中に、フォローしたユーザーの情報が含まれています。
|
||||
|
||||
### `unfollow`
|
||||
|
||||
自分が誰かのフォローを解除したときに発生するイベントです。
|
||||
|
||||
`body`プロパティの中に、フォロー解除したユーザーの情報が含まれています。
|
||||
|
||||
### `followed`
|
||||
|
||||
自分が誰かにフォローされたときに発生するイベントです。
|
||||
|
||||
`body`プロパティの中に、フォローしてきたユーザーの情報が含まれています。
|
||||
|
@ -36,6 +36,10 @@ main
|
||||
margin 1em 0
|
||||
line-height 1.6em
|
||||
|
||||
hr
|
||||
border none
|
||||
border-bottom solid 2px #eee
|
||||
|
||||
footer
|
||||
margin 32px 0 0 0
|
||||
border-top solid 2px #eee
|
||||
|
13
src/index.ts
13
src/index.ts
@ -66,7 +66,7 @@ async function masterMain() {
|
||||
|
||||
Logger.succ('Misskey initialized');
|
||||
|
||||
spawnWorkers(() => {
|
||||
spawnWorkers(config.clusterLimit, () => {
|
||||
Logger.succ('All workers started');
|
||||
Logger.info(`Now listening on port ${config.port} on ${config.url}`);
|
||||
});
|
||||
@ -79,9 +79,6 @@ async function workerMain() {
|
||||
// start server
|
||||
await require('./server').default();
|
||||
|
||||
// start processor
|
||||
require('./queue').default();
|
||||
|
||||
// Send a 'ready' message to parent process
|
||||
process.send('ready');
|
||||
}
|
||||
@ -140,14 +137,16 @@ async function init(): Promise<Config> {
|
||||
return config;
|
||||
}
|
||||
|
||||
function spawnWorkers(onComplete: Function) {
|
||||
function spawnWorkers(limit: number, onComplete: Function) {
|
||||
// Count the machine's CPUs
|
||||
const cpuCount = os.cpus().length;
|
||||
|
||||
const progress = new ProgressBar(cpuCount, 'Starting workers');
|
||||
const count = limit || cpuCount;
|
||||
|
||||
const progress = new ProgressBar(count, 'Starting workers');
|
||||
|
||||
// Create a worker for each CPU
|
||||
for (let i = 0; i < cpuCount; i++) {
|
||||
for (let i = 0; i < count; i++) {
|
||||
const worker = cluster.fork();
|
||||
worker.on('message', message => {
|
||||
if (message === 'ready') {
|
||||
|
@ -50,6 +50,7 @@ type IUserBase = {
|
||||
avatarUrl?: string;
|
||||
bannerUrl?: string;
|
||||
wallpaperId: mongo.ObjectID;
|
||||
wallpaperUrl?: string;
|
||||
data: any;
|
||||
description: string;
|
||||
pinnedNoteId: mongo.ObjectID;
|
||||
@ -400,21 +401,19 @@ export const pack = (
|
||||
}
|
||||
|
||||
if (_user.avatarUrl == null) {
|
||||
_user.avatarUrl = _user.avatarId != null
|
||||
? `${config.drive_url}/${_user.avatarId}`
|
||||
: `${config.drive_url}/default-avatar.jpg`;
|
||||
_user.avatarUrl = `${config.drive_url}/default-avatar.jpg`;
|
||||
|
||||
// 互換性のため
|
||||
if (_user.avatarId) {
|
||||
_user.avatarUrl = `${config.drive_url}/${_user.avatarId}`;
|
||||
}
|
||||
}
|
||||
|
||||
if (_user.bannerUrl == null) {
|
||||
_user.bannerUrl = _user.bannerId != null
|
||||
? `${config.drive_url}/${_user.bannerId}`
|
||||
: null;
|
||||
// 互換性のため
|
||||
if (_user.bannerId && _user.bannerUrl == null) {
|
||||
_user.bannerUrl = `${config.drive_url}/${_user.bannerId}`;
|
||||
}
|
||||
|
||||
_user.wallpaperUrl = _user.wallpaperId != null
|
||||
? `${config.drive_url}/${_user.wallpaperId}`
|
||||
: null;
|
||||
|
||||
if (!meId || !meId.equals(_user.id) || !opts.detail) {
|
||||
delete _user.avatarId;
|
||||
delete _user.bannerId;
|
||||
|
@ -1,28 +1,8 @@
|
||||
import * as Queue from 'bee-queue';
|
||||
|
||||
import config from '../config';
|
||||
import http from './processors/http';
|
||||
import { ILocalUser } from '../models/user';
|
||||
|
||||
const queue = new Queue('misskey', {
|
||||
redis: {
|
||||
port: config.redis.port,
|
||||
host: config.redis.host,
|
||||
password: config.redis.pass
|
||||
},
|
||||
|
||||
removeOnSuccess: true,
|
||||
removeOnFailure: true,
|
||||
getEvents: false,
|
||||
sendEvents: false,
|
||||
storeJobs: false
|
||||
});
|
||||
|
||||
export function createHttpJob(data: any) {
|
||||
return queue.createJob(data)
|
||||
//.retries(4)
|
||||
//.backoff('exponential', 16384) // 16s
|
||||
.save();
|
||||
return http({ data }, () => {});
|
||||
}
|
||||
|
||||
export function deliver(user: ILocalUser, content: any, to: any) {
|
||||
@ -33,7 +13,3 @@ export function deliver(user: ILocalUser, content: any, to: any) {
|
||||
to
|
||||
});
|
||||
}
|
||||
|
||||
export default function() {
|
||||
queue.process(128, http);
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ import ReversiGame, { pack } from '../../../../../models/games/reversi/game';
|
||||
import { ILocalUser } from '../../../../../models/user';
|
||||
|
||||
export const meta = {
|
||||
requireCredential: true
|
||||
};
|
||||
|
||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||
|
@ -4,6 +4,7 @@ import event from '../../../../stream';
|
||||
import DriveFile from '../../../../models/drive-file';
|
||||
import acceptAllFollowRequests from '../../../../services/following/requests/accept-all';
|
||||
import { IApp } from '../../../../models/app';
|
||||
import config from '../../../../config';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
@ -81,7 +82,11 @@ export default async (params: any, user: ILocalUser, app: IApp) => new Promise(a
|
||||
_id: avatarId
|
||||
});
|
||||
|
||||
if (avatar != null && avatar.metadata.properties.avgColor) {
|
||||
if (avatar == null) return rej('avatar not found');
|
||||
|
||||
updates.avatarUrl = avatar.metadata.url || `${config.drive_url}/${avatar._id}`;
|
||||
|
||||
if (avatar.metadata.properties.avgColor) {
|
||||
updates.avatarColor = avatar.metadata.properties.avgColor;
|
||||
}
|
||||
}
|
||||
@ -91,7 +96,11 @@ export default async (params: any, user: ILocalUser, app: IApp) => new Promise(a
|
||||
_id: bannerId
|
||||
});
|
||||
|
||||
if (banner != null && banner.metadata.properties.avgColor) {
|
||||
if (banner == null) return rej('banner not found');
|
||||
|
||||
updates.bannerUrl = banner.metadata.url || `${config.drive_url}/${banner._id}`;
|
||||
|
||||
if (banner.metadata.properties.avgColor) {
|
||||
updates.bannerColor = banner.metadata.properties.avgColor;
|
||||
}
|
||||
}
|
||||
@ -101,7 +110,11 @@ export default async (params: any, user: ILocalUser, app: IApp) => new Promise(a
|
||||
_id: wallpaperId
|
||||
});
|
||||
|
||||
if (wallpaper != null && wallpaper.metadata.properties.avgColor) {
|
||||
if (wallpaper == null) return rej('wallpaper not found');
|
||||
|
||||
updates.wallpaperUrl = wallpaper.metadata.url || `${config.drive_url}/${wallpaper._id}`;
|
||||
|
||||
if (wallpaper.metadata.properties.avgColor) {
|
||||
updates.wallpaperColor = wallpaper.metadata.properties.avgColor;
|
||||
}
|
||||
}
|
||||
|
@ -66,6 +66,12 @@ export default async function(followee: IUser, follower: IUser) {
|
||||
});
|
||||
//#endregion
|
||||
|
||||
await User.update({ _id: followee._id }, {
|
||||
$inc: {
|
||||
pendingReceivedFollowRequestsCount: -1
|
||||
}
|
||||
});
|
||||
|
||||
packUser(followee, followee, {
|
||||
detail: true
|
||||
}).then(packed => event(followee._id, 'meUpdated', packed));
|
||||
|
@ -22,7 +22,8 @@ export default async function(user: IUser, note: INote) {
|
||||
text: null,
|
||||
tags: [],
|
||||
mediaIds: [],
|
||||
poll: null
|
||||
poll: null,
|
||||
geo: null
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -10,8 +10,7 @@ export default async (me: mongodb.ObjectID, note: object) => {
|
||||
// if watching now
|
||||
const exist = await Watching.findOne({
|
||||
noteId: (note as any)._id,
|
||||
userId: me,
|
||||
deletedAt: { $exists: false }
|
||||
userId: me
|
||||
});
|
||||
|
||||
if (exist !== null) {
|
||||
|
Reference in New Issue
Block a user