Skip to content

Commit

Permalink
自动生成的 Powershell 脚本添加 BOM
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanxven committed Jul 29, 2024
1 parent 1a05700 commit e3fcf98
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import relativeTime from 'dayjs/plugin/relativeTime'
import { app, dialog } from 'electron'
import { configure } from 'mobx'
import EventEmitter from 'node:events'
import path from 'node:path'

import { setupLeagueAkariModules } from './modules'
import { appModule } from './modules/akari-core/app'
Expand Down
10 changes: 7 additions & 3 deletions src/main/modules/akari-core/auto-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ export class AutoUpdateModule extends MobxBasedBasicModule {
static DOWNLOAD_DIR_NAME = 'NewUpdates'
static UPDATE_SCRIPT_NAME = 'LeagueAkariUpdate.ps1'
static UPDATE_PROGRESS_UPDATE_INTERVAL = 200
static FAKE_USER_AGENT = `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0 LeagueAkari/${app.getVersion()} `
static USER_AGENT = `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0 LeagueAkari/${app.getVersion()} `

private _http = axios.create({
headers: {
'User-Agent': AutoUpdateModule.FAKE_USER_AGENT
'User-Agent': AutoUpdateModule.USER_AGENT
}
})

Expand Down Expand Up @@ -681,7 +681,11 @@ Try {
)

const scriptPath = path.join(app.getPath('temp'), AutoUpdateModule.UPDATE_SCRIPT_NAME)
fs.writeFileSync(scriptPath, generatedPowershellScript)

const bom = Buffer.from([0xef, 0xbb, 0xbf])
const scriptFileWithBom = Buffer.concat([bom, Buffer.from(generatedPowershellScript, 'utf-8')])

fs.writeFileSync(scriptPath, scriptFileWithBom)

this._logger.info(`写入更新脚本 ${scriptPath}`)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<ControlItem
class="control-item-margin"
label="更新文件夹"
label-description="当前更新已下载的位置,若无法只能自动僧更新流程,将需要手动更新"
label-description="当前更新已下载的位置,若无法执行完整的自动更新流程,则需要手动更新"
:label-width="180"
v-if="
processStatus.current >= 2 ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,29 @@
label="退出结算页面"
label-description="立即退出结算界面。适用于由于客户端原因无法退出结算页面的情况"
>
<NButton type="success" :disabled="!isInEndgamePhase" @click="handlePlayAgain" size="tiny"
<NButton type="primary" :disabled="!isInEndgamePhase" @click="handlePlayAgain" size="tiny"
>回到房间</NButton
>
</ControlItem>
<ControlItem
class="control-item-margin"
label="退出当前房间"
label-description="立即退出当前房间"
>
<NButton :disabled="gameflow.phase !== 'Lobby'" @click="deleteLobby" size="tiny"
>退出房间</NButton
>
</ControlItem>
</NCard>
</template>

<script setup lang="ts">
import ControlItem from '@shared/renderer/components/ControlItem.vue'
import { useGameflowStore } from '@shared/renderer/modules/lcu-state-sync/gameflow'
import { earlyExit } from '@shared/renderer/http-api/gameflow'
import { playAgain } from '@shared/renderer/http-api/lobby'
import { deleteLobby } from '@shared/renderer/http-api/lobby'
import { dodge } from '@shared/renderer/http-api/login'
import { useGameflowStore } from '@shared/renderer/modules/lcu-state-sync/gameflow'
import { laNotification } from '@shared/renderer/notification'
import { NButton, NCard } from 'naive-ui'
import { computed } from 'vue'
Expand Down Expand Up @@ -82,4 +92,4 @@ const handlePlayAgain = async () => {
font-weight: bold;
font-size: 18px;
}
</style>
</style>

0 comments on commit e3fcf98

Please sign in to comment.