Improve doc

This commit is contained in:
syuilo 2019-02-25 03:21:54 +09:00
parent b67f3438e9
commit 31802c9749
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
10 changed files with 85 additions and 16 deletions

View file

@ -35,7 +35,7 @@ export default Vue.extend({
created() { created() {
this.$root.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.announcements = meta.broadcasts; this.announcements = meta.announcements;
}); });
}, },
@ -65,7 +65,7 @@ export default Vue.extend({
save(silent) { save(silent) {
this.$root.api('admin/update-meta', { this.$root.api('admin/update-meta', {
broadcasts: this.announcements announcements: this.announcements
}).then(() => { }).then(() => {
if (!silent) { if (!silent) {
this.$root.dialog({ this.$root.dialog({

View file

@ -16,7 +16,7 @@
</svg> </svg>
</div> </div>
<p class="fetching" v-if="fetching">{{ $t('fetching') }}<mk-ellipsis/></p> <p class="fetching" v-if="fetching">{{ $t('fetching') }}<mk-ellipsis/></p>
<h1 v-if="!fetching">{{ announcements.length == 0 ? this.$t('no-broadcasts') : announcements[i].title }}</h1> <h1 v-if="!fetching">{{ announcements.length == 0 ? $t('no-broadcasts') : announcements[i].title }}</h1>
<p v-if="!fetching"> <p v-if="!fetching">
<span v-if="announcements.length != 0" v-html="announcements[i].text"></span> <span v-if="announcements.length != 0" v-html="announcements[i].text"></span>
<template v-if="announcements.length == 0">{{ $t('have-a-nice-day') }}</template> <template v-if="announcements.length == 0">{{ $t('have-a-nice-day') }}</template>
@ -47,7 +47,7 @@ export default define({
}, },
mounted() { mounted() {
this.$root.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.announcements = meta.broadcasts; this.announcements = meta.announcements;
this.fetching = false; this.fetching = false;
}); });
}, },

View file

@ -174,7 +174,7 @@ export default Vue.extend({
this.meta = meta; this.meta = meta;
this.name = meta.name; this.name = meta.name;
this.description = meta.description; this.description = meta.description;
this.announcements = meta.broadcasts; this.announcements = meta.announcements;
this.banner = meta.bannerUrl; this.banner = meta.bannerUrl;
}); });

View file

@ -82,7 +82,7 @@ export default Vue.extend({
mounted() { mounted() {
this.$root.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.announcements = meta.broadcasts; this.announcements = meta.announcements;
}); });
if (this.$store.getters.isSignedIn) { if (this.$store.getters.isSignedIn) {

View file

@ -98,7 +98,7 @@ export default Vue.extend({
this.meta = meta; this.meta = meta;
this.name = meta.name; this.name = meta.name;
this.description = meta.description; this.description = meta.description;
this.announcements = meta.broadcasts; this.announcements = meta.announcements;
this.banner = meta.bannerUrl; this.banner = meta.bannerUrl;
}); });

View file

@ -151,6 +151,15 @@ if ((config as any).sw) {
} }
}); });
} }
Meta.findOne({}).then(m => {
if (m != null && (m as any).broadcasts != null) {
Meta.update({}, {
$rename: {
broadcasts: 'announcements'
}
});
}
});
export type IMeta = { export type IMeta = {
name?: string; name?: string;
@ -173,7 +182,7 @@ export type IMeta = {
langs?: string[]; langs?: string[];
broadcasts?: any[]; announcements?: any[];
stats?: { stats?: {
notesCount: number; notesCount: number;

View file

@ -13,10 +13,10 @@ export const meta = {
requireModerator: true, requireModerator: true,
params: { params: {
broadcasts: { announcements: {
validator: $.optional.nullable.arr($.obj()), validator: $.optional.nullable.arr($.obj()),
desc: { desc: {
'ja-JP': 'ブロードキャスト' 'ja-JP': 'お知らせ'
} }
}, },
@ -328,8 +328,8 @@ export const meta = {
export default define(meta, async (ps) => { export default define(meta, async (ps) => {
const set = {} as any; const set = {} as any;
if (ps.broadcasts) { if (ps.announcements) {
set.broadcasts = ps.broadcasts; set.announcements = ps.announcements;
} }
if (typeof ps.disableRegistration === 'boolean') { if (typeof ps.disableRegistration === 'boolean') {

View file

@ -12,7 +12,19 @@ export const meta = {
requireCredential: true, requireCredential: true,
kind: 'drive-read' kind: 'drive-read',
res: {
type: 'object',
properties: {
capacity: {
type: 'number'
},
usage: {
type: 'number'
}
}
}
}; };
export default define(meta, async (ps, user) => { export default define(meta, async (ps, user) => {

View file

@ -24,6 +24,54 @@ export const meta = {
default: true default: true
} }
}, },
res: {
type: 'object',
properties: {
version: {
type: 'string',
description: 'The version of Misskey of this instance.',
example: pkg.version
},
name: {
type: 'string',
description: 'The name of this instance.',
},
description: {
type: 'string',
description: 'The description of this instance.',
},
announcements: {
type: 'array',
items: {
type: 'object',
properties: {
title: {
type: 'string',
description: 'The title of the announcement.',
},
text: {
type: 'string',
description: 'The text of the announcement. (can be HTML)',
},
}
},
description: 'The description of this instance.',
},
disableRegistration: {
type: 'boolean',
description: 'Whether disabled open registration.',
},
disableLocalTimeline: {
type: 'boolean',
description: 'Whether disabled LTL and STL.',
},
disableGlobalTimeline: {
type: 'boolean',
description: 'Whether disabled GTL.',
},
}
}
}; };
export default define(meta, async (ps, me) => { export default define(meta, async (ps, me) => {
@ -55,7 +103,7 @@ export default define(meta, async (ps, me) => {
cores: os.cpus().length cores: os.cpus().length
}, },
broadcasts: instance.broadcasts || [], announcements: instance.announcements || [],
disableRegistration: instance.disableRegistration, disableRegistration: instance.disableRegistration,
disableLocalTimeline: instance.disableLocalTimeline, disableLocalTimeline: instance.disableLocalTimeline,
disableGlobalTimeline: instance.disableGlobalTimeline, disableGlobalTimeline: instance.disableGlobalTimeline,

View file

@ -20,7 +20,7 @@ export const links = [/* (awaiting release) {
const nodeinfo2 = async () => { const nodeinfo2 = async () => {
const [ const [
{ name, description, maintainer, langs, broadcasts, disableRegistration, disableLocalTimeline, disableGlobalTimeline, enableRecaptcha, maxNoteTextLength, enableTwitterIntegration, enableGithubIntegration, enableDiscordIntegration, enableEmail, enableServiceWorker }, { name, description, maintainer, langs, announcements, disableRegistration, disableLocalTimeline, disableGlobalTimeline, enableRecaptcha, maxNoteTextLength, enableTwitterIntegration, enableGithubIntegration, enableDiscordIntegration, enableEmail, enableServiceWorker },
// total, // total,
// activeHalfyear, // activeHalfyear,
// activeMonth, // activeMonth,
@ -52,7 +52,7 @@ const nodeinfo2 = async () => {
// localPosts, // localPosts,
// localComments // localComments
}, },
metadata: { name, description, maintainer, langs, broadcasts, disableRegistration, disableLocalTimeline, disableGlobalTimeline, enableRecaptcha, maxNoteTextLength, enableTwitterIntegration, enableGithubIntegration, enableDiscordIntegration, enableEmail, enableServiceWorker } metadata: { name, description, maintainer, langs, announcements, disableRegistration, disableLocalTimeline, disableGlobalTimeline, enableRecaptcha, maxNoteTextLength, enableTwitterIntegration, enableGithubIntegration, enableDiscordIntegration, enableEmail, enableServiceWorker }
}; };
}; };