Compare commits
30 Commits
Author | SHA1 | Date | |
---|---|---|---|
c3c885de47 | |||
8a8c079b2f | |||
b4a30e2a25 | |||
f19f92c538 | |||
e1a946ab45 | |||
aa1817737e | |||
25ec5a24ab | |||
2118fadc48 | |||
ca2230f690 | |||
0ed197d4d9 | |||
046976dffc | |||
bb8139196e | |||
1fea2cdcbe | |||
fe3dd25bc3 | |||
5b09209ef9 | |||
62db650e3c | |||
b847886254 | |||
c6e69ffae4 | |||
b24f368d3f | |||
4dc8351f56 | |||
f3ab8199a5 | |||
28d953933a | |||
77d9ae92f6 | |||
7d00754587 | |||
982b5eb698 | |||
20a9c25d70 | |||
eebed9944c | |||
507a192489 | |||
689dc3b9d5 | |||
d765803b83 |
@ -10,7 +10,7 @@ Misskeyサーバーの構築にご関心をお寄せいただきありがとう
|
|||||||
|
|
||||||
*1.* Misskeyユーザーの作成
|
*1.* Misskeyユーザーの作成
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
Misskeyのrootで実行しない方がよいため、代わりにユーザーを作成します。
|
Misskeyはrootユーザーで実行しない方がよいため、代わりにユーザーを作成します。
|
||||||
Debianの例:
|
Debianの例:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -13,7 +13,7 @@ common:
|
|||||||
rich-contents: "Post"
|
rich-contents: "Post"
|
||||||
rich-contents-desc: "Just post your idea, hot topics and anything you want to share. You may want to decorate your words, attach your favorite pictures, send files including movies and create a poll - those are the things you can do on Misskey!"
|
rich-contents-desc: "Just post your idea, hot topics and anything you want to share. You may want to decorate your words, attach your favorite pictures, send files including movies and create a poll - those are the things you can do on Misskey!"
|
||||||
reaction: "Reactions"
|
reaction: "Reactions"
|
||||||
reaction-desc: "Easiest way to tell your emotions.\nMisskey allows you to add various type of reactions to other’s post. The emotional experience on Misskey will never be on other SNSs which only able to push “likes”."
|
reaction-desc: "Easiest way to tell your emotions. Misskey allows you to add various type of reactions to other’s post. The emotional experience on Misskey will never be on other SNSs which only able to push “likes”."
|
||||||
ui: "Interface"
|
ui: "Interface"
|
||||||
ui-desc: "No UI fits for everyone. Therefore, Misskey has a highly customizable UI for your taste. You can edit layouts of your timeline, place selectable widgets you can easily move and create your unique home as this place will be your home."
|
ui-desc: "No UI fits for everyone. Therefore, Misskey has a highly customizable UI for your taste. You can edit layouts of your timeline, place selectable widgets you can easily move and create your unique home as this place will be your home."
|
||||||
drive: "Misskey Drive"
|
drive: "Misskey Drive"
|
||||||
|
@ -7,7 +7,7 @@ common:
|
|||||||
about-title: "Une ⭐ du fédivers."
|
about-title: "Une ⭐ du fédivers."
|
||||||
about: "Merci d'avoir découvert Misskey. Misskey est une <b>plateforme de microblogage distribuée</b> née sur Terre. Parce qu'il fait partie du Fédivers (un univers composé de diverses plateformes de réseaux sociaux organisées), il est mutuellement connecté avec d'autres plateformes de réseaux sociaux. Désirez-vous prendre une pause, pendant un instant, loin de l'agitation de la ville et plonger dans un nouvel Internet ?"
|
about: "Merci d'avoir découvert Misskey. Misskey est une <b>plateforme de microblogage distribuée</b> née sur Terre. Parce qu'il fait partie du Fédivers (un univers composé de diverses plateformes de réseaux sociaux organisées), il est mutuellement connecté avec d'autres plateformes de réseaux sociaux. Désirez-vous prendre une pause, pendant un instant, loin de l'agitation de la ville et plonger dans un nouvel Internet ?"
|
||||||
intro:
|
intro:
|
||||||
title: "Misskeyって?"
|
title: "C’est quoi Misskey ?"
|
||||||
about: "Misskeyはオープンソースの<b>分散型マイクロブログSNS</b>です。リッチで高度にカスタマイズできるUI、投稿へのリアクション、ファイルを一元管理できるドライブなど、先進的な機能を揃えています。また、Fediverseと呼ばれるネットワークに接続できるため、他のSNSともやり取りできます。例えば、あなたが何か投稿すると、その投稿はMisskeyだけでなく他のSNSにも伝わります。ちょうどある惑星から他の惑星に電波を発信している様子をイメージしてください。"
|
about: "Misskeyはオープンソースの<b>分散型マイクロブログSNS</b>です。リッチで高度にカスタマイズできるUI、投稿へのリアクション、ファイルを一元管理できるドライブなど、先進的な機能を揃えています。また、Fediverseと呼ばれるネットワークに接続できるため、他のSNSともやり取りできます。例えば、あなたが何か投稿すると、その投稿はMisskeyだけでなく他のSNSにも伝わります。ちょうどある惑星から他の惑星に電波を発信している様子をイメージしてください。"
|
||||||
features: "Fonctionnalités"
|
features: "Fonctionnalités"
|
||||||
rich-contents: "Notes"
|
rich-contents: "Notes"
|
||||||
@ -891,10 +891,10 @@ desktop/views/pages/welcome.vue:
|
|||||||
signin-button: "Se connecter"
|
signin-button: "Se connecter"
|
||||||
signup-button: "S'inscrire"
|
signup-button: "S'inscrire"
|
||||||
timeline: "Fil d'actualité"
|
timeline: "Fil d'actualité"
|
||||||
announcements: "お知らせ"
|
announcements: "Notices"
|
||||||
photos: "最近の画像"
|
photos: "Images récentes"
|
||||||
powered-by-misskey: "Propulsé par <b>Misskey</b>."
|
powered-by-misskey: "Propulsé par <b>Misskey</b>."
|
||||||
info: "情報"
|
info: "Informations"
|
||||||
desktop/views/pages/drive.vue:
|
desktop/views/pages/drive.vue:
|
||||||
title: "Lecteur de Misskey"
|
title: "Lecteur de Misskey"
|
||||||
desktop/views/pages/favorites.vue:
|
desktop/views/pages/favorites.vue:
|
||||||
@ -1191,7 +1191,7 @@ mobile/views/pages/settings.vue:
|
|||||||
post-style: "Style de la publication"
|
post-style: "Style de la publication"
|
||||||
post-style-standard: "Standard"
|
post-style-standard: "Standard"
|
||||||
post-style-smart: "Intelligent"
|
post-style-smart: "Intelligent"
|
||||||
notification-position: "通知の表示"
|
notification-position: "Style de notification"
|
||||||
notification-position-bottom: "en bas"
|
notification-position-bottom: "en bas"
|
||||||
notification-position-top: "en haut"
|
notification-position-top: "en haut"
|
||||||
behavior: "Comportement"
|
behavior: "Comportement"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"author": "syuilo <i@syuilo.com>",
|
"author": "syuilo <i@syuilo.com>",
|
||||||
"version": "8.34.0",
|
"version": "8.35.0",
|
||||||
"clientVersion": "1.0.9559",
|
"clientVersion": "1.0.9589",
|
||||||
"codename": "nighthike",
|
"codename": "nighthike",
|
||||||
"main": "./built/index.js",
|
"main": "./built/index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const langs = LANGS;
|
||||||
|
|
||||||
//#region Load settings
|
//#region Load settings
|
||||||
let settings = null;
|
let settings = null;
|
||||||
const vuex = localStorage.getItem('vuex');
|
const vuex = localStorage.getItem('vuex');
|
||||||
@ -40,10 +42,10 @@
|
|||||||
//#region Detect the user language
|
//#region Detect the user language
|
||||||
let lang = null;
|
let lang = null;
|
||||||
|
|
||||||
if (LANGS.includes(navigator.language)) {
|
if (langs.includes(navigator.language)) {
|
||||||
lang = navigator.language;
|
lang = navigator.language;
|
||||||
} else {
|
} else {
|
||||||
lang = LANGS.find(x => x.split('-')[0] == navigator.language);
|
lang = langs.find(x => x.split('-')[0] == navigator.language);
|
||||||
|
|
||||||
if (lang == null) {
|
if (lang == null) {
|
||||||
// Fallback
|
// Fallback
|
||||||
@ -52,7 +54,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (settings && settings.device.lang &&
|
if (settings && settings.device.lang &&
|
||||||
LANGS.includes(settings.device.lang)) {
|
langs.includes(settings.device.lang)) {
|
||||||
lang = settings.device.lang;
|
lang = settings.device.lang;
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<span class="mk-avatar" :class="{ cat }" :title="user | acct" v-if="disableLink && !disablePreview" v-user-preview="user.id" @click="onClick">
|
<span class="mk-avatar" :style="style" :class="{ cat }" :title="user | acct" v-if="disableLink && !disablePreview" v-user-preview="user.id" @click="onClick">
|
||||||
<span class="inner" :style="style"></span>
|
<span class="inner" :style="icon"></span>
|
||||||
</span>
|
</span>
|
||||||
<span class="mk-avatar" :class="{ cat }" :title="user | acct" v-else-if="disableLink && disablePreview" @click="onClick">
|
<span class="mk-avatar" :style="style" :class="{ cat }" :title="user | acct" v-else-if="disableLink && disablePreview" @click="onClick">
|
||||||
<span class="inner" :style="style"></span>
|
<span class="inner" :style="icon"></span>
|
||||||
</span>
|
</span>
|
||||||
<router-link class="mk-avatar" :class="{ cat }" :to="user | userPage" :title="user | acct" :target="target" v-else-if="!disableLink && !disablePreview" v-user-preview="user.id">
|
<router-link class="mk-avatar" :style="style" :class="{ cat }" :to="user | userPage" :title="user | acct" :target="target" v-else-if="!disableLink && !disablePreview" v-user-preview="user.id">
|
||||||
<span class="inner" :style="style"></span>
|
<span class="inner" :style="icon"></span>
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link class="mk-avatar" :class="{ cat }" :to="user | userPage" :title="user | acct" :target="target" v-else-if="!disableLink && disablePreview">
|
<router-link class="mk-avatar" :style="style" :class="{ cat }" :to="user | userPage" :title="user | acct" :target="target" v-else-if="!disableLink && disablePreview">
|
||||||
<span class="inner" :style="style"></span>
|
<span class="inner" :style="icon"></span>
|
||||||
</router-link>
|
</router-link>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -42,6 +42,11 @@ export default Vue.extend({
|
|||||||
return this.user.isCat && this.$store.state.settings.circleIcons;
|
return this.user.isCat && this.$store.state.settings.circleIcons;
|
||||||
},
|
},
|
||||||
style(): any {
|
style(): any {
|
||||||
|
return {
|
||||||
|
borderRadius: this.$store.state.settings.circleIcons ? '100%' : null
|
||||||
|
};
|
||||||
|
},
|
||||||
|
icon(): any {
|
||||||
return {
|
return {
|
||||||
backgroundColor: this.lightmode
|
backgroundColor: this.lightmode
|
||||||
? `rgb(${this.user.avatarColor.slice(0, 3).join(',')})`
|
? `rgb(${this.user.avatarColor.slice(0, 3).join(',')})`
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Vue from 'vue';
|
import Vue, { VNode } from 'vue';
|
||||||
import * as emojilib from 'emojilib';
|
import * as emojilib from 'emojilib';
|
||||||
import { length } from 'stringz';
|
import { length } from 'stringz';
|
||||||
import parse from '../../../../../mfm/parse';
|
import parse from '../../../../../mfm/parse';
|
||||||
@ -6,10 +6,7 @@ import getAcct from '../../../../../misc/acct/render';
|
|||||||
import { url } from '../../../config';
|
import { url } from '../../../config';
|
||||||
import MkUrl from './url.vue';
|
import MkUrl from './url.vue';
|
||||||
import MkGoogle from './google.vue';
|
import MkGoogle from './google.vue';
|
||||||
|
import { concat } from '../../../../../prelude/array';
|
||||||
const flatten = list => list.reduce(
|
|
||||||
(a, b) => a.concat(Array.isArray(b) ? flatten(b) : b), []
|
|
||||||
);
|
|
||||||
|
|
||||||
export default Vue.component('misskey-flavored-markdown', {
|
export default Vue.component('misskey-flavored-markdown', {
|
||||||
props: {
|
props: {
|
||||||
@ -32,20 +29,20 @@ export default Vue.component('misskey-flavored-markdown', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
render(createElement) {
|
render(createElement) {
|
||||||
let ast;
|
let ast: any[];
|
||||||
|
|
||||||
if (this.ast == null) {
|
if (this.ast == null) {
|
||||||
// Parse text to ast
|
// Parse text to ast
|
||||||
ast = parse(this.text);
|
ast = parse(this.text);
|
||||||
} else {
|
} else {
|
||||||
ast = this.ast;
|
ast = this.ast as any[];
|
||||||
}
|
}
|
||||||
|
|
||||||
let bigCount = 0;
|
let bigCount = 0;
|
||||||
let motionCount = 0;
|
let motionCount = 0;
|
||||||
|
|
||||||
// Parse ast to DOM
|
// Parse ast to DOM
|
||||||
const els = flatten(ast.map(token => {
|
const els = concat(ast.map((token): VNode[] => {
|
||||||
switch (token.type) {
|
switch (token.type) {
|
||||||
case 'text': {
|
case 'text': {
|
||||||
const text = token.content.replace(/(\r\n|\n|\r)/g, '\n');
|
const text = token.content.replace(/(\r\n|\n|\r)/g, '\n');
|
||||||
@ -56,12 +53,12 @@ export default Vue.component('misskey-flavored-markdown', {
|
|||||||
x[x.length - 1].pop();
|
x[x.length - 1].pop();
|
||||||
return x;
|
return x;
|
||||||
} else {
|
} else {
|
||||||
return createElement('span', text.replace(/\n/g, ' '));
|
return [createElement('span', text.replace(/\n/g, ' '))];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'bold': {
|
case 'bold': {
|
||||||
return createElement('b', token.bold);
|
return [createElement('b', token.bold)];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'big': {
|
case 'big': {
|
||||||
@ -95,23 +92,23 @@ export default Vue.component('misskey-flavored-markdown', {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 'url': {
|
case 'url': {
|
||||||
return createElement(MkUrl, {
|
return [createElement(MkUrl, {
|
||||||
props: {
|
props: {
|
||||||
url: token.content,
|
url: token.content,
|
||||||
target: '_blank'
|
target: '_blank'
|
||||||
}
|
}
|
||||||
});
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'link': {
|
case 'link': {
|
||||||
return createElement('a', {
|
return [createElement('a', {
|
||||||
attrs: {
|
attrs: {
|
||||||
class: 'link',
|
class: 'link',
|
||||||
href: token.url,
|
href: token.url,
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
title: token.url
|
title: token.url
|
||||||
}
|
}
|
||||||
}, token.title);
|
}, token.title)];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'mention': {
|
case 'mention': {
|
||||||
@ -129,16 +126,16 @@ export default Vue.component('misskey-flavored-markdown', {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 'hashtag': {
|
case 'hashtag': {
|
||||||
return createElement('a', {
|
return [createElement('a', {
|
||||||
attrs: {
|
attrs: {
|
||||||
href: `${url}/tags/${encodeURIComponent(token.hashtag)}`,
|
href: `${url}/tags/${encodeURIComponent(token.hashtag)}`,
|
||||||
target: '_blank'
|
target: '_blank'
|
||||||
}
|
}
|
||||||
}, token.content);
|
}, token.content)];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'code': {
|
case 'code': {
|
||||||
return createElement('pre', {
|
return [createElement('pre', {
|
||||||
class: 'code'
|
class: 'code'
|
||||||
}, [
|
}, [
|
||||||
createElement('code', {
|
createElement('code', {
|
||||||
@ -146,15 +143,15 @@ export default Vue.component('misskey-flavored-markdown', {
|
|||||||
innerHTML: token.html
|
innerHTML: token.html
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
]);
|
])];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'inline-code': {
|
case 'inline-code': {
|
||||||
return createElement('code', {
|
return [createElement('code', {
|
||||||
domProps: {
|
domProps: {
|
||||||
innerHTML: token.html
|
innerHTML: token.html
|
||||||
}
|
}
|
||||||
});
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'quote': {
|
case 'quote': {
|
||||||
@ -164,43 +161,45 @@ export default Vue.component('misskey-flavored-markdown', {
|
|||||||
const x = text2.split('\n')
|
const x = text2.split('\n')
|
||||||
.map(t => [createElement('span', t), createElement('br')]);
|
.map(t => [createElement('span', t), createElement('br')]);
|
||||||
x[x.length - 1].pop();
|
x[x.length - 1].pop();
|
||||||
return createElement('div', {
|
return [createElement('div', {
|
||||||
attrs: {
|
attrs: {
|
||||||
class: 'quote'
|
class: 'quote'
|
||||||
}
|
}
|
||||||
}, x);
|
}, x)];
|
||||||
} else {
|
} else {
|
||||||
return createElement('span', {
|
return [createElement('span', {
|
||||||
attrs: {
|
attrs: {
|
||||||
class: 'quote'
|
class: 'quote'
|
||||||
}
|
}
|
||||||
}, text2.replace(/\n/g, ' '));
|
}, text2.replace(/\n/g, ' '))];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'title': {
|
case 'title': {
|
||||||
return createElement('div', {
|
return [createElement('div', {
|
||||||
attrs: {
|
attrs: {
|
||||||
class: 'title'
|
class: 'title'
|
||||||
}
|
}
|
||||||
}, token.title);
|
}, token.title)];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'emoji': {
|
case 'emoji': {
|
||||||
const emoji = emojilib.lib[token.emoji];
|
const emoji = emojilib.lib[token.emoji];
|
||||||
return createElement('span', emoji ? emoji.char : token.content);
|
return [createElement('span', emoji ? emoji.char : token.content)];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'search': {
|
case 'search': {
|
||||||
return createElement(MkGoogle, {
|
return [createElement(MkGoogle, {
|
||||||
props: {
|
props: {
|
||||||
q: token.query
|
q: token.query
|
||||||
}
|
}
|
||||||
});
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
console.log('unknown ast type:', token.type);
|
console.log('unknown ast type:', token.type);
|
||||||
|
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import parseAcct from '../../../../../misc/acct/parse';
|
import parseAcct from '../../../../../misc/acct/parse';
|
||||||
import getUserName from '../../../../../misc/get-user-name';
|
|
||||||
import Progress from '../../../common/scripts/loading';
|
import Progress from '../../../common/scripts/loading';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
<span v-if="visibility === 'specified'">%fa:envelope%</span>
|
<span v-if="visibility === 'specified'">%fa:envelope%</span>
|
||||||
<span v-if="visibility === 'private'">%fa:lock%</span>
|
<span v-if="visibility === 'private'">%fa:lock%</span>
|
||||||
</button>
|
</button>
|
||||||
<p class="text-count" :class="{ over: text.length > 1000 }">{{ 1000 - text.length }}</p>
|
<p class="text-count" :class="{ over: this.trimmedLength(text) > 1000 }">{{ 1000 - this.trimmedLength(text) }}</p>
|
||||||
<button :class="{ posting }" class="submit" :disabled="!canPost" @click="post">
|
<button :class="{ posting }" class="submit" :disabled="!canPost" @click="post">
|
||||||
{{ posting ? '%i18n:@posting%' : submitText }}<mk-ellipsis v-if="posting"/>
|
{{ posting ? '%i18n:@posting%' : submitText }}<mk-ellipsis v-if="posting"/>
|
||||||
</button>
|
</button>
|
||||||
@ -62,7 +62,8 @@ import getFace from '../../../common/scripts/get-face';
|
|||||||
import MkVisibilityChooser from '../../../common/views/components/visibility-chooser.vue';
|
import MkVisibilityChooser from '../../../common/views/components/visibility-chooser.vue';
|
||||||
import parse from '../../../../../mfm/parse';
|
import parse from '../../../../../mfm/parse';
|
||||||
import { host } from '../../../config';
|
import { host } from '../../../config';
|
||||||
import { erase } from '../../../../../prelude/array';
|
import { erase, unique } from '../../../../../prelude/array';
|
||||||
|
import { length } from 'stringz';
|
||||||
import parseAcct from '../../../../../misc/acct/parse';
|
import parseAcct from '../../../../../misc/acct/parse';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
@ -147,7 +148,7 @@ export default Vue.extend({
|
|||||||
canPost(): boolean {
|
canPost(): boolean {
|
||||||
return !this.posting &&
|
return !this.posting &&
|
||||||
(1 <= this.text.length || 1 <= this.files.length || this.poll || this.renote) &&
|
(1 <= this.text.length || 1 <= this.files.length || this.poll || this.renote) &&
|
||||||
(this.text.trim().length <= 1000);
|
(length(this.text.trim()) <= 1000);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -199,6 +200,10 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
trimmedLength(text: string) {
|
||||||
|
return length(text.trim());
|
||||||
|
},
|
||||||
|
|
||||||
addTag(tag: string) {
|
addTag(tag: string) {
|
||||||
insertTextAtCursor(this.$refs.text, ` #${tag} `);
|
insertTextAtCursor(this.$refs.text, ` #${tag} `);
|
||||||
},
|
},
|
||||||
@ -392,7 +397,7 @@ export default Vue.extend({
|
|||||||
if (this.text && this.text != '') {
|
if (this.text && this.text != '') {
|
||||||
const hashtags = parse(this.text).filter(x => x.type == 'hashtag').map(x => x.hashtag);
|
const hashtags = parse(this.text).filter(x => x.type == 'hashtag').map(x => x.hashtag);
|
||||||
const history = JSON.parse(localStorage.getItem('hashtags') || '[]') as string[];
|
const history = JSON.parse(localStorage.getItem('hashtags') || '[]') as string[];
|
||||||
localStorage.setItem('hashtags', JSON.stringify(hashtags.concat(history).reduce((a, c) => a.includes(c) ? a : [...a, c], [])));
|
localStorage.setItem('hashtags', JSON.stringify(unique(hashtags.concat(history))));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
<div class="mk-timeline">
|
<div class="mk-timeline">
|
||||||
<header>
|
<header>
|
||||||
<span :data-active="src == 'home'" @click="src = 'home'">%fa:home% %i18n:@home%</span>
|
<span :data-active="src == 'home'" @click="src = 'home'">%fa:home% %i18n:@home%</span>
|
||||||
<span :data-active="src == 'local'" @click="src = 'local'">%fa:R comments% %i18n:@local%</span>
|
<span :data-active="src == 'local'" @click="src = 'local'" v-if="enableLocalTimeline">%fa:R comments% %i18n:@local%</span>
|
||||||
<span :data-active="src == 'hybrid'" @click="src = 'hybrid'">%fa:share-alt% %i18n:@hybrid%</span>
|
<span :data-active="src == 'hybrid'" @click="src = 'hybrid'" v-if="enableLocalTimeline">%fa:share-alt% %i18n:@hybrid%</span>
|
||||||
<span :data-active="src == 'global'" @click="src = 'global'">%fa:globe% %i18n:@global%</span>
|
<span :data-active="src == 'global'" @click="src = 'global'">%fa:globe% %i18n:@global%</span>
|
||||||
<span :data-active="src == 'list'" @click="src = 'list'" v-if="list">%fa:list% {{ list.title }}</span>
|
<span :data-active="src == 'list'" @click="src = 'list'" v-if="list">%fa:list% {{ list.title }}</span>
|
||||||
<button @click="chooseList" title="%i18n:@list%">%fa:list%</button>
|
<button @click="chooseList" title="%i18n:@list%">%fa:list%</button>
|
||||||
@ -29,7 +29,8 @@ export default Vue.extend({
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
src: 'home',
|
src: 'home',
|
||||||
list: null
|
list: null,
|
||||||
|
enableLocalTimeline: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -44,6 +45,10 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
|
(this as any).os.getMeta().then(meta => {
|
||||||
|
this.enableLocalTimeline = !meta.disableLocalTimeline;
|
||||||
|
});
|
||||||
|
|
||||||
if (this.$store.state.device.tl) {
|
if (this.$store.state.device.tl) {
|
||||||
this.src = this.$store.state.device.tl.src;
|
this.src = this.$store.state.device.tl.src;
|
||||||
if (this.src == 'list') {
|
if (this.src == 'list') {
|
||||||
|
@ -1,94 +1,86 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="root item">
|
<div class="zvdbznxvfixtmujpsigoccczftvpiwqh">
|
||||||
<mk-avatar class="avatar" :user="user"/>
|
<div class="banner" :style="bannerStyle"></div>
|
||||||
<div class="main">
|
<mk-avatar class="avatar" :user="user" :disable-preview="true"/>
|
||||||
<header>
|
|
||||||
<router-link class="name" :to="user | userPage" v-user-preview="user.id">{{ user | userName }}</router-link>
|
|
||||||
<span class="username">@{{ user | acct }}</span>
|
|
||||||
</header>
|
|
||||||
<div class="body">
|
<div class="body">
|
||||||
|
<router-link :to="user | userPage" class="name">{{ user | userName }}</router-link>
|
||||||
|
<span class="username">@{{ user | acct }}</span>
|
||||||
|
<div class="description">
|
||||||
|
<misskey-flavored-markdown v-if="user.description" :text="user.description" :i="$store.state.i"/>
|
||||||
|
</div>
|
||||||
<p class="followed" v-if="user.isFollowed">%i18n:@followed%</p>
|
<p class="followed" v-if="user.isFollowed">%i18n:@followed%</p>
|
||||||
<div class="description">{{ user.description }}</div>
|
<mk-follow-button :user="user" :size="'big'"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<mk-follow-button :user="user"/>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['user']
|
props: ['user'],
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
bannerStyle(): any {
|
||||||
|
if (this.user.bannerUrl == null) return {};
|
||||||
|
return {
|
||||||
|
backgroundColor: this.user.bannerColor && this.user.bannerColor.length == 3 ? `rgb(${ this.user.bannerColor.join(',') })` : null,
|
||||||
|
backgroundImage: `url(${ this.user.bannerUrl })`
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="stylus" scoped>
|
<style lang="stylus" scoped>
|
||||||
.root.item
|
.zvdbznxvfixtmujpsigoccczftvpiwqh
|
||||||
padding 16px
|
$bg = #fff
|
||||||
font-size 16px
|
|
||||||
|
|
||||||
&:after
|
margin 16px auto
|
||||||
content ""
|
max-width calc(100% - 32px)
|
||||||
display block
|
font-size 16px
|
||||||
clear both
|
text-align center
|
||||||
|
background $bg
|
||||||
|
box-shadow 0 2px 4px rgba(0, 0, 0, 0.1)
|
||||||
|
|
||||||
|
> .banner
|
||||||
|
height 100px
|
||||||
|
background-color #f9f4f4
|
||||||
|
background-position center
|
||||||
|
background-size cover
|
||||||
|
|
||||||
> .avatar
|
> .avatar
|
||||||
display block
|
display block
|
||||||
float left
|
margin -40px auto 0 auto
|
||||||
margin 0 16px 0 0
|
width 80px
|
||||||
width 58px
|
height 80px
|
||||||
height 58px
|
border-radius 100%
|
||||||
border-radius 8px
|
border solid 4px $bg
|
||||||
|
|
||||||
> .main
|
|
||||||
float left
|
|
||||||
width calc(100% - 74px)
|
|
||||||
|
|
||||||
> header
|
|
||||||
margin-bottom 2px
|
|
||||||
|
|
||||||
> .name
|
|
||||||
display inline
|
|
||||||
margin 0
|
|
||||||
padding 0
|
|
||||||
color #777
|
|
||||||
font-size 1em
|
|
||||||
font-weight 700
|
|
||||||
text-align left
|
|
||||||
text-decoration none
|
|
||||||
|
|
||||||
&:hover
|
|
||||||
text-decoration underline
|
|
||||||
|
|
||||||
> .username
|
|
||||||
text-align left
|
|
||||||
margin 0 0 0 8px
|
|
||||||
color #ccc
|
|
||||||
|
|
||||||
> .body
|
> .body
|
||||||
|
padding 4px 32px 32px 32px
|
||||||
|
|
||||||
|
@media (max-width 400px)
|
||||||
|
padding 4px 16px 16px 16px
|
||||||
|
|
||||||
|
> .name
|
||||||
|
font-size 20px
|
||||||
|
font-weight bold
|
||||||
|
|
||||||
|
> .username
|
||||||
|
display block
|
||||||
|
opacity 0.7
|
||||||
|
|
||||||
|
> .description
|
||||||
|
margin 16px 0
|
||||||
|
|
||||||
> .followed
|
> .followed
|
||||||
display inline-block
|
margin 0 0 16px 0
|
||||||
margin 0 0 4px 0
|
padding 0
|
||||||
padding 2px 8px
|
line-height 24px
|
||||||
vertical-align top
|
font-size 0.8em
|
||||||
font-size 10px
|
|
||||||
color #71afc7
|
color #71afc7
|
||||||
background #eefaff
|
background #eefaff
|
||||||
border-radius 4px
|
border-radius 4px
|
||||||
|
|
||||||
> .description
|
|
||||||
cursor default
|
|
||||||
display block
|
|
||||||
margin 0
|
|
||||||
padding 0
|
|
||||||
overflow-wrap break-word
|
|
||||||
font-size 1.1em
|
|
||||||
color #717171
|
|
||||||
|
|
||||||
> .mk-follow-button
|
|
||||||
position absolute
|
|
||||||
top 16px
|
|
||||||
right 16px
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -33,7 +33,7 @@ export default Vue.extend({
|
|||||||
props: ['fetch', 'count', 'youKnowCount'],
|
props: ['fetch', 'count', 'youKnowCount'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
limit: 30,
|
limit: 20,
|
||||||
mode: 'all',
|
mode: 'all',
|
||||||
fetching: true,
|
fetching: true,
|
||||||
moreFetching: false,
|
moreFetching: false,
|
||||||
@ -73,10 +73,14 @@ export default Vue.extend({
|
|||||||
|
|
||||||
.mk-users-list
|
.mk-users-list
|
||||||
height 100%
|
height 100%
|
||||||
background #fff
|
overflow auto
|
||||||
|
background #eee
|
||||||
|
|
||||||
> nav
|
> nav
|
||||||
z-index 1
|
z-index 10
|
||||||
|
position sticky
|
||||||
|
top 0
|
||||||
|
background #fff
|
||||||
box-shadow 0 1px 0 rgba(#000, 0.1)
|
box-shadow 0 1px 0 rgba(#000, 0.1)
|
||||||
|
|
||||||
> div
|
> div
|
||||||
@ -114,16 +118,14 @@ export default Vue.extend({
|
|||||||
background #eee
|
background #eee
|
||||||
border-radius 20px
|
border-radius 20px
|
||||||
|
|
||||||
> .users
|
> button
|
||||||
height calc(100% - 54px)
|
display block
|
||||||
overflow auto
|
width calc(100% - 32px)
|
||||||
|
margin 16px
|
||||||
|
padding 16px
|
||||||
|
|
||||||
> *
|
&:hover
|
||||||
border-bottom solid 1px rgba(#000, 0.05)
|
background rgba(#000, 0.1)
|
||||||
|
|
||||||
> *
|
|
||||||
max-width 600px
|
|
||||||
margin 0 auto
|
|
||||||
|
|
||||||
> .no
|
> .no
|
||||||
margin 0
|
margin 0
|
||||||
|
@ -1,23 +1,35 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="obdskegsannmntldydackcpzezagxqfy mk-admin-card">
|
<div class="obdskegsannmntldydackcpzezagxqfy mk-admin-card">
|
||||||
<header>%i18n:@dashboard%</header>
|
<header>%i18n:@dashboard%</header>
|
||||||
|
|
||||||
<div v-if="stats" class="stats">
|
<div v-if="stats" class="stats">
|
||||||
<div><b>%fa:user% {{ stats.originalUsersCount | number }}</b><span>%i18n:@original-users%</span></div>
|
<div><b>%fa:user% {{ stats.originalUsersCount | number }}</b><span>%i18n:@original-users%</span></div>
|
||||||
<div><span>%fa:user% {{ stats.usersCount | number }}</span><span>%i18n:@all-users%</span></div>
|
<div><span>%fa:user% {{ stats.usersCount | number }}</span><span>%i18n:@all-users%</span></div>
|
||||||
<div><b>%fa:pencil-alt% {{ stats.originalNotesCount | number }}</b><span>%i18n:@original-notes%</span></div>
|
<div><b>%fa:pencil-alt% {{ stats.originalNotesCount | number }}</b><span>%i18n:@original-notes%</span></div>
|
||||||
<div><span>%fa:pencil-alt% {{ stats.notesCount | number }}</span><span>%i18n:@all-notes%</span></div>
|
<div><span>%fa:pencil-alt% {{ stats.notesCount | number }}</span><span>%i18n:@all-notes%</span></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="cpu-memory">
|
<div class="cpu-memory">
|
||||||
<x-cpu-memory :connection="connection"/>
|
<x-cpu-memory :connection="connection"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form">
|
||||||
<div>
|
<div>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" v-model="disableRegistration" @change="updateMeta">
|
<input type="checkbox" v-model="disableRegistration" @change="updateMeta">
|
||||||
<span>disableRegistration</span>
|
<span>%i18n:@disableRegistration%</span>
|
||||||
</label>
|
</label>
|
||||||
<button class="ui" @click="invite">%i18n:@invite%</button>
|
<button class="ui" @click="invite">%i18n:@invite%</button>
|
||||||
<p v-if="inviteCode">Code: <code>{{ inviteCode }}</code></p>
|
<p v-if="inviteCode">Code: <code>{{ inviteCode }}</code></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" v-model="disableLocalTimeline" @change="updateMeta">
|
||||||
|
<span>%i18n:@disableLocalTimeline%</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -33,6 +45,7 @@ export default Vue.extend({
|
|||||||
return {
|
return {
|
||||||
stats: null,
|
stats: null,
|
||||||
disableRegistration: false,
|
disableRegistration: false,
|
||||||
|
disableLocalTimeline: false,
|
||||||
inviteCode: null,
|
inviteCode: null,
|
||||||
connection: null,
|
connection: null,
|
||||||
connectionId: null
|
connectionId: null
|
||||||
@ -44,6 +57,7 @@ export default Vue.extend({
|
|||||||
|
|
||||||
(this as any).os.getMeta().then(meta => {
|
(this as any).os.getMeta().then(meta => {
|
||||||
this.disableRegistration = meta.disableRegistration;
|
this.disableRegistration = meta.disableRegistration;
|
||||||
|
this.disableLocalTimeline = meta.disableLocalTimeline;
|
||||||
});
|
});
|
||||||
|
|
||||||
(this as any).api('stats').then(stats => {
|
(this as any).api('stats').then(stats => {
|
||||||
@ -61,7 +75,8 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
updateMeta() {
|
updateMeta() {
|
||||||
(this as any).api('admin/update-meta', {
|
(this as any).api('admin/update-meta', {
|
||||||
disableRegistration: this.disableRegistration
|
disableRegistration: this.disableRegistration,
|
||||||
|
disableLocalTimeline: this.disableLocalTimeline
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,4 +112,8 @@ export default Vue.extend({
|
|||||||
border solid 1px #eee
|
border solid 1px #eee
|
||||||
border-radius: 8px
|
border-radius: 8px
|
||||||
|
|
||||||
|
> .form
|
||||||
|
> div
|
||||||
|
border-bottom solid 1px #eee
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<header>
|
<header>
|
||||||
<button class="cancel" @click="cancel">%fa:times%</button>
|
<button class="cancel" @click="cancel">%fa:times%</button>
|
||||||
<div>
|
<div>
|
||||||
<span class="text-count" :class="{ over: text.length > 1000 }">{{ 1000 - text.length }}</span>
|
<span class="text-count" :class="{ over: trimmedLength(text) > 1000 }">{{ 1000 - trimmedLength(text) }}</span>
|
||||||
<span class="geo" v-if="geo">%fa:map-marker-alt%</span>
|
<span class="geo" v-if="geo">%fa:map-marker-alt%</span>
|
||||||
<button class="submit" :disabled="!canPost" @click="post">{{ submitText }}</button>
|
<button class="submit" :disabled="!canPost" @click="post">{{ submitText }}</button>
|
||||||
</div>
|
</div>
|
||||||
@ -60,6 +60,7 @@ import getFace from '../../../common/scripts/get-face';
|
|||||||
import parse from '../../../../../mfm/parse';
|
import parse from '../../../../../mfm/parse';
|
||||||
import { host } from '../../../config';
|
import { host } from '../../../config';
|
||||||
import { erase } from '../../../../../prelude/array';
|
import { erase } from '../../../../../prelude/array';
|
||||||
|
import { length } from 'stringz';
|
||||||
import parseAcct from '../../../../../misc/acct/parse';
|
import parseAcct from '../../../../../misc/acct/parse';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
@ -180,6 +181,10 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
trimmedLength(text: string) {
|
||||||
|
return length(text.trim());
|
||||||
|
},
|
||||||
|
|
||||||
addTag(tag: string) {
|
addTag(tag: string) {
|
||||||
insertTextAtCursor(this.$refs.text, ` #${tag} `);
|
insertTextAtCursor(this.$refs.text, ` #${tag} `);
|
||||||
},
|
},
|
||||||
@ -303,7 +308,7 @@ export default Vue.extend({
|
|||||||
if (this.text && this.text != '') {
|
if (this.text && this.text != '') {
|
||||||
const hashtags = parse(this.text).filter(x => x.type == 'hashtag').map(x => x.hashtag);
|
const hashtags = parse(this.text).filter(x => x.type == 'hashtag').map(x => x.hashtag);
|
||||||
const history = JSON.parse(localStorage.getItem('hashtags') || '[]') as string[];
|
const history = JSON.parse(localStorage.getItem('hashtags') || '[]') as string[];
|
||||||
localStorage.setItem('hashtags', JSON.stringify(hashtags.concat(history).reduce((a, c) => a.includes(c) ? a : [...a, c], [])));
|
localStorage.setItem('hashtags', JSON.stringify(unique(hashtags.concat(history))));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
<div class="body">
|
<div class="body">
|
||||||
<div>
|
<div>
|
||||||
<span :data-active="src == 'home'" @click="src = 'home'">%fa:home% %i18n:@home%</span>
|
<span :data-active="src == 'home'" @click="src = 'home'">%fa:home% %i18n:@home%</span>
|
||||||
<span :data-active="src == 'local'" @click="src = 'local'">%fa:R comments% %i18n:@local%</span>
|
<span :data-active="src == 'local'" @click="src = 'local'" v-if="enableLocalTimeline">%fa:R comments% %i18n:@local%</span>
|
||||||
<span :data-active="src == 'hybrid'" @click="src = 'hybrid'">%fa:share-alt% %i18n:@hybrid%</span>
|
<span :data-active="src == 'hybrid'" @click="src = 'hybrid'" v-if="enableLocalTimeline">%fa:share-alt% %i18n:@hybrid%</span>
|
||||||
<span :data-active="src == 'global'" @click="src = 'global'">%fa:globe% %i18n:@global%</span>
|
<span :data-active="src == 'global'" @click="src = 'global'">%fa:globe% %i18n:@global%</span>
|
||||||
<template v-if="lists">
|
<template v-if="lists">
|
||||||
<span v-for="l in lists" :data-active="src == 'list' && list == l" @click="src = 'list'; list = l" :key="l.id">%fa:list% {{ l.title }}</span>
|
<span v-for="l in lists" :data-active="src == 'list' && list == l" @click="src = 'list'; list = l" :key="l.id">%fa:list% {{ l.title }}</span>
|
||||||
@ -60,7 +60,8 @@ export default Vue.extend({
|
|||||||
src: 'home',
|
src: 'home',
|
||||||
list: null,
|
list: null,
|
||||||
lists: null,
|
lists: null,
|
||||||
showNav: false
|
showNav: false,
|
||||||
|
enableLocalTimeline: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -85,6 +86,10 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
|
(this as any).os.getMeta().then(meta => {
|
||||||
|
this.enableLocalTimeline = !meta.disableLocalTimeline;
|
||||||
|
});
|
||||||
|
|
||||||
if (this.$store.state.device.tl) {
|
if (this.$store.state.device.tl) {
|
||||||
this.src = this.$store.state.device.tl.src;
|
this.src = this.$store.state.device.tl.src;
|
||||||
if (this.src == 'list') {
|
if (this.src == 'list') {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { capitalize } from "../../../prelude/string";
|
import { capitalize, toUpperCase } from "../../../prelude/string";
|
||||||
|
|
||||||
function escape(text: string) {
|
function escape(text: string) {
|
||||||
return text
|
return text
|
||||||
@ -92,7 +92,7 @@ const _keywords = [
|
|||||||
|
|
||||||
const keywords = _keywords
|
const keywords = _keywords
|
||||||
.concat(_keywords.map(capitalize))
|
.concat(_keywords.map(capitalize))
|
||||||
.concat(_keywords.map(k => k.toUpperCase()))
|
.concat(_keywords.map(toUpperCase))
|
||||||
.sort((a, b) => b.length - a.length);
|
.sort((a, b) => b.length - a.length);
|
||||||
|
|
||||||
const symbols = [
|
const symbols = [
|
||||||
|
@ -4,6 +4,7 @@ import { pack as packUser } from './user';
|
|||||||
import { pack as packFile } from './drive-file';
|
import { pack as packFile } from './drive-file';
|
||||||
import db from '../db/mongodb';
|
import db from '../db/mongodb';
|
||||||
import MessagingHistory, { deleteMessagingHistory } from './messaging-history';
|
import MessagingHistory, { deleteMessagingHistory } from './messaging-history';
|
||||||
|
import { length } from 'stringz';
|
||||||
|
|
||||||
const MessagingMessage = db.get<IMessagingMessage>('messagingMessages');
|
const MessagingMessage = db.get<IMessagingMessage>('messagingMessages');
|
||||||
export default MessagingMessage;
|
export default MessagingMessage;
|
||||||
@ -19,7 +20,7 @@ export interface IMessagingMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isValidText(text: string): boolean {
|
export function isValidText(text: string): boolean {
|
||||||
return text.length <= 1000 && text.trim() != '';
|
return length(text.trim()) <= 1000 && text.trim() != '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,5 +12,6 @@ export type IMeta = {
|
|||||||
originalUsersCount: number;
|
originalUsersCount: number;
|
||||||
};
|
};
|
||||||
disableRegistration?: boolean;
|
disableRegistration?: boolean;
|
||||||
|
disableLocalTimeline?: boolean;
|
||||||
hidedTags?: string[];
|
hidedTags?: string[];
|
||||||
};
|
};
|
||||||
|
@ -2,6 +2,7 @@ import * as mongo from 'mongodb';
|
|||||||
const deepcopy = require('deepcopy');
|
const deepcopy = require('deepcopy');
|
||||||
import rap from '@prezzemolo/rap';
|
import rap from '@prezzemolo/rap';
|
||||||
import db from '../db/mongodb';
|
import db from '../db/mongodb';
|
||||||
|
import { length } from 'stringz';
|
||||||
import { IUser, pack as packUser } from './user';
|
import { IUser, pack as packUser } from './user';
|
||||||
import { pack as packApp } from './app';
|
import { pack as packApp } from './app';
|
||||||
import PollVote, { deletePollVote } from './poll-vote';
|
import PollVote, { deletePollVote } from './poll-vote';
|
||||||
@ -24,11 +25,11 @@ Note.createIndex({
|
|||||||
export default Note;
|
export default Note;
|
||||||
|
|
||||||
export function isValidText(text: string): boolean {
|
export function isValidText(text: string): boolean {
|
||||||
return text.length <= 1000 && text.trim() != '';
|
return length(text.trim()) <= 1000 && text.trim() != '';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isValidCw(text: string): boolean {
|
export function isValidCw(text: string): boolean {
|
||||||
return text.length <= 100;
|
return length(text.trim()) <= 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type INote = {
|
export type INote = {
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
export function capitalize(s: string): string {
|
export function capitalize(s: string): string {
|
||||||
return s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();
|
return toUpperCase(s.charAt(0)) + toLowerCase(s.slice(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function toUpperCase(s: string): string {
|
||||||
|
return s.toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function toLowerCase(s: string): string {
|
||||||
|
return s.toLowerCase();
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,12 @@ export const meta = {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
disableLocalTimeline: $.bool.optional.nullable.note({
|
||||||
|
desc: {
|
||||||
|
'ja-JP': 'ローカルタイムライン(とソーシャルタイムライン)を無効にするか否か'
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
hidedTags: $.arr($.str).optional.nullable.note({
|
hidedTags: $.arr($.str).optional.nullable.note({
|
||||||
desc: {
|
desc: {
|
||||||
'ja-JP': '統計などで無視するハッシュタグ'
|
'ja-JP': '統計などで無視するハッシュタグ'
|
||||||
@ -45,6 +51,10 @@ export default (params: any) => new Promise(async (res, rej) => {
|
|||||||
set.disableRegistration = ps.disableRegistration;
|
set.disableRegistration = ps.disableRegistration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof ps.disableLocalTimeline === 'boolean') {
|
||||||
|
set.disableLocalTimeline = ps.disableLocalTimeline;
|
||||||
|
}
|
||||||
|
|
||||||
if (Array.isArray(ps.hidedTags)) {
|
if (Array.isArray(ps.hidedTags)) {
|
||||||
set.hidedTags = ps.hidedTags;
|
set.hidedTags = ps.hidedTags;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create following
|
// Create following
|
||||||
create(follower, followee);
|
await create(follower, followee);
|
||||||
|
|
||||||
// Send response
|
// Send response
|
||||||
res(await pack(followee._id, user));
|
res(await pack(followee._id, user));
|
||||||
|
@ -57,7 +57,7 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete following
|
// Delete following
|
||||||
deleteFollowing(follower, followee);
|
await deleteFollowing(follower, followee);
|
||||||
|
|
||||||
// Send response
|
// Send response
|
||||||
res(await pack(followee._id, user));
|
res(await pack(followee._id, user));
|
||||||
|
@ -34,6 +34,7 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
|
|||||||
},
|
},
|
||||||
broadcasts: meta.broadcasts,
|
broadcasts: meta.broadcasts,
|
||||||
disableRegistration: meta.disableRegistration,
|
disableRegistration: meta.disableRegistration,
|
||||||
|
disableLocalTimeline: meta.disableLocalTimeline,
|
||||||
driveCapacityPerLocalUserMb: config.localDriveCapacityMb,
|
driveCapacityPerLocalUserMb: config.localDriveCapacityMb,
|
||||||
recaptchaSitekey: config.recaptcha ? config.recaptcha.site_key : null,
|
recaptchaSitekey: config.recaptcha ? config.recaptcha.site_key : null,
|
||||||
swPublickey: config.sw ? config.sw.public_key : null,
|
swPublickey: config.sw ? config.sw.public_key : null,
|
||||||
|
@ -73,8 +73,7 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Serialize
|
// Serialize
|
||||||
const users = await Promise.all(following.map(async f =>
|
const users = await Promise.all(following.map(f => pack(f.followerId, me, { detail: true })));
|
||||||
await pack(f.followerId, me, { detail: true })));
|
|
||||||
|
|
||||||
// Response
|
// Response
|
||||||
res({
|
res({
|
||||||
|
@ -73,8 +73,7 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Serialize
|
// Serialize
|
||||||
const users = await Promise.all(following.map(async f =>
|
const users = await Promise.all(following.map(f => pack(f.followeeId, me, { detail: true })));
|
||||||
await pack(f.followeeId, me, { detail: true })));
|
|
||||||
|
|
||||||
// Response
|
// Response
|
||||||
res({
|
res({
|
||||||
|
@ -36,6 +36,13 @@ export default async function(
|
|||||||
|
|
||||||
// Subscribe Home stream channel
|
// Subscribe Home stream channel
|
||||||
subscriber.on(`user-stream:${user._id}`, async x => {
|
subscriber.on(`user-stream:${user._id}`, async x => {
|
||||||
|
// Renoteなら再pack
|
||||||
|
if (x.type == 'note' && x.body.renoteId != null) {
|
||||||
|
x.body.renote = await pack(x.body.renoteId, user, {
|
||||||
|
detail: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//#region 流れてきたメッセージがミュートしているユーザーが関わるものだったら無視する
|
//#region 流れてきたメッセージがミュートしているユーザーが関わるものだったら無視する
|
||||||
if (x.type == 'note') {
|
if (x.type == 'note') {
|
||||||
if (mutedUserIds.includes(x.body.userId)) {
|
if (mutedUserIds.includes(x.body.userId)) {
|
||||||
@ -54,13 +61,6 @@ export default async function(
|
|||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
// Renoteなら再pack
|
|
||||||
if (x.type == 'note' && x.body.renoteId != null) {
|
|
||||||
x.body.renote = await pack(x.body.renoteId, user, {
|
|
||||||
detail: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
connection.send(JSON.stringify(x));
|
connection.send(JSON.stringify(x));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -19,6 +19,13 @@ export default async function(
|
|||||||
subscriber.on(`hybrid-timeline:${user._id}`, onEvent);
|
subscriber.on(`hybrid-timeline:${user._id}`, onEvent);
|
||||||
|
|
||||||
async function onEvent(note: any) {
|
async function onEvent(note: any) {
|
||||||
|
// Renoteなら再pack
|
||||||
|
if (note.renoteId != null) {
|
||||||
|
note.renote = await pack(note.renoteId, user, {
|
||||||
|
detail: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//#region 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
//#region 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
||||||
if (mutedUserIds.indexOf(note.userId) != -1) {
|
if (mutedUserIds.indexOf(note.userId) != -1) {
|
||||||
return;
|
return;
|
||||||
@ -31,13 +38,6 @@ export default async function(
|
|||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
// Renoteなら再pack
|
|
||||||
if (note.renoteId != null) {
|
|
||||||
note.renote = await pack(note.renoteId, user, {
|
|
||||||
detail: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
connection.send(JSON.stringify({
|
connection.send(JSON.stringify({
|
||||||
type: 'note',
|
type: 'note',
|
||||||
body: note
|
body: note
|
||||||
|
@ -16,6 +16,13 @@ export default async function(
|
|||||||
|
|
||||||
// Subscribe stream
|
// Subscribe stream
|
||||||
subscriber.on('local-timeline', async note => {
|
subscriber.on('local-timeline', async note => {
|
||||||
|
// Renoteなら再pack
|
||||||
|
if (note.renoteId != null) {
|
||||||
|
note.renote = await pack(note.renoteId, user, {
|
||||||
|
detail: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//#region 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
//#region 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
||||||
if (mutedUserIds.indexOf(note.userId) != -1) {
|
if (mutedUserIds.indexOf(note.userId) != -1) {
|
||||||
return;
|
return;
|
||||||
@ -28,13 +35,6 @@ export default async function(
|
|||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
// Renoteなら再pack
|
|
||||||
if (note.renoteId != null) {
|
|
||||||
note.renote = await pack(note.renoteId, user, {
|
|
||||||
detail: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
connection.send(JSON.stringify({
|
connection.send(JSON.stringify({
|
||||||
type: 'note',
|
type: 'note',
|
||||||
body: note
|
body: note
|
||||||
|
@ -36,8 +36,11 @@ async function save(path: string, name: string, type: string, hash: string, size
|
|||||||
|
|
||||||
if (config.drive && config.drive.storage == 'minio') {
|
if (config.drive && config.drive.storage == 'minio') {
|
||||||
const minio = new Minio.Client(config.drive.config);
|
const minio = new Minio.Client(config.drive.config);
|
||||||
const key = `${config.drive.prefix}/${uuid.v4()}/${name}`;
|
|
||||||
const thumbnailKey = `${config.drive.prefix}/${uuid.v4()}/${name}.thumbnail.jpg`;
|
const keyDir = `${config.drive.prefix}/${uuid.v4()}`;
|
||||||
|
const key = `${keyDir}/${name}`;
|
||||||
|
const thumbnailKeyDir = `${config.drive.prefix}/${uuid.v4()}`;
|
||||||
|
const thumbnailKey = `${thumbnailKeyDir}/${name}.thumbnail.jpg`;
|
||||||
|
|
||||||
const baseUrl = config.drive.baseUrl
|
const baseUrl = config.drive.baseUrl
|
||||||
|| `${ config.drive.config.useSSL ? 'https' : 'http' }://${ config.drive.config.endPoint }${ config.drive.config.port ? `:${config.drive.config.port}` : '' }/${ config.drive.bucket }`;
|
|| `${ config.drive.config.useSSL ? 'https' : 'http' }://${ config.drive.config.endPoint }${ config.drive.config.port ? `:${config.drive.config.port}` : '' }/${ config.drive.bucket }`;
|
||||||
@ -61,8 +64,8 @@ async function save(path: string, name: string, type: string, hash: string, size
|
|||||||
key: key,
|
key: key,
|
||||||
thumbnailKey: thumbnailKey
|
thumbnailKey: thumbnailKey
|
||||||
},
|
},
|
||||||
url: `${ baseUrl }/${ key }`,
|
url: `${ baseUrl }/${ keyDir }/${ encodeURIComponent(name) }`,
|
||||||
thumbnailUrl: thumbnail ? `${ baseUrl }/${ thumbnailKey }` : null
|
thumbnailUrl: thumbnail ? `${ baseUrl }/${ thumbnailKeyDir }/${ encodeURIComponent(name) }.thumbnail.jpg` : null
|
||||||
});
|
});
|
||||||
|
|
||||||
const file = await DriveFile.insert({
|
const file = await DriveFile.insert({
|
||||||
|
@ -278,7 +278,6 @@ async function publish(user: IUser, note: INote, noteObj: any, reply: INote, ren
|
|||||||
} else {
|
} else {
|
||||||
// Publish event to myself's stream
|
// Publish event to myself's stream
|
||||||
publishUserStream(note.userId, 'note', noteObj);
|
publishUserStream(note.userId, 'note', noteObj);
|
||||||
publishHybridTimelineStream(note.userId, noteObj);
|
|
||||||
|
|
||||||
// Publish note to local and hybrid timeline stream
|
// Publish note to local and hybrid timeline stream
|
||||||
if (note.visibility != 'home') {
|
if (note.visibility != 'home') {
|
||||||
@ -287,6 +286,9 @@ async function publish(user: IUser, note: INote, noteObj: any, reply: INote, ren
|
|||||||
|
|
||||||
if (note.visibility == 'public') {
|
if (note.visibility == 'public') {
|
||||||
publishHybridTimelineStream(null, noteObj);
|
publishHybridTimelineStream(null, noteObj);
|
||||||
|
} else {
|
||||||
|
// Publish event to myself's stream
|
||||||
|
publishHybridTimelineStream(note.userId, noteObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,8 @@ export default async function(user: IUser, note: INote) {
|
|||||||
tags: [],
|
tags: [],
|
||||||
fileIds: [],
|
fileIds: [],
|
||||||
poll: null,
|
poll: null,
|
||||||
geo: null
|
geo: null,
|
||||||
|
cw: null
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,58 +1,97 @@
|
|||||||
import * as mongo from 'mongodb';
|
import * as mongo from 'mongodb';
|
||||||
import Xev from 'xev';
|
import Xev from 'xev';
|
||||||
|
import Meta, { IMeta } from './models/meta';
|
||||||
const ev = new Xev();
|
|
||||||
|
|
||||||
type ID = string | mongo.ObjectID;
|
type ID = string | mongo.ObjectID;
|
||||||
|
|
||||||
function publish(channel: string, type: string, value?: any): void {
|
class Publisher {
|
||||||
|
private ev: Xev;
|
||||||
|
private meta: IMeta;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.ev = new Xev();
|
||||||
|
|
||||||
|
setInterval(async () => {
|
||||||
|
this.meta = await Meta.findOne({});
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public getMeta = async () => {
|
||||||
|
if (this.meta != null) return this.meta;
|
||||||
|
|
||||||
|
this.meta = await Meta.findOne({});
|
||||||
|
return this.meta;
|
||||||
|
}
|
||||||
|
|
||||||
|
private publish = (channel: string, type: string, value?: any): void => {
|
||||||
const message = type == null ? value : value == null ?
|
const message = type == null ? value : value == null ?
|
||||||
{ type: type } :
|
{ type: type } :
|
||||||
{ type: type, body: value };
|
{ type: type, body: value };
|
||||||
|
|
||||||
ev.emit(channel, message);
|
this.ev.emit(channel, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function publishUserStream(userId: ID, type: string, value?: any): void {
|
public publishUserStream = (userId: ID, type: string, value?: any): void => {
|
||||||
publish(`user-stream:${userId}`, type, typeof value === 'undefined' ? null : value);
|
this.publish(`user-stream:${userId}`, type, typeof value === 'undefined' ? null : value);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function publishDriveStream(userId: ID, type: string, value?: any): void {
|
public publishDriveStream = (userId: ID, type: string, value?: any): void => {
|
||||||
publish(`drive-stream:${userId}`, type, typeof value === 'undefined' ? null : value);
|
this.publish(`drive-stream:${userId}`, type, typeof value === 'undefined' ? null : value);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function publishNoteStream(noteId: ID, type: string): void {
|
public publishNoteStream = (noteId: ID, type: string): void => {
|
||||||
publish(`note-stream:${noteId}`, null, noteId);
|
this.publish(`note-stream:${noteId}`, null, noteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function publishUserListStream(listId: ID, type: string, value?: any): void {
|
public publishUserListStream = (listId: ID, type: string, value?: any): void => {
|
||||||
publish(`user-list-stream:${listId}`, type, typeof value === 'undefined' ? null : value);
|
this.publish(`user-list-stream:${listId}`, type, typeof value === 'undefined' ? null : value);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function publishMessagingStream(userId: ID, otherpartyId: ID, type: string, value?: any): void {
|
public publishMessagingStream = (userId: ID, otherpartyId: ID, type: string, value?: any): void => {
|
||||||
publish(`messaging-stream:${userId}-${otherpartyId}`, type, typeof value === 'undefined' ? null : value);
|
this.publish(`messaging-stream:${userId}-${otherpartyId}`, type, typeof value === 'undefined' ? null : value);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function publishMessagingIndexStream(userId: ID, type: string, value?: any): void {
|
public publishMessagingIndexStream = (userId: ID, type: string, value?: any): void => {
|
||||||
publish(`messaging-index-stream:${userId}`, type, typeof value === 'undefined' ? null : value);
|
this.publish(`messaging-index-stream:${userId}`, type, typeof value === 'undefined' ? null : value);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function publishReversiStream(userId: ID, type: string, value?: any): void {
|
public publishReversiStream = (userId: ID, type: string, value?: any): void => {
|
||||||
publish(`reversi-stream:${userId}`, type, typeof value === 'undefined' ? null : value);
|
this.publish(`reversi-stream:${userId}`, type, typeof value === 'undefined' ? null : value);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function publishReversiGameStream(gameId: ID, type: string, value?: any): void {
|
public publishReversiGameStream = (gameId: ID, type: string, value?: any): void => {
|
||||||
publish(`reversi-game-stream:${gameId}`, type, typeof value === 'undefined' ? null : value);
|
this.publish(`reversi-game-stream:${gameId}`, type, typeof value === 'undefined' ? null : value);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function publishLocalTimelineStream(note: any): void {
|
public publishLocalTimelineStream = async (note: any): Promise<void> => {
|
||||||
publish('local-timeline', null, note);
|
const meta = await this.getMeta();
|
||||||
|
if (meta.disableLocalTimeline) return;
|
||||||
|
this.publish('local-timeline', null, note);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function publishHybridTimelineStream(userId: ID, note: any): void {
|
public publishHybridTimelineStream = async (userId: ID, note: any): Promise<void> => {
|
||||||
publish(userId ? `hybrid-timeline:${userId}` : 'hybrid-timeline', null, note);
|
const meta = await this.getMeta();
|
||||||
|
if (meta.disableLocalTimeline) return;
|
||||||
|
this.publish(userId ? `hybrid-timeline:${userId}` : 'hybrid-timeline', null, note);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function publishGlobalTimelineStream(note: any): void {
|
public publishGlobalTimelineStream = (note: any): void => {
|
||||||
publish('global-timeline', null, note);
|
this.publish('global-timeline', null, note);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const publisher = new Publisher();
|
||||||
|
|
||||||
|
export default publisher;
|
||||||
|
|
||||||
|
export const publishUserStream = publisher.publishUserStream;
|
||||||
|
export const publishDriveStream = publisher.publishDriveStream;
|
||||||
|
export const publishNoteStream = publisher.publishNoteStream;
|
||||||
|
export const publishUserListStream = publisher.publishUserListStream;
|
||||||
|
export const publishMessagingStream = publisher.publishMessagingStream;
|
||||||
|
export const publishMessagingIndexStream = publisher.publishMessagingIndexStream;
|
||||||
|
export const publishReversiStream = publisher.publishReversiStream;
|
||||||
|
export const publishReversiGameStream = publisher.publishReversiGameStream;
|
||||||
|
export const publishLocalTimelineStream = publisher.publishLocalTimelineStream;
|
||||||
|
export const publishHybridTimelineStream = publisher.publishHybridTimelineStream;
|
||||||
|
export const publishGlobalTimelineStream = publisher.publishGlobalTimelineStream;
|
||||||
|
Reference in New Issue
Block a user