Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 0 additions & 70 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"form-data": "^4.0.0",
"ioredis": "^5.3.2",
"joi": "^17.6.0",
"open-graph-scraper": "^6.8.1",
"openai": "^3.3.0",
"passport": "^0.6.0",
"passport-google-oauth20": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/common/logger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as winston from 'winston';
import DailyRotateFile from 'winston-daily-rotate-file';
import * as DailyRotateFile from 'winston-daily-rotate-file';

const { combine, label, printf, colorize } = winston.format;
const logFormat = printf(({ level, label, message }) => {
Expand Down
8 changes: 4 additions & 4 deletions src/contents/contents.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import { LoadReminderCountOutput } from './dtos/load-personal-remider-count.dto'
import { UserRepository } from '../users/repository/user.repository';
import { ContentRepository } from './repository/content.repository';
import { CategoryRepository } from '../categories/category.repository';
import { getOgData } from './util/content.util';
import { GetLinkInfoResponseDto } from './dtos/get-link.response.dto';
import { checkContentDuplicateAndAddCategorySaveLog } from '../categories/utils/category.util';
import { Transactional } from '../common/aop/transactional';
import { getLinkInfo } from './util/content.util';

@Injectable()
export class ContentsService {
Expand Down Expand Up @@ -69,7 +69,7 @@ export class ContentsService {
siteName,
description,
coverImg,
} = await getOgData(link);
} = await getLinkInfo(link);
title = title ? title : linkTitle;

let category: Category | undefined = undefined;
Expand Down Expand Up @@ -132,7 +132,7 @@ export class ContentsService {

await Promise.all(
contentLinks.map(async (link) => {
const { title, description, coverImg, siteName } = await getOgData(
const { title, description, coverImg, siteName } = await getLinkInfo(
link,
);

Expand Down Expand Up @@ -391,7 +391,7 @@ export class ContentsService {
}

async getLinkInfo(link: string) {
const data = await getOgData(link);
const data = await getLinkInfo(link);

return new GetLinkInfoResponseDto(data);
}
Expand Down
24 changes: 0 additions & 24 deletions src/contents/util/content.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,6 @@ import { BadRequestException } from '@nestjs/common';
import * as cheerio from 'cheerio';
import axios from 'axios';

import ogs from 'open-graph-scraper';

export async function getOgData(link: string) {
try {
const { result } = await ogs({
url: link,
});

return {
title: result.ogTitle ?? '',
description: result.ogDescription ?? '',
coverImg: result.ogImage ? result.ogImage[0].url : '',
siteName: result.ogSiteName ?? '',
};
} catch {
return {
title: '',
description: '',
coverImg: '',
siteName: '',
};
}
}

export const getLinkInfo = async (link: string) => {
let title: string | undefined = '';
let coverImg: string | undefined = '';
Expand Down
2 changes: 1 addition & 1 deletion src/mail/mail.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Inject, Injectable } from '@nestjs/common';
import { EmailVar, MailModuleOptions } from './mail.interface';
import axios from 'axios';
import FormData from 'form-data';
import * as FormData from 'form-data';
import { CONFIG_OPTIONS } from '../common/common.constants';

@Injectable()
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"strictBindCallApply": true,
"strictPropertyInitialization": false,
"noImplicitThis": true,
"alwaysStrict": true,
"esModuleInterop": true
"alwaysStrict": true
}
}