mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-27 15:43:08 +02:00
Add ToSUrl, repositoryUrl, feedbackUrl (#4921)
* Add ToSUrl, repositoryUrl, feedbackUrl * modify nodeinfo
This commit is contained in:
parent
b128b593c2
commit
7c03d37caa
10 changed files with 131 additions and 4 deletions
|
@ -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 変更の名前
|
||||
```
|
||||
|
||||
作成されたスクリプトは不必要な変更を含むため除去してください。
|
||||
|
|
|
@ -508,6 +508,7 @@ common/views/components/nav.vue:
|
|||
repository: "リポジトリ"
|
||||
develop: "開発者"
|
||||
feedback: "フィードバック"
|
||||
tos: "利用規約"
|
||||
|
||||
common/views/components/note-menu.vue:
|
||||
mention: "メンション"
|
||||
|
@ -628,6 +629,8 @@ common/views/components/signup.vue:
|
|||
password-matched: "確認されました"
|
||||
password-not-matched: "一致していません"
|
||||
recaptcha: "認証"
|
||||
agree-to: "{0}に同意します。"
|
||||
tos: "利用規約"
|
||||
create: "アカウント作成"
|
||||
some-error: "何らかの原因によりアカウントの作成に失敗しました。再度お試しください。"
|
||||
|
||||
|
@ -1215,10 +1218,15 @@ admin/views/instance.vue:
|
|||
instance-name: "インスタンス名"
|
||||
instance-description: "インスタンスの紹介"
|
||||
host: "ホスト"
|
||||
icon-url: "アイコンURL"
|
||||
logo-url: "ロゴURL"
|
||||
banner-url: "バナー画像URL"
|
||||
error-image-url: "エラー画像URL"
|
||||
languages: "インスタンスの対象言語"
|
||||
languages-desc: "スペースで区切って複数設定できます。"
|
||||
tos-url: "利用規約URL"
|
||||
repository-url: "リポジトリURL"
|
||||
feedback-url: "フィードバックURL"
|
||||
maintainer-config: "管理者情報"
|
||||
maintainer-name: "管理者名"
|
||||
maintainer-email: "管理者の連絡先"
|
||||
|
|
16
migration/1557761316509-AddSomeUrls.ts
Normal file
16
migration/1557761316509-AddSomeUrls.ts
Normal 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"`);
|
||||
}
|
||||
}
|
|
@ -10,6 +10,9 @@
|
|||
<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="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>
|
||||
</section>
|
||||
<section class="fit-bottom">
|
||||
|
@ -156,6 +159,9 @@ export default Vue.extend({
|
|||
host: toUnicode(host),
|
||||
maintainerName: null,
|
||||
maintainerEmail: null,
|
||||
ToSUrl: null,
|
||||
repositoryUrl: "https://github.com/syuilo/misskey",
|
||||
feedbackUrl: null,
|
||||
disableRegistration: false,
|
||||
disableLocalTimeline: false,
|
||||
disableGlobalTimeline: false,
|
||||
|
@ -207,6 +213,9 @@ export default Vue.extend({
|
|||
this.$root.getMeta(true).then(meta => {
|
||||
this.maintainerName = meta.maintainerName;
|
||||
this.maintainerEmail = meta.maintainerEmail;
|
||||
this.ToSUrl = meta.ToSUrl;
|
||||
this.repositoryUrl = meta.repositoryUrl;
|
||||
this.feedbackUrl = meta.feedbackUrl;
|
||||
this.disableRegistration = meta.disableRegistration;
|
||||
this.disableLocalTimeline = meta.disableLocalTimeline;
|
||||
this.disableGlobalTimeline = meta.disableGlobalTimeline;
|
||||
|
@ -268,6 +277,9 @@ export default Vue.extend({
|
|||
this.$root.api('admin/update-meta', {
|
||||
maintainerName: this.maintainerName,
|
||||
maintainerEmail: this.maintainerEmail,
|
||||
ToSUrl: this.ToSUrl,
|
||||
repositoryUrl: this.repositoryUrl,
|
||||
feedbackUrl: this.feedbackUrl,
|
||||
disableRegistration: this.disableRegistration,
|
||||
disableLocalTimeline: this.disableLocalTimeline,
|
||||
disableGlobalTimeline: this.disableGlobalTimeline,
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
<template>
|
||||
<span class="mk-nav">
|
||||
<a :href="aboutUrl">{{ $t('about') }}</a>
|
||||
<template v-if="ToSUrl !== null">
|
||||
<i>・</i>
|
||||
<a :href="ToSUrl" target="_blank">{{ $t('tos') }}</a>
|
||||
</template>
|
||||
<i>・</i>
|
||||
<a :href="repositoryUrl" rel="noopener" target="_blank">{{ $t('repository') }}</a>
|
||||
<i>・</i>
|
||||
<a :href="feedbackUrl" rel="noopener" target="_blank">{{ $t('feedback') }}</a>
|
||||
<i>・</i>
|
||||
<a href="/dev">{{ $t('develop') }}</a>
|
||||
<a href="/dev" target="_blank">{{ $t('develop') }}</a>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
|
@ -21,8 +25,17 @@ export default Vue.extend({
|
|||
return {
|
||||
aboutUrl: `/docs/${lang}/about`,
|
||||
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>
|
||||
|
|
|
@ -37,8 +37,13 @@
|
|||
<p v-if="passwordRetypeState == 'not-match'" style="color:#FF1161"><fa icon="exclamation-triangle" fixed-width/> {{ $t('password-not-matched') }}</p>
|
||||
</template>
|
||||
</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>
|
||||
<ui-button type="submit">{{ $t('create') }}</ui-button>
|
||||
<ui-button type="submit" :disabled="!(meta.ToSUrl ? ToSAgreement : true)">{{ $t('create') }}</ui-button>
|
||||
</template>
|
||||
</form>
|
||||
</template>
|
||||
|
@ -64,7 +69,8 @@ export default Vue.extend({
|
|||
usernameState: null,
|
||||
passwordStrength: '',
|
||||
passwordRetypeState: null,
|
||||
meta: null
|
||||
meta: {},
|
||||
ToSAgreement: false
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -268,4 +268,24 @@ export class Meta {
|
|||
nullable: true
|
||||
})
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -330,6 +330,27 @@ export const meta = {
|
|||
'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;
|
||||
}
|
||||
|
||||
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 => {
|
||||
const meta = await transactionalEntityManager.findOne(Meta, {
|
||||
order: {
|
||||
|
|
|
@ -106,6 +106,9 @@ export default define(meta, async (ps, me) => {
|
|||
uri: config.url,
|
||||
description: instance.description,
|
||||
langs: instance.langs,
|
||||
ToSUrl: instance.ToSUrl,
|
||||
repositoryUrl: instance.repositoryUrl,
|
||||
feedbackUrl: instance.feedbackUrl,
|
||||
|
||||
secure: config.https != null,
|
||||
machine: os.hostname(),
|
||||
|
|
|
@ -26,6 +26,9 @@ const nodeinfo2 = async () => {
|
|||
maintainerName,
|
||||
maintainerEmail,
|
||||
langs,
|
||||
ToSUrl,
|
||||
repositoryUrl,
|
||||
feedbackUrl,
|
||||
announcements,
|
||||
disableRegistration,
|
||||
disableLocalTimeline,
|
||||
|
@ -77,6 +80,9 @@ const nodeinfo2 = async () => {
|
|||
email: maintainerEmail
|
||||
},
|
||||
langs,
|
||||
ToSUrl,
|
||||
repositoryUrl,
|
||||
feedbackUrl,
|
||||
announcements,
|
||||
disableRegistration,
|
||||
disableLocalTimeline,
|
||||
|
|
Loading…
Reference in a new issue