Skip to content

Commit

Permalink
外部链接二次确认
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanxven committed Aug 19, 2024
1 parent cd5311c commit b9a43d6
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 27 deletions.
16 changes: 14 additions & 2 deletions src/main/modules/akari-core/auxiliary-window.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { is } from '@electron-toolkit/utils'
import { MobxBasedBasicModule } from '@main/akari-ipc/modules/mobx-based-basic-module'
import { BrowserWindow, Rectangle, screen, shell } from 'electron'
import { BrowserWindow, Rectangle, dialog, screen, shell } from 'electron'
import { comparer, computed, makeAutoObservable, observable } from 'mobx'
import { join } from 'path'

Expand Down Expand Up @@ -470,7 +470,19 @@ export class AuxWindowModule extends MobxBasedBasicModule {
})

this._w.webContents.setWindowOpenHandler((details) => {
shell.openExternal(details.url)
const response = dialog.showMessageBoxSync({
type: 'question',
buttons: ['是', '否'],
defaultId: 0,
title: '确认',
message: `将跳转到外部链接 ${new URL(details.url).origin}`,
detail: details.url
})

if (response === 0) {
shell.openExternal(details.url)
}

return { action: 'deny' }
})

Expand Down
16 changes: 14 additions & 2 deletions src/main/modules/akari-core/main-window.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { is } from '@electron-toolkit/utils'
import { MobxBasedBasicModule } from '@main/akari-ipc/modules/mobx-based-basic-module'
import { BrowserWindow, Event, app, shell } from 'electron'
import { BrowserWindow, Event, app, dialog, shell } from 'electron'
import { makeAutoObservable, observable } from 'mobx'
import { join } from 'node:path'

Expand Down Expand Up @@ -247,7 +247,19 @@ export class MainWindowModule extends MobxBasedBasicModule {
this._w.on('page-title-updated', (e) => e.preventDefault())

this._w.webContents.setWindowOpenHandler((details) => {
shell.openExternal(details.url)
const response = dialog.showMessageBoxSync({
type: 'question',
buttons: ['是', '否'],
defaultId: 0,
title: '确认',
message: `将跳转到外部链接 ${new URL(details.url).origin}`,
detail: details.url
})

if (response === 0) {
shell.openExternal(details.url)
}

return { action: 'deny' }
})

Expand Down
8 changes: 5 additions & 3 deletions src/main/modules/auto-select/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class AutoSelectModule extends MobxBasedBasicModule {
this._mwm = this.manager.getModule('main-window')

await this._setupSettingsSync()
this._setupStateSync()
await this._setupStateSync()
this._handleAutoPickBan()
this._handleBenchMode()

Expand Down Expand Up @@ -320,7 +320,7 @@ export class AutoSelectModule extends MobxBasedBasicModule {
`取消了即将进行的英雄交换, 目标: ${this.state.upcomingGrab.championId}`
)

this._notifyInChat('cancel', this.state.upcomingGrab.championId)
this._notifyInChat('cancel', this.state.upcomingGrab.championId).catch(() => {})
if (this.state.upcomingGrab) {
clearTimeout(this._grabTimerId!)
this._grabTimerId = null
Expand Down Expand Up @@ -353,7 +353,9 @@ export class AutoSelectModule extends MobxBasedBasicModule {
this._logger.info(`目标交换英雄: ${c}`)

this.state.setUpcomingGrab(c, Date.now() + waitTime)
this._notifyInChat('select', this.state.upcomingGrab!.championId, waitTime)
this._notifyInChat('select', this.state.upcomingGrab!.championId, waitTime).catch(
() => {}
)
this._grabTimerId = setTimeout(() => this._trySwap(), waitTime)
break
}
Expand Down
46 changes: 30 additions & 16 deletions src/renderer/src-auxiliary-window/views/opgg/OpggChampion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -420,22 +420,36 @@
</div>
<!-- inline styled :( -->
<div class="card-area" v-if="isAbleToAddToItemSet">
<div class="card-title">导入到配装方案</div>
<div
class="card-content"
style="display: flex; align-items: center; justify-content: space-between; height: 38px"
>
<span style="font-size: 13px">将当前所有装备导入到自定义出装方案中</span>
<div style="width: 76px; display: flex; justify-content: center">
<NButton
size="tiny"
type="primary"
secondary
@click="handleAddToItemSet"
:disabled="lc.state !== 'connected'"
>导入</NButton
>
<div class="card-title">方案应用</div>
<div class="card-content">
<div
style="display: flex; align-items: center; justify-content: space-between; height: 38px"
>
<span style="font-size: 13px">导入当前装备方案</span>
<div style="width: 76px; display: flex; justify-content: center">
<NButton
size="tiny"
type="primary"
secondary
@click="handleAddToItemSet"
:disabled="lc.state !== 'connected'"
>导入</NButton
>
</div>
</div>
<!-- <div
style="display: flex; align-items: center; justify-content: space-between; height: 38px"
>
<span style="font-size: 13px">自动应用出场率最高的方案</span>
<div style="width: 76px; display: flex; justify-content: center">
<NCheckbox
size="small"
type="primary"
secondary
v-model:checked="autoApply"
></NCheckbox>
</div>
</div> -->
</div>
</div>
<div
Expand Down Expand Up @@ -669,7 +683,7 @@ import {
} from 'naive-ui'
import { computed, ref, watchEffect } from 'vue'
import { MODE_TEXT, POSITION_TEXT, TIER_TEXT } from './text'
import { MODE_TEXT, POSITION_TEXT } from './text'
const props = defineProps<{
region?: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<div>
<div class="para">
League Akari
是免费开源的软件,旨在提供额外的辅助功能。您不应从任何付费渠道获取此软件。
是开源软件,旨在提供额外的辅助功能。您不应从任何付费渠道获取此软件。
</div>
<div class="para">
同时强调,对于使用本软件可能带来的任何后果,包括但不限于游戏账户的封禁、数据损坏或其他任何形式的游戏体验负面影响,本软件的开发者将不承担任何责任。用户在决定使用本软件时,应充分考虑并自行承担由此产生的所有风险和后果。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</div>
<div class="about-para">
<LeagueAkariSpan bold @click="() => handleClickEasterEgg()" /> (Version {{ app.version }})
是一个免费且开源的应用软件,专注于提供一些额外的功能,以辅助英雄联盟的游戏体验,其几乎所有实现都依赖
是开源软件,专注于提供一些额外的功能,以辅助英雄联盟的游戏体验,其几乎所有实现都依赖
<a target="_blank" href="https://riot-api-libraries.readthedocs.io/en/latest/lcu.html"
>League Client Update (LCU)</a
>。
Expand All @@ -37,7 +37,7 @@
src="https://img.shields.io/github/stars/Hanxven/LeagueAkari"
/></a>
</div>
<div class="divider"></div>
<div class="divider" />
<NCard size="small">
<ControlItem
class="control-item-margin"
Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils/analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ export interface AkariScore {
total: number
}

// 非卖品
// 非卖品, 仅限内部评判使用
export function calculateAkariScore(analyses: {
games: Record<number, MatchHistoryGamesAnalysis>
summary: MatchHistoryGamesAnalysisSummary
Expand Down

0 comments on commit b9a43d6

Please sign in to comment.