Resolve #3098
This commit is contained in:
parent
af4f1a7bd6
commit
1855ab60f1
9 changed files with 82 additions and 17 deletions
|
@ -1,6 +1,3 @@
|
||||||
name: example-instance-name # Name of your instance
|
|
||||||
description: example-description # Description of your instance
|
|
||||||
|
|
||||||
maintainer:
|
maintainer:
|
||||||
name: example-maitainer-name # Your name
|
name: example-maitainer-name # Your name
|
||||||
url: http://example.com/ # Your contact (http or mailto)
|
url: http://example.com/ # Your contact (http or mailto)
|
||||||
|
|
|
@ -1071,10 +1071,16 @@ admin/views/dashboard.vue:
|
||||||
instances: "インスタンス"
|
instances: "インスタンス"
|
||||||
this-instance: "このインスタンス"
|
this-instance: "このインスタンス"
|
||||||
federated: "連合"
|
federated: "連合"
|
||||||
|
|
||||||
|
admin/views/instance.vue:
|
||||||
|
instance: "インスタンス"
|
||||||
|
instance-name: "インスタンス名"
|
||||||
|
instance-description: "インスタンスの紹介"
|
||||||
|
banner-url: "バナー画像URL"
|
||||||
|
disableRegistration: "ユーザー登録の受付を停止する"
|
||||||
|
disableLocalTimeline: "ローカルタイムラインを無効にする"
|
||||||
invite: "招待"
|
invite: "招待"
|
||||||
banner-url: "Banner URL"
|
save: "保存"
|
||||||
disableRegistration: "Disable new user registration"
|
|
||||||
disableLocalTimeline: "Disable the local timeline"
|
|
||||||
|
|
||||||
admin/views/charts.vue:
|
admin/views/charts.vue:
|
||||||
title: "チャート"
|
title: "チャート"
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="axbwjelsbymowqjyywpirzhdlszoncqs">
|
<div class="axbwjelsbymowqjyywpirzhdlszoncqs">
|
||||||
<ui-card>
|
<ui-card>
|
||||||
<div slot="title">%i18n:@banner-url%</div>
|
<div slot="title">%i18n:@instance%</div>
|
||||||
<section class="fit-top">
|
<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>
|
<ui-button @click="updateMeta">%i18n:@save%</ui-button>
|
||||||
</section>
|
</section>
|
||||||
</ui-card>
|
</ui-card>
|
||||||
|
@ -35,9 +37,20 @@ export default Vue.extend({
|
||||||
disableRegistration: false,
|
disableRegistration: false,
|
||||||
disableLocalTimeline: false,
|
disableLocalTimeline: false,
|
||||||
bannerUrl: null,
|
bannerUrl: null,
|
||||||
|
name: null,
|
||||||
|
description: null,
|
||||||
inviteCode: null,
|
inviteCode: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
(this as any).os.getMeta().then(meta => {
|
||||||
|
this.bannerUrl = meta.bannerUrl;
|
||||||
|
this.name = meta.name;
|
||||||
|
this.description = meta.description;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
invite() {
|
invite() {
|
||||||
(this as any).api('admin/invite').then(x => {
|
(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}` });
|
//(this as any).os.apis.dialog({ text: `Failed ${e}` });
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
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,
|
disableLocalTimeline: this.disableLocalTimeline,
|
||||||
bannerUrl: this.bannerUrl
|
bannerUrl: this.bannerUrl,
|
||||||
|
name: this.name,
|
||||||
|
description: this.description
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
//(this as any).os.apis.dialog({ text: `Saved` });
|
//(this as any).os.apis.dialog({ text: `Saved` });
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
|
|
|
@ -51,8 +51,6 @@ export default function load() {
|
||||||
|
|
||||||
if (config.maxNoteTextLength == null) config.maxNoteTextLength = 1000;
|
if (config.maxNoteTextLength == null) config.maxNoteTextLength = 1000;
|
||||||
|
|
||||||
if (config.name == null) config.name = 'Misskey';
|
|
||||||
|
|
||||||
return Object.assign(config, mixin);
|
return Object.assign(config, mixin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,6 @@ export type Source = {
|
||||||
repository_url?: string;
|
repository_url?: string;
|
||||||
feedback_url?: string;
|
feedback_url?: string;
|
||||||
};
|
};
|
||||||
name?: string;
|
|
||||||
description?: string;
|
|
||||||
languages?: string[];
|
languages?: string[];
|
||||||
welcome_bg_url?: string;
|
welcome_bg_url?: string;
|
||||||
url: string;
|
url: string;
|
||||||
|
|
|
@ -1,9 +1,37 @@
|
||||||
import db from '../db/mongodb';
|
import db from '../db/mongodb';
|
||||||
|
import config from '../config';
|
||||||
|
|
||||||
const Meta = db.get<IMeta>('meta');
|
const Meta = db.get<IMeta>('meta');
|
||||||
export default 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 = {
|
export type IMeta = {
|
||||||
|
name?: string;
|
||||||
|
description?: string;
|
||||||
broadcasts?: any[];
|
broadcasts?: any[];
|
||||||
stats?: {
|
stats?: {
|
||||||
notesCount: number;
|
notesCount: number;
|
||||||
|
|
|
@ -45,6 +45,20 @@ export const meta = {
|
||||||
'ja-JP': 'インスタンスのバナー画像URL'
|
'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;
|
set.bannerUrl = ps.bannerUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ps.name !== undefined) {
|
||||||
|
set.name = ps.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ps.description !== undefined) {
|
||||||
|
set.description = ps.description;
|
||||||
|
}
|
||||||
|
|
||||||
await Meta.update({}, {
|
await Meta.update({}, {
|
||||||
$set: set
|
$set: set
|
||||||
}, { upsert: true });
|
}, { upsert: true });
|
||||||
|
|
|
@ -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: config.name || 'Misskey',
|
name: met.name || 'Misskey',
|
||||||
description: config.description,
|
description: met.description,
|
||||||
|
|
||||||
secure: config.https != null,
|
secure: config.https != null,
|
||||||
machine: os.hostname(),
|
machine: os.hostname(),
|
||||||
|
|
|
@ -37,8 +37,8 @@ router.get('/v1/instance', async ctx => { // TODO: This is a temporary implement
|
||||||
|
|
||||||
ctx.body = {
|
ctx.body = {
|
||||||
uri: config.hostname,
|
uri: config.hostname,
|
||||||
title: config.name || 'Misskey',
|
title: meta.name || 'Misskey',
|
||||||
description: config.description || '',
|
description: meta.description || '',
|
||||||
email: config.maintainer.email || config.maintainer.url.startsWith('mailto:') ? config.maintainer.url.slice(7) : '',
|
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?
|
version: `0.0.0:compatible:misskey:${pkg.version}`, // TODO: How to tell about that this is an api for compatibility?
|
||||||
thumbnail: meta.bannerUrl,
|
thumbnail: meta.bannerUrl,
|
||||||
|
|
Loading…
Reference in a new issue