@@ -26,7 +26,7 @@ import { PageEntityService } from '@/core/entities/PageEntityService.js';
26
26
import { GalleryPostEntityService } from '@/core/entities/GalleryPostEntityService.js' ;
27
27
import { ClipEntityService } from '@/core/entities/ClipEntityService.js' ;
28
28
import { ChannelEntityService } from '@/core/entities/ChannelEntityService.js' ;
29
- import type { ChannelsRepository , ClipsRepository , FlashsRepository , GalleryPostsRepository , NotesRepository , PagesRepository , UserProfilesRepository , UsersRepository } from '@/models/index.js' ;
29
+ import type { ChannelsRepository , ClipsRepository , FlashsRepository , GalleryPostsRepository , Meta , NotesRepository , PagesRepository , UserProfilesRepository , UsersRepository } from '@/models/index.js' ;
30
30
import type Logger from '@/logger.js' ;
31
31
import { deepClone } from '@/misc/clone.js' ;
32
32
import { bindThis } from '@/decorators.js' ;
@@ -117,6 +117,18 @@ export class ClientServerService {
117
117
return ( res ) ;
118
118
}
119
119
120
+ @bindThis
121
+ private generateCommonPugData ( meta : Meta ) {
122
+ return {
123
+ instanceName : meta . name ?? 'Misskey' ,
124
+ icon : meta . iconUrl ,
125
+ themeColor : meta . themeColor ,
126
+ serverErrorImageUrl : meta . serverErrorImageUrl ?? 'https://xn--931a.moe/assets/error.jpg' ,
127
+ infoImageUrl : meta . infoImageUrl ?? 'https://xn--931a.moe/assets/info.jpg' ,
128
+ notFoundImageUrl : meta . notFoundImageUrl ?? 'https://xn--931a.moe/assets/not-found.jpg' ,
129
+ } ;
130
+ }
131
+
120
132
@bindThis
121
133
public createServer ( fastify : FastifyInstance , options : FastifyPluginOptions , done : ( err ?: Error ) => void ) {
122
134
fastify . register ( fastifyCookie , { } ) ;
@@ -341,12 +353,10 @@ export class ClientServerService {
341
353
reply . header ( 'Cache-Control' , 'public, max-age=30' ) ;
342
354
return await reply . view ( 'base' , {
343
355
img : meta . bannerUrl ,
344
- title : meta . name ?? 'Misskey' ,
345
- instanceName : meta . name ?? 'Misskey' ,
346
356
url : this . config . url ,
357
+ title : meta . name ?? 'Misskey' ,
347
358
desc : meta . description ,
348
- icon : meta . iconUrl ,
349
- themeColor : meta . themeColor ,
359
+ ...this . generateCommonPugData ( meta ) ,
350
360
} ) ;
351
361
} ;
352
362
@@ -431,9 +441,7 @@ export class ClientServerService {
431
441
user, profile, me,
432
442
avatarUrl : user . avatarUrl ?? this . userEntityService . getIdenticonUrl ( user ) ,
433
443
sub : request . params . sub ,
434
- instanceName : meta . name ?? 'Misskey' ,
435
- icon : meta . iconUrl ,
436
- themeColor : meta . themeColor ,
444
+ ...this . generateCommonPugData ( meta ) ,
437
445
} ) ;
438
446
} else {
439
447
// リモートユーザーなので
@@ -481,9 +489,7 @@ export class ClientServerService {
481
489
avatarUrl : _note . user . avatarUrl ,
482
490
// TODO: Let locale changeable by instance setting
483
491
summary : getNoteSummary ( _note ) ,
484
- instanceName : meta . name ?? 'Misskey' ,
485
- icon : meta . iconUrl ,
486
- themeColor : meta . themeColor ,
492
+ ...this . generateCommonPugData ( meta ) ,
487
493
} ) ;
488
494
} else {
489
495
return await renderBase ( reply ) ;
@@ -522,9 +528,7 @@ export class ClientServerService {
522
528
page : _page ,
523
529
profile,
524
530
avatarUrl : _page . user . avatarUrl ,
525
- instanceName : meta . name ?? 'Misskey' ,
526
- icon : meta . iconUrl ,
527
- themeColor : meta . themeColor ,
531
+ ...this . generateCommonPugData ( meta ) ,
528
532
} ) ;
529
533
} else {
530
534
return await renderBase ( reply ) ;
@@ -550,9 +554,7 @@ export class ClientServerService {
550
554
flash : _flash ,
551
555
profile,
552
556
avatarUrl : _flash . user . avatarUrl ,
553
- instanceName : meta . name ?? 'Misskey' ,
554
- icon : meta . iconUrl ,
555
- themeColor : meta . themeColor ,
557
+ ...this . generateCommonPugData ( meta ) ,
556
558
} ) ;
557
559
} else {
558
560
return await renderBase ( reply ) ;
@@ -578,9 +580,7 @@ export class ClientServerService {
578
580
clip : _clip ,
579
581
profile,
580
582
avatarUrl : _clip . user . avatarUrl ,
581
- instanceName : meta . name ?? 'Misskey' ,
582
- icon : meta . iconUrl ,
583
- themeColor : meta . themeColor ,
583
+ ...this . generateCommonPugData ( meta ) ,
584
584
} ) ;
585
585
} else {
586
586
return await renderBase ( reply ) ;
@@ -604,9 +604,7 @@ export class ClientServerService {
604
604
post : _post ,
605
605
profile,
606
606
avatarUrl : _post . user . avatarUrl ,
607
- instanceName : meta . name ?? 'Misskey' ,
608
- icon : meta . iconUrl ,
609
- themeColor : meta . themeColor ,
607
+ ...this . generateCommonPugData ( meta ) ,
610
608
} ) ;
611
609
} else {
612
610
return await renderBase ( reply ) ;
@@ -625,9 +623,7 @@ export class ClientServerService {
625
623
reply . header ( 'Cache-Control' , 'public, max-age=15' ) ;
626
624
return await reply . view ( 'channel' , {
627
625
channel : _channel ,
628
- instanceName : meta . name ?? 'Misskey' ,
629
- icon : meta . iconUrl ,
630
- themeColor : meta . themeColor ,
626
+ ...this . generateCommonPugData ( meta ) ,
631
627
} ) ;
632
628
} else {
633
629
return await renderBase ( reply ) ;
0 commit comments