Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Horace dev #132

Merged
merged 2 commits into from
Oct 16, 2024
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
4 changes: 2 additions & 2 deletions electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@ async function createWindow() {
enka.options.defaultLanguage = lang

try {
return convertObjectToJson(await enka.fetchUser(uid, false))
return JSON.stringify(convertObjectToJson(await enka.fetchUser(uid)))
} catch {
return convertObjectToJson(await enka.fetchUser(uid, true))
return convertObjectToJson(await enka.fetchCollapsedUser(uid))
}
})

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@octokit/core": "5.1.0",
"axios": "^1.7.2",
"bootstrap-icons": "^1.11.3",
"enka-network-api": "^4.4.0",
"enka-network-api": "^4.6.1",
"marked": "^12.0.2",
"path": "^0.12.7",
"regedit": "^5.1.3",
Expand Down
61 changes: 21 additions & 40 deletions src/pages/GenshinPage/Components/GenshinInfoCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,16 @@ const requestInfo = () => {
window.enka
.getGenshinPlayer(uid, translate('gs_enkaLangCode'))
.then(resp => {
console.log(resp)
if (playerInfo.value && playerInfo.value.uid == resp.uid) {
mergeToPlayerinfo(resp.characters)
const _resp = JSON.parse(resp)
if (playerInfo.value && playerInfo.value.uid == _resp.uid) {
mergeToPlayerinfo(_resp.characters)
const temp = playerInfo.value.characters
playerInfo.value = Object.fromEntries(
Object.entries(resp).filter(([key]) => key !== 'characters'),
Object.entries(_resp).filter(([key]) => key !== 'characters'),
)
playerInfo.value.characters = temp
} else {
playerInfo.value = resp
playerInfo.value = _resp
}
console.log(playerInfo.value)
playerInfo.value.characters.sort(function (a: any, b: any) {
Expand Down Expand Up @@ -519,6 +519,9 @@ const countRolledSubstat = (stats: any[], prop: string) => {
}
return res
}

const enkaAssetUrl = (obj: any, keyName = 'name') =>
`https://enka.network/ui/${obj[keyName]}.png`
</script>

<template>
Expand All @@ -536,7 +539,7 @@ const countRolledSubstat = (stats: any[], prop: string) => {
v-if="playerInfo && !playerInfoLoading && !playerInfoFailed"
class="namecard-mask absolute top-0 right-0 bottom-0 z-0 w-1/3 object-cover"
style="height: 9vh; border-radius: 0 4.5vh 4.5vh 0"
:src="playerInfo.profileCard.pictures[1].url"
:src="enkaAssetUrl(playerInfo.profileCard.pictures[0])"
/>
<div
v-if="playerInfoLoading"
Expand Down Expand Up @@ -564,7 +567,7 @@ const countRolledSubstat = (stats: any[], prop: string) => {
<img
class="rounded-full bg-slate-200"
:style="`height: 6vh; margin-left: 1.5vh; border-width: calc(2px * min(${hScale}, ${vScale}))`"
:src="playerInfo.profilePicture.icon.url"
:src="enkaAssetUrl(playerInfo.profilePicture.icon)"
/>
<div
class="font-gs"
Expand Down Expand Up @@ -665,12 +668,7 @@ const countRolledSubstat = (stats: any[], prop: string) => {
></div>
<img
class="absolute bottom-0 char-side-icon rounded-full ml-1 w-12 h-12 hover:transform hover:scale-110 hover:-translate-y-1 active:scale-100 active:translate-y-0 transition-all object-cover"
:src="
character.costume.sideIcon.url.replace(
'api.ambr.top/assets/UI',
'enka.network/ui',
)
"
:src="enkaAssetUrl(character.costume.sideIcon)"
/>
</div>
</div>
Expand Down Expand Up @@ -733,10 +731,11 @@ const countRolledSubstat = (stats: any[], prop: string) => {
<img
class="inline-block object-cover bottom-0 left-0 absolute z-10 h-full pointer-events-none"
:src="
(store.settings.appearance.gsCostume
? character.costume.splashImage.url
: character.characterData.splashImage.url
).replace('api.ambr.top/assets/UI', 'enka.network/ui')
enkaAssetUrl(
store.settings.appearance.gsCostume
? character.costume.splashImage
: character.characterData.splashImage,
)
"
/>
</div>
Expand Down Expand Up @@ -777,12 +776,7 @@ const countRolledSubstat = (stats: any[], prop: string) => {
>
<img
class="h-8 rounded-full"
:src="
skill.skill.icon.url.replace(
'api.ambr.top/assets/UI',
'enka.network/ui',
)
"
:src="enkaAssetUrl(skill.skill.icon)"
/>
<div
class="text-center w-full mr-1 h-full align-middle text-base font-gs"
Expand Down Expand Up @@ -832,11 +826,8 @@ const countRolledSubstat = (stats: any[], prop: string) => {
<img
class="relative h-8 rounded-full ml-2 z-30"
:src="
character.unlockedConstellations[
idx - 1
].icon.url.replace(
'api.ambr.top/assets/UI',
'enka.network/ui',
enkaAssetUrl(
character.unlockedConstellations[idx - 1].icon,
)
"
/>
Expand Down Expand Up @@ -1040,12 +1031,7 @@ const countRolledSubstat = (stats: any[], prop: string) => {
>
<img
class="h-full"
:src="
character.weapon.weaponData.awakenIcon.url.replace(
'api.ambr.top/assets/UI',
'enka.network/ui',
)
"
:src="enkaAssetUrl(character.weapon.weaponData.awakenIcon)"
/>
<div class="w-full h-full relative">
<div class="flex flex-row justify-between ml-2 mt-4">
Expand Down Expand Up @@ -1135,12 +1121,7 @@ const countRolledSubstat = (stats: any[], prop: string) => {
margin-top: -45px;
"
class="artifact-mask w-28 object-cover"
:src="
artifact.artifactData.icon.url.replace(
'api.ambr.top/assets/UI',
'enka.network/ui',
)
"
:src="enkaAssetUrl(artifact.artifactData.icon)"
/>
<div class="w-full h-full relative">
<div
Expand Down
Loading