add localonly
Signed-off-by: mattyatea <mattyacocacora0@gmail.com>
This commit is contained in:
parent
b6692a47ee
commit
c0961eeb23
|
@ -0,0 +1,11 @@
|
||||||
|
export class AvatardecorationFederation1700197304572 {
|
||||||
|
name = 'AvatardecorationFederation1700197304572'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "avatar_decoration" ADD "localOnly" boolean NOT NULL DEFAULT false`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "avatar_decoration" DROP COLUMN "localOnly"`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -189,7 +189,8 @@ export class ApRendererService {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@bindThis
|
@bindThis
|
||||||
public renderAvatarDecoration(avatarDecoration: MiAvatarDecoration): IApAvatarDecoration {
|
public renderAvatarDecoration(avatarDecoration: MiAvatarDecoration): IApAvatarDecoration | null {
|
||||||
|
if (avatarDecoration.localOnly) return null;
|
||||||
return {
|
return {
|
||||||
id: avatarDecoration.url,
|
id: avatarDecoration.url,
|
||||||
type: 'AvatarDecoration',
|
type: 'AvatarDecoration',
|
||||||
|
|
|
@ -35,6 +35,11 @@ export class MiAvatarDecoration {
|
||||||
})
|
})
|
||||||
public description: string;
|
public description: string;
|
||||||
|
|
||||||
|
@Column('boolean', {
|
||||||
|
default: false,
|
||||||
|
})
|
||||||
|
public localOnly: boolean;
|
||||||
|
|
||||||
// TODO: 定期ジョブで存在しなくなったロールIDを除去するようにする
|
// TODO: 定期ジョブで存在しなくなったロールIDを除去するようにする
|
||||||
@Column('varchar', {
|
@Column('varchar', {
|
||||||
array: true, length: 128, default: '{}',
|
array: true, length: 128, default: '{}',
|
||||||
|
|
|
@ -19,6 +19,7 @@ export const paramDef = {
|
||||||
properties: {
|
properties: {
|
||||||
name: { type: 'string', minLength: 1 },
|
name: { type: 'string', minLength: 1 },
|
||||||
description: { type: 'string' },
|
description: { type: 'string' },
|
||||||
|
localOnly: { type: 'boolean' },
|
||||||
url: { type: 'string', minLength: 1 },
|
url: { type: 'string', minLength: 1 },
|
||||||
roleIdsThatCanBeUsedThisDecoration: { type: 'array', items: {
|
roleIdsThatCanBeUsedThisDecoration: { type: 'array', items: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
@ -37,6 +38,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
name: ps.name,
|
name: ps.name,
|
||||||
description: ps.description,
|
description: ps.description,
|
||||||
url: ps.url,
|
url: ps.url,
|
||||||
|
localOnly: ps.localOnly,
|
||||||
roleIdsThatCanBeUsedThisDecoration: ps.roleIdsThatCanBeUsedThisDecoration,
|
roleIdsThatCanBeUsedThisDecoration: ps.roleIdsThatCanBeUsedThisDecoration,
|
||||||
}, me);
|
}, me);
|
||||||
});
|
});
|
||||||
|
|
|
@ -45,6 +45,10 @@ export const meta = {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
},
|
},
|
||||||
|
localOnly: {
|
||||||
|
type: 'boolean',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
},
|
||||||
description: {
|
description: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
|
@ -91,6 +95,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
createdAt: this.idService.parse(avatarDecoration.id).date.toISOString(),
|
createdAt: this.idService.parse(avatarDecoration.id).date.toISOString(),
|
||||||
updatedAt: avatarDecoration.updatedAt?.toISOString() ?? null,
|
updatedAt: avatarDecoration.updatedAt?.toISOString() ?? null,
|
||||||
name: avatarDecoration.name,
|
name: avatarDecoration.name,
|
||||||
|
localOnly: avatarDecoration.localOnly,
|
||||||
description: avatarDecoration.description,
|
description: avatarDecoration.description,
|
||||||
url: avatarDecoration.url,
|
url: avatarDecoration.url,
|
||||||
roleIdsThatCanBeUsedThisDecoration: avatarDecoration.roleIdsThatCanBeUsedThisDecoration,
|
roleIdsThatCanBeUsedThisDecoration: avatarDecoration.roleIdsThatCanBeUsedThisDecoration,
|
||||||
|
|
|
@ -25,6 +25,7 @@ export const paramDef = {
|
||||||
id: { type: 'string', format: 'misskey:id' },
|
id: { type: 'string', format: 'misskey:id' },
|
||||||
name: { type: 'string', minLength: 1 },
|
name: { type: 'string', minLength: 1 },
|
||||||
description: { type: 'string' },
|
description: { type: 'string' },
|
||||||
|
localOnly: { type: 'boolean' },
|
||||||
url: { type: 'string', minLength: 1 },
|
url: { type: 'string', minLength: 1 },
|
||||||
roleIdsThatCanBeUsedThisDecoration: { type: 'array', items: {
|
roleIdsThatCanBeUsedThisDecoration: { type: 'array', items: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
@ -43,6 +44,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
name: ps.name,
|
name: ps.name,
|
||||||
description: ps.description,
|
description: ps.description,
|
||||||
url: ps.url,
|
url: ps.url,
|
||||||
|
localOnly: ps.localOnly,
|
||||||
roleIdsThatCanBeUsedThisDecoration: ps.roleIdsThatCanBeUsedThisDecoration,
|
roleIdsThatCanBeUsedThisDecoration: ps.roleIdsThatCanBeUsedThisDecoration,
|
||||||
}, me);
|
}, me);
|
||||||
});
|
});
|
||||||
|
|
|
@ -22,6 +22,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkInput v-model="avatarDecoration.url">
|
<MkInput v-model="avatarDecoration.url">
|
||||||
<template #label>{{ i18n.ts.imageUrl }}</template>
|
<template #label>{{ i18n.ts.imageUrl }}</template>
|
||||||
</MkInput>
|
</MkInput>
|
||||||
|
<MkSwitch v-model="avatarDecoration.localOnly">
|
||||||
|
<template #label>{{ i18n.ts.localOnly }}</template>
|
||||||
|
</MkSwitch>
|
||||||
<div class="buttons _buttons">
|
<div class="buttons _buttons">
|
||||||
<MkButton class="button" inline primary @click="save(avatarDecoration)"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
|
<MkButton class="button" inline primary @click="save(avatarDecoration)"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
|
||||||
<MkButton v-if="avatarDecoration.id != null" class="button" inline danger @click="del(avatarDecoration)"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
|
<MkButton v-if="avatarDecoration.id != null" class="button" inline danger @click="del(avatarDecoration)"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
|
||||||
|
@ -56,6 +59,7 @@ import MkFolder from '@/components/MkFolder.vue';
|
||||||
let avatarDecorations: any[] = $ref([]);
|
let avatarDecorations: any[] = $ref([]);
|
||||||
let tab = $ref('avatarDecorations');
|
let tab = $ref('avatarDecorations');
|
||||||
let acceptHosts: string = $ref('');
|
let acceptHosts: string = $ref('');
|
||||||
|
|
||||||
function add() {
|
function add() {
|
||||||
avatarDecorations.unshift({
|
avatarDecorations.unshift({
|
||||||
_id: Math.random().toString(36),
|
_id: Math.random().toString(36),
|
||||||
|
|
Loading…
Reference in New Issue