mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-04 11:56:13 +02:00
test
This commit is contained in:
@@ -84,7 +84,7 @@ export class ClientServerService {
|
||||
) {
|
||||
}
|
||||
|
||||
async #manifestHandler(ctx: Koa.Context) {
|
||||
private async manifestHandler(ctx: Koa.Context) {
|
||||
// TODO
|
||||
//const res = structuredClone(manifest);
|
||||
const res = JSON.parse(JSON.stringify(manifest));
|
||||
@@ -264,7 +264,7 @@ export class ClientServerService {
|
||||
});
|
||||
|
||||
// Manifest
|
||||
router.get('/manifest.json', ctx => this.#manifestHandler(ctx));
|
||||
router.get('/manifest.json', ctx => this.manifestHandler(ctx));
|
||||
|
||||
router.get('/robots.txt', async ctx => {
|
||||
await send(ctx as any, '/robots.txt', {
|
||||
|
||||
@@ -12,7 +12,7 @@ import type Koa from 'koa';
|
||||
|
||||
@Injectable()
|
||||
export class UrlPreviewService {
|
||||
#logger: Logger;
|
||||
private logger: Logger;
|
||||
|
||||
constructor(
|
||||
@Inject(DI.config)
|
||||
@@ -25,10 +25,10 @@ export class UrlPreviewService {
|
||||
private httpRequestService: HttpRequestService,
|
||||
private loggerService: LoggerService,
|
||||
) {
|
||||
this.#logger = this.loggerService.getLogger('url-preview');
|
||||
this.logger = this.loggerService.getLogger('url-preview');
|
||||
}
|
||||
|
||||
#wrap(url?: string): string | null {
|
||||
private wrap(url?: string): string | null {
|
||||
return url != null
|
||||
? url.match(/^https?:\/\//)
|
||||
? `${this.config.url}/proxy/preview.webp?${query({
|
||||
@@ -54,7 +54,7 @@ export class UrlPreviewService {
|
||||
|
||||
const meta = await this.metaService.fetch();
|
||||
|
||||
this.#logger.info(meta.summalyProxy
|
||||
this.logger.info(meta.summalyProxy
|
||||
? `(Proxy) Getting preview of ${url}@${lang} ...`
|
||||
: `Getting preview of ${url}@${lang} ...`);
|
||||
|
||||
@@ -67,17 +67,17 @@ export class UrlPreviewService {
|
||||
lang: lang ?? 'ja-JP',
|
||||
});
|
||||
|
||||
this.#logger.succ(`Got preview of ${url}: ${summary.title}`);
|
||||
this.logger.succ(`Got preview of ${url}: ${summary.title}`);
|
||||
|
||||
summary.icon = this.#wrap(summary.icon);
|
||||
summary.thumbnail = this.#wrap(summary.thumbnail);
|
||||
summary.icon = this.wrap(summary.icon);
|
||||
summary.thumbnail = this.wrap(summary.thumbnail);
|
||||
|
||||
// Cache 7days
|
||||
ctx.set('Cache-Control', 'max-age=604800, immutable');
|
||||
|
||||
ctx.body = summary;
|
||||
} catch (err) {
|
||||
this.#logger.warn(`Failed to get preview of ${url}: ${err}`);
|
||||
this.logger.warn(`Failed to get preview of ${url}: ${err}`);
|
||||
ctx.status = 200;
|
||||
ctx.set('Cache-Control', 'max-age=86400, immutable');
|
||||
ctx.body = '{}';
|
||||
|
||||
Reference in New Issue
Block a user