Skip to content

Commit

Permalink
Merge pull request #2 from bettaku/taiyme
Browse files Browse the repository at this point in the history
feat: vみみソーシャルTL (#2)
  • Loading branch information
DA-TENSHI authored Sep 30, 2024
2 parents ab3099c + 57a12a5 commit f5194d0
Show file tree
Hide file tree
Showing 23 changed files with 677 additions and 16 deletions.
20 changes: 18 additions & 2 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4988,6 +4988,10 @@ export interface Locale extends ILocale {
* センシティブなファイルを含むノートを表示
*/
readonly "withSensitive": string;
/**
* ローカルのみのノートを表示
*/
readonly "showLocalOnlyInTimeline": string;
/**
* {name}のセンシティブなファイルを含む投稿
*/
Expand Down Expand Up @@ -5374,6 +5378,10 @@ export interface Locale extends ILocale {
* VirtualKemomimiリレーに参加しているサーバーからの投稿を見られます。
*/
readonly "vmimi": string;
/**
* Vみみタイムラインの投稿とホームタイムラインの投稿が両方表示されます。
*/
readonly "vmimiHybrid": string;
/**
* それぞれのタイムラインは、画面上部でいつでも切り替えられます。
*/
Expand Down Expand Up @@ -5512,9 +5520,13 @@ export interface Locale extends ILocale {
*/
readonly "global": string;
/**
* Vミミタイムラインでは、VirtualKemomimiリレーに参加しているサーバーからの投稿を見られます。
* Vみみタイムラインでは、VirtualKemomimiリレーに参加しているサーバーからの投稿を見られます。
*/
readonly "vmimi": string;
/**
* Vみみソーシャルタイムラインでは、Vみみタイムラインとホームタイムラインの両方の投稿を表示することができます。
*/
readonly "vmimiHybrid": string;
};
readonly "_serverRules": {
/**
Expand Down Expand Up @@ -8802,9 +8814,13 @@ export interface Locale extends ILocale {
*/
readonly "global": string;
/**
* Vミミ
* Vみみ
*/
readonly "vmimi": string;
/**
* Vみみソーシャル
*/
readonly "vmimiHybrid": string;
};
readonly "_play": {
/**
Expand Down
8 changes: 6 additions & 2 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,7 @@ lastNDays: "直近{n}日"
backToTitle: "タイトルへ"
hemisphere: "お住まいの地域"
withSensitive: "センシティブなファイルを含むノートを表示"
showLocalOnlyInTimeline: "ローカルのみのノートを表示"
userSaysSomethingSensitive: "{name}のセンシティブなファイルを含む投稿"
enableHorizontalSwipe: "スワイプしてタブを切り替える"
loading: "読み込み中"
Expand Down Expand Up @@ -1351,6 +1352,7 @@ _initialTutorial:
social: "ホームタイムラインとローカルタイムラインの投稿が両方表示されます。"
global: "接続している他のすべてのサーバーからの投稿を見られます。"
vmimi: "VirtualKemomimiリレーに参加しているサーバーからの投稿を見られます。"
vmimiHybrid: "Vみみタイムラインの投稿とホームタイムラインの投稿が両方表示されます。"
description2: "それぞれのタイムラインは、画面上部でいつでも切り替えられます。"
description3: "その他にも、リストタイムラインやチャンネルタイムラインなどがあります。詳しくは{link}をご覧ください。"
_postNote:
Expand Down Expand Up @@ -1390,7 +1392,8 @@ _timelineDescription:
local: "ローカルタイムラインでは、このサーバーにいるユーザー全員の投稿を見られます。"
social: "ソーシャルタイムラインには、ホームタイムラインとローカルタイムラインの投稿が両方表示されます。"
global: "グローバルタイムラインでは、接続している他のすべてのサーバーからの投稿を見られます。"
vmimi: "Vミミタイムラインでは、VirtualKemomimiリレーに参加しているサーバーからの投稿を見られます。"
vmimi: "Vみみタイムラインでは、VirtualKemomimiリレーに参加しているサーバーからの投稿を見られます。"
vmimiHybrid: "Vみみソーシャルタイムラインでは、Vみみタイムラインとホームタイムラインの両方の投稿を表示することができます。"

_serverRules:
description: "新規登録前に表示する、サーバーの簡潔なルールを設定します。内容は利用規約の要約とすることを推奨します。"
Expand Down Expand Up @@ -2322,7 +2325,8 @@ _timelines:
local: "ローカル"
social: "ソーシャル"
global: "グローバル"
vmimi: "Vミミ"
vmimi: "Vみみ"
vmimiHybrid: "Vみみソーシャル"

_play:
new: "Playの作成"
Expand Down
6 changes: 6 additions & 0 deletions packages/backend/src/core/FanoutTimelineService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ export type FanoutTimelineName =
// role timelines
| `roleTimeline:${string}` // any notes are included

// vmimi relay timeline
| 'vmimiRelayTimeline' // replies not included
| 'vmimiRelayTimelineWithFiles' // only notes with files are included
| 'vmimiRelayTimelineWithReplies' // only replies are included
| `vmimiRelayTimelineWithReplyTo:${string}` // Only replies to specific local user are included. Parameter is reply user id.

@Injectable()
export class FanoutTimelineService {
constructor(
Expand Down
16 changes: 16 additions & 0 deletions packages/backend/src/core/NoteCreateService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import { UserBlockingService } from '@/core/UserBlockingService.js';
import { isReply } from '@/misc/is-reply.js';
import { trackPromise } from '@/misc/promise-tracker.js';
import { IdentifiableError } from '@/misc/identifiable-error.js';
import { VmimiRelayService } from '@/core/VmimiRelayService.js';

type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';

Expand Down Expand Up @@ -218,6 +219,7 @@ export class NoteCreateService implements OnApplicationShutdown {
private instanceChart: InstanceChart,
private utilityService: UtilityService,
private userBlockingService: UserBlockingService,
private vmimiRelayService: VmimiRelayService,
) { }

@bindThis
Expand Down Expand Up @@ -956,6 +958,13 @@ export class NoteCreateService implements OnApplicationShutdown {
this.fanoutTimelineService.push(`localTimelineWithReplyTo:${note.replyUserId}`, note.id, 300 / 10, r);
}
}

if (note.visibility === 'public' && this.vmimiRelayService.isRelayedInstance(note.userHost) && !note.localOnly) {
this.fanoutTimelineService.push('vmimiRelayTimelineWithReplies', note.id, 300 / 10, r);
if (note.replyUserHost == null) {
this.fanoutTimelineService.push(`vmimiRelayTimelineWithReplyTo:${note.replyUserId}`, note.id, 300 / 10, r);
}
}
} else {
this.fanoutTimelineService.push(`userTimeline:${user.id}`, note.id, note.userHost == null ? meta.perLocalUserUserTimelineCacheMax : meta.perRemoteUserUserTimelineCacheMax, r);
if (note.fileIds.length > 0) {
Expand All @@ -968,6 +977,13 @@ export class NoteCreateService implements OnApplicationShutdown {
this.fanoutTimelineService.push('localTimelineWithFiles', note.id, 500, r);
}
}

if (note.visibility === 'public' && this.vmimiRelayService.isRelayedInstance(note.userHost) && !note.localOnly) {
this.fanoutTimelineService.push('vmimiRelayTimeline', note.id, 1000, r);
if (note.fileIds.length > 0) {
this.fanoutTimelineService.push('vmimiRelayTimelineWithFiles', note.id, 500, r);
}
}
}

if (Math.random() < 0.1) {
Expand Down
4 changes: 4 additions & 0 deletions packages/backend/src/server/ServerModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ import { HomeTimelineChannelService } from './api/stream/channels/home-timeline.
import { HybridTimelineChannelService } from './api/stream/channels/hybrid-timeline.js';
import { LocalTimelineChannelService } from './api/stream/channels/local-timeline.js';
import { VmimiRelayTimelineChannelService } from './api/stream/channels/vmimi-relay-timeline.js';
import { VmimiHybridTimelineChannelService } from './api/stream/channels/vmimi-hybrid-timeline.js';

import { QueueStatsChannelService } from './api/stream/channels/queue-stats.js';
import { ServerStatsChannelService } from './api/stream/channels/server-stats.js';
import { UserListChannelService } from './api/stream/channels/user-list.js';
Expand Down Expand Up @@ -89,6 +91,8 @@ import { ReversiGameChannelService } from './api/stream/channels/reversi-game.js
HybridTimelineChannelService,
LocalTimelineChannelService,
VmimiRelayTimelineChannelService,
VmimiHybridTimelineChannelService,

QueueStatsChannelService,
ServerStatsChannelService,
UserListChannelService,
Expand Down
4 changes: 4 additions & 0 deletions packages/backend/src/server/api/EndpointsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ import * as ep___notes_globalTimeline from './endpoints/notes/global-timeline.js
import * as ep___notes_hybridTimeline from './endpoints/notes/hybrid-timeline.js';
import * as ep___notes_localTimeline from './endpoints/notes/local-timeline.js';
import * as ep___notes_vmimiRelayTimeline from './endpoints/notes/vmimi-relay-timeline.js';
import * as ep___notes_vmimiHybridTimeline from './endpoints/notes/vmimi-hybrid-timeline.js';
import * as ep___notes_mentions from './endpoints/notes/mentions.js';
import * as ep___notes_polls_recommendation from './endpoints/notes/polls/recommendation.js';
import * as ep___notes_polls_vote from './endpoints/notes/polls/vote.js';
Expand Down Expand Up @@ -668,6 +669,7 @@ const $notes_favorites_delete: Provider = { provide: 'ep:notes/favorites/delete'
const $notes_featured: Provider = { provide: 'ep:notes/featured', useClass: ep___notes_featured.default };
const $notes_globalTimeline: Provider = { provide: 'ep:notes/global-timeline', useClass: ep___notes_globalTimeline.default };
const $notes_vmimiRelayTimeline: Provider = { provide: 'ep:notes/vmimi-relay-timeline', useClass: ep___notes_vmimiRelayTimeline.default };
const $notes_vmimiHybridTimeline: Provider = { provide: 'ep:notes/vmimi-hybrid-timeline', useClass: ep___notes_vmimiHybridTimeline.default };
const $notes_hybridTimeline: Provider = { provide: 'ep:notes/hybrid-timeline', useClass: ep___notes_hybridTimeline.default };
const $notes_localTimeline: Provider = { provide: 'ep:notes/local-timeline', useClass: ep___notes_localTimeline.default };
const $notes_mentions: Provider = { provide: 'ep:notes/mentions', useClass: ep___notes_mentions.default };
Expand Down Expand Up @@ -1058,6 +1060,7 @@ const $reversi_verify: Provider = { provide: 'ep:reversi/verify', useClass: ep__
$notes_hybridTimeline,
$notes_localTimeline,
$notes_vmimiRelayTimeline,
$notes_vmimiHybridTimeline,
$notes_mentions,
$notes_polls_recommendation,
$notes_polls_vote,
Expand Down Expand Up @@ -1440,6 +1443,7 @@ const $reversi_verify: Provider = { provide: 'ep:reversi/verify', useClass: ep__
$notes_hybridTimeline,
$notes_localTimeline,
$notes_vmimiRelayTimeline,
$notes_vmimiHybridTimeline,
$notes_mentions,
$notes_polls_recommendation,
$notes_polls_vote,
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/server/api/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ import * as ep___notes_globalTimeline from './endpoints/notes/global-timeline.js
import * as ep___notes_hybridTimeline from './endpoints/notes/hybrid-timeline.js';
import * as ep___notes_localTimeline from './endpoints/notes/local-timeline.js';
import * as ep___notes_vmimiRelayTimeline from './endpoints/notes/vmimi-relay-timeline.js';
import * as ep___notes_vmimiHybridTimeline from './endpoints/notes/vmimi-hybrid-timeline.js';
import * as ep___notes_mentions from './endpoints/notes/mentions.js';
import * as ep___notes_polls_recommendation from './endpoints/notes/polls/recommendation.js';
import * as ep___notes_polls_vote from './endpoints/notes/polls/vote.js';
Expand Down Expand Up @@ -674,6 +675,7 @@ const eps = [
['notes/hybrid-timeline', ep___notes_hybridTimeline],
['notes/local-timeline', ep___notes_localTimeline],
['notes/vmimi-relay-timeline', ep___notes_vmimiRelayTimeline],
['notes/vmimi-hybrid-timeline', ep___notes_vmimiHybridTimeline],
['notes/mentions', ep___notes_mentions],
['notes/polls/recommendation', ep___notes_polls_recommendation],
['notes/polls/vote', ep___notes_polls_vote],
Expand Down
Loading

0 comments on commit f5194d0

Please sign in to comment.