Merge branch 'feature/202501107-all' into feature/20251103_cl_FX_VIDEO_01
This commit is contained in:
@@ -31,8 +31,8 @@
|
||||
<!-- 온스토브 카드 -->
|
||||
<div class="inspection-card inspection-stove-card">
|
||||
<h3 :class="{ 'text-center': !launchingStatus }" class="card-title text-base md:text-lg">
|
||||
<span v-if="!launchingStatus" v-dompurify-html="tm('Inspection_Game_During_Maintenance')"></span>
|
||||
<span v-else v-dompurify-html="tm('org_Inspection_During_Maintenance')"></span>
|
||||
<span v-if="!launchingStatus" v-dompurify-html="inspectionGameDuringMaintenance"></span>
|
||||
<span v-else v-dompurify-html="orgInspectionDuringMaintenance"></span>
|
||||
</h3>
|
||||
<div class="button-group justify-center">
|
||||
<!-- <a
|
||||
@@ -121,10 +121,20 @@ const resultGetMultilingual = await useGetMultilingual({
|
||||
baseApiUrl: translationApi,
|
||||
fileName: 'test_common_inspection.json'
|
||||
})
|
||||
const { tm, locale } = useI18n({
|
||||
const i18n = useI18n({
|
||||
useScope: 'local',
|
||||
messages: Object(resultGetMultilingual.value.multilingual)
|
||||
})
|
||||
const { locale } = i18n
|
||||
|
||||
// 타입 오류 해결: tm 함수를 string 반환 타입으로 단언
|
||||
const tm = ((key: string): string => {
|
||||
return String((i18n.tm as any)(key) ?? '')
|
||||
}) as (key: string) => string
|
||||
|
||||
// 타입 오류 해결을 위한 computed 속성
|
||||
const inspectionGameDuringMaintenance = computed(() => tm('Inspection_Game_During_Maintenance'))
|
||||
const orgInspectionDuringMaintenance = computed(() => tm('org_Inspection_During_Maintenance'))
|
||||
|
||||
// locale에 따라 뒤에 KST 또는 UTC 추가 ko, en, zh-tw, ja
|
||||
// ko: (KST)
|
||||
|
||||
@@ -1,30 +1,20 @@
|
||||
export default defineI18nLocale(async (locale: string) => {
|
||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
||||
// const config = useRuntimeConfig()
|
||||
// const rootPath = config.public.staticUrl
|
||||
// const runType = config.public.runType
|
||||
const config = useRuntimeConfig()
|
||||
const rootPath = config.public.staticUrl
|
||||
const runType = config.public.runType
|
||||
|
||||
// const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
||||
const translationApi = `https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json`
|
||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
||||
|
||||
try {
|
||||
const { data } = await useFetch(translationApi, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
|
||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
||||
const apiData = data.value?.['ko'] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
|
||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
||||
const finalResult = { ...apiData }
|
||||
|
||||
return finalResult
|
||||
} catch (error) {
|
||||
console.error('Error fetching translation data:', error)
|
||||
// 에러 발생 시 common.json 데이터라도 반환
|
||||
return commonData[locale] || {}
|
||||
const result = (await commonFetch('GET', `${translationApi}`)) as any
|
||||
if(import.meta.client) {
|
||||
console.log("🚀 ~ result:", result[locale])
|
||||
}
|
||||
return result[locale]
|
||||
} catch (e) {
|
||||
console.error('[Exception] ko.defineI18nLocale: ', e)
|
||||
return fallback
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -7,28 +7,14 @@ export default defineI18nLocale(async (locale: string) => {
|
||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
||||
|
||||
try {
|
||||
const { data } = await useFetch(translationApi, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
if(locale === 'zh-tw') {
|
||||
locale = 'zh-TW'
|
||||
const result = (await commonFetch('GET', `${translationApi}`)) as any
|
||||
if(import.meta.client) {
|
||||
console.log("🚀 ~ result:", result[locale])
|
||||
}
|
||||
|
||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
|
||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
||||
const finalResult = { ...apiData }
|
||||
|
||||
return finalResult
|
||||
} catch (error) {
|
||||
console.error('Error fetching translation data:', error)
|
||||
// 에러 발생 시 common.json 데이터라도 반환
|
||||
return commonData[locale] || {}
|
||||
return result[locale]
|
||||
} catch (e) {
|
||||
console.error('[Exception] ko.defineI18nLocale: ', e)
|
||||
return fallback
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -15,9 +15,14 @@ export default defineNuxtRouteMiddleware(async (to, _from) => {
|
||||
|
||||
//현재 url에서 게임 도메인만 추출
|
||||
const currentDomain = window.location.hostname;
|
||||
const config = useRuntimeConfig()
|
||||
const req: GameDataRequest = {
|
||||
gameDomain: `${currentDomain}`,
|
||||
langCode: `${currentLangCode}`,
|
||||
game_alias: '',
|
||||
lang_code: `${currentLangCode}`,
|
||||
baseApiUrl: `${config.public.stoveApiUrl}`,
|
||||
gameId: '',
|
||||
}
|
||||
const { getGameDataExternal } = useGetGameDataExternal()
|
||||
await getGameDataExternal(req)
|
||||
|
||||
@@ -15,7 +15,7 @@ export default defineNuxtRouteMiddleware(async (to) => {
|
||||
// domain: baseDomain
|
||||
// })
|
||||
|
||||
const finalLocale = csrGetFinalLocale(to.path)
|
||||
const finalLocale = csrGetFinalLocale(to.path, gameData.value.lang_codes)
|
||||
// localeCookie.value = finalLocale.toUpperCase()
|
||||
|
||||
// 웹 점검 -----
|
||||
|
||||
@@ -3,7 +3,7 @@ import { getTrueClientIp } from '#layers/utils/apiUtil'
|
||||
export default defineEventHandler((event) => {
|
||||
let clientIP = ''
|
||||
try {
|
||||
clientIP = getTrueClientIp(event.node.req)
|
||||
clientIP = getTrueClientIp(event.node.req as any)
|
||||
} catch (e) {
|
||||
console.error('[Exception] /server/api/clientIp - Cannot Get Client IP: ', e)
|
||||
}
|
||||
|
||||
@@ -157,8 +157,8 @@ export default defineEventHandler(async event => {
|
||||
// 1-2. /inspection 패스
|
||||
if (fullPath.includes('/inspection')) {
|
||||
// 리턴 되기 전 언어 쿠키 세팅
|
||||
const finalLocale = ssrGetFinalLocale(event?.node.req.url, event.node.req.headers)
|
||||
setFinalLocaleCookie(event, finalLocale, baseDomain)
|
||||
// const finalLocale = ssrGetFinalLocale(event?.node.req.url, event.node.req.headers)
|
||||
// setFinalLocaleCookie(event, finalLocale, baseDomain)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -196,8 +196,9 @@ export default defineEventHandler(async event => {
|
||||
// console.log("🚀 ~ apiUrl:", apiUrl)
|
||||
|
||||
// 2. 언어 코드 추출
|
||||
const finalLocale = ssrGetFinalLocale(event?.node.req.url, event.node.req.headers)
|
||||
// const finalLocale = ssrGetFinalLocale(event?.node.req.url, event.node.req.headers)
|
||||
|
||||
const finalLocale = ssrGetFinalLocale(event?.node.req.url, event.node.req.headers)
|
||||
|
||||
const queryParams: Record<string, string> = {
|
||||
game_domain: event.context.gameDomain || '',
|
||||
@@ -213,6 +214,8 @@ export default defineEventHandler(async event => {
|
||||
// setFinalLocaleCookie(event, finalLocale, baseDomain)
|
||||
// }
|
||||
|
||||
|
||||
|
||||
if (response?.code === 0 && 'value' in response) {
|
||||
event.context.gameData = response.value
|
||||
event.context.googleAnalyticsId = response.value?.ga_code
|
||||
|
||||
@@ -32,7 +32,7 @@ const parseCookies = (cookieHeader: string) => {
|
||||
*
|
||||
* @param {string} path - 현재 URL 경로
|
||||
*/
|
||||
export const csrGetFinalLocale = (path = '') => {
|
||||
export const csrGetFinalLocale = (path = '', coveragesLocales: string[]) => {
|
||||
const config = useRuntimeConfig()
|
||||
const baseDomain = `${config.public.baseDomain}`
|
||||
|
||||
@@ -101,7 +101,7 @@ export const ssrGetFinalLocale = (path = '', headers: any) => {
|
||||
const cookieHeader = headers.cookie || ''
|
||||
const cookies = parseCookies(cookieHeader)
|
||||
const cookieLanguage = cookies.LOCALE ? `${cookies.LOCALE}`.toLowerCase() : ''
|
||||
if (cookieLanguage && cookieLanguage !== '' && coveragesLocales.includes(cookieLanguage)) {
|
||||
if (cookieLanguage && cookieLanguage !== '') {
|
||||
finalLocale = cookieLanguage
|
||||
return finalLocale
|
||||
}
|
||||
@@ -116,13 +116,13 @@ export const ssrGetFinalLocale = (path = '', headers: any) => {
|
||||
const preferredLocale = getPreferredLanguage(acceptLanguage)
|
||||
if (preferredLocale) {
|
||||
// 선호 언어의 기본 코드와 일치하는 지원 로케일 찾기
|
||||
const matchedLocale = coveragesLocales.find((locale: string) =>
|
||||
preferredLocale.toLowerCase().startsWith(locale.toLowerCase())
|
||||
)
|
||||
if (matchedLocale) {
|
||||
finalLocale = matchedLocale.toLowerCase()
|
||||
return finalLocale
|
||||
}
|
||||
// const matchedLocale = coveragesLocales.find((locale: string) =>
|
||||
// preferredLocale.toLowerCase().startsWith(locale.toLowerCase())
|
||||
// )
|
||||
// if (matchedLocale) {
|
||||
// finalLocale = matchedLocale.toLowerCase()
|
||||
// return finalLocale
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ export default defineNuxtConfig({
|
||||
payloadExtraction: false,
|
||||
},
|
||||
typescript: {
|
||||
typeCheck: false,
|
||||
typeCheck: true,
|
||||
strict: false,
|
||||
},
|
||||
nitro: {
|
||||
|
||||
@@ -218,7 +218,7 @@ export default defineEventHandler(async (event) => {
|
||||
|
||||
// 점검 중일 때 IP 필터링 활성화 여부 확인
|
||||
if (inspectionData?.ip_filter_use_yn === 'Y') {
|
||||
const clientIP = getTrueClientIp(event.node.req)
|
||||
const clientIP = getTrueClientIp(event.node.req as any)
|
||||
|
||||
// 허용된 IP 목록 확인
|
||||
if (!inspectionData?.ip_filter_list?.includes(clientIP)) {
|
||||
|
||||
Reference in New Issue
Block a user