Skip to content

Commit

Permalink
重构之中的阶段性提交
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanxven committed Oct 28, 2024
1 parent a443379 commit 255b2ad
Show file tree
Hide file tree
Showing 112 changed files with 10,279 additions and 7,949 deletions.
1 change: 1 addition & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
branches:
- main
- dev
- refactor
workflow_dispatch:

jobs:
Expand Down
Binary file modified .yarn/install-state.gz
Binary file not shown.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

- [TODO] 对局页面添加一个截图到剪贴板的按钮。

# v1.3.0 DRAFT
- [CHANGED] 移除对局中自动路由功能。

# v1.3.0 Sakurako DRAFT

## 修复

Expand Down
33 changes: 12 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,27 +123,18 @@ node-gyp build

League Akari 的实现参考了许多现有的优秀开源项目,这些项目为软件的部分模块开发提供了清晰的思路指导,特此表示感谢。❤️

- [LCU API 文档 1](https://www.mingweisamuel.com/lcu-schema/tool/#/)

- [LCU 文档 - League of Legends LCU and Riot Client API Docs](https://github.com/KebsCS/lcu-and-riotclient-api)

- [Community Dragon](https://www.communitydragon.org/documentation/assets)

- [Pengu Loader - ✨ The ultimate JavaScript plugin loader, build your unmatched LoL Client.](https://github.com/PenguLoader/PenguLoader)

- [Seraphine - 英雄联盟战绩查询工具](https://github.com/Zzaphkiel/Seraphine)

- [lol-helper - 英雄联盟工具,LCU API,一键喊话,战绩查询,一键发送战绩,更改段位显示,更改背景页,牛马/上等马/下等马,彩虹屁,禁用英雄 ,秒选英雄,解锁炫彩皮肤等](https://github.com/4379711/lol-helper)

- [Joi - 一个英雄联盟助手工具](https://github.com/watchingfun/Joi)

- [fix-lcu-window - 解决《英雄联盟》客户端异常窗口大小的问题。](https://github.com/LeagueTavern/fix-lcu-window)

- [vscode-league-respawn-timer - An extension to display League of Legends player respawn time in Visual Studio Code.](https://github.com/Coooookies/vscode-league-respawn-timer)

- [LeaguePrank](https://github.com/LeagueTavern/LeaguePrank)

- [frank - A bran-new League of Legends assistant software, a replacement for WeGame.](https://github.com/Java-S12138/frank)
| 项目名称 | 描述 |
| --- | --- |
| ⭐⭐⭐ [Pengu Loader](https://github.com/PenguLoader/PenguLoader) | 用于 UX 客户端调试和逆向工程工具 |
| ⭐⭐⭐ [League of Legends LCU and Riot Client API Docs](https://github.com/KebsCS/lcu-and-riotclient-api) | LCU API 文档参考 |
| ⭐⭐ [Community Dragon](https://www.communitydragon.org/documentation/assets) | 资源管理和参考文档 |
| ⭐⭐ [Seraphine](https://github.com/Zzaphkiel/Seraphine) | 缝合重灾区,提供了集成思路 |
|[fix-lcu-window](https://github.com/LeagueTavern/fix-lcu-window) | 修复客户端窗口大小问题的思路借鉴 |
|[Joi](https://github.com/watchingfun/Joi) | OP.GG 相关实现的参考 |
|[lol-helper](https://github.com/4379711/lol-helper) | (曾经的) 卡炫彩功能和工具设计的参考 |
|[vscode-league-respawn-timer](https://github.com/Coooookies/vscode-league-respawn-timer) | 重生倒计时功能的参考 |
|[LeaguePrank](https://github.com/LeagueTavern/LeaguePrank) | 趣味功能的实现参考 |
|[LCU API](https://www.mingweisamuel.com/lcu-schema/tool/#/) | LCU API 早期参考文档 |

# 5. FAQ - 常见问题及回答

Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"axios": "^1.7.7",
"axios-retry": "^4.5.0",
"dayjs": "^1.11.13",
"fast-csv": "^5.0.2",
"lodash": "^4.17.21",
"luaparse": "^0.3.1",
"mobx": "^6.13.5",
Expand All @@ -42,7 +43,7 @@
"@electron-toolkit/tsconfig": "^1.0.1",
"@electron/notarize": "^2.5.0",
"@rushstack/eslint-patch": "^1.10.4",
"@swc/core": "^1.7.36",
"@swc/core": "^1.7.40",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/deep-eql": "^4.0.2",
"@types/lodash": "^4.17.12",
Expand Down Expand Up @@ -73,12 +74,12 @@
"semver": "^7.6.3",
"typescript": "^5.6.3",
"vfonts": "^0.0.3",
"vite": "^5.4.9",
"vite": "^5.4.10",
"vue": "^3.5.12",
"vue-chartjs": "^5.3.1",
"vue-i18n": "10.0.4",
"vue-router": "^4.4.5",
"vue-tsc": "^2.1.6"
"vue-tsc": "^2.1.8"
},
"packageManager": "[email protected]"
}
19 changes: 13 additions & 6 deletions src/main/bootstrap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { AutoReplyMain } from '@main/shards/auto-reply'
import { AutoSelectMain } from '@main/shards/auto-select'
import { GameClientMain } from '@main/shards/game-client'
import { AkariIpcMain } from '@main/shards/ipc'
import { KeyboardShortcutsMain } from '@main/shards/keyboard-shorcuts'
import { KeyboardShortcutsMain } from '@main/shards/keyboard-shortcuts'
import { LeagueClientMain } from '@main/shards/league-client'
import { LeagueClientUxMain } from '@main/shards/league-client-ux'
import { LoggerFactoryMain } from '@main/shards/logger-factory'
Expand Down Expand Up @@ -66,6 +66,8 @@ declare module '@shared/akari-shard/manager' {
write: (config: BaseConfig) => void
}

version: string

/**
* 退出应用
*/
Expand Down Expand Up @@ -134,7 +136,7 @@ export function bootstrap() {

logger.info({
message: `League Akari ${app.getVersion()}`,
namespace: 'bootstrap'
namespace: 'app'
})

try {
Expand All @@ -160,6 +162,7 @@ export function bootstrap() {
write: (config: any) => writeBaseConfig(config)
}
manager.global.isAdministrator = isAdministrator
manager.global.version = app.getVersion()
manager.global.quit = () => app.quit()
manager.global.restart = () => {
app.relaunch()
Expand Down Expand Up @@ -250,17 +253,21 @@ export function bootstrap() {
shardDisposed = true
events.removeAllListeners()
logger.info({
message: `应用退出`,
namespace: 'bootstrap'
message: `应用即将退出`,
namespace: 'app'
})
logger.on('finish', () => app.quit())
logger.on('finish', () => app.exit()) // 不知为何, 使用 app.quit() 在这里不会生效. 除非包裹 setImmediate 或 setTimeout
logger.end()
})
})

app.on('quit', () => {
console.log(`[${dayjs().format('YYYY-MM-DD HH:mm:ss:SSS')}] [finale] 应用退出`)
})
} catch (error) {
logger.error({
message: `[10001] 应用启动时出现错误 ${formatError(error)}`,
namespace: 'bootstrap'
namespace: 'app'
})
dialog.showErrorBox('应用启动时出现错误', formatError(error))
logger.on('finish', () => app.exit(10001))
Expand Down
22 changes: 19 additions & 3 deletions src/main/shards/app-common/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { IAkariShardInitDispose } from '@shared/akari-shard/interface'
import { AkariSharedGlobalShard, SHARED_GLOBAL_ID } from '@shared/akari-shard/manager'
import { app, shell } from 'electron'

import { AkariIpcMain } from '../ipc'
import { MobxUtilsMain } from '../mobx-utils'
import { SettingFactoryMain } from '../setting-factory'
import { MobxSettingService } from '../setting-factory/mobx-setting-service'
import { SetterSettingService } from '../setting-factory/setter-setting-service'
import { AppCommonSettings, AppCommonState } from './state'

/**
Expand All @@ -25,7 +26,7 @@ export class AppCommonMain implements IAkariShardInitDispose {
private _shared: AkariSharedGlobalShard
private _ipc: AkariIpcMain
private _mobx: MobxUtilsMain
private _setting: MobxSettingService
private _setting: SetterSettingService

constructor(deps: any) {
this._shared = deps[SHARED_GLOBAL_ID]
Expand All @@ -46,6 +47,8 @@ export class AppCommonMain implements IAkariShardInitDispose {
this._shared.global.events.on('second-instance', (commandLine, workingDirectory) => {
this._ipc.sendEvent(AppCommonMain.id, 'second-instance', commandLine, workingDirectory)
})

this.state.setBaseConfig(this._shared.global.baseConfig.value)
}

private _setDisableHardwareAccelerationAndRelaunch(s: boolean) {
Expand All @@ -70,6 +73,10 @@ export class AppCommonMain implements IAkariShardInitDispose {
this._shared.global.restart()
}

openUserDataDir() {
return shell.openPath(app.getPath('userData'))
}

private async _handleState() {
await this._setting.applyToState()
this._mobx.propSync(AppCommonMain.id, 'settings', this.settings, [
Expand All @@ -78,7 +85,8 @@ export class AppCommonMain implements IAkariShardInitDispose {
])
this._mobx.propSync(AppCommonMain.id, 'state', this.state, [
'isAdministrator',
'disableHardwareAcceleration'
'disableHardwareAcceleration',
'baseConfig'
])

// 状态指示, 是否禁用硬件加速
Expand All @@ -93,5 +101,13 @@ export class AppCommonMain implements IAkariShardInitDispose {
this._ipc.onCall(AppCommonMain.id, 'setDisableHardwareAcceleration', (s: boolean) => {
this._setDisableHardwareAccelerationAndRelaunch(s)
})

this._ipc.onCall(AppCommonMain.id, 'getVersion', () => {
return this._shared.global.version
})

this._ipc.onCall(AppCommonMain.id, 'openUserDataDir', () => {
return this.openUserDataDir()
})
}
}
11 changes: 9 additions & 2 deletions src/main/shards/app-common/state.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { makeAutoObservable } from 'mobx'
import { BaseConfig } from '@main/bootstrap/base-config'
import { makeAutoObservable, observable } from 'mobx'

export class AppCommonState {
isAdministrator: boolean = false
Expand All @@ -8,6 +9,8 @@ export class AppCommonState {
*/
disableHardwareAcceleration: boolean = false

baseConfig: BaseConfig | null

setAdministrator(s: boolean) {
this.isAdministrator = s
}
Expand All @@ -16,8 +19,12 @@ export class AppCommonState {
this.disableHardwareAcceleration = s
}

setBaseConfig(s: BaseConfig | null) {
this.baseConfig = s
}

constructor() {
makeAutoObservable(this)
makeAutoObservable(this, { baseConfig: observable.ref })
}
}

Expand Down
Loading

0 comments on commit 255b2ad

Please sign in to comment.