Add ToSUrl, repositoryUrl, feedbackUrl (#4921)

* Add ToSUrl, repositoryUrl, feedbackUrl

* modify nodeinfo
This commit is contained in:
tamaina 2019-05-14 02:57:04 +09:00 committed by syuilo
parent b128b593c2
commit 7c03d37caa
10 changed files with 131 additions and 4 deletions

View file

@ -197,3 +197,13 @@ const user = await Users.findOne(userId).then(ensure);
// } // }
// の糖衣構文のような扱いです // の糖衣構文のような扱いです
``` ```
### Migration作成方法
コードの変更をした後、`ormconfig.json`書き方はCONTRIBUTING.mdを参照を用意し、
```
npm i -g ts-node
ts-node ./node_modules/typeorm/cli.js migration:generate -n 変更の名前
```
作成されたスクリプトは不必要な変更を含むため除去してください。

View file

@ -508,6 +508,7 @@ common/views/components/nav.vue:
repository: "リポジトリ" repository: "リポジトリ"
develop: "開発者" develop: "開発者"
feedback: "フィードバック" feedback: "フィードバック"
tos: "利用規約"
common/views/components/note-menu.vue: common/views/components/note-menu.vue:
mention: "メンション" mention: "メンション"
@ -628,6 +629,8 @@ common/views/components/signup.vue:
password-matched: "確認されました" password-matched: "確認されました"
password-not-matched: "一致していません" password-not-matched: "一致していません"
recaptcha: "認証" recaptcha: "認証"
agree-to: "{0}に同意します。"
tos: "利用規約"
create: "アカウント作成" create: "アカウント作成"
some-error: "何らかの原因によりアカウントの作成に失敗しました。再度お試しください。" some-error: "何らかの原因によりアカウントの作成に失敗しました。再度お試しください。"
@ -1215,10 +1218,15 @@ admin/views/instance.vue:
instance-name: "インスタンス名" instance-name: "インスタンス名"
instance-description: "インスタンスの紹介" instance-description: "インスタンスの紹介"
host: "ホスト" host: "ホスト"
icon-url: "アイコンURL"
logo-url: "ロゴURL"
banner-url: "バナー画像URL" banner-url: "バナー画像URL"
error-image-url: "エラー画像URL" error-image-url: "エラー画像URL"
languages: "インスタンスの対象言語" languages: "インスタンスの対象言語"
languages-desc: "スペースで区切って複数設定できます。" languages-desc: "スペースで区切って複数設定できます。"
tos-url: "利用規約URL"
repository-url: "リポジトリURL"
feedback-url: "フィードバックURL"
maintainer-config: "管理者情報" maintainer-config: "管理者情報"
maintainer-name: "管理者名" maintainer-name: "管理者名"
maintainer-email: "管理者の連絡先" maintainer-email: "管理者の連絡先"

View file

@ -0,0 +1,16 @@
import {MigrationInterface, QueryRunner} from "typeorm";
export class AddSomeUrls1557761316509 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<any> {
await queryRunner.query(`ALTER TABLE "meta" ADD "ToSUrl" character varying(512)`);
await queryRunner.query(`ALTER TABLE "meta" ADD "repositoryUrl" character varying(512) NOT NULL DEFAULT 'https://github.com/syuilo/misskey'`);
await queryRunner.query(`ALTER TABLE "meta" ADD "feedbackUrl" character varying(512) DEFAULT 'https://github.com/syuilo/misskey/issues/new'`);
}
public async down(queryRunner: QueryRunner): Promise<any> {
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "feedbackUrl"`);
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "repositoryUrl"`);
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "ToSUrl"`);
}
}

View file

@ -10,6 +10,9 @@
<ui-input v-model="mascotImageUrl"><template #icon><fa icon="link"/></template>{{ $t('logo-url') }}</ui-input> <ui-input v-model="mascotImageUrl"><template #icon><fa icon="link"/></template>{{ $t('logo-url') }}</ui-input>
<ui-input v-model="bannerUrl"><template #icon><fa icon="link"/></template>{{ $t('banner-url') }}</ui-input> <ui-input v-model="bannerUrl"><template #icon><fa icon="link"/></template>{{ $t('banner-url') }}</ui-input>
<ui-input v-model="errorImageUrl"><template #icon><fa icon="link"/></template>{{ $t('error-image-url') }}</ui-input> <ui-input v-model="errorImageUrl"><template #icon><fa icon="link"/></template>{{ $t('error-image-url') }}</ui-input>
<ui-input v-model="ToSUrl"><template #icon><fa icon="link"/></template>{{ $t('tos-url') }}</ui-input>
<ui-input v-model="repositoryUrl"><template #icon><fa icon="link"/></template>{{ $t('repository-url') }}</ui-input>
<ui-input v-model="feedbackUrl"><template #icon><fa icon="link"/></template>{{ $t('feedback-url') }}</ui-input>
<ui-input v-model="languages"><template #icon><fa icon="language"/></template>{{ $t('languages') }}<template #desc>{{ $t('languages-desc') }}</template></ui-input> <ui-input v-model="languages"><template #icon><fa icon="language"/></template>{{ $t('languages') }}<template #desc>{{ $t('languages-desc') }}</template></ui-input>
</section> </section>
<section class="fit-bottom"> <section class="fit-bottom">
@ -156,6 +159,9 @@ export default Vue.extend({
host: toUnicode(host), host: toUnicode(host),
maintainerName: null, maintainerName: null,
maintainerEmail: null, maintainerEmail: null,
ToSUrl: null,
repositoryUrl: "https://github.com/syuilo/misskey",
feedbackUrl: null,
disableRegistration: false, disableRegistration: false,
disableLocalTimeline: false, disableLocalTimeline: false,
disableGlobalTimeline: false, disableGlobalTimeline: false,
@ -207,6 +213,9 @@ export default Vue.extend({
this.$root.getMeta(true).then(meta => { this.$root.getMeta(true).then(meta => {
this.maintainerName = meta.maintainerName; this.maintainerName = meta.maintainerName;
this.maintainerEmail = meta.maintainerEmail; this.maintainerEmail = meta.maintainerEmail;
this.ToSUrl = meta.ToSUrl;
this.repositoryUrl = meta.repositoryUrl;
this.feedbackUrl = meta.feedbackUrl;
this.disableRegistration = meta.disableRegistration; this.disableRegistration = meta.disableRegistration;
this.disableLocalTimeline = meta.disableLocalTimeline; this.disableLocalTimeline = meta.disableLocalTimeline;
this.disableGlobalTimeline = meta.disableGlobalTimeline; this.disableGlobalTimeline = meta.disableGlobalTimeline;
@ -268,6 +277,9 @@ export default Vue.extend({
this.$root.api('admin/update-meta', { this.$root.api('admin/update-meta', {
maintainerName: this.maintainerName, maintainerName: this.maintainerName,
maintainerEmail: this.maintainerEmail, maintainerEmail: this.maintainerEmail,
ToSUrl: this.ToSUrl,
repositoryUrl: this.repositoryUrl,
feedbackUrl: this.feedbackUrl,
disableRegistration: this.disableRegistration, disableRegistration: this.disableRegistration,
disableLocalTimeline: this.disableLocalTimeline, disableLocalTimeline: this.disableLocalTimeline,
disableGlobalTimeline: this.disableGlobalTimeline, disableGlobalTimeline: this.disableGlobalTimeline,

View file

@ -1,12 +1,16 @@
<template> <template>
<span class="mk-nav"> <span class="mk-nav">
<a :href="aboutUrl">{{ $t('about') }}</a> <a :href="aboutUrl">{{ $t('about') }}</a>
<template v-if="ToSUrl !== null">
<i></i>
<a :href="ToSUrl" target="_blank">{{ $t('tos') }}</a>
</template>
<i></i> <i></i>
<a :href="repositoryUrl" rel="noopener" target="_blank">{{ $t('repository') }}</a> <a :href="repositoryUrl" rel="noopener" target="_blank">{{ $t('repository') }}</a>
<i></i> <i></i>
<a :href="feedbackUrl" rel="noopener" target="_blank">{{ $t('feedback') }}</a> <a :href="feedbackUrl" rel="noopener" target="_blank">{{ $t('feedback') }}</a>
<i></i> <i></i>
<a href="/dev">{{ $t('develop') }}</a> <a href="/dev" target="_blank">{{ $t('develop') }}</a>
</span> </span>
</template> </template>
@ -21,8 +25,17 @@ export default Vue.extend({
return { return {
aboutUrl: `/docs/${lang}/about`, aboutUrl: `/docs/${lang}/about`,
repositoryUrl: 'https://github.com/syuilo/misskey', repositoryUrl: 'https://github.com/syuilo/misskey',
feedbackUrl: 'https://github.com/syuilo/misskey/issues/new' feedbackUrl: 'https://github.com/syuilo/misskey/issues/new',
ToSUrl: null
} }
},
mounted() {
this.$root.getMeta(true).then(meta => {
this.repositoryUrl = meta.repositoryUrl;
this.feedbackUrl = meta.feedbackUrl;
this.ToSUrl = meta.ToSUrl;
})
} }
}); });
</script> </script>

View file

@ -37,8 +37,13 @@
<p v-if="passwordRetypeState == 'not-match'" style="color:#FF1161"><fa icon="exclamation-triangle" fixed-width/> {{ $t('password-not-matched') }}</p> <p v-if="passwordRetypeState == 'not-match'" style="color:#FF1161"><fa icon="exclamation-triangle" fixed-width/> {{ $t('password-not-matched') }}</p>
</template> </template>
</ui-input> </ui-input>
<ui-switch v-model="ToSAgreement" v-if="meta.ToSUrl">
<i18n path="agree-to">
<a :href="meta.ToSUrl" target="_blank">{{ $t('tos') }}</a>
</i18n>
</ui-switch>
<div v-if="meta.enableRecaptcha" class="g-recaptcha" :data-sitekey="meta.recaptchaSiteKey" style="margin: 16px 0;"></div> <div v-if="meta.enableRecaptcha" class="g-recaptcha" :data-sitekey="meta.recaptchaSiteKey" style="margin: 16px 0;"></div>
<ui-button type="submit">{{ $t('create') }}</ui-button> <ui-button type="submit" :disabled="!(meta.ToSUrl ? ToSAgreement : true)">{{ $t('create') }}</ui-button>
</template> </template>
</form> </form>
</template> </template>
@ -64,7 +69,8 @@ export default Vue.extend({
usernameState: null, usernameState: null,
passwordStrength: '', passwordStrength: '',
passwordRetypeState: null, passwordRetypeState: null,
meta: null meta: {},
ToSAgreement: false
} }
}, },

View file

@ -268,4 +268,24 @@ export class Meta {
nullable: true nullable: true
}) })
public discordClientSecret: string | null; public discordClientSecret: string | null;
@Column('varchar', {
length: 512,
nullable: true
})
public ToSUrl: string | null;
@Column('varchar', {
length: 512,
default: 'https://github.com/syuilo/misskey',
nullable: false
})
public repositoryUrl: string;
@Column('varchar', {
length: 512,
default: 'https://github.com/syuilo/misskey/issues/new',
nullable: true
})
public feedbackUrl: string | null;
} }

View file

@ -330,6 +330,27 @@ export const meta = {
'ja-JP': 'ServiceWorkerのVAPIDキーペアの秘密鍵' 'ja-JP': 'ServiceWorkerのVAPIDキーペアの秘密鍵'
} }
}, },
ToSUrl: {
validator: $.optional.nullable.str,
desc: {
'ja-JP': '利用規約のURL'
}
},
repositoryUrl: {
validator: $.optional.str,
desc: {
'ja-JP': 'リポジトリのURL'
}
},
feedbackUrl: {
validator: $.optional.str,
desc: {
'ja-JP': 'フィードバックのURL'
}
}
} }
}; };
@ -516,6 +537,18 @@ export default define(meta, async (ps) => {
set.swPrivateKey = ps.swPrivateKey; set.swPrivateKey = ps.swPrivateKey;
} }
if (ps.ToSUrl !== undefined) {
set.ToSUrl = ps.ToSUrl;
}
if (ps.repositoryUrl !== undefined) {
set.repositoryUrl = ps.repositoryUrl;
}
if (ps.feedbackUrl !== undefined) {
set.feedbackUrl = ps.feedbackUrl;
}
await getConnection().transaction(async transactionalEntityManager => { await getConnection().transaction(async transactionalEntityManager => {
const meta = await transactionalEntityManager.findOne(Meta, { const meta = await transactionalEntityManager.findOne(Meta, {
order: { order: {

View file

@ -106,6 +106,9 @@ export default define(meta, async (ps, me) => {
uri: config.url, uri: config.url,
description: instance.description, description: instance.description,
langs: instance.langs, langs: instance.langs,
ToSUrl: instance.ToSUrl,
repositoryUrl: instance.repositoryUrl,
feedbackUrl: instance.feedbackUrl,
secure: config.https != null, secure: config.https != null,
machine: os.hostname(), machine: os.hostname(),

View file

@ -26,6 +26,9 @@ const nodeinfo2 = async () => {
maintainerName, maintainerName,
maintainerEmail, maintainerEmail,
langs, langs,
ToSUrl,
repositoryUrl,
feedbackUrl,
announcements, announcements,
disableRegistration, disableRegistration,
disableLocalTimeline, disableLocalTimeline,
@ -77,6 +80,9 @@ const nodeinfo2 = async () => {
email: maintainerEmail email: maintainerEmail
}, },
langs, langs,
ToSUrl,
repositoryUrl,
feedbackUrl,
announcements, announcements,
disableRegistration, disableRegistration,
disableLocalTimeline, disableLocalTimeline,