Skip to content

Commit

Permalink
Merge pull request #604 from Kyusung4698/develop
Browse files Browse the repository at this point in the history
0.6.20 (2020-04-10)
  • Loading branch information
Kyusung4698 authored Apr 10, 2020
2 parents e14c93a + fe5ef75 commit 5ffcb57
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 22 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.6.20 (2020-04-10)

- fix poe overlay losses focus after clicking on it (#602)

## 0.6.19 (2020-04-10)

- update `evaluate-translate` default shortcut to `Alt + T` (#590)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
![GitHub Release Date](https://img.shields.io/github/release-date/Kyusung4698/PoE-Overlay)
<a href="https://www.patreon.com/bePatron?u=30666721"><img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Become a Patron" width="85px" height="20px"></a>

# PoE Overlay 0.6.19
# PoE Overlay 0.6.20

An Overlay for Path of Exile. The ***core aspect*** is to blend in with the game. Built with Electron and Angular.

Expand Down Expand Up @@ -62,7 +62,7 @@ These instructions will set you up to run and enjoy the overlay.
#### Supports

* Windows 10 x64
* Windows 7 x64
* Windows 7 x64 (with keyboard support enabled)
* Linux coming soon (can be compiled manually)

#### Prerequisites
Expand All @@ -74,11 +74,11 @@ These instructions will set you up to run and enjoy the overlay.
#### Installing

1. Head over to [Releases](https://github.com/Kyusung4698/PoE-Overlay/releases) and download one of the following files
1. `poe-overlay-Setup-0.6.19.exe` to install locally. This supports auto update/ auto launch.
2. `poe-overlay-0.6.19.exe` portable version. This does not support auto update/ auto launch.
1. `poe-overlay-Setup-0.6.20.exe` to install locally. This supports auto update/ auto launch.
2. `poe-overlay-0.6.20.exe` portable version. This does not support auto update/ auto launch.
2. Run either of your downloaded file
3. Start Path of Exile
4. Wait until you can see `PoE Overlay 0.6.19` in the bottom left corner
4. Wait until you can see `PoE Overlay 0.6.20` in the bottom left corner
5. Hit `f7` and set `Language` and `League` to meet your game settings

#### Shortcuts
Expand Down
15 changes: 14 additions & 1 deletion main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { app, BrowserWindow, dialog, Display, ipcMain, Menu, MenuItem, MenuItemConstructorOptions, screen, systemPreferences, Tray } from 'electron';
import { app, BrowserWindow, dialog, Display, ipcMain, Menu, MenuItem, MenuItemConstructorOptions, screen, session, systemPreferences, Tray } from 'electron';
import * as path from 'path';
import * as url from 'url';
import UserAgent from 'user-agents';
import * as launch from './electron/auto-launch';
import * as update from './electron/auto-updater';
import * as game from './electron/game';
Expand Down Expand Up @@ -49,6 +50,17 @@ const childs: {
[key: string]: BrowserWindow
} = {};

/* session */

function setUserAgent() {
const userAgent = new UserAgent();
const generatedUserAgent = userAgent.random().toString();
session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => {
details.requestHeaders['User-Agent'] = generatedUserAgent;
callback({ cancel: false, requestHeaders: details.requestHeaders });
});
}

/* helper */

function getDisplay(): Display {
Expand Down Expand Up @@ -314,6 +326,7 @@ try {
createWindow();
createTray();
}, 300);
setUserAgent();
});

app.on('window-all-closed', () => {
Expand Down
47 changes: 44 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "poe-overlay",
"version": "0.6.19",
"version": "0.6.20",
"private": true,
"description": "A Overlay for Path of Exile. Built with Electron and Angular.",
"main": "main.js",
Expand Down Expand Up @@ -89,6 +89,7 @@
"robotjs": "git+https://github.com/Kyusung4698/robotjs.git#a219829c83ff7f3a802c98a9c52a672ca798d80e",
"rxjs": "~6.5.4",
"tslib": "^1.11.1",
"user-agents": "^1.0.559",
"zone.js": "^0.10.3"
},
"resolutions": {
Expand Down
29 changes: 20 additions & 9 deletions src/app/data/poe/service/trade-http.service.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { HttpClient, HttpErrorResponse, HttpParams, HttpResponse } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { BrowserService, SessionService } from '@app/service';
import { BrowserService, LoggerService, SessionService } from '@app/service';
import { environment } from '@env/environment';
import { Language } from '@shared/module/poe/type';
import { Observable, of, throwError } from 'rxjs';
import { delay, flatMap, map, retryWhen } from 'rxjs/operators';
import { TradeFetchResult, TradeItemsResult, TradeLeaguesResult, TradeResponse, TradeSearchRequest, TradeSearchResponse, TradeStaticResult, TradeStatsResult } from '../schema/trade';

const RETRY_COUNT = 3;
const RETRY_DELAY = 100;
const RETRY_LIMIT_DELAY = 300;
const RETRY_LIMIT_DELAY_FACTOR = [1, 2, 4];
const RETRY_DELAY = 300;
const RETRY_LIMIT_COUNT = 1;
const RETRY_LIMIT_DELAY = 2000;

@Injectable({
providedIn: 'root'
Expand All @@ -19,7 +19,8 @@ export class TradeHttpService {
constructor(
private readonly http: HttpClient,
private readonly browser: BrowserService,
private readonly session: SessionService) { }
private readonly session: SessionService,
private readonly logger: LoggerService) { }

public getItems(language: Language): Observable<TradeResponse<TradeItemsResult>> {
const url = this.getApiUrl('data/items', language);
Expand All @@ -43,7 +44,9 @@ export class TradeHttpService {

public search(request: TradeSearchRequest, language: Language, leagueId: string): Observable<TradeSearchResponse> {
const url = this.getApiUrl(`search/${encodeURIComponent(leagueId)}`, language);
return this.http.post<TradeSearchResponse>(url, request).pipe(
return this.http.post<TradeSearchResponse>(url, request, {
withCredentials: true
}).pipe(
retryWhen(errors => errors.pipe(
flatMap((response, count) => this.handleError(url, response, count))
)),
Expand All @@ -61,7 +64,8 @@ export class TradeHttpService {
fromObject: {
query: queryId
}
})
}),
withCredentials: true
}).pipe(
retryWhen(errors => errors.pipe(
flatMap((response, count) => this.handleError(url, response, count))
Expand All @@ -72,7 +76,8 @@ export class TradeHttpService {
private getAndTransform<TResponse>(url: string): Observable<TResponse> {
return this.http.get(url, {
observe: 'response',
responseType: 'text'
responseType: 'text',
withCredentials: true
}).pipe(
retryWhen(errors => errors.pipe(
flatMap((response, count) => this.handleError(url, response, count))
Expand Down Expand Up @@ -143,9 +148,15 @@ export class TradeHttpService {
return throwError(response.error);
}
case 403:
if (count >= RETRY_LIMIT_COUNT) {
return throwError(response);
}
return this.browser.retrieve(url).pipe(delay(RETRY_DELAY));
case 429:
return of(null).pipe(delay(RETRY_LIMIT_DELAY * RETRY_LIMIT_DELAY_FACTOR[count]));
if (count >= RETRY_LIMIT_COUNT) {
return throwError(response);
}
return of(null).pipe(delay(RETRY_LIMIT_DELAY));
default:
return this.session.clear().pipe(delay(RETRY_DELAY));
}
Expand Down
8 changes: 5 additions & 3 deletions src/app/layout/page/overlay/overlay.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { SnackBarService } from '@shared/module/material/service';
import { ContextService } from '@shared/module/poe/service';
import { Context } from '@shared/module/poe/type';
import { BehaviorSubject, Observable } from 'rxjs';
import { distinctUntilChanged, flatMap, tap } from 'rxjs/operators';
import { distinctUntilChanged, flatMap, map, tap } from 'rxjs/operators';
import { UserSettingsService } from '../../service/user-settings.service';
import { UserSettings } from '../../type';

Expand Down Expand Up @@ -97,11 +97,13 @@ export class OverlayComponent implements OnInit, OnDestroy {
}

private registerVisibleChange(): void {

this.app.visibleChange().pipe(
tap(flag => this.shortcut.check(flag)),
map(flag => flag !== VisibleFlag.None),
distinctUntilChanged()
).subscribe(flag => {
if (flag === VisibleFlag.None) {
).subscribe(show => {
if (!show) {
this.window.hide();
} else {
this.window.show();
Expand Down

0 comments on commit 5ffcb57

Please sign in to comment.