Merge branch 'develop' into feature/2024.10

This commit is contained in:
dakkar 2024-12-12 17:38:29 +00:00
commit b266a5f9f6
20 changed files with 93 additions and 13 deletions

8
locales/index.d.ts vendored
View file

@ -10977,6 +10977,14 @@ export interface Locale extends ILocale {
* Stop note search from indexing your public notes. * Stop note search from indexing your public notes.
*/ */
"makeIndexableDescription": string; "makeIndexableDescription": string;
/**
* Enable RSS feed
*/
"enableRss": string;
/**
* Generate an RSS feed containing your basic profile details and public notes. Users can subscribe to the feed without a follow request or approval.
*/
"enableRssDescription": string;
/** /**
* Require approval for new users * Require approval for new users
*/ */

View file

@ -0,0 +1,13 @@
export class AddUserEnableRss1733748798177 {
name = 'AddUserEnableRss1733748798177'
async up(queryRunner) {
// Disable by default, then specifically enable for all existing local users.
await queryRunner.query(`ALTER TABLE "user" ADD "enable_rss" boolean NOT NULL DEFAULT false`);
await queryRunner.query(`UPDATE "user" SET "enable_rss" = true WHERE host IS NULL;`)
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "enable_rss"`);
}
}

View file

@ -0,0 +1,11 @@
export class AlterUserHideOnlineStatusDefaultTrue1733754069260 {
name = 'AlterUserHideOnlineStatusDefaultTrue1733754069260'
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "user" ALTER COLUMN "hideOnlineStatus" SET DEFAULT true`);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "user" ALTER COLUMN "hideOnlineStatus" SET DEFAULT false`);
}
}

View file

@ -135,6 +135,7 @@ export class SignupService {
isRoot: isTheFirstUser, isRoot: isTheFirstUser,
approved: isTheFirstUser || (opts.approved ?? !this.meta.approvalRequiredForSignup), approved: isTheFirstUser || (opts.approved ?? !this.meta.approvalRequiredForSignup),
signupReason: reason, signupReason: reason,
enableRss: false,
})); }));
await transactionalEntityManager.save(new MiUserKeypair({ await transactionalEntityManager.save(new MiUserKeypair({

View file

@ -98,6 +98,7 @@ function generateDummyUser(override?: Partial<MiUser>): MiUser {
approved: true, approved: true,
signupReason: null, signupReason: null,
noindex: false, noindex: false,
enableRss: true,
...override, ...override,
}; };
} }
@ -214,6 +215,7 @@ function toPackedUserLite(user: MiUser, override?: Packed<'UserLite'>): Packed<'
isAdmin: false, isAdmin: false,
isSystem: false, isSystem: false,
isSilenced: user.isSilenced, isSilenced: user.isSilenced,
enableRss: true,
...override, ...override,
}; };
} }

View file

@ -531,8 +531,10 @@ export class ApRendererService {
discoverable: user.isExplorable, discoverable: user.isExplorable,
publicKey: this.renderKey(user, keypair, '#main-key'), publicKey: this.renderKey(user, keypair, '#main-key'),
isCat: user.isCat, isCat: user.isCat,
hideOnlineStatus: user.hideOnlineStatus,
noindex: user.noindex, noindex: user.noindex,
indexable: !user.noindex, indexable: !user.noindex,
enableRss: user.enableRss,
speakAsCat: user.speakAsCat, speakAsCat: user.speakAsCat,
attachment: attachment.length ? attachment : undefined, attachment: attachment.length ? attachment : undefined,
}; };

View file

@ -567,8 +567,10 @@ const extension_context_definition = {
speakAsCat: 'firefish:speakAsCat', speakAsCat: 'firefish:speakAsCat',
// Sharkey // Sharkey
sharkey: 'https://joinsharkey.org/ns#', sharkey: 'https://joinsharkey.org/ns#',
hideOnlineStatus: 'sharkey:hideOnlineStatus',
backgroundUrl: 'sharkey:backgroundUrl', backgroundUrl: 'sharkey:backgroundUrl',
listenbrainz: 'sharkey:listenbrainz', listenbrainz: 'sharkey:listenbrainz',
enableRss: 'sharkey:enableRss',
// vcard // vcard
vcard: 'http://www.w3.org/2006/vcard/ns#', vcard: 'http://www.w3.org/2006/vcard/ns#',
} satisfies Context; } satisfies Context;

View file

@ -391,10 +391,13 @@ export class ApPersonService implements OnModuleInit {
lastFetchedAt: new Date(), lastFetchedAt: new Date(),
name: truncate(person.name, nameLength), name: truncate(person.name, nameLength),
noindex: (person as any).noindex ?? false, noindex: (person as any).noindex ?? false,
enableRss: person.enableRss === true,
isLocked: person.manuallyApprovesFollowers, isLocked: person.manuallyApprovesFollowers,
movedToUri: person.movedTo, movedToUri: person.movedTo,
movedAt: person.movedTo ? new Date() : null, movedAt: person.movedTo ? new Date() : null,
alsoKnownAs: person.alsoKnownAs, alsoKnownAs: person.alsoKnownAs,
// We use "!== false" to handle incorrect types, missing / null values, and "default to true" logic.
hideOnlineStatus: person.hideOnlineStatus !== false,
isExplorable: person.discoverable, isExplorable: person.discoverable,
username: person.preferredUsername, username: person.preferredUsername,
approved: true, approved: true,
@ -593,9 +596,12 @@ export class ApPersonService implements OnModuleInit {
isCat: (person as any).isCat === true, isCat: (person as any).isCat === true,
speakAsCat: (person as any).speakAsCat != null ? (person as any).speakAsCat === true : (person as any).isCat === true, speakAsCat: (person as any).speakAsCat != null ? (person as any).speakAsCat === true : (person as any).isCat === true,
noindex: (person as any).noindex ?? false, noindex: (person as any).noindex ?? false,
enableRss: person.enableRss === true,
isLocked: person.manuallyApprovesFollowers, isLocked: person.manuallyApprovesFollowers,
movedToUri: person.movedTo ?? null, movedToUri: person.movedTo ?? null,
alsoKnownAs: person.alsoKnownAs ?? null, alsoKnownAs: person.alsoKnownAs ?? null,
// We use "!== false" to handle incorrect types, missing / null values, and "default to true" logic.
hideOnlineStatus: person.hideOnlineStatus !== false,
isExplorable: person.discoverable, isExplorable: person.discoverable,
...(await this.resolveAvatarAndBanner(exist, person.icon, person.image, person.backgroundUrl).catch(() => ({}))), ...(await this.resolveAvatarAndBanner(exist, person.icon, person.image, person.backgroundUrl).catch(() => ({}))),
} as Partial<MiRemoteUser> & Pick<MiRemoteUser, 'isBot' | 'isCat' | 'speakAsCat' | 'isLocked' | 'movedToUri' | 'alsoKnownAs' | 'isExplorable'>; } as Partial<MiRemoteUser> & Pick<MiRemoteUser, 'isBot' | 'isCat' | 'speakAsCat' | 'isLocked' | 'movedToUri' | 'alsoKnownAs' | 'isExplorable'>;

View file

@ -218,7 +218,9 @@ export interface IActor extends IObject {
}; };
'vcard:bday'?: string; 'vcard:bday'?: string;
'vcard:Address'?: string; 'vcard:Address'?: string;
hideOnlineStatus?: boolean;
noindex?: boolean; noindex?: boolean;
enableRss?: boolean;
listenbrainz?: string; listenbrainz?: string;
backgroundUrl?: string; backgroundUrl?: string;
} }

View file

@ -539,6 +539,7 @@ export class UserEntityService implements OnModuleInit {
isBot: user.isBot, isBot: user.isBot,
isCat: user.isCat, isCat: user.isCat,
noindex: user.noindex, noindex: user.noindex,
enableRss: user.enableRss,
isSilenced: user.isSilenced || this.roleService.getUserPolicies(user.id).then(r => !r.canPublicNote), isSilenced: user.isSilenced || this.roleService.getUserPolicies(user.id).then(r => !r.canPublicNote),
speakAsCat: user.speakAsCat ?? false, speakAsCat: user.speakAsCat ?? false,
approved: user.approved, approved: user.approved,

View file

@ -32,7 +32,7 @@ export class MiUser {
public lastActiveDate: Date | null; public lastActiveDate: Date | null;
@Column('boolean', { @Column('boolean', {
default: false, default: true,
}) })
public hideOnlineStatus: boolean; public hideOnlineStatus: boolean;
@ -328,6 +328,17 @@ export class MiUser {
}) })
public signupReason: string | null; public signupReason: string | null;
/**
* True if profile RSS feeds are enabled for this user.
* Enabled by default (opt-out) for existing users, to avoid breaking any existing feeds.
* Disabled by default (opt-in) for newly created users, for privacy.
*/
@Column('boolean', {
name: 'enable_rss',
default: true,
})
public enableRss: boolean;
constructor(data: Partial<MiUser>) { constructor(data: Partial<MiUser>) {
if (data == null) return; if (data == null) return;

View file

@ -130,6 +130,10 @@ export const packedUserLiteSchema = {
type: 'boolean', type: 'boolean',
nullable: false, optional: false, nullable: false, optional: false,
}, },
enableRss: {
type: 'boolean',
nullable: false, optional: false,
},
isBot: { isBot: {
type: 'boolean', type: 'boolean',
nullable: false, optional: true, nullable: false, optional: true,

View file

@ -198,6 +198,7 @@ export const paramDef = {
requireSigninToViewContents: { type: 'boolean' }, requireSigninToViewContents: { type: 'boolean' },
makeNotesFollowersOnlyBefore: { type: 'integer', nullable: true }, makeNotesFollowersOnlyBefore: { type: 'integer', nullable: true },
makeNotesHiddenBefore: { type: 'integer', nullable: true }, makeNotesHiddenBefore: { type: 'integer', nullable: true },
enableRss: { type: 'boolean' },
isBot: { type: 'boolean' }, isBot: { type: 'boolean' },
isCat: { type: 'boolean' }, isCat: { type: 'boolean' },
speakAsCat: { type: 'boolean' }, speakAsCat: { type: 'boolean' },
@ -352,6 +353,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (typeof ps.hideOnlineStatus === 'boolean') updates.hideOnlineStatus = ps.hideOnlineStatus; if (typeof ps.hideOnlineStatus === 'boolean') updates.hideOnlineStatus = ps.hideOnlineStatus;
if (typeof ps.publicReactions === 'boolean') profileUpdates.publicReactions = ps.publicReactions; if (typeof ps.publicReactions === 'boolean') profileUpdates.publicReactions = ps.publicReactions;
if (typeof ps.noindex === 'boolean') updates.noindex = ps.noindex; if (typeof ps.noindex === 'boolean') updates.noindex = ps.noindex;
if (typeof ps.enableRss === 'boolean') updates.enableRss = ps.enableRss;
if (typeof ps.isBot === 'boolean') updates.isBot = ps.isBot; if (typeof ps.isBot === 'boolean') updates.isBot = ps.isBot;
if (typeof ps.carefulBot === 'boolean') profileUpdates.carefulBot = ps.carefulBot; if (typeof ps.carefulBot === 'boolean') profileUpdates.carefulBot = ps.carefulBot;
if (typeof ps.autoAcceptFollowed === 'boolean') profileUpdates.autoAcceptFollowed = ps.autoAcceptFollowed; if (typeof ps.autoAcceptFollowed === 'boolean') profileUpdates.autoAcceptFollowed = ps.autoAcceptFollowed;
@ -619,12 +621,15 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// these two methods need to be kept in sync with // these two methods need to be kept in sync with
// `ApRendererService.renderPerson` // `ApRendererService.renderPerson`
private userNeedsPublishing(oldUser: MiLocalUser, newUser: Partial<MiUser>): boolean { private userNeedsPublishing(oldUser: MiLocalUser, newUser: Partial<MiUser>): boolean {
for (const field of ['avatarId', 'bannerId', 'backgroundId', 'isBot', 'username', 'name', 'isLocked', 'isExplorable', 'isCat', 'noindex', 'speakAsCat', 'movedToUri', 'alsoKnownAs'] as (keyof MiUser)[]) { const basicFields: (keyof MiUser)[] = ['avatarId', 'bannerId', 'backgroundId', 'isBot', 'username', 'name', 'isLocked', 'isExplorable', 'isCat', 'noindex', 'speakAsCat', 'movedToUri', 'alsoKnownAs', 'hideOnlineStatus', 'enableRss'];
for (const field of basicFields) {
if ((field in newUser) && oldUser[field] !== newUser[field]) { if ((field in newUser) && oldUser[field] !== newUser[field]) {
return true; return true;
} }
} }
for (const arrayField of ['emojis', 'tags'] as (keyof MiUser)[]) {
const arrayFields: (keyof MiUser)[] = ['emojis', 'tags'];
for (const arrayField of arrayFields) {
if ((arrayField in newUser) !== (arrayField in oldUser)) { if ((arrayField in newUser) !== (arrayField in oldUser)) {
return true; return true;
} }
@ -634,7 +639,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (!Array.isArray(oldArray) || !Array.isArray(newArray)) { if (!Array.isArray(oldArray) || !Array.isArray(newArray)) {
return true; return true;
} }
if (oldArray.join("\0") !== newArray.join("\0")) { if (oldArray.join('\0') !== newArray.join('\0')) {
return true; return true;
} }
} }
@ -642,12 +647,15 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} }
private profileNeedsPublishing(oldProfile: MiUserProfile, newProfile: Partial<MiUserProfile>): boolean { private profileNeedsPublishing(oldProfile: MiUserProfile, newProfile: Partial<MiUserProfile>): boolean {
for (const field of ['description', 'followedMessage', 'birthday', 'location', 'listenbrainz'] as (keyof MiUserProfile)[]) { const basicFields: (keyof MiUserProfile)[] = ['description', 'followedMessage', 'birthday', 'location', 'listenbrainz'];
for (const field of basicFields) {
if ((field in newProfile) && oldProfile[field] !== newProfile[field]) { if ((field in newProfile) && oldProfile[field] !== newProfile[field]) {
return true; return true;
} }
} }
for (const arrayField of ['fields'] as (keyof MiUserProfile)[]) {
const arrayFields: (keyof MiUserProfile)[] = ['fields'];
for (const arrayField of arrayFields) {
if ((arrayField in newProfile) !== (arrayField in oldProfile)) { if ((arrayField in newProfile) !== (arrayField in oldProfile)) {
return true; return true;
} }
@ -657,7 +665,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (!Array.isArray(oldArray) || !Array.isArray(newArray)) { if (!Array.isArray(oldArray) || !Array.isArray(newArray)) {
return true; return true;
} }
if (oldArray.join("\0") !== newArray.join("\0")) { if (oldArray.join('\0') !== newArray.join('\0')) {
return true; return true;
} }
} }

View file

@ -530,6 +530,7 @@ export class ClientServerService {
usernameLower: username.toLowerCase(), usernameLower: username.toLowerCase(),
host: host ?? IsNull(), host: host ?? IsNull(),
isSuspended: false, isSuspended: false,
enableRss: true,
}); });
return user && await this.feedService.packFeed(user); return user && await this.feedService.packFeed(user);

View file

@ -14,7 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</p> </p>
<footer> <footer>
<img class="icon" :src="flash.user.avatarUrl"/> <img class="icon" :src="flash.user.avatarUrl"/>
<p>{{ userName(flash.user) }}</p> <MkUserName :key="flash.user.id" :user="flash.user"/>
</footer> </footer>
</article> </article>
</MkA> </MkA>
@ -23,7 +23,6 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { } from 'vue'; import { } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { userName } from '@/filters/user.js';
const props = defineProps<{ const props = defineProps<{
flash: Misskey.entities.Flash; flash: Misskey.entities.Flash;

View file

@ -21,7 +21,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<p v-if="page.summary" :title="page.summary">{{ page.summary.length > 85 ? page.summary.slice(0, 85) + '…' : page.summary }}</p> <p v-if="page.summary" :title="page.summary">{{ page.summary.length > 85 ? page.summary.slice(0, 85) + '…' : page.summary }}</p>
<footer> <footer>
<img v-if="page.user.avatarUrl" class="icon" :src="page.user.avatarUrl"/> <img v-if="page.user.avatarUrl" class="icon" :src="page.user.avatarUrl"/>
<p>{{ userName(page.user) }}</p> <MkUserName :key="page.user.id" :user="page.user"/>
</footer> </footer>
</article> </article>
</MkA> </MkA>
@ -30,7 +30,6 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { } from 'vue'; import { } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { userName } from '@/filters/user.js';
import MediaImage from '@/components/MkMediaImage.vue'; import MediaImage from '@/components/MkMediaImage.vue';
const props = defineProps<{ const props = defineProps<{

View file

@ -44,7 +44,7 @@ import MkFolder from '@/components/MkFolder.vue';
import { misskeyApi } from '@/scripts/misskey-api.js'; import { misskeyApi } from '@/scripts/misskey-api.js';
const isLocked = ref(false); const isLocked = ref(false);
const hideOnlineStatus = ref(false); const hideOnlineStatus = ref(true);
const noCrawle = ref(false); const noCrawle = ref(false);
watch([isLocked, hideOnlineStatus, noCrawle], () => { watch([isLocked, hideOnlineStatus, noCrawle], () => {

View file

@ -43,6 +43,10 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts.makeExplorable }} {{ i18n.ts.makeExplorable }}
<template #caption>{{ i18n.ts.makeExplorableDescription }}</template> <template #caption>{{ i18n.ts.makeExplorableDescription }}</template>
</MkSwitch> </MkSwitch>
<MkSwitch v-model="enableRss" @update:modelValue="save()">
{{ i18n.ts.enableRss }}
<template #caption>{{ i18n.ts.enableRssDescription }}</template>
</MkSwitch>
<FormSection> <FormSection>
<template #label>{{ i18n.ts.lockdown }}<span class="_beta">{{ i18n.ts.beta }}</span></template> <template #label>{{ i18n.ts.lockdown }}<span class="_beta">{{ i18n.ts.beta }}</span></template>
@ -180,6 +184,7 @@ const isLocked = ref($i.isLocked);
const autoAcceptFollowed = ref($i.autoAcceptFollowed); const autoAcceptFollowed = ref($i.autoAcceptFollowed);
const noCrawle = ref($i.noCrawle); const noCrawle = ref($i.noCrawle);
const noindex = ref($i.noindex); const noindex = ref($i.noindex);
const enableRss = ref($i.enableRss);
const isExplorable = ref($i.isExplorable); const isExplorable = ref($i.isExplorable);
const requireSigninToViewContents = ref($i.requireSigninToViewContents ?? false); const requireSigninToViewContents = ref($i.requireSigninToViewContents ?? false);
const makeNotesFollowersOnlyBefore = ref($i.makeNotesFollowersOnlyBefore ?? null); const makeNotesFollowersOnlyBefore = ref($i.makeNotesFollowersOnlyBefore ?? null);
@ -237,6 +242,7 @@ function save() {
autoAcceptFollowed: !!autoAcceptFollowed.value, autoAcceptFollowed: !!autoAcceptFollowed.value,
noCrawle: !!noCrawle.value, noCrawle: !!noCrawle.value,
noindex: !!noindex.value, noindex: !!noindex.value,
enableRss: !!enableRss.value,
isExplorable: !!isExplorable.value, isExplorable: !!isExplorable.value,
requireSigninToViewContents: !!requireSigninToViewContents.value, requireSigninToViewContents: !!requireSigninToViewContents.value,
makeNotesFollowersOnlyBefore: makeNotesFollowersOnlyBefore.value, makeNotesFollowersOnlyBefore: makeNotesFollowersOnlyBefore.value,

View file

@ -3931,6 +3931,7 @@ export type components = {
/** @default false */ /** @default false */
isSystem?: boolean; isSystem?: boolean;
noindex: boolean; noindex: boolean;
enableRss: boolean;
isBot?: boolean; isBot?: boolean;
isCat?: boolean; isCat?: boolean;
speakAsCat?: boolean; speakAsCat?: boolean;
@ -21482,6 +21483,7 @@ export type operations = {
requireSigninToViewContents?: boolean; requireSigninToViewContents?: boolean;
makeNotesFollowersOnlyBefore?: number | null; makeNotesFollowersOnlyBefore?: number | null;
makeNotesHiddenBefore?: number | null; makeNotesHiddenBefore?: number | null;
enableRss?: boolean;
isBot?: boolean; isBot?: boolean;
isCat?: boolean; isCat?: boolean;
speakAsCat?: boolean; speakAsCat?: boolean;

View file

@ -88,6 +88,8 @@ searchEngineCustomURIDescription: "The custom URI must be input in the format li
searchEngineCusomURI: "Custom URI" searchEngineCusomURI: "Custom URI"
makeIndexable: "Make public notes not indexable" makeIndexable: "Make public notes not indexable"
makeIndexableDescription: "Stop note search from indexing your public notes." makeIndexableDescription: "Stop note search from indexing your public notes."
enableRss: "Enable RSS feed"
enableRssDescription: "Generate an RSS feed containing your basic profile details and public notes. Users can subscribe to the feed without a follow request or approval."
sendErrorReportsDescription: "When turned on, detailed error information will be shared with Sharkey when a problem occurs, helping to improve the quality of Sharkey.\nThis will include information such the version of your OS, what browser you're using, your activity in Sharkey, etc." sendErrorReportsDescription: "When turned on, detailed error information will be shared with Sharkey when a problem occurs, helping to improve the quality of Sharkey.\nThis will include information such the version of your OS, what browser you're using, your activity in Sharkey, etc."
noInquiryUrlWarning: "Contact URL is not set." noInquiryUrlWarning: "Contact URL is not set."
misskeyUpdated: "Sharkey has been updated!" misskeyUpdated: "Sharkey has been updated!"