Skip to content

Commit

Permalink
Merge pull request #62 from HoraceHuang-ui/horace_dev
Browse files Browse the repository at this point in the history
Horace dev
  • Loading branch information
HoraceHuang-ui authored Feb 28, 2024
2 parents 2691524 + fa839da commit 79eaed3
Show file tree
Hide file tree
Showing 16 changed files with 108 additions and 46 deletions.
15 changes: 11 additions & 4 deletions electron-builder.json5
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,29 @@
*/
{
$schema: "https://raw.githubusercontent.com/electron-userland/electron-builder/master/packages/app-builder-lib/scheme.json",
appId: "YourAppID",
appId: "com.horacehyy.mixed",
asar: true,
directories: {
output: "release/${version}",
},
files: ["dist-electron", "dist"],
files: [
"dist-electron",
"dist"
],
mac: {
artifactName: "${productName}_${version}.${ext}",
target: ["dmg"],
target: [
"dmg"
],
},
win: {
requestedExecutionLevel: "requireAdministrator",
target: [
{
target: "nsis",
arch: ["x64"],
arch: [
"x64"
],
},
],
artifactName: "${productName}_${version}.${ext}",
Expand Down
2 changes: 1 addition & 1 deletion electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ async function createWindow() {

const contextMenu = Menu.buildFromTemplate([
{
label: '退出', click: () => {
label: 'Quit', click: () => {
win.destroy()
}
},
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "miXeD",
"version": "2.5.4",
"version": "2.5.5",
"main": "dist-electron/main/index.js",
"description": "All-in-one MiHOYO game launcher",
"author": "HoraceHYY <3214442497@qq.com>",
"description": "All-in-one miHoYo game launcher",
"author": "HoraceHYY <horacehuang17@gmail.com>",
"license": "MIT",
"private": true,
"keywords": [
Expand Down
6 changes: 3 additions & 3 deletions src/i18n/en_US.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"general_loading": "Loading...",
"general_welcomeTitle": "Welcome to miXeD!",
"general_langText": "Let's get started by setting up your language preference.",
"general_cancel": "Cancel",
"general_confirm": "Confirm",
"general_mainpage": "Home",
Expand Down Expand Up @@ -47,8 +49,6 @@
"mainpage_title": "miHoYo miXeD Launcher",
"mainpage_buttonText": "Launch {game}",
"genshin_launcherContentsUrl": "https://sdk-os-static.mihoyo.com/hk4e_global/mdk/launcher/api/content?filter_adv=false&key=gcStgarh&language=en-us&launcher_id=10",
"gs_apiChangeTitle": "Welcome to miXeD!",
"gs_apiChangeText": "Due to API change, this update will wipe your Genshin Impact player data, please retrieve again. Apologies for inconvenience!",
"gs_enkaLangCode": "en",
"gs_emptyPlayerTip": "Player details will be displayed here",
"gs_showcaseTip": "Player details unavailable, please enable 'Show Character Details' in game and try again.",
Expand Down Expand Up @@ -79,7 +79,7 @@
"sr_noRelicSets": "No Set Effects",
"sr_charDetails": "Details",
"sr_lockedRank": "(Locked)",
"sr_noLightcone": "No Lightcone Equipped",
"sr_noLightcone": "No Light Cone Equipped",
"sr_noSubstats": "No Substats",
"sr_noRelics": "No Relics",
"hi3_launcherContentsUrl": "https://sdk-os-static.mihoyo.com/bh3_global/mdk/launcher/api/content?filter_adv=false&key=tEGNtVhN&language=en-us&launcher_id=9",
Expand Down
5 changes: 2 additions & 3 deletions src/i18n/fr_FR.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"general_loading": "Chargement en cours...",
"general_welcomeTitle": "Bienvenue sur miXeD!",
"general_cancel": "Abandonner",
"general_confirm": "Confirm",
"general_mainpage": "Domicile",
Expand Down Expand Up @@ -47,8 +48,6 @@
"mainpage_title": "miHoYo miXeD Launcher",
"mainpage_buttonText": "Lancer {game}",
"genshin_launcherContentsUrl": "https://sdk-os-static.mihoyo.com/hk4e_global/mdk/launcher/api/content?filter_adv=false&key=gcStgarh&language=fr-fr&launcher_id=10",
"gs_apiChangeTitle": "Bienvenue sur miXeD!",
"gs_apiChangeText": "En raison du changement d'API, cette mise à jour va effacer vos données de joueur de Genshin Impact, veuillez récupérer à nouveau. Toutes nos excuses pour les inconvénients !",
"gs_enkaLangCode": "fr",
"gs_emptyPlayerTip": "Les détails du joueur s'afficheront ici",
"gs_showcaseTip": "Les détails du joueur ne sont pas disponibles, veuillez activer 'Afficher les détails du personnage' dans le jeu et réessayez.",
Expand Down Expand Up @@ -79,7 +78,7 @@
"sr_noRelicSets": "Aucun effet d'ensemble",
"sr_charDetails": "Détails",
"sr_lockedRank": "(Verrouillé)",
"sr_noLightcone": "Aucun Lightcone équipé",
"sr_noLightcone": "Aucun Light Cone équipé",
"sr_noSubstats": "Aucune Substats",
"sr_noRelics": "Aucune relique",
"hi3_launcherContentsUrl": "https://sdk-os-static.mihoyo.com/bh3_global/mdk/launcher/api/content?filter_adv=false&key=dpz65xJ3&language=fr-fr&launcher_id=10",
Expand Down
19 changes: 19 additions & 0 deletions src/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,22 @@ export const switchLang = (language: lang) => {
localStorage.lang = language
i18n.global.locale = language

Check failure on line 68 in src/i18n/index.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'i18n.global' is of type 'unknown'.
}

export const str2Lang = (str: string | null): lang | null => {
switch (str) {
case 'en_US':
return 'en_US'
case 'zh_CN':
return 'zh_CN'
case 'zh_TW':
return 'zh_TW'
case 'ru_RU':
return 'ru_RU'
case 'ja_JP':
return 'ja_JP'
case 'fr_FR':
return 'fr_FR'
default:
return null
}
}
3 changes: 1 addition & 2 deletions src/i18n/ja_JP.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"general_loading": "読み込み中...",
"general_welcomeTitle": "miXeDへようこそ!",
"general_cancel": "キャンセル",
"general_confirm": "確認",
"general_mainpage": "ホームページ",
Expand Down Expand Up @@ -47,8 +48,6 @@
"mainpage_title": "miHoYo miXeD ランチャー",
"mainpage_buttonText": "{game}を起動!",
"genshin_launcherContentsUrl": "https://sdk-os-static.mihoyo.com/hk4e_global/mdk/launcher/api/content?filter_adv=false&key=gcStgarh&language=ja-jp&launcher_id=10",
"gs_apiChangeTitle": "miXeDへようこそ!",
"gs_apiChangeText": "APIの変更により、このアップデートは原神インパクトプレイヤーのデータを消去します。ご不便をおかけして申し訳ございません。",
"gs_enkaLangCode": "ja",
"gs_emptyPlayerTip": "キャラの詳細がここに表示されます",
"gs_showcaseTip": "キャラの詳細情報が利用できません。ゲーム内で「キャラクターの詳細を表示」を有効にして、もう一度お試しください。",
Expand Down
3 changes: 1 addition & 2 deletions src/i18n/ru_RU.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"general_loading": "Загрузка...",
"general_welcomeTitle": "Добро пожаловать в miXeD!",
"general_cancel": "Отмена",
"general_confirm": "Подтвердить",
"general_mainpage": "Главная",
Expand Down Expand Up @@ -47,8 +48,6 @@
"mainpage_title": "Запуск miHoYo miXeD",
"mainpage_buttonText": "Запустить {game}",
"genshin_launcherContentsUrl": "https://sdk-os-static.mihoyo.com/hk4e_global/mdk/launcher/api/content?filter_adv=false&key=gcStgarh&language=ru-ru&launcher_id=10",
"gs_apiChangeTitle": "Добро пожаловать в miXeD!",
"gs_apiChangeText": "В связи с изменениями API это обновление удалит данные игрока, пожалуйста, восстановите их. Приносим извинения за неудобства!",
"gs_enkaLangCode": "ru",
"gs_emptyPlayerTip": "Информация о игроке будет отображена здесь",
"gs_showcaseTip": "Информация о игроке недоступна. Включите 'Отображение деталей персонажей' в игре и попробуйте снова.",
Expand Down
3 changes: 1 addition & 2 deletions src/i18n/zh_CN.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"general_loading": "加载中...",
"general_welcomeTitle": "欢迎使用 miXeD!",
"general_cancel": "取消",
"general_confirm": "确定",
"general_mainpage": "主页",
Expand Down Expand Up @@ -47,8 +48,6 @@
"mainpage_title": "米哈游聚合启动器",
"mainpage_buttonText": "{game}启动",
"genshin_launcherContentsUrl": "https://sdk-static.mihoyo.com/hk4e_cn/mdk/launcher/api/content?filter_adv=false&key=eYd89JmJ&language=zh-cn&launcher_id=18",
"gs_apiChangeTitle": "欢迎使用 miXeD!",
"gs_apiChangeText": "由于API变更,此次更新将清除您的原神账号信息,请您重新获取。为您带来不便敬请谅解!",
"gs_enkaLangCode": "chs",
"gs_emptyPlayerTip": "此处将显示角色的详细信息",
"gs_showcaseTip": "当前暂无详细信息,请在游戏内打开“显示角色详情”后再试。",
Expand Down
3 changes: 1 addition & 2 deletions src/i18n/zh_TW.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"general_loading": "載入中...",
"general_welcomeTitle": "歡迎使用 miXeD!",
"general_cancel": "取消",
"general_confirm": "確定",
"general_mainpage": "主頁",
Expand Down Expand Up @@ -47,8 +48,6 @@
"mainpage_title": "米哈游聚合啓動器",
"mainpage_buttonText": "{game}啓動",
"genshin_launcherContentsUrl": "https://sdk-os-static.mihoyo.com/hk4e_global/mdk/launcher/api/content?filter_adv=false&key=gcStgarh&language=zh-tw&launcher_id=10",
"gs_apiChangeTitle": "歡迎使用 miXeD!",
"gs_apiChangeText": "由於API變更,此次更新將清除您的原神賬戶信息,請您重新獲取。爲您帶來不便敬請諒解!",
"gs_enkaLangCode": "cht",
"gs_emptyPlayerTip": "此處將顯示角色的詳細信息",
"gs_showcaseTip": "當前暫無詳細信息,請在游戲内打開”顯示角色詳情“后再試。",
Expand Down
4 changes: 2 additions & 2 deletions src/pages/GenshinPage/Components/GSImportDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const onDialogOk = () => {
<div class="ml-3" style="margin-top: 5px; grid-column: 1 / 3;">
<span class="font-gs mr-2">{{ translate('general_game') }}</span>
{{
launcherPath === '' ? '' : (combinePaths ? launcherPath + '\\Genshin Impact Game\\YuanShen.exe' :
launcherPath === '' ? gamePath : (combinePaths ? launcherPath + '\\Genshin Impact Game\\YuanShen.exe' :
gamePath)
}}
</div>
Expand Down Expand Up @@ -131,4 +131,4 @@ const onDialogOk = () => {
.confirm-button-disabled {
@apply bg-blue-200 text-white pointer-events-none;
}
</style>
</style>
2 changes: 1 addition & 1 deletion src/pages/GenshinPage/Components/GenshinDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,4 @@ defineExpose({
.divider-bg {
background: #DAD2C5;
}
</style>
</style>
4 changes: 2 additions & 2 deletions src/pages/Honkai3Page/Components/HI3ImportDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const onDialogOk = () => {
<div class="ml-3 text-gray-200" style="margin-top: 5px; grid-column: 1 / 3;">
<span class="theme-color font-bold mr-2">{{ translate('general_game') }}</span>
{{
launcherPath === '' ? '' : (combinePaths ? launcherPath + '\\Games\\BH3.exe' :
launcherPath === '' ? gamePath : (combinePaths ? launcherPath + '\\Games\\BH3.exe' :
gamePath)
}}
</div>
Expand Down Expand Up @@ -142,4 +142,4 @@ const onDialogOk = () => {
.theme-color {
color: #51C3F9;
}
</style>
</style>
72 changes: 56 additions & 16 deletions src/pages/MainPage.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<script setup lang="ts">
import {computed, onMounted, ref} from 'vue'
import {translate} from '../i18n'
import {dialogComponent, dialogStyle} from "../types/dialog/dialog";
import {useDialog} from "../utils/template-dialog";
import {h, onMounted, ref} from 'vue'
import {availableLangCodes, availableLangNames, lang, str2Lang, translate} from '../i18n'
import {dialogComponent, dialogStyle} from "../types/dialog/dialog"
import {useDialog} from "../utils/template-dialog"
import {useRouter} from 'vue-router'
const router = useRouter()
const gsGamePath = ref('')
const srGamePath = ref('')
Expand All @@ -13,9 +16,7 @@ const bgPath = ref('')
const dialogStyle = ref<dialogStyle>('gs')
const DEFAULT_BG = '../../src/assets/gsbanner.png'
const bgImage = computed(() => {
return bgPath.value ? bgPath.value : DEFAULT_BG
})
const lang = ref<lang | null>(null)
onMounted(async () => {
gsGamePath.value = await window.store.get('gsGamePath')
Expand All @@ -29,17 +30,52 @@ onMounted(async () => {
window.store.set('dialogStyle', 'gs', false)
}
dialogStyle.value = style
})
window.store.get('newApi').then((resp: boolean) => {
if (!resp) {
useDialog(dialogComponent(dialogStyle.value), {}, {
title: translate('gs_apiChangeTitle'),
msg: translate('gs_apiChangeText'),
showCancel: false
lang.value = str2Lang(localStorage.getItem('lang'))
if (!lang.value) {
localStorage.setItem('lang', 'en_US')
lang.value = 'en_US'
useDialog(dialogComponent(dialogStyle.value), {
onOk(dispose: Function) {
if (lang.value !== 'en_US') {
router.go(0)
}
dispose()
},
onCancel(dispose: Function) {
if (lang.value !== 'en_US') {
router.go(0)
}
dispose()
}
}, {
title: translate('general_welcomeTitle'),
msg: translate('general_langText'),
vnode: h('div', {
style: {
'display': 'flex',
'flex-direction': 'row',
'justify-content': 'center',
'width': '100%'
}
}, h('select', {
style: {
'border-width': '2px',
'border-radius': '9999px',
'margin-top': '0.5rem',
'padding': '0.25rem 0.5rem',
'transition': 'all 0.2s',
},
onChange: (e: Event) => {
const target = e.target as HTMLSelectElement
localStorage.setItem('lang', target.value)
lang.value = str2Lang(target.value)
}
}, availableLangCodes.map((langCode, i) => {
return h('option', {value: langCode}, availableLangNames[i])
}))
)
})
window.store.delete('genshinInfo')
window.store.set('newApi', true, false)
}
})
})
Expand Down Expand Up @@ -146,4 +182,8 @@ const resetPic = () => {
@apply bottom-0;
height: 20vh;
}
.lang-select {
@apply border-2 rounded-full py-1 px-2 ml-3 hover:bg-gray-100 transition-all;
}
</style>
3 changes: 2 additions & 1 deletion src/pages/SettingsPage/SettingsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const trayOnLaunch = ref(true)
const gsCostume = ref(false)
onMounted(async () => {
lang.value = localStorage.lang || 'en-US'
lang.value = localStorage.lang || 'en_US'
quitOnClose.value = await window.store.get('quitOnClose')
if (quitOnClose.value === undefined) {
await window.store.set('quitOnClose', true, false)
Expand Down Expand Up @@ -202,6 +202,7 @@ const showClearDialog = () => {
useDialog(dialogComponent(dialogStyle.value), {
onOk(dispose: Function) {
window.store.clear()
localStorage.clear()
router.go(0)
dispose()
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/StarRailPage/Components/SRImportDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const onDialogOk = () => {
<div class="ml-3" style="margin-top: 5px; grid-column: 1 / 3;">
<span class="font-bold mr-2">{{ translate('general_game') }}</span>
{{
launcherPath === '' ? '' : (combinePaths ? launcherPath + '\\Game\\StarRail.exe' :
launcherPath === '' ? gamePath : (combinePaths ? launcherPath + '\\Game\\StarRail.exe' :
gamePath)
}}
</div>
Expand Down Expand Up @@ -124,4 +124,4 @@ const onDialogOk = () => {
.confirm-button-disabled {
@apply bg-blue-200 text-white pointer-events-none;
}
</style>
</style>

0 comments on commit 79eaed3

Please sign in to comment.