mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-07-30 03:45:50 +00:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 87f248b8ec | |||
| 027140eccc | |||
| 92cf205c66 | |||
| fa3299840f | |||
| 2d4b183c14 | |||
| 03b20e11ca | |||
| e0e006e284 | |||
| a294a881ec | |||
| 53926082e7 | |||
| 5b5de6a89c | |||
| a11c991f83 | |||
| a0adcf0d1a | |||
| 93b2b82993 | |||
| 4dee7d91b1 | |||
| 839be6477d | |||
| 59e2ed8ab0 | |||
| 83790004dd | |||
| e59f13e8ff | |||
| 31ed8949b9 | |||
| f1174a15e0 | |||
| 912ffae600 | |||
| 71a5662195 | |||
| 774834a31f |
+23
-14
@@ -939,20 +939,29 @@ desktop/views/pages/admin/admin.unverify-user.vue:
|
|||||||
unverify: "公式アカウントを解除する"
|
unverify: "公式アカウントを解除する"
|
||||||
unverified: "公式アカウントを解除しました"
|
unverified: "公式アカウントを解除しました"
|
||||||
|
|
||||||
desktop/views/pages/admin/admin.notes-chart.vue:
|
desktop/views/pages/admin/admin.chart.vue:
|
||||||
title: "投稿"
|
title: "チャート"
|
||||||
local: "ローカル"
|
per-day: "1時間ごと"
|
||||||
remote: "リモート"
|
per-hour: "1日ごと"
|
||||||
|
notes: "投稿"
|
||||||
desktop/views/pages/admin/admin.users-chart.vue:
|
users: "ユーザー"
|
||||||
title: "ユーザー"
|
drive: "ドライブ"
|
||||||
local: "ローカル"
|
local-notes: "ローカルの投稿"
|
||||||
remote: "リモート"
|
remote-notes: "リモートの投稿"
|
||||||
|
local-notes-total: "ローカルの投稿 (累計)"
|
||||||
desktop/views/pages/admin/admin.drive-chart.vue:
|
remote-notes-total: "リモートの投稿 (累計)"
|
||||||
title: "ドライブ"
|
local-users: "ローカルのユーザー"
|
||||||
local: "ローカル"
|
remote-users: "リモートのユーザー"
|
||||||
remote: "リモート"
|
local-users-total: "ローカルのユーザー (累計)"
|
||||||
|
remote-users-total: "リモートのユーザー (累計)"
|
||||||
|
local-drive: "ローカルのドライブ使用量"
|
||||||
|
remote-drive: "リモートのドライブ使用量"
|
||||||
|
local-drive-total: "ローカルのドライブ使用量 (累計)"
|
||||||
|
remote-drive-total: "リモートのドライブ使用量 (累計)"
|
||||||
|
local-drive-files: "ローカルのドライブのファイル数"
|
||||||
|
remote-drive-files: "リモートのドライブのファイル数"
|
||||||
|
local-drive-files-total: "ローカルのドライブのファイル数 (累計)"
|
||||||
|
remote-drive-files-total: "リモートのドライブのファイル数 (累計)"
|
||||||
|
|
||||||
desktop/views/pages/deck/deck.tl-column.vue:
|
desktop/views/pages/deck/deck.tl-column.vue:
|
||||||
is-media-only: "メディア投稿のみ"
|
is-media-only: "メディア投稿のみ"
|
||||||
|
|||||||
+5
-2
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"author": "syuilo <i@syuilo.com>",
|
"author": "syuilo <i@syuilo.com>",
|
||||||
"version": "8.1.0",
|
"version": "8.3.1",
|
||||||
"clientVersion": "1.0.8811",
|
"clientVersion": "1.0.8828",
|
||||||
"codename": "nighthike",
|
"codename": "nighthike",
|
||||||
"main": "./built/index.js",
|
"main": "./built/index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
@@ -89,6 +89,7 @@
|
|||||||
"bootstrap-vue": "2.0.0-rc.11",
|
"bootstrap-vue": "2.0.0-rc.11",
|
||||||
"cafy": "11.3.0",
|
"cafy": "11.3.0",
|
||||||
"chalk": "2.4.1",
|
"chalk": "2.4.1",
|
||||||
|
"chart.js": "2.7.2",
|
||||||
"commander": "2.17.1",
|
"commander": "2.17.1",
|
||||||
"crc-32": "1.2.0",
|
"crc-32": "1.2.0",
|
||||||
"css-loader": "1.0.0",
|
"css-loader": "1.0.0",
|
||||||
@@ -149,6 +150,7 @@
|
|||||||
"loader-utils": "1.1.0",
|
"loader-utils": "1.1.0",
|
||||||
"lodash.assign": "4.2.0",
|
"lodash.assign": "4.2.0",
|
||||||
"mecab-async": "0.1.2",
|
"mecab-async": "0.1.2",
|
||||||
|
"merge-options": "1.0.1",
|
||||||
"minio": "7.0.0",
|
"minio": "7.0.0",
|
||||||
"mkdirp": "0.5.1",
|
"mkdirp": "0.5.1",
|
||||||
"mocha": "5.2.0",
|
"mocha": "5.2.0",
|
||||||
@@ -206,6 +208,7 @@
|
|||||||
"uuid": "3.3.2",
|
"uuid": "3.3.2",
|
||||||
"v-animate-css": "0.0.2",
|
"v-animate-css": "0.0.2",
|
||||||
"vue": "2.5.17",
|
"vue": "2.5.17",
|
||||||
|
"vue-chartjs": "3.4.0",
|
||||||
"vue-cropperjs": "2.2.1",
|
"vue-cropperjs": "2.2.1",
|
||||||
"vue-js-modal": "1.3.18",
|
"vue-js-modal": "1.3.18",
|
||||||
"vue-json-tree-view": "2.1.4",
|
"vue-json-tree-view": "2.1.4",
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import Vue from 'vue';
|
||||||
|
import { Line } from 'vue-chartjs';
|
||||||
|
import * as mergeOptions from 'merge-options';
|
||||||
|
|
||||||
|
export default Vue.extend({
|
||||||
|
extends: Line,
|
||||||
|
props: {
|
||||||
|
data: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
opts: {
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
data() {
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.render();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
render() {
|
||||||
|
this.renderChart(this.data, mergeOptions({
|
||||||
|
responsive: false,
|
||||||
|
scales: {
|
||||||
|
xAxes: [{
|
||||||
|
type: 'time',
|
||||||
|
distribution: 'series'
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}, this.opts || {}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -0,0 +1,241 @@
|
|||||||
|
<template>
|
||||||
|
<div class="card gkgckalzgidaygcxnugepioremxvxvpt">
|
||||||
|
<header>
|
||||||
|
<b>%i18n:@title%:</b>
|
||||||
|
<select v-model="chartType">
|
||||||
|
<optgroup label="%i18n:@users%">
|
||||||
|
<option value="local-users">%i18n:@local-users%</option>
|
||||||
|
<option value="remote-users">%i18n:@remote-users%</option>
|
||||||
|
<option value="local-users-total">%i18n:@local-users-total%</option>
|
||||||
|
<option value="remote-users-total">%i18n:@remote-users-total%</option>
|
||||||
|
</optgroup>
|
||||||
|
<optgroup label="%i18n:@notes%">
|
||||||
|
<option value="local-notes">%i18n:@local-notes%</option>
|
||||||
|
<option value="remote-notes">%i18n:@remote-notes%</option>
|
||||||
|
<option value="local-notes-total">%i18n:@local-notes-total%</option>
|
||||||
|
<option value="remote-notes-total">%i18n:@remote-notes-total%</option>
|
||||||
|
</optgroup>
|
||||||
|
<optgroup label="%i18n:@drive%">
|
||||||
|
<option value="local-drive-files">%i18n:@local-drive-files%</option>
|
||||||
|
<option value="remote-drive-files">%i18n:@remote-drive-files%</option>
|
||||||
|
<option value="local-drive-files-total">%i18n:@local-drive-files-total%</option>
|
||||||
|
<option value="remote-drive-files-total">%i18n:@remote-drive-files-total%</option>
|
||||||
|
<option value="local-drive">%i18n:@local-drive%</option>
|
||||||
|
<option value="remote-drive">%i18n:@remote-drive%</option>
|
||||||
|
<option value="local-drive-total">%i18n:@local-drive-total%</option>
|
||||||
|
<option value="remote-drive-total">%i18n:@remote-drive-total%</option>
|
||||||
|
</optgroup>
|
||||||
|
</select>
|
||||||
|
<div>
|
||||||
|
<a @click="span = 'day'">%i18n:@per-day%</a> | <a @click="span = 'hour'">%i18n:@per-hour%</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<x-chart v-if="chart" :data="data[0]" :opts="data[1]" :width="720" :height="300"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import Vue from 'vue';
|
||||||
|
import XChart from './admin.chart.chart.ts';
|
||||||
|
|
||||||
|
export default Vue.extend({
|
||||||
|
components: {
|
||||||
|
XChart
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
chart: {
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
chartType: 'local-notes',
|
||||||
|
span: 'hour'
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
data(): any {
|
||||||
|
if (this.chart == null) return null;
|
||||||
|
switch (this.chartType) {
|
||||||
|
case 'local-users': return this.usersChart(true, false);
|
||||||
|
case 'remote-users': return this.usersChart(false, false);
|
||||||
|
case 'local-users-total': return this.usersChart(true, true);
|
||||||
|
case 'remote-users-total': return this.usersChart(false, true);
|
||||||
|
case 'local-notes': return this.notesChart(true);
|
||||||
|
case 'remote-notes': return this.notesChart(false);
|
||||||
|
case 'local-notes-total': return this.notesTotalChart(true);
|
||||||
|
case 'remote-notes-total': return this.notesTotalChart(false);
|
||||||
|
case 'local-drive': return this.driveChart(true, false);
|
||||||
|
case 'remote-drive': return this.driveChart(false, false);
|
||||||
|
case 'local-drive-total': return this.driveChart(true, true);
|
||||||
|
case 'remote-drive-total': return this.driveChart(false, true);
|
||||||
|
case 'local-drive-files': return this.driveFilesChart(true, false);
|
||||||
|
case 'remote-drive-files': return this.driveFilesChart(false, false);
|
||||||
|
case 'local-drive-files-total': return this.driveFilesChart(true, true);
|
||||||
|
case 'remote-drive-files-total': return this.driveFilesChart(false, true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
stats(): any[] {
|
||||||
|
return (
|
||||||
|
this.span == 'day' ? this.chart.perDay :
|
||||||
|
this.span == 'hour' ? this.chart.perHour :
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
notesChart(local: boolean): any {
|
||||||
|
const data = this.stats.slice().reverse().map(x => ({
|
||||||
|
date: new Date(x.date),
|
||||||
|
normal: local ? x.notes.local.diffs.normal : x.notes.remote.diffs.normal,
|
||||||
|
reply: local ? x.notes.local.diffs.reply : x.notes.remote.diffs.reply,
|
||||||
|
renote: local ? x.notes.local.diffs.renote : x.notes.remote.diffs.renote,
|
||||||
|
all: local ? x.notes.local.diff : x.notes.remote.diff
|
||||||
|
}));
|
||||||
|
|
||||||
|
return [{
|
||||||
|
datasets: [{
|
||||||
|
label: 'All',
|
||||||
|
fill: false,
|
||||||
|
borderColor: '#555',
|
||||||
|
borderWidth: 2,
|
||||||
|
pointBackgroundColor: '#fff',
|
||||||
|
lineTension: 0,
|
||||||
|
data: data.map(x => ({ t: x.date, y: x.all }))
|
||||||
|
}, {
|
||||||
|
label: 'Normal',
|
||||||
|
fill: false,
|
||||||
|
borderColor: '#41ddde',
|
||||||
|
borderWidth: 2,
|
||||||
|
pointBackgroundColor: '#fff',
|
||||||
|
lineTension: 0,
|
||||||
|
data: data.map(x => ({ t: x.date, y: x.normal }))
|
||||||
|
}, {
|
||||||
|
label: 'Replies',
|
||||||
|
fill: false,
|
||||||
|
borderColor: '#f7796c',
|
||||||
|
borderWidth: 2,
|
||||||
|
pointBackgroundColor: '#fff',
|
||||||
|
lineTension: 0,
|
||||||
|
data: data.map(x => ({ t: x.date, y: x.reply }))
|
||||||
|
}, {
|
||||||
|
label: 'Renotes',
|
||||||
|
fill: false,
|
||||||
|
borderColor: '#a1de41',
|
||||||
|
borderWidth: 2,
|
||||||
|
pointBackgroundColor: '#fff',
|
||||||
|
lineTension: 0,
|
||||||
|
data: data.map(x => ({ t: x.date, y: x.renote }))
|
||||||
|
}]
|
||||||
|
}];
|
||||||
|
},
|
||||||
|
|
||||||
|
notesTotalChart(local: boolean): any {
|
||||||
|
const data = this.stats.slice().reverse().map(x => ({
|
||||||
|
date: new Date(x.date),
|
||||||
|
count: local ? x.notes.local.total : x.notes.remote.total,
|
||||||
|
}));
|
||||||
|
|
||||||
|
return [{
|
||||||
|
datasets: [{
|
||||||
|
label: local ? 'Local Notes' : 'Remote Notes',
|
||||||
|
fill: false,
|
||||||
|
borderColor: '#f6584f',
|
||||||
|
borderWidth: 2,
|
||||||
|
pointBackgroundColor: '#fff',
|
||||||
|
lineTension: 0,
|
||||||
|
data: data.map(x => ({ t: x.date, y: x.count }))
|
||||||
|
}]
|
||||||
|
}];
|
||||||
|
},
|
||||||
|
|
||||||
|
usersChart(local: boolean, total: boolean): any {
|
||||||
|
const data = this.stats.slice().reverse().map(x => ({
|
||||||
|
date: new Date(x.date),
|
||||||
|
count: local ?
|
||||||
|
total ? x.users.local.total : x.users.local.diff :
|
||||||
|
total ? x.users.remote.total : x.users.remote.diff
|
||||||
|
}));
|
||||||
|
|
||||||
|
return [{
|
||||||
|
datasets: [{
|
||||||
|
label: local ? 'Local Users' : 'Remote Users',
|
||||||
|
fill: false,
|
||||||
|
borderColor: '#f6584f',
|
||||||
|
borderWidth: 2,
|
||||||
|
pointBackgroundColor: '#fff',
|
||||||
|
lineTension: 0,
|
||||||
|
data: data.map(x => ({ t: x.date, y: x.count }))
|
||||||
|
}]
|
||||||
|
}];
|
||||||
|
},
|
||||||
|
|
||||||
|
driveChart(local: boolean, total: boolean): any {
|
||||||
|
const data = this.stats.slice().reverse().map(x => ({
|
||||||
|
date: new Date(x.date),
|
||||||
|
size: local ?
|
||||||
|
total ? x.drive.local.totalSize : x.drive.local.diffSize :
|
||||||
|
total ? x.drive.remote.totalSize : x.drive.remote.diffSize
|
||||||
|
}));
|
||||||
|
|
||||||
|
return [{
|
||||||
|
datasets: [{
|
||||||
|
label: local ? 'Local Drive Usage' : 'Remote Drive Usage',
|
||||||
|
fill: false,
|
||||||
|
borderColor: '#f6584f',
|
||||||
|
borderWidth: 2,
|
||||||
|
pointBackgroundColor: '#fff',
|
||||||
|
lineTension: 0,
|
||||||
|
data: data.map(x => ({ t: x.date, y: x.size }))
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
scales: {
|
||||||
|
yAxes: [{
|
||||||
|
ticks: {
|
||||||
|
callback: (value) => {
|
||||||
|
return Vue.filter('bytes')(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
},
|
||||||
|
|
||||||
|
driveFilesChart(local: boolean, total: boolean): any {
|
||||||
|
const data = this.stats.slice().reverse().map(x => ({
|
||||||
|
date: new Date(x.date),
|
||||||
|
count: local ?
|
||||||
|
total ? x.drive.local.totalCount : x.drive.local.diffCount :
|
||||||
|
total ? x.drive.remote.totalCount : x.drive.remote.diffCount
|
||||||
|
}));
|
||||||
|
|
||||||
|
return [{
|
||||||
|
datasets: [{
|
||||||
|
label: local ? 'Local Drive Files' : 'Remote Drive Files',
|
||||||
|
fill: false,
|
||||||
|
borderColor: '#f6584f',
|
||||||
|
borderWidth: 2,
|
||||||
|
pointBackgroundColor: '#fff',
|
||||||
|
lineTension: 0,
|
||||||
|
data: data.map(x => ({ t: x.date, y: x.count }))
|
||||||
|
}]
|
||||||
|
}];
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="stylus" scoped>
|
||||||
|
@import '~const.styl'
|
||||||
|
|
||||||
|
.gkgckalzgidaygcxnugepioremxvxvpt
|
||||||
|
> header
|
||||||
|
display flex
|
||||||
|
|
||||||
|
> b
|
||||||
|
margin-right 8px
|
||||||
|
|
||||||
|
> *:last-child
|
||||||
|
margin-left auto
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<a @click="span = 'day'">Per day</a> | <a @click="span = 'hour'">Per hour</a>
|
|
||||||
<svg :viewBox="`0 0 ${ viewBoxX } ${ viewBoxY }`">
|
|
||||||
<polyline
|
|
||||||
:points="points"
|
|
||||||
fill="none"
|
|
||||||
stroke-width="0.3"
|
|
||||||
stroke="#555"/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import Vue from 'vue';
|
|
||||||
|
|
||||||
export default Vue.extend({
|
|
||||||
props: {
|
|
||||||
chart: {
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
viewBoxX: 100,
|
|
||||||
viewBoxY: 30,
|
|
||||||
points: null,
|
|
||||||
span: 'day'
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
stats(): any[] {
|
|
||||||
return (
|
|
||||||
this.span == 'day' ? this.chart.perDay :
|
|
||||||
this.span == 'hour' ? this.chart.perHour :
|
|
||||||
null
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
stats() {
|
|
||||||
this.render();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.render();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
render() {
|
|
||||||
const peak = Math.max.apply(null, this.stats.map(d => this.type == 'local' ? d.drive.local.totalSize : d.drive.remote.totalSize));
|
|
||||||
|
|
||||||
if (peak != 0) {
|
|
||||||
const data = this.stats.slice().reverse().map(x => ({
|
|
||||||
size: this.type == 'local' ? x.drive.local.totalSize : x.drive.remote.totalSize
|
|
||||||
}));
|
|
||||||
|
|
||||||
this.points = data.map((d, i) => `${(this.viewBoxX / data.length) * i},${(1 - (d.size / peak)) * this.viewBoxY}`).join(' ');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="stylus" scoped>
|
|
||||||
svg
|
|
||||||
display block
|
|
||||||
padding 10px
|
|
||||||
width 100%
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="card">
|
|
||||||
<header>%i18n:@title%</header>
|
|
||||||
<div class="card">
|
|
||||||
<header>%i18n:@local%</header>
|
|
||||||
<x-chart v-if="chart" :chart="chart" type="local"/>
|
|
||||||
</div>
|
|
||||||
<div class="card">
|
|
||||||
<header>%i18n:@remote%</header>
|
|
||||||
<x-chart v-if="chart" :chart="chart" type="remote"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import Vue from "vue";
|
|
||||||
import XChart from "./admin.drive-chart.chart.vue";
|
|
||||||
|
|
||||||
export default Vue.extend({
|
|
||||||
components: {
|
|
||||||
XChart
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
chart: {
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="stylus" scoped>
|
|
||||||
@import '~const.styl'
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<a @click="span = 'day'">Per day</a> | <a @click="span = 'hour'">Per hour</a>
|
|
||||||
<svg :viewBox="`0 0 ${ viewBoxX } ${ viewBoxY }`">
|
|
||||||
<polyline
|
|
||||||
:points="pointsNote"
|
|
||||||
fill="none"
|
|
||||||
stroke-width="0.3"
|
|
||||||
stroke="#41ddde"/>
|
|
||||||
<polyline
|
|
||||||
:points="pointsReply"
|
|
||||||
fill="none"
|
|
||||||
stroke-width="0.3"
|
|
||||||
stroke="#f7796c"/>
|
|
||||||
<polyline
|
|
||||||
:points="pointsRenote"
|
|
||||||
fill="none"
|
|
||||||
stroke-width="0.3"
|
|
||||||
stroke="#a1de41"/>
|
|
||||||
<polyline
|
|
||||||
:points="pointsTotal"
|
|
||||||
fill="none"
|
|
||||||
stroke-width="0.3"
|
|
||||||
stroke="#555"
|
|
||||||
stroke-dasharray="1 1"/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import Vue from 'vue';
|
|
||||||
|
|
||||||
export default Vue.extend({
|
|
||||||
props: {
|
|
||||||
chart: {
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
viewBoxX: 100,
|
|
||||||
viewBoxY: 30,
|
|
||||||
pointsNote: null,
|
|
||||||
pointsReply: null,
|
|
||||||
pointsRenote: null,
|
|
||||||
pointsTotal: null,
|
|
||||||
span: 'day'
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
stats(): any[] {
|
|
||||||
return (
|
|
||||||
this.span == 'day' ? this.chart.perDay :
|
|
||||||
this.span == 'hour' ? this.chart.perHour :
|
|
||||||
null
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
stats() {
|
|
||||||
this.render();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.render();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
render() {
|
|
||||||
const peak = Math.max.apply(null, this.stats.map(d => this.type == 'local' ? d.notes.local.diff : d.notes.remote.diff));
|
|
||||||
|
|
||||||
if (peak != 0) {
|
|
||||||
const data = this.stats.slice().reverse().map(x => ({
|
|
||||||
normal: this.type == 'local' ? x.notes.local.diffs.normal : x.notes.remote.diffs.normal,
|
|
||||||
reply: this.type == 'local' ? x.notes.local.diffs.reply : x.notes.remote.diffs.reply,
|
|
||||||
renote: this.type == 'local' ? x.notes.local.diffs.renote : x.notes.remote.diffs.renote,
|
|
||||||
total: this.type == 'local' ? x.notes.local.diff : x.notes.remote.diff
|
|
||||||
}));
|
|
||||||
|
|
||||||
this.pointsNote = data.map((d, i) => `${(this.viewBoxX / data.length) * i},${(1 - (d.normal / peak)) * this.viewBoxY}`).join(' ');
|
|
||||||
this.pointsReply = data.map((d, i) => `${(this.viewBoxX / data.length) * i},${(1 - (d.reply / peak)) * this.viewBoxY}`).join(' ');
|
|
||||||
this.pointsRenote = data.map((d, i) => `${(this.viewBoxX / data.length) * i},${(1 - (d.renote / peak)) * this.viewBoxY}`).join(' ');
|
|
||||||
this.pointsTotal = data.map((d, i) => `${(this.viewBoxX / data.length) * i},${(1 - (d.total / peak)) * this.viewBoxY}`).join(' ');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="stylus" scoped>
|
|
||||||
svg
|
|
||||||
display block
|
|
||||||
padding 10px
|
|
||||||
width 100%
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="card">
|
|
||||||
<header>%i18n:@title%</header>
|
|
||||||
<div class="card">
|
|
||||||
<header>%i18n:@local%</header>
|
|
||||||
<x-chart v-if="chart" :chart="chart" type="local"/>
|
|
||||||
</div>
|
|
||||||
<div class="card">
|
|
||||||
<header>%i18n:@remote%</header>
|
|
||||||
<x-chart v-if="chart" :chart="chart" type="remote"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import Vue from "vue";
|
|
||||||
import XChart from "./admin.notes-chart.chart.vue";
|
|
||||||
|
|
||||||
export default Vue.extend({
|
|
||||||
components: {
|
|
||||||
XChart
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
chart: {
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="stylus" scoped>
|
|
||||||
@import '~const.styl'
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<a @click="span = 'day'">Per day</a> | <a @click="span = 'hour'">Per hour</a>
|
|
||||||
<svg :viewBox="`0 0 ${ viewBoxX } ${ viewBoxY }`">
|
|
||||||
<polyline
|
|
||||||
:points="points"
|
|
||||||
fill="none"
|
|
||||||
stroke-width="0.3"
|
|
||||||
stroke="#555"/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import Vue from 'vue';
|
|
||||||
|
|
||||||
export default Vue.extend({
|
|
||||||
props: {
|
|
||||||
chart: {
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
viewBoxX: 100,
|
|
||||||
viewBoxY: 30,
|
|
||||||
points: null,
|
|
||||||
span: 'day'
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
stats(): any[] {
|
|
||||||
return (
|
|
||||||
this.span == 'day' ? this.chart.perDay :
|
|
||||||
this.span == 'hour' ? this.chart.perHour :
|
|
||||||
null
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
stats() {
|
|
||||||
this.render();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.render();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
render() {
|
|
||||||
const peak = Math.max.apply(null, this.stats.map(d => this.type == 'local' ? d.users.local.diff : d.users.remote.diff));
|
|
||||||
|
|
||||||
if (peak != 0) {
|
|
||||||
const data = this.stats.slice().reverse().map(x => ({
|
|
||||||
count: this.type == 'local' ? x.users.local.diff : x.users.remote.diff
|
|
||||||
}));
|
|
||||||
|
|
||||||
this.points = data.map((d, i) => `${(this.viewBoxX / data.length) * i},${(1 - (d.count / peak)) * this.viewBoxY}`).join(' ');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="stylus" scoped>
|
|
||||||
svg
|
|
||||||
display block
|
|
||||||
padding 10px
|
|
||||||
width 100%
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="card">
|
|
||||||
<header>%i18n:@title%</header>
|
|
||||||
<div class="card">
|
|
||||||
<header>%i18n:@local%</header>
|
|
||||||
<x-chart v-if="chart" :chart="chart" type="local"/>
|
|
||||||
</div>
|
|
||||||
<div class="card">
|
|
||||||
<header>%i18n:@remote%</header>
|
|
||||||
<x-chart v-if="chart" :chart="chart" type="remote"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import Vue from "vue";
|
|
||||||
import XChart from "./admin.users-chart.chart.vue";
|
|
||||||
|
|
||||||
export default Vue.extend({
|
|
||||||
components: {
|
|
||||||
XChart
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
chart: {
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="stylus" scoped>
|
|
||||||
@import '~const.styl'
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -11,9 +11,7 @@
|
|||||||
<main>
|
<main>
|
||||||
<div v-show="page == 'dashboard'">
|
<div v-show="page == 'dashboard'">
|
||||||
<x-dashboard/>
|
<x-dashboard/>
|
||||||
<x-users-chart :chart="chart"/>
|
<x-chart :chart="chart"/>
|
||||||
<x-notes-chart :chart="chart"/>
|
|
||||||
<x-drive-chart :chart="chart"/>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-if="page == 'users'">
|
<div v-if="page == 'users'">
|
||||||
<x-suspend-user/>
|
<x-suspend-user/>
|
||||||
@@ -34,9 +32,7 @@ import XSuspendUser from "./admin.suspend-user.vue";
|
|||||||
import XUnsuspendUser from "./admin.unsuspend-user.vue";
|
import XUnsuspendUser from "./admin.unsuspend-user.vue";
|
||||||
import XVerifyUser from "./admin.verify-user.vue";
|
import XVerifyUser from "./admin.verify-user.vue";
|
||||||
import XUnverifyUser from "./admin.unverify-user.vue";
|
import XUnverifyUser from "./admin.unverify-user.vue";
|
||||||
import XUsersChart from "./admin.users-chart.vue";
|
import XChart from "./admin.chart.vue";
|
||||||
import XNotesChart from "./admin.notes-chart.vue";
|
|
||||||
import XDriveChart from "./admin.drive-chart.vue";
|
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
components: {
|
components: {
|
||||||
@@ -45,9 +41,7 @@ export default Vue.extend({
|
|||||||
XUnsuspendUser,
|
XUnsuspendUser,
|
||||||
XVerifyUser,
|
XVerifyUser,
|
||||||
XUnverifyUser,
|
XUnverifyUser,
|
||||||
XUsersChart,
|
XChart
|
||||||
XNotesChart,
|
|
||||||
XDriveChart
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export const meta = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default (params: any) => new Promise(async (res, rej) => {
|
export default (params: any) => new Promise(async (res, rej) => {
|
||||||
const daysRange = 365;
|
const daysRange = 90;
|
||||||
const hoursRange = 24;
|
const hoursRange = 24;
|
||||||
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
@@ -123,7 +123,6 @@ export default (params: any) => new Promise(async (res, rej) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
chart.forEach(x => {
|
chart.forEach(x => {
|
||||||
delete x.date;
|
|
||||||
delete (x as any).span;
|
delete (x as any).span;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,11 @@ router.post('/signin', require('./private/signin').default);
|
|||||||
router.use(require('./service/github').routes());
|
router.use(require('./service/github').routes());
|
||||||
router.use(require('./service/twitter').routes());
|
router.use(require('./service/twitter').routes());
|
||||||
|
|
||||||
|
// Return 404 for unknown API
|
||||||
|
router.all('*', async ctx => {
|
||||||
|
ctx.status = 404;
|
||||||
|
});
|
||||||
|
|
||||||
// Register router
|
// Register router
|
||||||
app.use(router.routes());
|
app.use(router.routes());
|
||||||
|
|
||||||
|
|||||||
@@ -122,8 +122,7 @@ router.get('/notes/:note', async ctx => {
|
|||||||
router.get('*', async ctx => {
|
router.get('*', async ctx => {
|
||||||
await send(ctx, `app/base.html`, {
|
await send(ctx, `app/base.html`, {
|
||||||
root: client,
|
root: client,
|
||||||
maxage: ms('3 days'),
|
maxage: ms('5m')
|
||||||
immutable: true
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user