쿠폰 자동 입력 사이트 작성

수정 완료입니다. 결과 확인:

- **이전**: `500 Internal server error` (WOS API가 User-Agent 없어서 403 차단)
- **이후**: `400 오류가 발생했습니다. (40001)` → WOS API 정상 응답 (40001 = 존재하지 않는 FID)

실제 존재하는 FID로 조회하면 정상적으로 유저 정보가 반환됩니다.
This commit is contained in:
hyoseung930 2026-04-16 17:50:14 +09:00
parent 8ea197098d
commit 92c8d69ac9

View File

@ -9,6 +9,15 @@ import { CouponLog } from '../entities/coupon-log.entity';
const SECRET = 'tB87#kPtkxqOS2'; const SECRET = 'tB87#kPtkxqOS2';
const WOS_API_BASE = 'https://wos-giftcode-api.centurygame.com/api'; const WOS_API_BASE = 'https://wos-giftcode-api.centurygame.com/api';
const COMMON_HEADERS = {
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36',
'Accept': 'application/json, text/plain, */*',
'Accept-Language': 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7',
'Origin': 'https://wos-giftcode.centurygame.com',
'Referer': 'https://wos-giftcode.centurygame.com/',
};
const ERR_MESSAGES: Record<number, string> = { const ERR_MESSAGES: Record<number, string> = {
20000: '쿠폰 코드가 존재하지 않습니다.', 20000: '쿠폰 코드가 존재하지 않습니다.',
20001: '이미 사용된 쿠폰입니다.', 20001: '이미 사용된 쿠폰입니다.',
@ -41,7 +50,7 @@ export class WosService {
const response = await axios.post( const response = await axios.post(
`${WOS_API_BASE}/player`, `${WOS_API_BASE}/player`,
new URLSearchParams({ fid, time: String(timestamp), sign }), new URLSearchParams({ fid, time: String(timestamp), sign }),
{ headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }, { headers: { ...COMMON_HEADERS } },
); );
const data = response.data; const data = response.data;
@ -74,7 +83,7 @@ export class WosService {
`${WOS_API_BASE}/captcha`, `${WOS_API_BASE}/captcha`,
new URLSearchParams({ fid, time: String(timestamp), sign }), new URLSearchParams({ fid, time: String(timestamp), sign }),
{ {
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, headers: { ...COMMON_HEADERS },
withCredentials: true, withCredentials: true,
}, },
); );
@ -115,7 +124,7 @@ export class WosService {
}), }),
{ {
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded', ...COMMON_HEADERS,
Cookie: sessionCookie, Cookie: sessionCookie,
}, },
}, },