インスタンスの対象言語の設定を実装
This commit is contained in:
		
							parent
							
								
									1585bb12cf
								
							
						
					
					
						commit
						001bb7bbcd
					
				
					 6 changed files with 22 additions and 1 deletions
				
			
		|  | @ -1079,6 +1079,8 @@ admin/views/instance.vue: | |||
|   instance-name: "インスタンス名" | ||||
|   instance-description: "インスタンスの紹介" | ||||
|   banner-url: "バナー画像URL" | ||||
|   languages: "インスタンスの対象言語" | ||||
|   languages-desc: "スペースで区切って複数設定できます。" | ||||
|   maintainer-config: "管理者情報" | ||||
|   maintainer-name: "管理者名" | ||||
|   maintainer-email: "管理者の連絡先" | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| 			<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"><i slot="icon"><fa icon="link"/></i>%i18n:@banner-url%</ui-input> | ||||
| 			<ui-input v-model="languages"><i slot="icon"><fa icon="language"/></i>%i18n:@languages%<span slot="desc">%i18n:@languages-desc%</span></ui-input> | ||||
| 		</section> | ||||
| 		<section class="fit-bottom"> | ||||
| 			<header><fa icon="headset"/> %i18n:@maintainer-config%</header> | ||||
|  | @ -31,7 +32,7 @@ | |||
| 		<section> | ||||
| 			<header><fa icon="ghost"/> %i18n:@proxy-account-config%</header> | ||||
| 			<ui-info>%i18n:@proxy-account-info%</ui-info> | ||||
| 			<ui-input v-model="proxyAccount"><i slot="prefix">@</i>%i18n:@proxy-account-username%<span slot="desc">%i18n:@proxy-account-username-desc%</span></ui-input> | ||||
| 			<ui-input v-model="proxyAccount"><span slot="prefix">@</span>%i18n:@proxy-account-username%<span slot="desc">%i18n:@proxy-account-username-desc%</span></ui-input> | ||||
| 			<ui-info warn>%i18n:@proxy-account-warn%</ui-info> | ||||
| 		</section> | ||||
| 		<section> | ||||
|  | @ -68,6 +69,7 @@ export default Vue.extend({ | |||
| 			bannerUrl: null, | ||||
| 			name: null, | ||||
| 			description: null, | ||||
| 			languages: null, | ||||
| 			cacheRemoteFiles: false, | ||||
| 			localDriveCapacityMb: null, | ||||
| 			remoteDriveCapacityMb: null, | ||||
|  | @ -87,6 +89,7 @@ export default Vue.extend({ | |||
| 			this.bannerUrl = meta.bannerUrl; | ||||
| 			this.name = meta.name; | ||||
| 			this.description = meta.description; | ||||
| 			this.languages = meta.langs.join(' '); | ||||
| 			this.cacheRemoteFiles = meta.cacheRemoteFiles; | ||||
| 			this.localDriveCapacityMb = meta.driveCapacityPerLocalUserMb; | ||||
| 			this.remoteDriveCapacityMb = meta.driveCapacityPerRemoteUserMb; | ||||
|  | @ -119,6 +122,7 @@ export default Vue.extend({ | |||
| 				bannerUrl: this.bannerUrl, | ||||
| 				name: this.name, | ||||
| 				description: this.description, | ||||
| 				langs: this.languages.split(' '), | ||||
| 				cacheRemoteFiles: this.cacheRemoteFiles, | ||||
| 				localDriveCapacityMb: parseInt(this.localDriveCapacityMb, 10), | ||||
| 				remoteDriveCapacityMb: parseInt(this.remoteDriveCapacityMb, 10), | ||||
|  |  | |||
|  | @ -2,6 +2,7 @@ import Meta, { IMeta } from '../models/meta'; | |||
| 
 | ||||
| const defaultMeta: any = { | ||||
| 	name: 'Misskey', | ||||
| 	langs: [], | ||||
| 	cacheRemoteFiles: true, | ||||
| 	localDriveCapacityMb: 256, | ||||
| 	remoteDriveCapacityMb: 8, | ||||
|  |  | |||
|  | @ -119,6 +119,8 @@ export type IMeta = { | |||
| 		email?: string; | ||||
| 	}; | ||||
| 
 | ||||
| 	langs?: string[]; | ||||
| 
 | ||||
| 	broadcasts?: any[]; | ||||
| 
 | ||||
| 	stats?: { | ||||
|  |  | |||
|  | @ -130,6 +130,13 @@ export const meta = { | |||
| 			desc: { | ||||
| 				'ja-JP': 'インスタンス管理者の連絡先メールアドレス' | ||||
| 			} | ||||
| 		}, | ||||
| 
 | ||||
| 		langs: { | ||||
| 			validator: $.arr($.str).optional, | ||||
| 			desc: { | ||||
| 				'ja-JP': 'インスタンスの対象言語' | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| }; | ||||
|  | @ -205,6 +212,10 @@ export default define(meta, (ps) => new Promise(async (res, rej) => { | |||
| 		set['maintainer.email'] = ps.maintainerEmail; | ||||
| 	} | ||||
| 
 | ||||
| 	if (ps.langs !== undefined) { | ||||
| 		set.langs = ps.langs; | ||||
| 	} | ||||
| 
 | ||||
| 	await Meta.update({}, { | ||||
| 		$set: set | ||||
| 	}, { upsert: true }); | ||||
|  |  | |||
|  | @ -43,6 +43,7 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => { | |||
| 
 | ||||
| 		name: instance.name, | ||||
| 		description: instance.description, | ||||
| 		langs: instance.langs, | ||||
| 
 | ||||
| 		secure: config.https != null, | ||||
| 		machine: os.hostname(), | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue