モロヘイヤ使用の場合等、タグの追記はオフにできるように。

This commit is contained in:
Tatsuya Koishi 2024-01-28 11:14:44 +09:00
parent 36cfe398d2
commit f216585421
8 changed files with 24 additions and 20 deletions

View file

@ -194,5 +194,6 @@ signToActivityPubGet: true
# Upload or download file size limits (bytes)
#maxFileSize: 262144000
tagging:
defaultTag: null
defaultTag:
tag: null
append: true

View file

@ -226,5 +226,6 @@ signToActivityPubGet: true
# PID File of master process
#pidFile: /tmp/misskey.pid
tagging:
defaultTag: null
defaultTag:
tag: null
append: true

View file

@ -56,8 +56,9 @@ type Source = {
index: string;
scope?: 'local' | 'global' | string[];
};
tagging: {
defaultTag: string;
defaultTag: {
tag: string;
append: boolean;
};
proxy?: string;
@ -127,8 +128,9 @@ export type Config = {
index: string;
scope?: 'local' | 'global' | string[];
} | undefined;
tagging: {
defaultTag: string;
defaultTag: {
tag: string;
append: boolean;
};
proxy: string | undefined;
proxySmtp: string | undefined;
@ -267,7 +269,7 @@ export function loadConfig(): Config {
perUserNotificationsMaxCount: config.perUserNotificationsMaxCount ?? 500,
deactivateAntennaThreshold: config.deactivateAntennaThreshold ?? (1000 * 60 * 60 * 24 * 7),
pidFile: config.pidFile,
tagging: config.tagging,
defaultTag: config.defaultTag,
};
}

View file

@ -320,10 +320,10 @@ export class NoteCreateService implements OnApplicationShutdown {
data.localOnly = true;
}
// デフォルトハッシュタグ処理
if (['public', 'home'].includes(data.visibility)) {
if (this.config.tagging?.defaultTag != null) {
const tag = `#${this.config.tagging?.defaultTag}`;
// デフォルトハッシュタグを本文末尾に書き足す
if (this.config.defaultTag?.append && ['public', 'home'].includes(data.visibility)) {
if (this.config.defaultTag?.tag != null) {
const tag = `#${this.config.defaultTag?.tag}`;
if (String(data.text).match(tag)) {
data.text = `${data.text}\n\n${tag}`;
}
@ -923,10 +923,10 @@ export class NoteCreateService implements OnApplicationShutdown {
}
}
// デフォルトハッシュタグ
if (this.config.tagging?.defaultTag != null) {
// デフォルトハッシュタグを含む投稿は、リモートであってもローカルタイムラインに含める
if (this.config.defaultTag?.tag != null) {
const noteTags = note.tags ? note.tags.map((t: string) => t.toLowerCase()) : [];
if (note.visibility === 'public' && noteTags.includes(normalizeForSearch(this.config.tagging?.defaultTag))) {
if (note.visibility === 'public' && noteTags.includes(normalizeForSearch(this.config.defaultTag?.tag))) {
this.fanoutTimelineService.push('localTimelineWithReplies', note.id, 300, r);
this.fanoutTimelineService.push('localTimeline', note.id, 1000, r);
if (note.fileIds.length > 0) {

View file

@ -201,7 +201,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
const config = loadConfig();
const defaultTag: string | null = config.tagging?.defaultTag;
const defaultTag: string | null = config.defaultTag?.tag;
if (defaultTag == null) {
qb.orWhere('(note.visibility = \'public\') AND (note.userHost IS NULL)');
} else {

View file

@ -152,7 +152,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
withReplies: boolean,
}, me: MiLocalUser | null) {
const config = loadConfig();
const defaultTag: string | null = config.tagging?.defaultTag;
const defaultTag: string | null = config.defaultTag?.tag;
const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'),
ps.sinceId, ps.untilId)
.andWhere(new Brackets(qb => {

View file

@ -47,7 +47,7 @@ class HybridTimelineChannel extends Channel {
this.withReplies = params.withReplies ?? false;
this.withFiles = params.withFiles ?? false;
const config = loadConfig();
this.defaultTag = config.tagging?.defaultTag;
this.defaultTag = config.defaultTag?.tag;
// Subscribe events
this.subscriber.on('notesStream', this.onNote);

View file

@ -45,7 +45,7 @@ class LocalTimelineChannel extends Channel {
this.withReplies = params.withReplies ?? false;
this.withFiles = params.withFiles ?? false;
const config = loadConfig();
this.defaultTag = config.tagging?.defaultTag;
this.defaultTag = config.defaultTag?.tag;
// Subscribe events
this.subscriber.on('notesStream', this.onNote);