mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2026-09-25 14:15:42 +00:00
cf protection
This commit is contained in:
@@ -11,6 +11,7 @@ import { closeWindow as closeSettings } from './main/SettingsWindow'
|
||||
import { logger } from './main/logger'
|
||||
import { checkForUpdates } from './main/updates'
|
||||
import os from 'os'
|
||||
import { setupCfProtection } from './main/cf-protection'
|
||||
import { createOverlayWindow } from './main/overlay-window'
|
||||
import { setupAltVisibility } from './main/alt-visibility'
|
||||
import { setupBuiltinBrowser } from './main/builtin-browser'
|
||||
@@ -58,6 +59,7 @@ app.on('ready', async () => {
|
||||
setTimeout(
|
||||
async () => {
|
||||
await createOverlayWindow()
|
||||
setupCfProtection()
|
||||
setupShortcuts()
|
||||
setupAltVisibility()
|
||||
},
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { overlayWindow } from './overlay-window'
|
||||
|
||||
export function setupCfProtection () {
|
||||
overlayWindow!.webContents.session.webRequest.onHeadersReceived({
|
||||
urls: ['https://*.pathofexile.com/*']
|
||||
}, (details, next) => {
|
||||
if (details.responseHeaders?.['set-cookie']) {
|
||||
const cookies = details.responseHeaders['set-cookie']
|
||||
const cfduid = cookies.find(c => c.startsWith('__cfduid'))
|
||||
|
||||
if (cfduid) {
|
||||
// console.log(cfduid)
|
||||
// @TODO will break with next Chromium update?
|
||||
details.responseHeaders['set-cookie'] = [
|
||||
...cookies.filter(c => !c.startsWith('__cfduid')),
|
||||
cfduid.split(';').filter(_ => _.trim() !== 'SameSite=Lax').join(';')
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
next({ responseHeaders: details.responseHeaders })
|
||||
})
|
||||
}
|
||||
@@ -17,8 +17,9 @@
|
||||
<div>
|
||||
<span class="text-red-400">Failed to load leagues</span>
|
||||
<button class="btn ml-2" @click="retry">Retry</button>
|
||||
<button class="btn ml-1" @click="openCaptcha">Browser</button>
|
||||
</div>
|
||||
<pre class="text-gray-500 whitespace-normal">Error: {{ leaguesService.loadingError }}</pre>
|
||||
<!-- <pre class="text-gray-500 whitespace-normal">Error: {{ leaguesService.loadingError }}</pre> -->
|
||||
<div class="font-fontin-bold">Verify that the realm is not under maintenance and pathofexile.com is loading.</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -40,6 +41,7 @@ export default {
|
||||
this.updateInfo = updateInfo
|
||||
})
|
||||
},
|
||||
inject: ['wm', 'widget'],
|
||||
data () {
|
||||
return {
|
||||
updateInfo: null
|
||||
@@ -54,6 +56,9 @@ export default {
|
||||
if (Leagues.isLoaded) {
|
||||
Prices.load()
|
||||
}
|
||||
},
|
||||
openCaptcha () {
|
||||
this.wm.showBrowser(this.widget.config.wmId, 'https://api.pathofexile.com/leagues?type=main&realm=pc&compact=1')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user