Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d3ff3a7d54 | ||
![]() |
cf36106520 | ||
![]() |
1642fbec31 | ||
![]() |
b195fd8145 | ||
![]() |
5f59b980a7 | ||
![]() |
2a5c19cd01 | ||
![]() |
42e007ddb7 | ||
![]() |
756dc397d9 | ||
![]() |
8f714b5b12 | ||
![]() |
06bb2a1c7c | ||
![]() |
ac50bb9225 | ||
![]() |
8fd95de25b | ||
![]() |
0e14b2eba4 | ||
![]() |
08413a7550 | ||
![]() |
5e0f2a5b06 |
@@ -43,8 +43,8 @@ jobs:
|
|||||||
- run:
|
- run:
|
||||||
name: Configure
|
name: Configure
|
||||||
command: |
|
command: |
|
||||||
cp .ci/default.yml .config
|
cp .circleci/misskey/default.yml .config
|
||||||
cp .ci/test.yml .config
|
cp .circleci/misskey/test.yml .config
|
||||||
- run:
|
- run:
|
||||||
name: Build
|
name: Build
|
||||||
command: |
|
command: |
|
||||||
|
@@ -57,21 +57,6 @@ mongodb:
|
|||||||
user: example-misskey-user
|
user: example-misskey-user
|
||||||
pass: example-misskey-pass
|
pass: example-misskey-pass
|
||||||
|
|
||||||
# Drive capacity of a local user (MB)
|
|
||||||
localDriveCapacityMb: 256
|
|
||||||
|
|
||||||
# Drive capacity of a remote user (MB)
|
|
||||||
remoteDriveCapacityMb: 8
|
|
||||||
|
|
||||||
# If enabled:
|
|
||||||
# Server will not cache remote files (Using direct link instead).
|
|
||||||
# You can save your storage.
|
|
||||||
#
|
|
||||||
# NOTE:
|
|
||||||
# * Users cannot see remote images when they turn off "Show media from a remote server" setting.
|
|
||||||
# * Since thumbnails are not provided, traffic increases.
|
|
||||||
preventCacheRemoteFiles: false
|
|
||||||
|
|
||||||
drive:
|
drive:
|
||||||
storage: 'db'
|
storage: 'db'
|
||||||
|
|
||||||
@@ -110,6 +95,10 @@ drive:
|
|||||||
# accessKey: XXX
|
# accessKey: XXX
|
||||||
# secretKey: YYY
|
# secretKey: YYY
|
||||||
|
|
||||||
|
# If enabled:
|
||||||
|
# The first account created is automatically marked as Admin.
|
||||||
|
autoAdmin: true
|
||||||
|
|
||||||
#
|
#
|
||||||
# Below settings are optional
|
# Below settings are optional
|
||||||
#
|
#
|
||||||
|
@@ -1078,6 +1078,12 @@ admin/views/instance.vue:
|
|||||||
instance-name: "インスタンス名"
|
instance-name: "インスタンス名"
|
||||||
instance-description: "インスタンスの紹介"
|
instance-description: "インスタンスの紹介"
|
||||||
banner-url: "バナー画像URL"
|
banner-url: "バナー画像URL"
|
||||||
|
drive-config: "ドライブの設定"
|
||||||
|
cache-remote-files: "リモートのファイルをキャッシュする"
|
||||||
|
cache-remote-files-desc: "この設定を無効にすると、リモートファイルをキャッシュせず直リンクするようになります。そのためサーバーのストレージを節約できますが、プライバシー設定で直リンクを無効にしているユーザーにはファイルが見えなくなったり、サムネイルが生成されないので通信量が増加します。通常はこの設定をオンにしておくことをおすすめします。"
|
||||||
|
local-drive-capacity-mb: "ローカルユーザーひとりあたりのドライブ容量"
|
||||||
|
remote-drive-capacity-mb: "リモートユーザーひとりあたりのドライブ容量"
|
||||||
|
mb: "メガバイト単位"
|
||||||
max-note-text-length: "投稿の最大文字数"
|
max-note-text-length: "投稿の最大文字数"
|
||||||
disable-registration: "ユーザー登録の受付を停止する"
|
disable-registration: "ユーザー登録の受付を停止する"
|
||||||
disable-local-timeline: "ローカルタイムラインを無効にする"
|
disable-local-timeline: "ローカルタイムラインを無効にする"
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"author": "syuilo <i@syuilo.com>",
|
"author": "syuilo <i@syuilo.com>",
|
||||||
"version": "10.40.1",
|
"version": "10.41.0",
|
||||||
"clientVersion": "1.0.11579",
|
"clientVersion": "1.0.11594",
|
||||||
"codename": "nighthike",
|
"codename": "nighthike",
|
||||||
"main": "./built/index.js",
|
"main": "./built/index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
"eslint-plugin-vue": "4.7.1",
|
"eslint-plugin-vue": "4.7.1",
|
||||||
"eventemitter3": "3.1.0",
|
"eventemitter3": "3.1.0",
|
||||||
"file-loader": "2.0.0",
|
"file-loader": "2.0.0",
|
||||||
"file-type": "10.3.0",
|
"file-type": "10.4.0",
|
||||||
"fuckadblock": "3.2.1",
|
"fuckadblock": "3.2.1",
|
||||||
"gulp": "3.9.1",
|
"gulp": "3.9.1",
|
||||||
"gulp-cssnano": "2.1.3",
|
"gulp-cssnano": "2.1.3",
|
||||||
@@ -228,7 +228,7 @@
|
|||||||
"vuex-persistedstate": "2.5.4",
|
"vuex-persistedstate": "2.5.4",
|
||||||
"web-push": "3.3.3",
|
"web-push": "3.3.3",
|
||||||
"webfinger.js": "2.6.6",
|
"webfinger.js": "2.6.6",
|
||||||
"webpack": "4.23.1",
|
"webpack": "4.25.1",
|
||||||
"webpack-cli": "3.1.2",
|
"webpack-cli": "3.1.2",
|
||||||
"websocket": "1.0.28",
|
"websocket": "1.0.28",
|
||||||
"ws": "6.1.0",
|
"ws": "6.1.0",
|
||||||
|
@@ -274,12 +274,15 @@ export default Vue.extend({
|
|||||||
return {
|
return {
|
||||||
series: [{
|
series: [{
|
||||||
name: 'Combined',
|
name: 'Combined',
|
||||||
|
type: 'line',
|
||||||
data: this.format(sum(this.stats.notes.local.total, this.stats.notes.remote.total))
|
data: this.format(sum(this.stats.notes.local.total, this.stats.notes.remote.total))
|
||||||
}, {
|
}, {
|
||||||
name: 'Local',
|
name: 'Local',
|
||||||
|
type: 'area',
|
||||||
data: this.format(this.stats.notes.local.total)
|
data: this.format(this.stats.notes.local.total)
|
||||||
}, {
|
}, {
|
||||||
name: 'Remote',
|
name: 'Remote',
|
||||||
|
type: 'area',
|
||||||
data: this.format(this.stats.notes.remote.total)
|
data: this.format(this.stats.notes.remote.total)
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -289,18 +292,21 @@ export default Vue.extend({
|
|||||||
return {
|
return {
|
||||||
series: [{
|
series: [{
|
||||||
name: 'Combined',
|
name: 'Combined',
|
||||||
|
type: 'line',
|
||||||
data: this.format(total
|
data: this.format(total
|
||||||
? sum(this.stats.users.local.total, this.stats.users.remote.total)
|
? sum(this.stats.users.local.total, this.stats.users.remote.total)
|
||||||
: sum(this.stats.users.local.inc, negate(this.stats.users.local.dec), this.stats.users.remote.inc, negate(this.stats.users.remote.dec))
|
: sum(this.stats.users.local.inc, negate(this.stats.users.local.dec), this.stats.users.remote.inc, negate(this.stats.users.remote.dec))
|
||||||
)
|
)
|
||||||
}, {
|
}, {
|
||||||
name: 'Local',
|
name: 'Local',
|
||||||
|
type: 'area',
|
||||||
data: this.format(total
|
data: this.format(total
|
||||||
? this.stats.users.local.total
|
? this.stats.users.local.total
|
||||||
: sum(this.stats.users.local.inc, negate(this.stats.users.local.dec))
|
: sum(this.stats.users.local.inc, negate(this.stats.users.local.dec))
|
||||||
)
|
)
|
||||||
}, {
|
}, {
|
||||||
name: 'Remote',
|
name: 'Remote',
|
||||||
|
type: 'area',
|
||||||
data: this.format(total
|
data: this.format(total
|
||||||
? this.stats.users.remote.total
|
? this.stats.users.remote.total
|
||||||
: sum(this.stats.users.remote.inc, negate(this.stats.users.remote.dec))
|
: sum(this.stats.users.remote.inc, negate(this.stats.users.remote.dec))
|
||||||
@@ -314,6 +320,7 @@ export default Vue.extend({
|
|||||||
bytes: true,
|
bytes: true,
|
||||||
series: [{
|
series: [{
|
||||||
name: 'All',
|
name: 'All',
|
||||||
|
type: 'line',
|
||||||
data: this.format(
|
data: this.format(
|
||||||
sum(
|
sum(
|
||||||
this.stats.drive.local.incSize,
|
this.stats.drive.local.incSize,
|
||||||
@@ -324,15 +331,19 @@ export default Vue.extend({
|
|||||||
)
|
)
|
||||||
}, {
|
}, {
|
||||||
name: 'Local +',
|
name: 'Local +',
|
||||||
|
type: 'area',
|
||||||
data: this.format(this.stats.drive.local.incSize)
|
data: this.format(this.stats.drive.local.incSize)
|
||||||
}, {
|
}, {
|
||||||
name: 'Local -',
|
name: 'Local -',
|
||||||
|
type: 'area',
|
||||||
data: this.format(negate(this.stats.drive.local.decSize))
|
data: this.format(negate(this.stats.drive.local.decSize))
|
||||||
}, {
|
}, {
|
||||||
name: 'Remote +',
|
name: 'Remote +',
|
||||||
|
type: 'area',
|
||||||
data: this.format(this.stats.drive.remote.incSize)
|
data: this.format(this.stats.drive.remote.incSize)
|
||||||
}, {
|
}, {
|
||||||
name: 'Remote -',
|
name: 'Remote -',
|
||||||
|
type: 'area',
|
||||||
data: this.format(negate(this.stats.drive.remote.decSize))
|
data: this.format(negate(this.stats.drive.remote.decSize))
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -343,12 +354,15 @@ export default Vue.extend({
|
|||||||
bytes: true,
|
bytes: true,
|
||||||
series: [{
|
series: [{
|
||||||
name: 'Combined',
|
name: 'Combined',
|
||||||
|
type: 'line',
|
||||||
data: this.format(sum(this.stats.drive.local.totalSize, this.stats.drive.remote.totalSize))
|
data: this.format(sum(this.stats.drive.local.totalSize, this.stats.drive.remote.totalSize))
|
||||||
}, {
|
}, {
|
||||||
name: 'Local',
|
name: 'Local',
|
||||||
|
type: 'area',
|
||||||
data: this.format(this.stats.drive.local.totalSize)
|
data: this.format(this.stats.drive.local.totalSize)
|
||||||
}, {
|
}, {
|
||||||
name: 'Remote',
|
name: 'Remote',
|
||||||
|
type: 'area',
|
||||||
data: this.format(this.stats.drive.remote.totalSize)
|
data: this.format(this.stats.drive.remote.totalSize)
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -358,6 +372,7 @@ export default Vue.extend({
|
|||||||
return {
|
return {
|
||||||
series: [{
|
series: [{
|
||||||
name: 'All',
|
name: 'All',
|
||||||
|
type: 'line',
|
||||||
data: this.format(
|
data: this.format(
|
||||||
sum(
|
sum(
|
||||||
this.stats.drive.local.incCount,
|
this.stats.drive.local.incCount,
|
||||||
@@ -368,15 +383,19 @@ export default Vue.extend({
|
|||||||
)
|
)
|
||||||
}, {
|
}, {
|
||||||
name: 'Local +',
|
name: 'Local +',
|
||||||
|
type: 'area',
|
||||||
data: this.format(this.stats.drive.local.incCount)
|
data: this.format(this.stats.drive.local.incCount)
|
||||||
}, {
|
}, {
|
||||||
name: 'Local -',
|
name: 'Local -',
|
||||||
|
type: 'area',
|
||||||
data: this.format(negate(this.stats.drive.local.decCount))
|
data: this.format(negate(this.stats.drive.local.decCount))
|
||||||
}, {
|
}, {
|
||||||
name: 'Remote +',
|
name: 'Remote +',
|
||||||
|
type: 'area',
|
||||||
data: this.format(this.stats.drive.remote.incCount)
|
data: this.format(this.stats.drive.remote.incCount)
|
||||||
}, {
|
}, {
|
||||||
name: 'Remote -',
|
name: 'Remote -',
|
||||||
|
type: 'area',
|
||||||
data: this.format(negate(this.stats.drive.remote.decCount))
|
data: this.format(negate(this.stats.drive.remote.decCount))
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -386,12 +405,15 @@ export default Vue.extend({
|
|||||||
return {
|
return {
|
||||||
series: [{
|
series: [{
|
||||||
name: 'Combined',
|
name: 'Combined',
|
||||||
|
type: 'line',
|
||||||
data: this.format(sum(this.stats.drive.local.totalCount, this.stats.drive.remote.totalCount))
|
data: this.format(sum(this.stats.drive.local.totalCount, this.stats.drive.remote.totalCount))
|
||||||
}, {
|
}, {
|
||||||
name: 'Local',
|
name: 'Local',
|
||||||
|
type: 'area',
|
||||||
data: this.format(this.stats.drive.local.totalCount)
|
data: this.format(this.stats.drive.local.totalCount)
|
||||||
}, {
|
}, {
|
||||||
name: 'Remote',
|
name: 'Remote',
|
||||||
|
type: 'area',
|
||||||
data: this.format(this.stats.drive.remote.totalCount)
|
data: this.format(this.stats.drive.remote.totalCount)
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
</ui-input>
|
</ui-input>
|
||||||
</ui-horizon-group>
|
</ui-horizon-group>
|
||||||
<ui-input v-model="url">
|
<ui-input v-model="url">
|
||||||
|
<i slot="icon"><fa icon="link"/></i>
|
||||||
<span>%i18n:@add-emoji.url%</span>
|
<span>%i18n:@add-emoji.url%</span>
|
||||||
</ui-input>
|
</ui-input>
|
||||||
<ui-info>%i18n:@add-emoji.info%</ui-info>
|
<ui-info>%i18n:@add-emoji.info%</ui-info>
|
||||||
@@ -34,6 +35,7 @@
|
|||||||
</ui-input>
|
</ui-input>
|
||||||
</ui-horizon-group>
|
</ui-horizon-group>
|
||||||
<ui-input v-model="emoji.url">
|
<ui-input v-model="emoji.url">
|
||||||
|
<i slot="icon"><fa icon="link"/></i>
|
||||||
<span>%i18n:@add-emoji.url%</span>
|
<span>%i18n:@add-emoji.url%</span>
|
||||||
</ui-input>
|
</ui-input>
|
||||||
<ui-horizon-group>
|
<ui-horizon-group>
|
||||||
|
@@ -2,11 +2,21 @@
|
|||||||
<div class="axbwjelsbymowqjyywpirzhdlszoncqs">
|
<div class="axbwjelsbymowqjyywpirzhdlszoncqs">
|
||||||
<ui-card>
|
<ui-card>
|
||||||
<div slot="title"><fa icon="cog"/> %i18n:@instance%</div>
|
<div slot="title"><fa icon="cog"/> %i18n:@instance%</div>
|
||||||
<section class="fit-top">
|
<section class="fit-top fit-bottom">
|
||||||
<ui-input v-model="name">%i18n:@instance-name%</ui-input>
|
<ui-input v-model="name">%i18n:@instance-name%</ui-input>
|
||||||
<ui-textarea v-model="description">%i18n:@instance-description%</ui-textarea>
|
<ui-textarea v-model="description">%i18n:@instance-description%</ui-textarea>
|
||||||
<ui-input v-model="bannerUrl">%i18n:@banner-url%</ui-input>
|
<ui-input v-model="bannerUrl"><i slot="icon"><fa icon="link"/></i>%i18n:@banner-url%</ui-input>
|
||||||
|
</section>
|
||||||
|
<section class="fit-top fit-bottom">
|
||||||
<ui-input v-model="maxNoteTextLength">%i18n:@max-note-text-length%</ui-input>
|
<ui-input v-model="maxNoteTextLength">%i18n:@max-note-text-length%</ui-input>
|
||||||
|
</section>
|
||||||
|
<section class="fit-bottom">
|
||||||
|
<header><fa icon="cloud"/> %i18n:@drive-config%</header>
|
||||||
|
<ui-switch v-model="cacheRemoteFiles">%i18n:@cache-remote-files%<span slot="desc">%i18n:@cache-remote-files-desc%</span></ui-switch>
|
||||||
|
<ui-input v-model="localDriveCapacityMb">%i18n:@local-drive-capacity-mb%<span slot="text">%i18n:@mb%</span><span slot="suffix">MB</span></ui-input>
|
||||||
|
<ui-input v-model="remoteDriveCapacityMb" :disabled="!cacheRemoteFiles">%i18n:@remote-drive-capacity-mb%<span slot="text">%i18n:@mb%</span><span slot="suffix">MB</span></ui-input>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
<ui-button @click="updateMeta">%i18n:@save%</ui-button>
|
<ui-button @click="updateMeta">%i18n:@save%</ui-button>
|
||||||
</section>
|
</section>
|
||||||
</ui-card>
|
</ui-card>
|
||||||
@@ -40,6 +50,9 @@ export default Vue.extend({
|
|||||||
bannerUrl: null,
|
bannerUrl: null,
|
||||||
name: null,
|
name: null,
|
||||||
description: null,
|
description: null,
|
||||||
|
cacheRemoteFiles: false,
|
||||||
|
localDriveCapacityMb: null,
|
||||||
|
remoteDriveCapacityMb: null,
|
||||||
maxNoteTextLength: null,
|
maxNoteTextLength: null,
|
||||||
inviteCode: null,
|
inviteCode: null,
|
||||||
};
|
};
|
||||||
@@ -50,6 +63,9 @@ export default Vue.extend({
|
|||||||
this.bannerUrl = meta.bannerUrl;
|
this.bannerUrl = meta.bannerUrl;
|
||||||
this.name = meta.name;
|
this.name = meta.name;
|
||||||
this.description = meta.description;
|
this.description = meta.description;
|
||||||
|
this.cacheRemoteFiles = meta.cacheRemoteFiles;
|
||||||
|
this.localDriveCapacityMb = meta.driveCapacityPerLocalUserMb;
|
||||||
|
this.remoteDriveCapacityMb = meta.driveCapacityPerRemoteUserMb;
|
||||||
this.maxNoteTextLength = meta.maxNoteTextLength;
|
this.maxNoteTextLength = meta.maxNoteTextLength;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -73,6 +89,9 @@ export default Vue.extend({
|
|||||||
bannerUrl: this.bannerUrl,
|
bannerUrl: this.bannerUrl,
|
||||||
name: this.name,
|
name: this.name,
|
||||||
description: this.description,
|
description: this.description,
|
||||||
|
cacheRemoteFiles: this.cacheRemoteFiles,
|
||||||
|
localDriveCapacityMb: parseInt(this.localDriveCapacityMb, 10),
|
||||||
|
remoteDriveCapacityMb: parseInt(this.remoteDriveCapacityMb, 10),
|
||||||
maxNoteTextLength: parseInt(this.maxNoteTextLength, 10)
|
maxNoteTextLength: parseInt(this.maxNoteTextLength, 10)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.$swal({
|
this.$swal({
|
||||||
|
@@ -216,7 +216,11 @@ export default Vue.extend({
|
|||||||
}
|
}
|
||||||
} else if (this.type == 'emoji') {
|
} else if (this.type == 'emoji') {
|
||||||
if (this.q == null || this.q == '') {
|
if (this.q == null || this.q == '') {
|
||||||
this.emojis = this.emojiDb.filter(x => x.isCustomEmoji && !x.aliasOf);
|
this.emojis = this.emojiDb.filter(x => x.isCustomEmoji && !x.aliasOf).sort((a, b) => {
|
||||||
|
var textA = a.name.toUpperCase();
|
||||||
|
var textB = b.name.toUpperCase();
|
||||||
|
return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -48,6 +48,9 @@ export default Vue.extend({
|
|||||||
&.fit-top
|
&.fit-top
|
||||||
padding-top 0
|
padding-top 0
|
||||||
|
|
||||||
|
&.fit-bottom
|
||||||
|
padding-bottom 0
|
||||||
|
|
||||||
> header
|
> header
|
||||||
margin-bottom 16px
|
margin-bottom 16px
|
||||||
font-weight bold
|
font-weight bold
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="ui-input" :class="[{ focused, filled, inline }, styl]">
|
<div class="ui-input" :class="[{ focused, filled, inline, disabled }, styl]">
|
||||||
<div class="icon" ref="icon"><slot name="icon"></slot></div>
|
<div class="icon" ref="icon"><slot name="icon"></slot></div>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<div class="password-meter" v-if="withPasswordMeter" v-show="passwordStrength != ''" :data-strength="passwordStrength">
|
<div class="password-meter" v-if="withPasswordMeter" v-show="passwordStrength != ''" :data-strength="passwordStrength">
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
<input ref="input"
|
<input ref="input"
|
||||||
:type="type"
|
:type="type"
|
||||||
v-model="v"
|
v-model="v"
|
||||||
|
:disabled="disabled"
|
||||||
:required="required"
|
:required="required"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:pattern="pattern"
|
:pattern="pattern"
|
||||||
@@ -62,6 +63,10 @@ export default Vue.extend({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false
|
required: false
|
||||||
},
|
},
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false
|
||||||
|
},
|
||||||
pattern: {
|
pattern: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false
|
required: false
|
||||||
@@ -353,4 +358,10 @@ root(fill)
|
|||||||
display inline-block
|
display inline-block
|
||||||
margin 0
|
margin 0
|
||||||
|
|
||||||
|
&.disabled
|
||||||
|
opacity 0.7
|
||||||
|
|
||||||
|
&, *
|
||||||
|
cursor not-allowed !important
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@@ -255,7 +255,7 @@ export default Vue.extend({
|
|||||||
p
|
p
|
||||||
margin 0
|
margin 0
|
||||||
|
|
||||||
i, .mk-reaction-icon
|
[data-icon], .mk-reaction-icon
|
||||||
margin-right 4px
|
margin-right 4px
|
||||||
|
|
||||||
.note-preview
|
.note-preview
|
||||||
@@ -272,19 +272,19 @@ export default Vue.extend({
|
|||||||
margin-right 3px
|
margin-right 3px
|
||||||
|
|
||||||
&.renote, &.quote
|
&.renote, &.quote
|
||||||
.text p i
|
.text p [data-icon]
|
||||||
color #77B255
|
color #77B255
|
||||||
|
|
||||||
&.follow
|
&.follow
|
||||||
.text p i
|
.text p [data-icon]
|
||||||
color #53c7ce
|
color #53c7ce
|
||||||
|
|
||||||
&.receiveFollowRequest
|
&.receiveFollowRequest
|
||||||
.text p i
|
.text p [data-icon]
|
||||||
color #888
|
color #888
|
||||||
|
|
||||||
&.reply, &.mention
|
&.reply, &.mention
|
||||||
.text p i
|
.text p [data-icon]
|
||||||
color #555
|
color #555
|
||||||
|
|
||||||
> .date
|
> .date
|
||||||
|
@@ -105,7 +105,7 @@ export default Vue.extend({
|
|||||||
p
|
p
|
||||||
margin 0
|
margin 0
|
||||||
|
|
||||||
i, mk-reaction-icon
|
[data-icon], mk-reaction-icon
|
||||||
margin-right 4px
|
margin-right 4px
|
||||||
|
|
||||||
.note-ref
|
.note-ref
|
||||||
@@ -118,19 +118,19 @@ export default Vue.extend({
|
|||||||
margin-right 3px
|
margin-right 3px
|
||||||
|
|
||||||
&.renote, &.quote
|
&.renote, &.quote
|
||||||
.text p i
|
.text p [data-icon]
|
||||||
color #77B255
|
color #77B255
|
||||||
|
|
||||||
&.follow
|
&.follow
|
||||||
.text p i
|
.text p [data-icon]
|
||||||
color #53c7ce
|
color #53c7ce
|
||||||
|
|
||||||
&.receiveFollowRequest
|
&.receiveFollowRequest
|
||||||
.text p i
|
.text p [data-icon]
|
||||||
color #888
|
color #888
|
||||||
|
|
||||||
&.reply, &.mention
|
&.reply, &.mention
|
||||||
.text p i
|
.text p [data-icon]
|
||||||
color #fff
|
color #fff
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@@ -149,7 +149,7 @@ export default Vue.extend({
|
|||||||
align-items baseline
|
align-items baseline
|
||||||
white-space nowrap
|
white-space nowrap
|
||||||
|
|
||||||
i, .mk-reaction-icon
|
[data-icon], .mk-reaction-icon
|
||||||
margin-right 4px
|
margin-right 4px
|
||||||
|
|
||||||
> .mk-time
|
> .mk-time
|
||||||
@@ -171,15 +171,15 @@ export default Vue.extend({
|
|||||||
margin-right 3px
|
margin-right 3px
|
||||||
|
|
||||||
&.renote
|
&.renote
|
||||||
> div > header i
|
> div > header [data-icon]
|
||||||
color #77B255
|
color #77B255
|
||||||
|
|
||||||
&.follow
|
&.follow
|
||||||
> div > header i
|
> div > header [data-icon]
|
||||||
color #53c7ce
|
color #53c7ce
|
||||||
|
|
||||||
&.receiveFollowRequest
|
&.receiveFollowRequest
|
||||||
> div > header i
|
> div > header [data-icon]
|
||||||
color #888
|
color #888
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@@ -46,8 +46,7 @@ export default function load() {
|
|||||||
mixin.drive_url = `${mixin.scheme}://${mixin.host}/files`;
|
mixin.drive_url = `${mixin.scheme}://${mixin.host}/files`;
|
||||||
mixin.user_agent = `Misskey/${pkg.version} (${config.url})`;
|
mixin.user_agent = `Misskey/${pkg.version} (${config.url})`;
|
||||||
|
|
||||||
if (config.localDriveCapacityMb == null) config.localDriveCapacityMb = 256;
|
if (config.autoAdmin == null) config.autoAdmin = false;
|
||||||
if (config.remoteDriveCapacityMb == null) config.remoteDriveCapacityMb = 8;
|
|
||||||
|
|
||||||
return Object.assign(config, mixin);
|
return Object.assign(config, mixin);
|
||||||
}
|
}
|
||||||
|
@@ -46,10 +46,6 @@ export type Source = {
|
|||||||
secret_key: string;
|
secret_key: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
localDriveCapacityMb: number;
|
|
||||||
remoteDriveCapacityMb: number;
|
|
||||||
preventCacheRemoteFiles: boolean;
|
|
||||||
|
|
||||||
drive?: {
|
drive?: {
|
||||||
storage: string;
|
storage: string;
|
||||||
bucket?: string;
|
bucket?: string;
|
||||||
@@ -58,6 +54,8 @@ export type Source = {
|
|||||||
config?: any;
|
config?: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
autoAdmin?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ゴーストアカウントのID
|
* ゴーストアカウントのID
|
||||||
*/
|
*/
|
||||||
|
20
src/misc/fetch-meta.ts
Normal file
20
src/misc/fetch-meta.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import Meta, { IMeta } from '../models/meta';
|
||||||
|
|
||||||
|
const defaultMeta: any = {
|
||||||
|
name: 'Misskey',
|
||||||
|
cacheRemoteFiles: true,
|
||||||
|
localDriveCapacityMb: 256,
|
||||||
|
remoteDriveCapacityMb: 8,
|
||||||
|
hidedTags: [],
|
||||||
|
stats: {
|
||||||
|
originalNotesCount: 0,
|
||||||
|
originalUsersCount: 0
|
||||||
|
},
|
||||||
|
maxNoteTextLength: 1000
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function(): Promise<IMeta> {
|
||||||
|
const meta = await Meta.findOne({});
|
||||||
|
|
||||||
|
return Object.assign({}, defaultMeta, meta);
|
||||||
|
}
|
@@ -28,6 +28,39 @@ if ((config as any).description) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if ((config as any).localDriveCapacityMb) {
|
||||||
|
Meta.findOne({}).then(m => {
|
||||||
|
if (m != null && m.localDriveCapacityMb == null) {
|
||||||
|
Meta.update({}, {
|
||||||
|
$set: {
|
||||||
|
localDriveCapacityMb: (config as any).localDriveCapacityMb
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ((config as any).remoteDriveCapacityMb) {
|
||||||
|
Meta.findOne({}).then(m => {
|
||||||
|
if (m != null && m.remoteDriveCapacityMb == null) {
|
||||||
|
Meta.update({}, {
|
||||||
|
$set: {
|
||||||
|
remoteDriveCapacityMb: (config as any).remoteDriveCapacityMb
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ((config as any).preventCacheRemoteFiles) {
|
||||||
|
Meta.findOne({}).then(m => {
|
||||||
|
if (m != null && m.cacheRemoteFiles == null) {
|
||||||
|
Meta.update({}, {
|
||||||
|
$set: {
|
||||||
|
cacheRemoteFiles: !(config as any).preventCacheRemoteFiles
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export type IMeta = {
|
export type IMeta = {
|
||||||
name?: string;
|
name?: string;
|
||||||
@@ -44,6 +77,18 @@ export type IMeta = {
|
|||||||
hidedTags?: string[];
|
hidedTags?: string[];
|
||||||
bannerUrl?: string;
|
bannerUrl?: string;
|
||||||
|
|
||||||
|
cacheRemoteFiles?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Drive capacity of a local user (MB)
|
||||||
|
*/
|
||||||
|
localDriveCapacityMb?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Drive capacity of a remote user (MB)
|
||||||
|
*/
|
||||||
|
remoteDriveCapacityMb?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Max allowed note text length in charactors
|
* Max allowed note text length in charactors
|
||||||
*/
|
*/
|
||||||
|
@@ -65,6 +65,29 @@ export const meta = {
|
|||||||
desc: {
|
desc: {
|
||||||
'ja-JP': '投稿の最大文字数'
|
'ja-JP': '投稿の最大文字数'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
localDriveCapacityMb: {
|
||||||
|
validator: $.num.optional.min(0),
|
||||||
|
desc: {
|
||||||
|
'ja-JP': 'ローカルユーザーひとりあたりのドライブ容量 (メガバイト単位)',
|
||||||
|
'en-US': 'Drive capacity of a local user (MB)'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
remoteDriveCapacityMb: {
|
||||||
|
validator: $.num.optional.min(0),
|
||||||
|
desc: {
|
||||||
|
'ja-JP': 'リモートユーザーひとりあたりのドライブ容量 (メガバイト単位)',
|
||||||
|
'en-US': 'Drive capacity of a remote user (MB)'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
cacheRemoteFiles: {
|
||||||
|
validator: $.bool.optional,
|
||||||
|
desc: {
|
||||||
|
'ja-JP': 'リモートのファイルをキャッシュするか否か'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -104,6 +127,18 @@ export default define(meta, (ps) => new Promise(async (res, rej) => {
|
|||||||
set.maxNoteTextLength = ps.maxNoteTextLength;
|
set.maxNoteTextLength = ps.maxNoteTextLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ps.localDriveCapacityMb !== undefined) {
|
||||||
|
set.localDriveCapacityMb = ps.localDriveCapacityMb;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ps.remoteDriveCapacityMb !== undefined) {
|
||||||
|
set.remoteDriveCapacityMb = ps.remoteDriveCapacityMb;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ps.cacheRemoteFiles !== undefined) {
|
||||||
|
set.cacheRemoteFiles = ps.cacheRemoteFiles;
|
||||||
|
}
|
||||||
|
|
||||||
await Meta.update({}, {
|
await Meta.update({}, {
|
||||||
$set: set
|
$set: set
|
||||||
}, { upsert: true });
|
}, { upsert: true });
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
import Note from '../../../../models/note';
|
import Note from '../../../../models/note';
|
||||||
import Meta from '../../../../models/meta';
|
|
||||||
import define from '../../define';
|
import define from '../../define';
|
||||||
|
import fetchMeta from '../../../../misc/fetch-meta';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
requireCredential: false,
|
requireCredential: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default define(meta, (ps) => new Promise(async (res, rej) => {
|
export default define(meta, (ps) => new Promise(async (res, rej) => {
|
||||||
const meta = await Meta.findOne({});
|
const instance = await fetchMeta();
|
||||||
const hidedTags = meta ? (meta.hidedTags || []).map(t => t.toLowerCase()) : [];
|
const hidedTags = instance.hidedTags.map(t => t.toLowerCase());
|
||||||
|
|
||||||
const span = 1000 * 60 * 60 * 24 * 7; // 1週間
|
const span = 1000 * 60 * 60 * 24 * 7; // 1週間
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import DriveFile from '../../../models/drive-file';
|
import DriveFile from '../../../models/drive-file';
|
||||||
import config from '../../../config';
|
|
||||||
import define from '../define';
|
import define from '../define';
|
||||||
|
import fetchMeta from '../../../misc/fetch-meta';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
desc: {
|
desc: {
|
||||||
@@ -14,6 +14,8 @@ export const meta = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default define(meta, (ps, user) => new Promise(async (res, rej) => {
|
export default define(meta, (ps, user) => new Promise(async (res, rej) => {
|
||||||
|
const instance = await fetchMeta();
|
||||||
|
|
||||||
// Calculate drive usage
|
// Calculate drive usage
|
||||||
const usage = await DriveFile
|
const usage = await DriveFile
|
||||||
.aggregate([{
|
.aggregate([{
|
||||||
@@ -39,7 +41,7 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
res({
|
res({
|
||||||
capacity: 1024 * 1024 * config.localDriveCapacityMb,
|
capacity: 1024 * 1024 * instance.localDriveCapacityMb,
|
||||||
usage: usage
|
usage: usage
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import Note from '../../../../models/note';
|
import Note from '../../../../models/note';
|
||||||
import { erase } from '../../../../prelude/array';
|
import { erase } from '../../../../prelude/array';
|
||||||
import Meta from '../../../../models/meta';
|
|
||||||
import define from '../../define';
|
import define from '../../define';
|
||||||
|
import fetchMeta from '../../../../misc/fetch-meta';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
トレンドに載るためには「『直近a分間のユニーク投稿数が今からa分前~今からb分前の間のユニーク投稿数のn倍以上』のハッシュタグの上位5位以内に入る」ことが必要
|
トレンドに載るためには「『直近a分間のユニーク投稿数が今からa分前~今からb分前の間のユニーク投稿数のn倍以上』のハッシュタグの上位5位以内に入る」ことが必要
|
||||||
@@ -20,8 +20,8 @@ export const meta = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default define(meta, () => new Promise(async (res, rej) => {
|
export default define(meta, () => new Promise(async (res, rej) => {
|
||||||
const meta = await Meta.findOne({});
|
const instance = await fetchMeta();
|
||||||
const hidedTags = meta ? (meta.hidedTags || []).map(t => t.toLowerCase()) : [];
|
const hidedTags = instance.hidedTags.map(t => t.toLowerCase());
|
||||||
|
|
||||||
//#region 1. 直近Aの内に投稿されたハッシュタグ(とユーザーのペア)を集計
|
//#region 1. 直近Aの内に投稿されたハッシュタグ(とユーザーのペア)を集計
|
||||||
const data = await Note.aggregate([{
|
const data = await Note.aggregate([{
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import $ from 'cafy';
|
import $ from 'cafy';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import config from '../../../config';
|
import config from '../../../config';
|
||||||
import Meta from '../../../models/meta';
|
|
||||||
import Emoji from '../../../models/emoji';
|
import Emoji from '../../../models/emoji';
|
||||||
import define from '../define';
|
import define from '../define';
|
||||||
|
import fetchMeta from '../../../misc/fetch-meta';
|
||||||
|
|
||||||
const pkg = require('../../../../package.json');
|
const pkg = require('../../../../package.json');
|
||||||
const client = require('../../../../built/client/meta.json');
|
const client = require('../../../../built/client/meta.json');
|
||||||
@@ -27,7 +27,7 @@ export const meta = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default define(meta, (ps, me) => new Promise(async (res, rej) => {
|
export default define(meta, (ps, me) => new Promise(async (res, rej) => {
|
||||||
const met: any = (await Meta.findOne()) || {};
|
const instance = await fetchMeta();
|
||||||
|
|
||||||
const emojis = await Emoji.find({ host: null }, {
|
const emojis = await Emoji.find({ host: null }, {
|
||||||
fields: {
|
fields: {
|
||||||
@@ -41,8 +41,8 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
|
|||||||
version: pkg.version,
|
version: pkg.version,
|
||||||
clientVersion: client.version,
|
clientVersion: client.version,
|
||||||
|
|
||||||
name: met.name || 'Misskey',
|
name: instance.name,
|
||||||
description: met.description,
|
description: instance.description,
|
||||||
|
|
||||||
secure: config.https != null,
|
secure: config.https != null,
|
||||||
machine: os.hostname(),
|
machine: os.hostname(),
|
||||||
@@ -54,21 +54,23 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
|
|||||||
cores: os.cpus().length
|
cores: os.cpus().length
|
||||||
},
|
},
|
||||||
|
|
||||||
broadcasts: met.broadcasts || [],
|
broadcasts: instance.broadcasts || [],
|
||||||
disableRegistration: met.disableRegistration,
|
disableRegistration: instance.disableRegistration,
|
||||||
disableLocalTimeline: met.disableLocalTimeline,
|
disableLocalTimeline: instance.disableLocalTimeline,
|
||||||
driveCapacityPerLocalUserMb: config.localDriveCapacityMb,
|
driveCapacityPerLocalUserMb: instance.localDriveCapacityMb,
|
||||||
|
driveCapacityPerRemoteUserMb: instance.remoteDriveCapacityMb,
|
||||||
|
cacheRemoteFiles: instance.cacheRemoteFiles,
|
||||||
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,
|
||||||
hidedTags: (me && me.isAdmin) ? met.hidedTags : undefined,
|
hidedTags: (me && me.isAdmin) ? instance.hidedTags : undefined,
|
||||||
bannerUrl: met.bannerUrl,
|
bannerUrl: instance.bannerUrl,
|
||||||
maxNoteTextLength: met.maxNoteTextLength || 1000,
|
maxNoteTextLength: instance.maxNoteTextLength,
|
||||||
|
|
||||||
emojis: emojis,
|
emojis: emojis,
|
||||||
|
|
||||||
features: ps.detail ? {
|
features: ps.detail ? {
|
||||||
registration: !met.disableRegistration,
|
registration: !instance.disableRegistration,
|
||||||
localTimeLine: !met.disableLocalTimeline,
|
localTimeLine: !instance.disableLocalTimeline,
|
||||||
elasticsearch: config.elasticsearch ? true : false,
|
elasticsearch: config.elasticsearch ? true : false,
|
||||||
recaptcha: config.recaptcha ? true : false,
|
recaptcha: config.recaptcha ? true : false,
|
||||||
objectStorage: config.drive && config.drive.storage === 'minio',
|
objectStorage: config.drive && config.drive.storage === 'minio',
|
||||||
|
@@ -6,13 +6,13 @@ import User, { IUser } from '../../../../models/user';
|
|||||||
import DriveFile, { IDriveFile } from '../../../../models/drive-file';
|
import DriveFile, { IDriveFile } from '../../../../models/drive-file';
|
||||||
import create from '../../../../services/note/create';
|
import create from '../../../../services/note/create';
|
||||||
import define from '../../define';
|
import define from '../../define';
|
||||||
import Meta from '../../../../models/meta';
|
import fetchMeta from '../../../../misc/fetch-meta';
|
||||||
|
|
||||||
let maxNoteTextLength = 1000;
|
let maxNoteTextLength = 1000;
|
||||||
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
Meta.findOne({}).then(m => {
|
fetchMeta().then(m => {
|
||||||
if (m.maxNoteTextLength) maxNoteTextLength = m.maxNoteTextLength;
|
maxNoteTextLength = m.maxNoteTextLength;
|
||||||
});
|
});
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import Meta from '../../../models/meta';
|
|
||||||
import define from '../define';
|
import define from '../define';
|
||||||
import driveChart from '../../../chart/drive';
|
import driveChart from '../../../chart/drive';
|
||||||
import federationChart from '../../../chart/federation';
|
import federationChart from '../../../chart/federation';
|
||||||
|
import fetchMeta from '../../../misc/fetch-meta';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
requireCredential: false,
|
requireCredential: false,
|
||||||
@@ -15,9 +15,9 @@ export const meta = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default define(meta, () => new Promise(async (res, rej) => {
|
export default define(meta, () => new Promise(async (res, rej) => {
|
||||||
const meta = await Meta.findOne();
|
const instance = await fetchMeta();
|
||||||
|
|
||||||
const stats: any = meta ? meta.stats : {};
|
const stats: any = instance.stats;
|
||||||
|
|
||||||
const driveStats = await driveChart.getChart('hour', 1);
|
const driveStats = await driveChart.getChart('hour', 1);
|
||||||
stats.driveUsageLocal = driveStats.local.totalSize[0];
|
stats.driveUsageLocal = driveStats.local.totalSize[0];
|
||||||
|
@@ -2,10 +2,10 @@ import * as Router from 'koa-router';
|
|||||||
import User from '../../../models/user';
|
import User from '../../../models/user';
|
||||||
import { toASCII } from 'punycode';
|
import { toASCII } from 'punycode';
|
||||||
import config from '../../../config';
|
import config from '../../../config';
|
||||||
import Meta from '../../../models/meta';
|
|
||||||
import { ObjectID } from 'bson';
|
import { ObjectID } from 'bson';
|
||||||
import Emoji from '../../../models/emoji';
|
import Emoji from '../../../models/emoji';
|
||||||
import { toMastodonEmojis } from './emoji';
|
import { toMastodonEmojis } from './emoji';
|
||||||
|
import fetchMeta from '../../../misc/fetch-meta';
|
||||||
const pkg = require('../../../../package.json');
|
const pkg = require('../../../../package.json');
|
||||||
|
|
||||||
// Init router
|
// Init router
|
||||||
@@ -19,11 +19,8 @@ router.get('/v1/custom_emojis', async ctx => ctx.body =
|
|||||||
})).map(x => toMastodonEmojis(x)));
|
})).map(x => toMastodonEmojis(x)));
|
||||||
|
|
||||||
router.get('/v1/instance', async ctx => { // TODO: This is a temporary implementation. Consider creating helper methods!
|
router.get('/v1/instance', async ctx => { // TODO: This is a temporary implementation. Consider creating helper methods!
|
||||||
const meta = await Meta.findOne() || {};
|
const meta = await fetchMeta();
|
||||||
const { originalNotesCount, originalUsersCount } = meta.stats || {
|
const { originalNotesCount, originalUsersCount } = meta.stats;
|
||||||
originalNotesCount: 0,
|
|
||||||
originalUsersCount: 0
|
|
||||||
};
|
|
||||||
const domains = await User.distinct('host', { host: { $ne: null } }) as any as [] || [];
|
const domains = await User.distinct('host', { host: { $ne: null } }) as any as [] || [];
|
||||||
const maintainer = await User.findOne({ isAdmin: true }) || {
|
const maintainer = await User.findOne({ isAdmin: true }) || {
|
||||||
_id: ObjectID.createFromTime(0),
|
_id: ObjectID.createFromTime(0),
|
||||||
|
@@ -8,6 +8,7 @@ import config from '../../../config';
|
|||||||
import Meta from '../../../models/meta';
|
import Meta from '../../../models/meta';
|
||||||
import RegistrationTicket from '../../../models/registration-tickets';
|
import RegistrationTicket from '../../../models/registration-tickets';
|
||||||
import usersChart from '../../../chart/users';
|
import usersChart from '../../../chart/users';
|
||||||
|
import fetchMeta from '../../../misc/fetch-meta';
|
||||||
|
|
||||||
if (config.recaptcha) {
|
if (config.recaptcha) {
|
||||||
recaptcha.init({
|
recaptcha.init({
|
||||||
@@ -33,9 +34,9 @@ export default async (ctx: Koa.Context) => {
|
|||||||
const password = body['password'];
|
const password = body['password'];
|
||||||
const invitationCode = body['invitationCode'];
|
const invitationCode = body['invitationCode'];
|
||||||
|
|
||||||
const meta = await Meta.findOne({});
|
const instance = await fetchMeta();
|
||||||
|
|
||||||
if (meta && meta.disableRegistration) {
|
if (instance && instance.disableRegistration) {
|
||||||
if (invitationCode == null || typeof invitationCode != 'string') {
|
if (invitationCode == null || typeof invitationCode != 'string') {
|
||||||
ctx.status = 400;
|
ctx.status = 400;
|
||||||
return;
|
return;
|
||||||
@@ -67,14 +68,16 @@ export default async (ctx: Koa.Context) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const usersCount = await User.count({});
|
||||||
|
|
||||||
// Fetch exist user that same username
|
// Fetch exist user that same username
|
||||||
const usernameExist = await User
|
const usernameExist = await User
|
||||||
.count({
|
.count({
|
||||||
usernameLower: username.toLowerCase(),
|
usernameLower: username.toLowerCase(),
|
||||||
host: null
|
host: null
|
||||||
}, {
|
}, {
|
||||||
limit: 1
|
limit: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
// Check username already used
|
// Check username already used
|
||||||
if (usernameExist !== 0) {
|
if (usernameExist !== 0) {
|
||||||
@@ -104,17 +107,12 @@ export default async (ctx: Koa.Context) => {
|
|||||||
host: null,
|
host: null,
|
||||||
keypair: generateKeypair(),
|
keypair: generateKeypair(),
|
||||||
token: secret,
|
token: secret,
|
||||||
email: null,
|
|
||||||
password: hash,
|
password: hash,
|
||||||
|
isAdmin: config.autoAdmin && usersCount === 0,
|
||||||
profile: {
|
profile: {
|
||||||
bio: null,
|
bio: null,
|
||||||
birthday: null,
|
birthday: null,
|
||||||
blood: null,
|
location: null
|
||||||
gender: null,
|
|
||||||
handedness: null,
|
|
||||||
height: null,
|
|
||||||
location: null,
|
|
||||||
weight: null
|
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
autoWatch: false
|
autoWatch: false
|
||||||
|
@@ -19,6 +19,7 @@ import config from '../../config';
|
|||||||
import { getDriveFileThumbnailBucket } from '../../models/drive-file-thumbnail';
|
import { getDriveFileThumbnailBucket } from '../../models/drive-file-thumbnail';
|
||||||
import driveChart from '../../chart/drive';
|
import driveChart from '../../chart/drive';
|
||||||
import perUserDriveChart from '../../chart/per-user-drive';
|
import perUserDriveChart from '../../chart/per-user-drive';
|
||||||
|
import fetchMeta from '../../misc/fetch-meta';
|
||||||
|
|
||||||
const log = debug('misskey:drive:add-file');
|
const log = debug('misskey:drive:add-file');
|
||||||
|
|
||||||
@@ -255,7 +256,8 @@ export default async function(
|
|||||||
|
|
||||||
log(`drive usage is ${usage}`);
|
log(`drive usage is ${usage}`);
|
||||||
|
|
||||||
const driveCapacity = 1024 * 1024 * (isLocalUser(user) ? config.localDriveCapacityMb : config.remoteDriveCapacityMb);
|
const instance = await fetchMeta();
|
||||||
|
const driveCapacity = 1024 * 1024 * (isLocalUser(user) ? instance.localDriveCapacityMb : instance.remoteDriveCapacityMb);
|
||||||
|
|
||||||
// If usage limit exceeded
|
// If usage limit exceeded
|
||||||
if (usage + size > driveCapacity) {
|
if (usage + size > driveCapacity) {
|
||||||
|
@@ -10,6 +10,7 @@ import create from './add-file';
|
|||||||
import config from '../../config';
|
import config from '../../config';
|
||||||
import { IUser } from '../../models/user';
|
import { IUser } from '../../models/user';
|
||||||
import * as mongodb from 'mongodb';
|
import * as mongodb from 'mongodb';
|
||||||
|
import fetchMeta from '../../misc/fetch-meta';
|
||||||
|
|
||||||
const log = debug('misskey:drive:upload-from-url');
|
const log = debug('misskey:drive:upload-from-url');
|
||||||
|
|
||||||
@@ -34,28 +35,48 @@ export default async (url: string, user: IUser, folderId: mongodb.ObjectID = nul
|
|||||||
// write content at URL to temp file
|
// write content at URL to temp file
|
||||||
await new Promise((res, rej) => {
|
await new Promise((res, rej) => {
|
||||||
const writable = fs.createWriteStream(path);
|
const writable = fs.createWriteStream(path);
|
||||||
|
|
||||||
|
writable.on('finish', () => {
|
||||||
|
res();
|
||||||
|
});
|
||||||
|
|
||||||
|
writable.on('error', error => {
|
||||||
|
rej(error);
|
||||||
|
});
|
||||||
|
|
||||||
const requestUrl = URL.parse(url).pathname.match(/[^\u0021-\u00ff]/) ? encodeURI(url) : url;
|
const requestUrl = URL.parse(url).pathname.match(/[^\u0021-\u00ff]/) ? encodeURI(url) : url;
|
||||||
request({
|
|
||||||
|
const req = request({
|
||||||
url: requestUrl,
|
url: requestUrl,
|
||||||
proxy: config.proxy,
|
proxy: config.proxy,
|
||||||
|
timeout: 10 * 1000,
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': config.user_agent
|
'User-Agent': config.user_agent
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
.on('error', rej)
|
|
||||||
.on('end', () => {
|
req.pipe(writable);
|
||||||
|
|
||||||
|
req.on('response', response => {
|
||||||
|
if (response.statusCode !== 200) {
|
||||||
writable.close();
|
writable.close();
|
||||||
res();
|
rej(response.statusCode);
|
||||||
})
|
}
|
||||||
.pipe(writable)
|
});
|
||||||
.on('error', rej);
|
|
||||||
|
req.on('error', error => {
|
||||||
|
writable.close();
|
||||||
|
rej(error);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const instance = await fetchMeta();
|
||||||
|
|
||||||
let driveFile: IDriveFile;
|
let driveFile: IDriveFile;
|
||||||
let error;
|
let error;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
driveFile = await create(user, path, name, null, folderId, false, config.preventCacheRemoteFiles, url, uri, sensitive);
|
driveFile = await create(user, path, name, null, folderId, false, !instance.cacheRemoteFiles, url, uri, sensitive);
|
||||||
log(`got: ${driveFile._id}`);
|
log(`got: ${driveFile._id}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e;
|
error = e;
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
import * as mongo from 'mongodb';
|
import * as mongo from 'mongodb';
|
||||||
import redis from './db/redis';
|
import redis from './db/redis';
|
||||||
import Xev from 'xev';
|
import Xev from 'xev';
|
||||||
import Meta, { IMeta } from './models/meta';
|
import { IMeta } from './models/meta';
|
||||||
|
import fetchMeta from './misc/fetch-meta';
|
||||||
|
|
||||||
type ID = string | mongo.ObjectID;
|
type ID = string | mongo.ObjectID;
|
||||||
|
|
||||||
@@ -16,14 +17,14 @@ class Publisher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setInterval(async () => {
|
setInterval(async () => {
|
||||||
this.meta = await Meta.findOne({});
|
this.meta = await fetchMeta();
|
||||||
}, 5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getMeta = async () => {
|
public fetchMeta = async () => {
|
||||||
if (this.meta != null) return this.meta;
|
if (this.meta != null) return this.meta;
|
||||||
|
|
||||||
this.meta = await Meta.findOne({});
|
this.meta = await fetchMeta();
|
||||||
return this.meta;
|
return this.meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,13 +83,13 @@ class Publisher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public publishLocalTimelineStream = async (note: any): Promise<void> => {
|
public publishLocalTimelineStream = async (note: any): Promise<void> => {
|
||||||
const meta = await this.getMeta();
|
const meta = await this.fetchMeta();
|
||||||
if (meta.disableLocalTimeline) return;
|
if (meta.disableLocalTimeline) return;
|
||||||
this.publish('localTimeline', null, note);
|
this.publish('localTimeline', null, note);
|
||||||
}
|
}
|
||||||
|
|
||||||
public publishHybridTimelineStream = async (userId: ID, note: any): Promise<void> => {
|
public publishHybridTimelineStream = async (userId: ID, note: any): Promise<void> => {
|
||||||
const meta = await this.getMeta();
|
const meta = await this.fetchMeta();
|
||||||
if (meta.disableLocalTimeline) return;
|
if (meta.disableLocalTimeline) return;
|
||||||
this.publish(userId ? `hybridTimeline:${userId}` : 'hybridTimeline', null, note);
|
this.publish(userId ? `hybridTimeline:${userId}` : 'hybridTimeline', null, note);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user