This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #172 from ferreira-tb/captcha-route
fix: impede que o AS continue atacando após surgir captcha
- Loading branch information
Showing
11 changed files
with
74 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
import { ipcRenderer } from 'electron'; | ||
import { usePlunderConfigStore } from '$renderer/stores/plunder'; | ||
import { setPlunderConfigEvents } from '$browser/events/plunder/config'; | ||
import { setPlunderNavigationEvents } from '$browser/events/plunder/navigation'; | ||
|
||
export function setPlunderEvents() { | ||
setPlunderConfigEvents(); | ||
setPlunderNavigationEvents(); | ||
|
||
const plunderConfigStore = usePlunderConfigStore(); | ||
|
||
ipcRenderer.on('plunder:stop', () => (plunderConfigStore.active = false)); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { ipcMain, webContents } from 'electron'; | ||
import { storeToRefs, watch } from 'mechanus'; | ||
import { isUserAlias } from '$global/guards'; | ||
import { MainProcessEventError } from '$electron/error'; | ||
import { useAresStore, useCacheStore, usePlunderHistoryStore, PlunderHistory } from '$electron/interface'; | ||
|
||
export function setCaptchaEvents() { | ||
const aresStore = useAresStore(); | ||
const { captcha } = storeToRefs(aresStore); | ||
|
||
const cacheStore = useCacheStore(); | ||
const plunderHistoryStore = usePlunderHistoryStore(); | ||
|
||
ipcMain.on('captcha:update-status', (e, status: boolean) => { | ||
captcha.value = status; | ||
for (const contents of webContents.getAllWebContents()) { | ||
if (contents !== e.sender) { | ||
contents.send('captcha:status-did-update', status); | ||
}; | ||
}; | ||
}); | ||
|
||
watch(captcha, async (status) => { | ||
try { | ||
if (!status) return; | ||
for (const contents of webContents.getAllWebContents()) { | ||
contents.send('plunder:stop'); | ||
}; | ||
|
||
if (isUserAlias(cacheStore.userAlias)) { | ||
await PlunderHistory.saveHistory(cacheStore.userAlias, plunderHistoryStore); | ||
}; | ||
|
||
} catch (err) { | ||
MainProcessEventError.catch(err); | ||
}; | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { ipcMain } from 'electron'; | ||
import { useAresStore } from '$electron/interface'; | ||
import { getMainWindow } from '$electron/utils/helpers'; | ||
import { setCaptchaEvents } from '$electron/events/browser/captcha'; | ||
|
||
export function setBrowserEvents() { | ||
const mainWindow = getMainWindow(); | ||
const aresStore = useAresStore(); | ||
|
||
ipcMain.handle('browser:get-response-time', () => aresStore.responseTime); | ||
|
||
ipcMain.on('browser:update-response-time', (_e, time: number) => { | ||
aresStore.responseTime = time; | ||
mainWindow.webContents.send('response-time-did-update', time); | ||
}); | ||
|
||
setCaptchaEvents(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters