This commit is contained in:
syuilo 2018-11-04 23:00:43 +09:00
parent af4f1a7bd6
commit 1855ab60f1
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
9 changed files with 82 additions and 17 deletions

View File

@ -1,6 +1,3 @@
name: example-instance-name # Name of your instance
description: example-description # Description of your instance
maintainer:
name: example-maitainer-name # Your name
url: http://example.com/ # Your contact (http or mailto)

View File

@ -1071,10 +1071,16 @@ admin/views/dashboard.vue:
instances: "インスタンス"
this-instance: "このインスタンス"
federated: "連合"
admin/views/instance.vue:
instance: "インスタンス"
instance-name: "インスタンス名"
instance-description: "インスタンスの紹介"
banner-url: "バナー画像URL"
disableRegistration: "ユーザー登録の受付を停止する"
disableLocalTimeline: "ローカルタイムラインを無効にする"
invite: "招待"
banner-url: "Banner URL"
disableRegistration: "Disable new user registration"
disableLocalTimeline: "Disable the local timeline"
save: "保存"
admin/views/charts.vue:
title: "チャート"

View File

@ -1,9 +1,11 @@
<template>
<div class="axbwjelsbymowqjyywpirzhdlszoncqs">
<ui-card>
<div slot="title">%i18n:@banner-url%</div>
<div slot="title">%i18n:@instance%</div>
<section class="fit-top">
<ui-input v-model="bannerUrl"/>
<ui-input v-model="name">%i18n:@instance-name%</ui-input>
<ui-textarea v-model="description">%i18n:@instance-description%</ui-textarea>
<ui-input v-model="bannerUrl">%i18n:@banner-url%</ui-input>
<ui-button @click="updateMeta">%i18n:@save%</ui-button>
</section>
</ui-card>
@ -35,9 +37,20 @@ export default Vue.extend({
disableRegistration: false,
disableLocalTimeline: false,
bannerUrl: null,
name: null,
description: null,
inviteCode: null,
};
},
created() {
(this as any).os.getMeta().then(meta => {
this.bannerUrl = meta.bannerUrl;
this.name = meta.name;
this.description = meta.description;
});
},
methods: {
invite() {
(this as any).api('admin/invite').then(x => {
@ -46,11 +59,14 @@ export default Vue.extend({
//(this as any).os.apis.dialog({ text: `Failed ${e}` });
});
},
updateMeta() {
(this as any).api('admin/update-meta', {
disableRegistration: this.disableRegistration,
disableLocalTimeline: this.disableLocalTimeline,
bannerUrl: this.bannerUrl
bannerUrl: this.bannerUrl,
name: this.name,
description: this.description
}).then(() => {
//(this as any).os.apis.dialog({ text: `Saved` });
}).catch(e => {

View File

@ -51,8 +51,6 @@ export default function load() {
if (config.maxNoteTextLength == null) config.maxNoteTextLength = 1000;
if (config.name == null) config.name = 'Misskey';
return Object.assign(config, mixin);
}

View File

@ -18,8 +18,6 @@ export type Source = {
repository_url?: string;
feedback_url?: string;
};
name?: string;
description?: string;
languages?: string[];
welcome_bg_url?: string;
url: string;

View File

@ -1,9 +1,37 @@
import db from '../db/mongodb';
import config from '../config';
const Meta = db.get<IMeta>('meta');
export default Meta;
// 後方互換性のため。
// 過去のMisskeyではインスタンス名や紹介を設定ファイルに記述していたのでそれを移行
if ((config as any).name) {
Meta.findOne({}).then(m => {
if (m != null && m.name == null) {
Meta.update({}, {
$set: {
name: (config as any).name
}
});
}
});
}
if ((config as any).description) {
Meta.findOne({}).then(m => {
if (m != null && m.description == null) {
Meta.update({}, {
$set: {
description: (config as any).description
}
});
}
});
}
export type IMeta = {
name?: string;
description?: string;
broadcasts?: any[];
stats?: {
notesCount: number;

View File

@ -45,6 +45,20 @@ export const meta = {
'ja-JP': 'インスタンスのバナー画像URL'
}
},
name: {
validator: $.str.optional.nullable,
desc: {
'ja-JP': 'インスタンス名'
}
},
description: {
validator: $.str.optional.nullable,
desc: {
'ja-JP': 'インスタンスの紹介文'
}
},
}
};
@ -71,6 +85,14 @@ export default define(meta, (ps) => new Promise(async (res, rej) => {
set.bannerUrl = ps.bannerUrl;
}
if (ps.name !== undefined) {
set.name = ps.name;
}
if (ps.description !== undefined) {
set.description = ps.description;
}
await Meta.update({}, {
$set: set
}, { upsert: true });

View File

@ -41,8 +41,8 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
version: pkg.version,
clientVersion: client.version,
name: config.name || 'Misskey',
description: config.description,
name: met.name || 'Misskey',
description: met.description,
secure: config.https != null,
machine: os.hostname(),

View File

@ -37,8 +37,8 @@ router.get('/v1/instance', async ctx => { // TODO: This is a temporary implement
ctx.body = {
uri: config.hostname,
title: config.name || 'Misskey',
description: config.description || '',
title: meta.name || 'Misskey',
description: meta.description || '',
email: config.maintainer.email || config.maintainer.url.startsWith('mailto:') ? config.maintainer.url.slice(7) : '',
version: `0.0.0:compatible:misskey:${pkg.version}`, // TODO: How to tell about that this is an api for compatibility?
thumbnail: meta.bannerUrl,