Skip to content

Commit 832ef78

Browse files
authored
Merge pull request #148 from RCVolus/disable-farsight
feat: only enable farsight if configured (default off)
2 parents 49ad4e8 + c0a0748 commit 832ef78

File tree

6 files changed

+1176
-2032
lines changed

6 files changed

+1176
-2032
lines changed

electron/module/Modules.ts

+12-8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { LCU } from '../connector/LCU'
77
import { InGameApi } from './InGameApi'
88
import { Lobby } from './Lobby';
99
import { Farsight } from './Farsight';
10+
import { store } from '../index'
1011

1112
export class Modules {
1213
public modules: Map<string, LCUModule | ReplayModule | LiveEventsModule | InGameApi | Lobby | Farsight> = new Map()
@@ -76,15 +77,18 @@ export class Modules {
7677
this.menu
7778
))
7879

79-
this.modules.set("farsight", new Farsight(
80-
"in-game-farsight",
81-
"Farsight",
82-
"module-league-in-game",
83-
this.lcu,
84-
this.server,
85-
this.menu
86-
))
80+
if (store.get("enable-farsight") === true) {
81+
this.modules.set("farsight", new Farsight(
82+
"in-game-farsight",
83+
"Farsight",
84+
"module-league-in-game",
85+
this.lcu,
86+
this.server,
87+
this.menu
88+
));
89+
}
8790

91+
8892
ipcMain.handle('modules-ready', async () => {
8993
// eslint-disable-next-line @typescript-eslint/no-unused-vars
9094
return [...this.modules].map(([k, m]) => {

electron/module/ReplayModule.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ import fetch, { FetchError } from 'electron-fetch'
99
import { Agent } from "https";
1010
import type { DisplayError } from '../../types/DisplayError';
1111
import { store } from '../index'
12-
import { keyboard } from '@nut-tree/nut-js'
13-
import { Key } from '@nut-tree/nut-js/dist/lib/key.enum';
12+
import robotjs from '@hurdlegroup/robotjs';
1413
import api from '../api';
1514
import log from 'electron-log';
1615

@@ -268,7 +267,8 @@ export class ReplayModule {
268267
this.sendPlayback()
269268
}, 0)
270269
this.server.subscribe('module-league-caster-cockpit', 'show-gold', () => {
271-
keyboard.type(Key.X)
270+
// TODO: this is broken currently (it works outside of league but not inside)
271+
robotjs.unicodeTap('x'.charCodeAt(0))
272272
})
273273
}
274274

electron/store.ts

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ const schema: Schema<Config> = {
3232
},
3333
'league-install-path': {
3434
type: 'string'
35+
},
36+
'enable-farsight': {
37+
type: 'boolean',
38+
default: false
3539
}
3640
}
3741

0 commit comments

Comments
 (0)