From 23f2df77e296d53eee80cfb3e9d58073e4dacc33 Mon Sep 17 00:00:00 2001 From: zombodotcom Date: Sat, 12 Oct 2019 10:25:53 -0600 Subject: [PATCH 1/8] derp --- main.ts | 4 +- package.json | 3 +- src/app/displaylist/displaylist.component.ts | 47 +++++++++++++++++--- src/app/displaylist/getstash.py | 16 +++++++ src/app/poeninjaapi.service.ts | 10 ++--- 5 files changed, 65 insertions(+), 15 deletions(-) create mode 100644 src/app/displaylist/getstash.py diff --git a/main.ts b/main.ts index 72a8a6f..a3ebcf6 100644 --- a/main.ts +++ b/main.ts @@ -1,11 +1,11 @@ import { app, BrowserWindow, screen } from "electron"; import * as path from "path"; import * as url from "url"; - +import { PythonShell } from "python-shell"; let win, serve; const args = process.argv.slice(1); serve = args.some(val => val === "--serve"); - +var pyshell = require("python-shell"); function createWindow() { const electronScreen = screen; const size = electronScreen.getPrimaryDisplay().workAreaSize; diff --git a/package.json b/package.json index f218f83..6998719 100644 --- a/package.json +++ b/package.json @@ -89,10 +89,9 @@ "@angular/forms": "^8.0.0 || ^9.0.0-0", "@angular/material": "~8.2.3", "axios": "^0.19.0", - "express": "^4.17.1", "hammerjs": "^2.0.8", "node-fetch": "^2.6.0", - "node-poe-api": "^1.0.5", + "python-shell": "^1.0.8", "request-promise": "^4.2.4" } } diff --git a/src/app/displaylist/displaylist.component.ts b/src/app/displaylist/displaylist.component.ts index 1b1f39f..7007b4b 100644 --- a/src/app/displaylist/displaylist.component.ts +++ b/src/app/displaylist/displaylist.component.ts @@ -2,8 +2,10 @@ import { Component, OnInit } from "@angular/core"; import { PoeninjaapiService } from "../poeninjaapi.service"; import { DataSource } from "@angular/cdk/table"; import { Sort } from "@angular/material/sort"; -import { HttpClient } from "@angular/common/http"; -import { Cookies } from "electron"; +import { HttpClient, HttpHeaders } from "@angular/common/http"; +import { Observable } from "rxjs"; +// import { Cookies } from "electron"; +// import { PythonShell } from "python-shell"; export interface PoeNinjaItemData { name: string; @@ -30,9 +32,31 @@ export class DisplaylistComponent implements OnInit { "icon", "explicitModifiers" ]; - + httpOptions = { + withCredentials: true, + headers: new HttpHeaders({ + "Content-Type": "application/json", + POESESID: "INSERT HERE" + }) + }; constructor(private svc: PoeninjaapiService, private http: HttpClient) {} ngOnInit() { + // PythonShell.run("../services/pythonservice/getstash.py", null, function( + // err + // ) { + // if (err) throw err; + // console.log("finished"); + // }); + // let path = require("path"); + // var rq = require("request-promise"); + + // var subpy = require("child_process").spawn("python", ["getstash.py"]); + + // PythonShell.run("getstash.py", null, function(err, result) { + // if (err) throw err; + // console.log("finished"); + // console.log(result); + // }); // var rp = require("request-promise"); // this.http.get('/api/people/1').subscribe(character => { // this.http.get(character.homeworld).subscribe(homeworld => { @@ -76,10 +100,13 @@ export class DisplaylistComponent implements OnInit { // .catch(function(err) { // // API call failed... // }); + let devurl = + "https://cors-anywhere.herokuapp.com/https://poe.ninja/api/data/ItemOverview?league=Blight&type=Fossil"; + this.http.get(devurl).subscribe(json => console.log(json)); - this.http - .get("https://poe.ninja/api/data/ItemOverview?league=Blight&type=Fossil") - .subscribe(json => console.log(json)); + let stashurl = + "https://cors-anywhere.herokuapp.com/https://www.pathofexile.com/character-window/get-items?accountName=qqazraelz&character=ZomboTD"; + this.http.get(stashurl).subscribe(json => console.log(json)); this.svc.getPoeNinjaData().subscribe(data => { this.poeninjaData = data; this.sortedData = this.poeninjaData; @@ -114,6 +141,14 @@ export class DisplaylistComponent implements OnInit { // })(); // add console output here }); + + console.log("Before"); + let posturl = + "https://www.pathofexile.com/character-window/get-stash-items?league=Blight&tabs=0&tabIndex=1&accountName=qqazraelz"; + this.http + .get(posturl, this.httpOptions) + .subscribe(json => console.log(json)); + console.log("After"); } sortData(sort: Sort) { const data = this.poeninjaData.slice(); diff --git a/src/app/displaylist/getstash.py b/src/app/displaylist/getstash.py new file mode 100644 index 0000000..4bb5191 --- /dev/null +++ b/src/app/displaylist/getstash.py @@ -0,0 +1,16 @@ +from __future__ import print_function +import time +from flask import Flask + +app = Flask(__name__) + + +@app.route("/") +def hello(): + return "Hello World! This is powered by Python backend." + + +if __name__ == "__main__": + print('oh hello') + # time.sleep(5) + app.run(host='127.0.0.1', port=5000) diff --git a/src/app/poeninjaapi.service.ts b/src/app/poeninjaapi.service.ts index d454b43..b7e9c11 100644 --- a/src/app/poeninjaapi.service.ts +++ b/src/app/poeninjaapi.service.ts @@ -43,10 +43,10 @@ export class PoeninjaapiService { "https://poe.ninja/api/data/ItemOverview?league=Blight&type=Fossil" ); constructor(private http: HttpClient) {} - private url = - "https://poe.ninja/api/data/ItemOverview?league=Blight&type=Fossil"; - // private poeUrl = - // "https://cors-anywhere.herokuapp.com/https://poe.ninja/api/data/ItemOverview?league=Blight&type=Fossil"; + // private url = + // "https://poe.ninja/api/data/ItemOverview?league=Blight&type=Fossil"; + private devurl = + "https://cors-anywhere.herokuapp.com/https://poe.ninja/api/data/ItemOverview?league=Blight&type=Fossil"; // private poeCharactersUrl="https://www.pathofexile.com/character-window/get-account-name="; // private poeCharactersUrl = ""https://www.pathofexile.com/character-window/get-characters=""; // private poeCharactersUrl = "https://www.pathofexile.com/character-window/get-account-name="; @@ -54,7 +54,7 @@ export class PoeninjaapiService { getPoeNinjaData(): Observable { console.log("Fetching Data"); // httpProvider.defaults.useXDomain = true; - let getfromNinja = this.http.get(this.url); + let getfromNinja = this.http.get(this.devurl); // let getOurStash = this.http.get(""); return getfromNinja; } From fb6bfb9fe382886c49e873bca4ec52ed846ded93 Mon Sep 17 00:00:00 2001 From: zombodotcom Date: Sat, 12 Oct 2019 10:31:18 -0600 Subject: [PATCH 2/8] travis ci --- src/.travis.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/.travis.yml diff --git a/src/.travis.yml b/src/.travis.yml new file mode 100644 index 0000000..7acc02f --- /dev/null +++ b/src/.travis.yml @@ -0,0 +1,24 @@ +os: + - linux + - osx +language: node_js +node_js: + - "12" + - "11" + - "10" +dist: xenial +sudo: required +services: + - xvfb +addons: + chrome: stable +before_script: + - export DISPLAY=:99.0 +install: + - npm set progress=false + - npm install +script: + - ng lint + - npm run test + - npm run e2e + - npm run build From ef61a3439c3ca750ccf3bb9337275e0b969cd258 Mon Sep 17 00:00:00 2001 From: zombodotcom Date: Sat, 12 Oct 2019 10:42:37 -0600 Subject: [PATCH 3/8] add travis --- .travis.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..7acc02f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,24 @@ +os: + - linux + - osx +language: node_js +node_js: + - "12" + - "11" + - "10" +dist: xenial +sudo: required +services: + - xvfb +addons: + chrome: stable +before_script: + - export DISPLAY=:99.0 +install: + - npm set progress=false + - npm install +script: + - ng lint + - npm run test + - npm run e2e + - npm run build From e563bfc1816fe1face9ec18f8c8db90cfd0b516b Mon Sep 17 00:00:00 2001 From: zombodotcom Date: Sat, 12 Oct 2019 16:17:11 -0600 Subject: [PATCH 4/8] make it so --- package.json | 2 + src/app/app.module.ts | 5 +- .../displaylist/displaylist.component.html | 46 +++++ src/app/displaylist/displaylist.component.ts | 173 ++++++++++-------- src/app/poeninjaapi.service.ts | 46 ++++- 5 files changed, 194 insertions(+), 78 deletions(-) diff --git a/package.json b/package.json index 6998719..d5e2611 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "@angular/router": "8.2.8", "@ngx-translate/core": "11.0.1", "@ngx-translate/http-loader": "4.0.0", + "@types/core-js": "^2.5.2", "@types/jasmine": "3.3.16", "@types/jasminewd2": "2.0.6", "@types/mocha": "5.2.7", @@ -90,6 +91,7 @@ "@angular/material": "~8.2.3", "axios": "^0.19.0", "hammerjs": "^2.0.8", + "ngx-cookie-service": "^2.2.0", "node-fetch": "^2.6.0", "python-shell": "^1.0.8", "request-promise": "^4.2.4" diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 6aa4825..930d071 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -8,7 +8,8 @@ import { HttpClientModule, HttpClient } from "@angular/common/http"; import { CoreModule } from "./core/core.module"; import { SharedModule } from "./shared/shared.module"; import { Component } from "@angular/core"; - +import { CookieService } from "ngx-cookie-service"; +import { map } from "rxjs/operators"; import { AppRoutingModule } from "./app-routing.module"; // NG Translate @@ -72,7 +73,7 @@ export function HttpLoaderFactory(http: HttpClient) { }), BrowserAnimationsModule ], - providers: [UserService], + providers: [UserService, CookieService], bootstrap: [AppComponent] }) export class AppModule {} diff --git a/src/app/displaylist/displaylist.component.html b/src/app/displaylist/displaylist.component.html index 5be6cba..c7946e2 100644 --- a/src/app/displaylist/displaylist.component.html +++ b/src/app/displaylist/displaylist.component.html @@ -63,6 +63,52 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Item Name{{ element.name }}Chaos Value{{ element.chaosValue }} cexaltedValue{{ element.exaltedValue }} exIconDetails + + {{ element.explicitModifiers[0].text }} +
+
+ - -
- - +
+
+
+ - - - - - + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + - - - + + - - -
Item Name{{ element.name }}Item Name{{ element.name }}Chaos Value{{ element.chaosValue }} cexaltedValue{{ element.exaltedValue }} exChaos Value{{ element.chaosValue }} cexaltedValue + {{ element.exaltedValue }} ex + IconDetailsIconDetails - - {{ element.explicitModifiers[0].text }} - + + {{ element.explicitModifiers[0].text }} +
+ + + +
- -
- - - - - - - - - - - - - - - - - - + +
+
Item Name{{ element.name }}Chaos Value{{ element.chaosValue }} cexaltedValue{{ element.exaltedValue }} ex
+ + + - - + - - - - - - + + + + + + + + + - - + +
Name + {{ element.name }} + Icon + + Details - - {{ element.explicitModifiers[0].text }} + + + Socketed Items + + +
+
+ + + + {{ item.typeLine }} +
  • + {{ properties.name }} {{ properties.values }} +
  • +
    Icon +
    - - diff --git a/src/app/displaylist/displaylist.component.scss b/src/app/displaylist/displaylist.component.scss index 86ad26b..bc805db 100644 --- a/src/app/displaylist/displaylist.component.scss +++ b/src/app/displaylist/displaylist.component.scss @@ -1,10 +1,10 @@ -table { - width: 100%; -} -.example-container { - height: 800px; - overflow: auto; -} -.mat-sort-header-container { - align-items: center; -} +// table { +// width: 100%; +// } +// .example-container { +// height: 800px; +// overflow: auto; +// } +// .mat-sort-header-container { +// align-items: center; +// } diff --git a/src/app/displaylist/displaylist.component.ts b/src/app/displaylist/displaylist.component.ts index b3b7fde..3fbe7bd 100644 --- a/src/app/displaylist/displaylist.component.ts +++ b/src/app/displaylist/displaylist.component.ts @@ -1,14 +1,20 @@ import { Component, OnInit } from "@angular/core"; -import { PoeninjaapiService } from "../poeninjaapi.service"; +import { PoeninjaapiService, CharacterData } from "../poeninjaapi.service"; import { DataSource } from "@angular/cdk/table"; import { Sort } from "@angular/material/sort"; -import { HttpClient, HttpHeaders } from "@angular/common/http"; + +import { + HttpClient, + HttpHeaders, + HttpErrorResponse +} from "@angular/common/http"; import { Observable } from "rxjs"; import { CookieService } from "ngx-cookie-service"; // import { Cookies } from "electron"; // import { PythonShell } from "python-shell"; import { map } from "rxjs/operators"; import { StringDecoder } from "string_decoder"; +import { MatTableDataSource } from "@angular/material"; export interface PoeNinjaItemData { name: string; chaosValue: number; @@ -17,16 +23,35 @@ export interface PoeNinjaItemData { explicitModifiers: any; } +// if (isDev) { +// console.log("Running in development"); +// } else { +// console.log("Running in production"); +// } + +export interface ZombpoeData { + character: {}; + items: {}; +} @Component({ selector: "app-displaylist", templateUrl: "./displaylist.component.html", styleUrls: ["./displaylist.component.scss"] }) export class DisplaylistComponent implements OnInit { + public restcolumns: string[]; cookieValue = "UNKNOWN"; public poeninjaData: any; public stashItems: any; + public characterItems: any; + public charactersRequest: any; + // public itemlist:any; sortedData: PoeNinjaItemData[]; + dataSource2; + public images; + users2: CharacterData[]; + tester3: CharacterData; + // fetch = require("node-fetch"); displayedColumns: string[] = [ @@ -38,11 +63,25 @@ export class DisplaylistComponent implements OnInit { ]; displayedColumnsUser: string[] = [ "name", - "chaosValue", - "exaltedValue", "icon", - "explicitModifiers" + "socketedItems" + // "chaosValue", + // "exaltedValue", + // "icon", + // "explicitModifiers" + ]; + displayedColumnsUser2: string[] = [ + "items", + "icon", + "socketedItems" + // "icon" + // "socketedItems" + // "chaosValue", + // "exaltedValue", + // "icon", + // "explicitModifiers" ]; + httpOptions = { withCredentials: true, headers: new HttpHeaders({ @@ -50,6 +89,7 @@ export class DisplaylistComponent implements OnInit { POESESSID: "insert here" }) }; + itemsdata3: any; constructor( private svc: PoeninjaapiService, private http: HttpClient, @@ -60,13 +100,24 @@ export class DisplaylistComponent implements OnInit { this.cookieService.set("POESESSID", "insert here"); this.cookieValue = this.cookieService.get("POESESSID"); console.log(this.cookieValue); + let isDevMode = process.execPath.match(/dist[\\/]electron/i); + let devurl; + let characteritemsurl; + if (isDevMode) { + console.log("IS IT DEV MODE?"); + devurl = + "https://cors-anywhere.herokuapp.com/https://poe.ninja/api/data/ItemOverview?league=Blight&type=Fossil"; + characteritemsurl = + "https://cors-anywhere.herokuapp.com/https://www.pathofexile.com/character-window/get-items?accountName=qqazraelz&character=ZomboTD"; + // let privatetesturl = + // "https://poe.ninja/api/data/ItemOverview?league=Blight&type=Fossil"; + } else { + devurl = + "https://poe.ninja/api/data/ItemOverview?league=Blight&type=Fossil"; + characteritemsurl = + "https://www.pathofexile.com/character-window/get-items?accountName=qqazraelz&character=ZomboTD"; + } - let devurl = - "https://cors-anywhere.herokuapp.com/https://poe.ninja/api/data/ItemOverview?league=Blight&type=Fossil"; - let privatetesturl = - "https://poe.ninja/api/data/ItemOverview?league=Blight&type=Fossil"; - // this.http.get(devurl).subscribe(json => console.log(json)); // working get - // this.http.get(privatetesturl).subscribe(json => console.log(json)); let options = { headers: { //withCredentials: true, @@ -83,103 +134,108 @@ export class DisplaylistComponent implements OnInit { interface ICustomer { name: string; } - // function createUserItems( - // name: string, - - // ) { - // this.stashItems.push({ name }); - // } - // let derp = this.http.get( - // "https://cors-anywhere.herokuapp.com/https://www.pathofexile.com/character-window/get-items?accountName=qqazraelz&character=ZomboTD", - // options - // ); - // let derp = this.http.get( - // "https://cors-anywhere.herokuapp.com/https://www.pathofexile.com/character-window/get-items?accountName=qqazraelz&character=ZomboTD" - // ); - let characteritemsurl = - "https://cors-anywhere.herokuapp.com/https://www.pathofexile.com/character-window/get-items?accountName=qqazraelz&character=ZomboTD"; let customer: ICustomer[]; - function createCustomer(name: Array) { - for (let x in name[0]) console.log(JSON.stringify(x)); - // console.log(name[0], "hi"); - } - this.svc.getStashData(characteritemsurl).subscribe(result => { - this.stashItems = result; - console.log(result, typeof result); - let jsonresults = JSON.stringify(result); - console.log(JSON.parse(jsonresults)); - createCustomer(result.items); - for (let i in result) { - console.log(i, "Category"); - for (let key in result[i]) { - console.log(key + ": " + result[i][key], " object"); - for (let tester in result[i][key][0]) { - console.log(tester); - } - } - } - // for (let x in jsonresults) { - // console.log(x); - // } - }); this.svc.getStashData(characteritemsurl).subscribe(result => { console.log(result); }); - // console.log("hello"); - // console.log(this.stashItems, "Hello"); - // new edit area + this.svc + .getUsers(characteritemsurl) + .subscribe((users2: CharacterData[]) => { + this.users2 = users2; + console.log(users2, "users2"); + this.dataSource2 = new MatTableDataSource(users2); + + // FINALLY ADD THE NEWLY CREATED TABLE WITH JSON DATA TO A CONTAINER. + + // this.generateTableHead("table2", data3); + // this.generateTable("table2", this.users2); + }); + + // this.svc + // .getImages(characteritemsurl) + // .subscribe(images => (this.images = images)); this.svc.getPoeNinjaData(devurl).subscribe(data => { this.poeninjaData = data; this.sortedData = this.poeninjaData; // add console output here and add to main data console.log(this.poeninjaData); - - // time to add python shellk - // (async () => { - // const generateQueryParams = query => - // "?" + - // Object.keys(query) - // .map(key => `${key}=${query[key]}`) - // .join("&"); - // const POESESSID = "---------------------"; - // const query = { - // accountName: "--------------", - // realm: "pc", - // league: "Blight", - // tab: 1, - // tabIndex: 0 - // }; - // fetch( - // "https://cors-anywhere.herokuapp.com/https://www.pathofexile.com/character-window/get-stash-items" + - // generateQueryParams(query), - // { - // headers: { - // COOKIE: `POESESSID=${POESESSID}` - // } - // } - // ) - // .then(res => res.json()) - // .then(res => console.log({ res })); - // })(); - // add console output here }); console.log("Before"); - //sendind cookies currently but sending POESIS - // let posturl = - // "https://cors-anywhere.herokuapp.com/https://www.pathofexile.com/character-window/get-stash-items?league=Blight&tabs=0&tabIndex=1&accountName=qqazraelz"; + let derplist; + // derplist = this.svc.findAllShows(characteritemsurl).subscribe(data => data); + // // console.log(derpite, "derpite"); + + // this.svc.sendGetRequest(characteritemsurl).subscribe(data => { + // console.log(data, "sendget"); + // this.characterItems = data; + // }); // this.http - // .get(posturl, this.httpOptions) - // .subscribe(json => console.log(json)); - // console.log("After"); + // .get(characteritemsurl) + // .pipe(map(res => (this.charactersRequest = res))); + + this.http.get(characteritemsurl).subscribe( + data => { + this.tester3 = data; + this.itemsdata3 = data.items; + // console.log("Items: " + data.items, "derp", typeof data.items); + this.dataSource2 = new MatTableDataSource(data.items); + console.log("Items: " + data.items); + for (let entry of data.items) { + console.log(entry); + } + + // EXTRACT VALUE FOR HTML HEADER. + // ('Book ID', 'Book Name', 'Category' and 'Price') + var col = []; + let temptable = data.items; + for (var i = 0; i < temptable.length; i++) { + // console.log(temptable); + for (var key in temptable[i]) { + if (col.indexOf(key) === -1) { + col.push(key); + // console.log(col, key, "hi"); + } + } + } + // CREATE DYNAMIC TABLE. + this.restcolumns = col; + console.log(this.restcolumns, "rest Columns"); + // CREATE HTML TABLE HEADER ROW USING THE EXTRACTED HEADERS ABOVE. + + // for (var i = 0; i < col.length; i++) { + // console.log(col, col[i]); + // } + + // // ADD JSON DATA TO THE TABLE AS ROWS. + // for (var i = 0; i < temptable.length; i++) { + // for (var j = 0; j < col.length; j++) { + // console.log(temptable[i][col[j]], "hi23434"); + // } + // } + + // this.dataSource2= + // console.log('Items: ' + data.userId); + }, + (err: HttpErrorResponse) => { + if (err.error instanceof Error) { + console.log("Client-side error occured."); + } else { + console.log("Server-side error occured."); + } + } + ); + + ///end of on init } + // start of functions after init sortData(sort: Sort) { const data = this.poeninjaData.slice(); if (!sort.active || sort.direction === "") { @@ -205,4 +261,24 @@ export class DisplaylistComponent implements OnInit { return (a < b ? -1 : 1) * (isAsc ? 1 : -1); } } + // generateTableHead(table, data) { + // let thead = table.createTHead(); + // let row = thead.insertRow(); + // for (let key of data) { + // let th = document.createElement("th"); + // let text = document.createTextNode(key); + // th.appendChild(text); + // row.appendChild(th); + // } + // } + // generateTable(table, data) { + // for (let element of data) { + // let row = table.insertRow(); + // for (let key in element) { + // let cell = row.insertCell(); + // let text = document.createTextNode(element[key]); + // cell.appendChild(text); + // } + // } + // } } diff --git a/src/app/poeninjaapi.service.ts b/src/app/poeninjaapi.service.ts index fed4ef7..9566255 100644 --- a/src/app/poeninjaapi.service.ts +++ b/src/app/poeninjaapi.service.ts @@ -7,24 +7,87 @@ import { map } from "rxjs/operators"; import { from } from "rxjs"; import { get } from "http"; export interface Character { - table: string; - name: string; - datatype: string; + [index: number]: { + string: { + string: [number | string]; + }; + }; } export interface Items { - name: string; + items: { + name: string; + icon: string; + }; } -export interface BlacklistData { - character: Character[]; - items: Items[]; +export interface CharacterData { + items?: (ItemsEntity)[] | null; + character: Character; +} +export interface ItemsEntity { + verified: boolean; + w: number; + h: number; + ilvl: number; + icon: string; + league: string; + id: string; + name: string; + typeLine: string; + identified: boolean; + properties?: (PropertiesEntity)[] | null; + requirements?: (RequirementsEntity)[] | null; + utilityMods?: (string)[] | null; + explicitMods?: (string)[] | null; + descrText: string; + flavourText?: (string)[] | null; + frameType: number; + x: number; + y: number; + inventoryId: string; +} +export interface PropertiesEntity { + name: string; + values?: + | ( + | ( + | string + | number + | string + | number + | string + | number + | string + | number + | string + | number)[] + | null)[] + | null; + displayMode: number; + type?: number | null; +} +export interface RequirementsEntity { + name: string; + values?: ((string | number)[] | null)[] | null; + displayMode: number; +} +export interface Character { + name: string; + league: string; + classId: number; + ascendancyClass: number; + class: string; + level: number; + experience: number; + lastActive: boolean; } @Injectable({ providedIn: "root" }) export class PoeninjaapiService { + derp; baseURL = "https://poe.ninja/api/data/{}Overview?league={}&type={}"; ninjaCurrencyTypes = ["Fragment", "Currency"]; myObjStr = []; @@ -68,6 +131,7 @@ export class PoeninjaapiService { // private poeCharactersUrl = ""https://www.pathofexile.com/character-window/get-characters=""; // private poeCharactersUrl = "https://www.pathofexile.com/character-window/get-account-name="; derplist = []; + searchResult: any[]; getPoeNinjaData(url): Observable { console.log("Fetching Data"); // httpProvider.defaults.useXDomain = true; @@ -79,18 +143,19 @@ export class PoeninjaapiService { //change here for build // let getfromNinja = this.http.get(this.devurl); - // console.log(JSON.stringify(getfromNinja.lines)); + // console.log(JSON.stringify(getfromNinja)); console.log("end data fetch"); // let getOurStash = this.http.get(""); return getfromNinja; } - // BlackListData: Promise; + // CharacterData: Promise; getStashData(url): Observable { // url = url.toLowerCase(); console.log("Fetching Data"); // httpProvider.defaults.useXDomain = true; let getfromNinja = this.http.get(url).pipe(map(result => result)); + // this.http.get(url).pipe(map(derpo => derpo)); console.log("Inside"); // console.log("derp", getfromNinja as any); // let getOurStash = this.http.get(""); @@ -98,6 +163,42 @@ export class PoeninjaapiService { return getfromNinja; } + sendGetRequest(url) { + return this.http.get(url); + } + + findAllShows(url): Observable { + return this.http.get(url).pipe( + map((result: any) => { + result; + console.log(result, "derp1234"); + }) + ); + } + + getStashDataInterface(url): Observable { + // url = url.toLowerCase(); + console.log("Fetching Data Interfacte"); + + // httpProvider.defaults.useXDomain = true; + + let getfromNinja = this.http + .get(url) + .pipe(map(result => result)); + console.log("Inside"); + // this.http.get(url, { responseType: "json" }).subscribe(data => { + // // Data extraction from the HTTP response is already done + // // Display the result + + // console.log("TJ user data", data); + // }); + + // console.log("derp", getfromNinja as any); + // let getOurStash = this.http.get(""); + + return getfromNinja; + } + // httpOptions = { // headers: new HttpHeaders({ // "Content-Type": "application/json", @@ -106,4 +207,18 @@ export class PoeninjaapiService { // }), // params: new HttpParams().set("program_id", this.program_id) // }; + + getUsers(url) { + return this.http.get(url); + } + + setUser(user, url) { + let userId = user.id; + delete user.id; + return this.http.post(url, user); + } + + getImages(url) { + return this.http.get(url); + } } diff --git a/src/main.ts b/src/main.ts index dc59988..e6feaae 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,9 +1,48 @@ -import 'hammerjs'; -import { enableProdMode } from '@angular/core'; -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; +import "hammerjs"; +import { enableProdMode } from "@angular/core"; +import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"; -import { AppModule } from './app/app.module'; -import { AppConfig } from './environments/environment'; +import { AppModule } from "./app/app.module"; +import { AppConfig } from "./environments/environment"; +const log = require("electron-log"); +log.transports.console.level = true; +// log.info("Hello, log"); +// log.warn("Some problem appears"); + +// let loglist = ["error", "warn", "info", "verbose", "debug", "silly"]; + +export const isDev = require("electron-is-dev"); +require("update-electron-app")({ + repo: "zombodotcom/Zombpoe", + updateInterval: "5 minutes", + logger: require("electron-log") +}); + +if (isDev) { + console.log( + "%c Running In Dev \n Welcome to ZombPoes Dev Branches", + "background: #222; color: magenta" + ); + + log.info("%cMagenta text. %cGreen text", "color: magenta", "color: green"); + log.error("%cMagenta text. %cGreen text", "color: magenta", "color: green"); + log.verbose("%cMagenta text. %cGreen text", "color: magenta", "color: green"); + log.debug("%cRed text. %cGreen text", "color: red", "color: green"); + log.silly( + "%cUnset %cBlack %cRed %cGreen %cYellow %cBlue %cMagenta %cCyan %cWhite", + "color: unset", + "color: black", + "color: red", + "color: green", + "color: yellow", + "color: blue", + "color: magenta", + "color: cyan", + "color: white" + ); +} else { + console.log("Running in production"); +} if (AppConfig.production) { enableProdMode(); From fa7e08d4459287ea977d9511e6a64bc9dd1d5fce Mon Sep 17 00:00:00 2001 From: zombodotcom Date: Sun, 13 Oct 2019 18:25:18 -0600 Subject: [PATCH 8/8] make it so 2 test --- src/main.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main.ts b/src/main.ts index e6feaae..7f798d2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -12,13 +12,14 @@ log.transports.console.level = true; // let loglist = ["error", "warn", "info", "verbose", "debug", "silly"]; export const isDev = require("electron-is-dev"); -require("update-electron-app")({ - repo: "zombodotcom/Zombpoe", - updateInterval: "5 minutes", - logger: require("electron-log") -}); if (isDev) { + require("update-electron-app")({ + repo: "zombodotcom/Zombpoe", + updateInterval: "5 minutes", + logger: require("electron-log") + }); + console.log( "%c Running In Dev \n Welcome to ZombPoes Dev Branches", "background: #222; color: magenta" @@ -41,6 +42,12 @@ if (isDev) { "color: white" ); } else { + require("update-electron-app")({ + repo: "zombodotcom/Zombpoe", + updateInterval: "5 minutes", + logger: require("electron-log") + }); + console.log("Running in production"); }