Commit 09e4f886 authored by 神楽坂玲奈's avatar 神楽坂玲奈

lint & update

Signed-off-by: 神楽坂玲奈's avatarzh99998 <zh99998@gmail.com>
parent ec931392
{
"name": "mycard-mobile",
"version": "1.0.9",
"version": "1.0.18",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......@@ -17,9 +17,9 @@
}
},
"@angular/animations": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@angular/animations/-/animations-4.3.1.tgz",
"integrity": "sha1-H34LuAPvwhxggkbmdlocZH89Gl8=",
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/@angular/animations/-/animations-4.3.6.tgz",
"integrity": "sha1-v5KD7HyMmLMvVp2E3NoQiQ/cAmI=",
"requires": {
"tslib": "1.7.1"
}
......@@ -83,7 +83,7 @@
"raw-loader": "0.5.1",
"resolve": "1.3.3",
"rsvp": "3.6.2",
"rxjs": "5.4.2",
"rxjs": "5.4.3",
"sass-loader": "6.0.6",
"script-loader": "0.7.0",
"semver": "5.4.1",
......@@ -100,32 +100,32 @@
"webpack-dev-middleware": "1.11.0",
"webpack-dev-server": "2.5.1",
"webpack-merge": "4.1.0",
"zone.js": "0.8.14"
"zone.js": "0.8.17"
}
},
"@angular/common": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@angular/common/-/common-4.3.1.tgz",
"integrity": "sha1-Jg9IenzcoybENr0+qVFceX3i/3I=",
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/@angular/common/-/common-4.3.6.tgz",
"integrity": "sha1-7TfpMHx1Bt2DR5fBps9nXlK1tu4=",
"requires": {
"tslib": "1.7.1"
}
},
"@angular/compiler": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-4.3.1.tgz",
"integrity": "sha1-OiTUns8BrCtuB/Y+N4uP+OJX/gk=",
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-4.3.6.tgz",
"integrity": "sha1-vhcN8Ji3HoNczt8WjV+3sj5QRbg=",
"requires": {
"tslib": "1.7.1"
}
},
"@angular/compiler-cli": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-4.3.1.tgz",
"integrity": "sha1-ALQa+2+utK71YbhCeASsiICv9jw=",
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-4.3.6.tgz",
"integrity": "sha1-avpq72jdaB5hs5i+TWJw5choCxI=",
"dev": true,
"requires": {
"@angular/tsc-wrapped": "4.3.1",
"@angular/tsc-wrapped": "4.3.6",
"minimist": "1.2.0",
"reflect-metadata": "0.1.10"
},
......@@ -139,33 +139,33 @@
}
},
"@angular/core": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@angular/core/-/core-4.3.1.tgz",
"integrity": "sha1-qdCn1kS5YmBnQmm2iaBP7qYyqNM=",
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/@angular/core/-/core-4.3.6.tgz",
"integrity": "sha1-u6xj1o0Pe8s4nRKzQghlK+MofpY=",
"requires": {
"tslib": "1.7.1"
}
},
"@angular/forms": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@angular/forms/-/forms-4.3.1.tgz",
"integrity": "sha1-M5FNossUZDD/kBRx5oLHZlRiLf4=",
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/@angular/forms/-/forms-4.3.6.tgz",
"integrity": "sha1-DyDEWXwWoVJ0XXzZVVmFWgpcZoc=",
"requires": {
"tslib": "1.7.1"
}
},
"@angular/http": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@angular/http/-/http-4.3.1.tgz",
"integrity": "sha1-5PZh90ZxHojsvqdqPJBbq/l9MVo=",
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/@angular/http/-/http-4.3.6.tgz",
"integrity": "sha1-Vjgn0afV6J47fYa3f7vTZ7LAhZE=",
"requires": {
"tslib": "1.7.1"
}
},
"@angular/language-service": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@angular/language-service/-/language-service-4.3.1.tgz",
"integrity": "sha1-mRCDP8id2qw+SNP/r4u4k2GM2hE=",
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/@angular/language-service/-/language-service-4.3.6.tgz",
"integrity": "sha1-cc8tu0ZhVo89EqnA5LngQ++TvTo=",
"dev": true
},
"@angular/material": {
......@@ -177,25 +177,25 @@
}
},
"@angular/platform-browser": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-4.3.1.tgz",
"integrity": "sha1-23J7Bu7WS9pd7+xxgV2yak2i9pA=",
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-4.3.6.tgz",
"integrity": "sha1-YVKx87eNAkb8XhUOL3ue1DN+O6Y=",
"requires": {
"tslib": "1.7.1"
}
},
"@angular/platform-browser-dynamic": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-4.3.1.tgz",
"integrity": "sha1-hANNpgqC7zbn7/2ns63m5kWzMLM=",
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-4.3.6.tgz",
"integrity": "sha1-nqv4JvEZyY+Fwqlu3LGKsAtO+xw=",
"requires": {
"tslib": "1.7.1"
}
},
"@angular/router": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@angular/router/-/router-4.3.1.tgz",
"integrity": "sha1-UhnURSYVbYFgZYQRJ2EBZaAVtFA=",
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/@angular/router/-/router-4.3.6.tgz",
"integrity": "sha1-ZAM+20/NoIoyPnUztKGCDA8o0TA=",
"requires": {
"tslib": "1.7.1"
}
......@@ -211,9 +211,9 @@
}
},
"@angular/tsc-wrapped": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@angular/tsc-wrapped/-/tsc-wrapped-4.3.1.tgz",
"integrity": "sha1-9mFqTSo7vsHN7WZP0fUm7c6Z70E=",
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/@angular/tsc-wrapped/-/tsc-wrapped-4.3.6.tgz",
"integrity": "sha1-GqZuCrLEeZpK0UtnXhOVOqX81DY=",
"dev": true,
"requires": {
"tsickle": "0.21.6"
......@@ -249,15 +249,15 @@
}
},
"@types/lodash": {
"version": "4.14.71",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.71.tgz",
"integrity": "sha512-x9E8HYuhmcQJPjhTd+t0oRXiQCJXoRPSzCOgYKggxtvNb/kGw8RrbdZzCXrQ6i/i4o0TettxyouY7UdbqkS4AQ==",
"version": "4.14.74",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.74.tgz",
"integrity": "sha512-BZknw3E/z3JmCLqQVANcR17okqVTPZdlxvcIz0fJiJVLUCbSH1hK3zs9r634PVSmrzAxN+n/fxlVRiYoArdOIQ==",
"dev": true
},
"@types/node": {
"version": "8.0.16",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.16.tgz",
"integrity": "sha512-P2XfbkmcAnP/XT5J5m59cQPbcIbszCwXRdngnBZefmqt1RgOv4RIFoIkG85QFDHWIt1T6bXogZP/tvh2dm/xEQ==",
"version": "8.0.24",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.24.tgz",
"integrity": "sha512-c3Npme+2JGqxW8+B+aXdN5SPIlCf1C8WxQC6Ea39rO/ASPosnMkWVR16mDJtRE+2dr2xwOQ7DiLxb+wO/TWuPg==",
"dev": true
},
"abbrev": {
......@@ -623,7 +623,7 @@
"integrity": "sha1-CpSJ8UTecO+zzkMArM2zKeL8VDs=",
"dev": true,
"requires": {
"core-js": "2.4.1",
"core-js": "2.5.0",
"regenerator-runtime": "0.10.5"
}
},
......@@ -1363,9 +1363,9 @@
"dev": true
},
"core-js": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz",
"integrity": "sha1-TekR5mew6ukSTjQlS1OupvxhjT4="
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.0.tgz",
"integrity": "sha1-VpwFCRi+ZIazg3VSAorgRmtxcIY="
},
"core-object": {
"version": "3.1.3",
......@@ -1691,9 +1691,9 @@
"dev": true
},
"deepmerge": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.0.tgz",
"integrity": "sha512-Hm4+NyDQGgH3oYhKqR0gd99veBBZpnEUNoEfFl+3PRkQL+LKGJEBgqimeofAWzUn6aBzcaYPJrRigto/WfDzTg=="
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.1.tgz",
"integrity": "sha512-Ndl8eeOHB9dQkmT1HWCgY3t0odl4bmWKFzjQZBYAxVTNs2B3nn5b6orimRYHKZ4FI8psvZkA1INRCW6l7vc9lQ=="
},
"defined": {
"version": "1.0.0",
......@@ -5015,9 +5015,9 @@
}
},
"node-fetch": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.1.tgz",
"integrity": "sha512-j8XsFGCLw79vWXkZtMSmmLaOk9z5SQ9bV/tkbZVCqvgwzrjAGq66igobLofHtF63NvMTp2WjytpsNTGKa+XRIQ==",
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.2.tgz",
"integrity": "sha512-xZZUq2yDhKMIn/UgG5q//IZSNLJIwW2QxS14CNH5spuiXkITM2pUitjdq58yLSaU7m4M0wBNaM2Gh/ggY4YJig==",
"requires": {
"encoding": "0.1.12",
"is-stream": "1.1.0"
......@@ -6519,8 +6519,7 @@
"requires-port": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=",
"dev": true
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8="
},
"resolve": {
"version": "1.3.3",
......@@ -6600,9 +6599,9 @@
}
},
"rxjs": {
"version": "5.4.2",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.4.2.tgz",
"integrity": "sha1-KjI2/L8D31e64G/Wly/ZnlwI/Pc=",
"version": "5.4.3",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.4.3.tgz",
"integrity": "sha512-fSNi+y+P9ss+EZuV0GcIIqPUK07DEaMRUtLJvdcvMyFjc9dizuDjere+A4V7JrLGnm9iCc+nagV/4QdMTkqC4A==",
"requires": {
"symbol-observable": "1.0.4"
}
......@@ -7400,9 +7399,9 @@
"integrity": "sha1-vIAEFkaRkjp5/oN4u+s9ogF1OOw="
},
"tslint": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.5.0.tgz",
"integrity": "sha1-EOjas+MGH6YelELozuOYKs8gpqo=",
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.6.0.tgz",
"integrity": "sha1-CIqmxgJmIzOGULKQCCirPt9Z9s8=",
"dev": true,
"requires": {
"babel-code-frame": "6.22.0",
......@@ -7414,13 +7413,13 @@
"resolve": "1.3.3",
"semver": "5.4.1",
"tslib": "1.7.1",
"tsutils": "2.8.0"
"tsutils": "2.8.1"
}
},
"tsutils": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.8.0.tgz",
"integrity": "sha1-AWAXNymzvxOGKN0UoVN+AIUdgUo=",
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.8.1.tgz",
"integrity": "sha1-N3FATnyp8L7fXZGaR6SxiQpo7/8=",
"dev": true,
"requires": {
"tslib": "1.7.1"
......@@ -7597,6 +7596,11 @@
}
}
},
"url-join": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/url-join/-/url-join-2.0.2.tgz",
"integrity": "sha1-wHJ1aWetJLi1nldBVRyqx49QuLc="
},
"url-loader": {
"version": "0.5.9",
"resolved": "https://registry.npmjs.org/url-loader/-/url-loader-0.5.9.tgz",
......@@ -7611,7 +7615,6 @@
"version": "1.1.9",
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.1.9.tgz",
"integrity": "sha1-xn8dd11R8KGJEd17P/rSe7nlvRk=",
"dev": true,
"requires": {
"querystringify": "1.0.0",
"requires-port": "1.0.0"
......@@ -7620,8 +7623,7 @@
"querystringify": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-1.0.0.tgz",
"integrity": "sha1-YoYkIRLFtxL6ZU5SZlK/ahP/Bcs=",
"dev": true
"integrity": "sha1-YoYkIRLFtxL6ZU5SZlK/ahP/Bcs="
}
}
},
......@@ -7743,13 +7745,15 @@
}
},
"webdav": {
"version": "1.0.0-rc1",
"resolved": "https://registry.npmjs.org/webdav/-/webdav-1.0.0-rc1.tgz",
"integrity": "sha1-UT6nI8EdnqnqGw4ND0TzxoXIS1U=",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/webdav/-/webdav-1.0.1.tgz",
"integrity": "sha1-rvSBjfJI+TozrgtksMr2berfp9E=",
"requires": {
"deepmerge": "1.5.0",
"node-fetch": "1.7.1",
"xml2js": "0.4.17"
"deepmerge": "1.5.1",
"node-fetch": "1.7.2",
"url-join": "2.0.2",
"url-parse": "1.1.9",
"xml2js": "0.4.19"
}
},
"webpack": {
......@@ -8106,21 +8110,18 @@
"dev": true
},
"xml2js": {
"version": "0.4.17",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.17.tgz",
"integrity": "sha1-F76T6q4/O3eTWceVtBlwWogX6Gg=",
"version": "0.4.19",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz",
"integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==",
"requires": {
"sax": "1.2.4",
"xmlbuilder": "4.2.1"
"xmlbuilder": "9.0.4"
}
},
"xmlbuilder": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-4.2.1.tgz",
"integrity": "sha1-qlijBBoGb5DqoWwvU4n/GfP0YaU=",
"requires": {
"lodash": "4.17.4"
}
"version": "9.0.4",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.4.tgz",
"integrity": "sha1-UZy0ymhtAFqEINNJbz8MruzKWA8="
},
"xmldom": {
"version": "0.1.27",
......@@ -8220,9 +8221,9 @@
}
},
"zone.js": {
"version": "0.8.14",
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.8.14.tgz",
"integrity": "sha1-DE2ySxeCMidMy0P3jJnbfzZCts8="
"version": "0.8.17",
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.8.17.tgz",
"integrity": "sha1-TF5RhahX2o2nk9rzkZNxxaNrKgs="
}
}
}
......@@ -7,42 +7,41 @@
"start": "ng serve --base-href /mobile/ --deploy-url /mobile --locale zh-CN --output-path mobile --open",
"start:wild": "npm run start -- --host 0.0.0.0 --public-host 192.168.1.131:4200",
"build": "ng build --base-href /mobile/ --locale zh-CN --aot --build-optimizer --extract-css --prod",
"postinstall": "./fuck.sh",
"build:dev": "ng build --base-href /mobile2/ --locale zh-CN --aot --build-optimizer --extract-css",
"lint": "ng lint",
"lint": "ng lint --type-check --fix",
"publish": "npm run build && ./ossutil cp -rf dist oss://mycard/mobile",
"publish:dev": "npm run build:dev && ./ossutil cp -rf dist oss://mycard/mobile2"
},
"dependencies": {
"@angular/animations": "^4.3.0",
"@angular/animations": "^4.3.6",
"@angular/cdk": "^2.0.0-beta.8",
"@angular/common": "^4.2.4",
"@angular/compiler": "^4.2.4",
"@angular/core": "^4.2.4",
"@angular/forms": "^4.2.4",
"@angular/http": "^4.2.4",
"@angular/common": "^4.3.6",
"@angular/compiler": "^4.3.6",
"@angular/core": "^4.3.6",
"@angular/forms": "^4.3.6",
"@angular/http": "^4.3.6",
"@angular/material": "^2.0.0-beta.8",
"@angular/platform-browser": "^4.2.4",
"@angular/platform-browser-dynamic": "^4.2.4",
"@angular/router": "^4.2.4",
"core-js": "^2.4.1",
"@angular/platform-browser": "^4.3.6",
"@angular/platform-browser-dynamic": "^4.3.6",
"@angular/router": "^4.3.6",
"core-js": "^2.5.0",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"lodash": "^4.17.4",
"material-design-icons": "^3.0.1",
"rxjs": "^5.4.2",
"webdav": "^1.0.0-rc1",
"zone.js": "^0.8.14"
"rxjs": "^5.4.3",
"webdav": "^1.0.1",
"zone.js": "^0.8.17"
},
"devDependencies": {
"@angular/cli": "1.3.0-rc.1",
"@angular/compiler-cli": "^4.2.4",
"@angular/language-service": "^4.2.4",
"@angular/compiler-cli": "^4.3.6",
"@angular/language-service": "^4.3.6",
"@angular/service-worker": "^1.0.0-beta.16",
"@types/lodash": "^4.14.70",
"@types/node": "^8.0.13",
"@types/lodash": "^4.14.74",
"@types/node": "^8.0.24",
"codelyzer": "~3.1.1",
"tslint": "^5.5.0",
"tslint": "^5.6.0",
"typescript": "~2.3.3"
}
}
......@@ -28,9 +28,9 @@ import 'rxjs/Rx';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { LobbyComponent } from './lobby/lobby.component';
import { MatchDialog } from './match/match.component';
import { MatchDialogComponent } from './match/match.component';
import { NewRoomComponent } from './new-room/new-room.component';
import { ResultDialog } from './result/result.dialog';
import { ResultDialogComponent } from './result/result.dialog';
import { RoomListComponent } from './room-list/room-list.component';
import { StorageService } from './storage.service';
import { ToolbarComponent } from './toolbar/toolbar.component';
......@@ -44,11 +44,11 @@ import { YGOProService } from './ygopro.service';
LobbyComponent,
NewRoomComponent,
RoomListComponent,
MatchDialog,
MatchDialogComponent,
WindbotComponent,
WatchComponent,
ToolbarComponent,
ResultDialog,
ResultDialogComponent,
],
imports: [
BrowserModule,
......@@ -78,7 +78,7 @@ import { YGOProService } from './ygopro.service';
],
providers: [YGOProService, StorageService],
bootstrap: [AppComponent],
entryComponents: [MatchDialog, ResultDialog],
entryComponents: [MatchDialogComponent, ResultDialogComponent],
})
export class AppModule {
}
......@@ -5,7 +5,7 @@
<md-icon>menu</md-icon>
</button>
<form (submit)="search(key)">
<input type=search placeholder="卡片搜索" name="key" [(ngModel)]="key" [mdAutocomplete]="auto" [formControl]="searchCtrl">
<input type=search placeholder="卡片搜索" name="key" [(ngModel)]="key" mdAutocomplete="auto" [formControl]="searchCtrl">
<md-autocomplete #auto="mdAutocomplete">
<md-option *ngFor="let card of suggestion | async" [value]="card" (onSelectionChange)="search(card)">
......
import { Component } from '@angular/core';
import { Component, HostBinding } from '@angular/core';
import { FormControl } from '@angular/forms';
import { Http, Jsonp } from '@angular/http';
import { MdDialog } from '@angular/material';
import { ActivatedRoute } from '@angular/router';
import { environment } from '../../environments/environment';
import { LoginService } from '../login.service';
import { MatchDialog } from '../match/match.component';
import { routerTransition2 } from '../router.animations';
import { YGOProService } from '../ygopro.service';
import { StorageService } from '../storage.service';
import { YGOProService } from '../ygopro.service';
@Component({
selector: 'app-lobby',
templateUrl: 'lobby.component.html',
styleUrls: ['lobby.component.css'],
animations: [routerTransition2],
host: { '[@routerTransition2]': '' }
animations: [routerTransition2]
})
export class LobbyComponent {
@HostBinding('@routerTransition2')
animation: '';
version = environment.version;
build: BuildConfig;
searchCtrl = new FormControl();
suggestion = this.searchCtrl.valueChanges.filter(name => name).flatMap(name => this.jsonp.get('http://www.ourocg.cn/Suggest.aspx', {
params: { callback: 'JSONP_CALLBACK', key: name }
params: {callback: 'JSONP_CALLBACK', key: name}
}).map(response => response.json().result));
key: string;
arena_url: string;
constructor(public login: LoginService, public ygopro: YGOProService, public dialog: MdDialog, private http: Http, private jsonp: Jsonp, private route: ActivatedRoute, public storage: StorageService) {
constructor(public login: LoginService,
public ygopro: YGOProService,
private http: Http,
private jsonp: Jsonp,
public storage: StorageService) {
const arena_url = new URL('https://mycard.moe/ygopro/arena');
arena_url.searchParams.set('sso', login.token);
......
......@@ -11,9 +11,9 @@ export class LoginService {
login() {
let params = new URLSearchParams();
params.set('return_sso_url', location.href);
let payload = Buffer.from(params.toString()).toString('base64');
const payload = Buffer.from(params.toString()).toString('base64');
let url = new URL('https://accounts.moecube.com');
const url = new URL('https://accounts.moecube.com');
params = url['searchParams'];
params.set('sso', payload);
......@@ -48,9 +48,9 @@ export class LoginService {
logout() {
let params = new URLSearchParams();
params.set('return_sso_url', location.href);
let payload = Buffer.from(params.toString()).toString('base64');
const payload = Buffer.from(params.toString()).toString('base64');
let url = new URL('https://accounts.moecube.com/signin');
const url = new URL('https://accounts.moecube.com/signin');
params = url['searchParams'];
params.set('sso', payload);
return url.toString();
......
......@@ -13,20 +13,25 @@ const offset = new Date().getTimezoneOffset() * 60 * second;
templateUrl: './match.component.html',
styleUrls: ['./match.component.css']
})
export class MatchDialog implements OnInit, OnDestroy {
export class MatchDialogComponent implements OnInit, OnDestroy {
expect_wait = this.http.get('https://api.mycard.moe/ygopro/match/stats/' + this.arena).map(response => response.json() * second + offset);
actual_wait = Observable.timer(0, second).map(timestamp => timestamp * second + offset);
matching: Subscription;
constructor(@Inject(MD_DIALOG_DATA) public arena: string, private dialogRef: MdDialogRef<MatchDialog>, private http: Http, private login: LoginService) {
constructor(@Inject(MD_DIALOG_DATA) public arena: string,
private dialogRef: MdDialogRef<MatchDialogComponent>,
private http: Http,
private login: LoginService) {
}
ngOnInit() {
this.matching = this.http.post('https://api.mycard.moe/ygopro/match', null, {
headers: new Headers({ Authorization: 'Basic ' + Buffer.from(this.login.user.username + ':' + this.login.user.external_id).toString('base64') }),
params: { arena: this.arena, locale: 'zh-CN' }
headers: new Headers({
Authorization: 'Basic ' + Buffer.from(this.login.user.username + ':' + this.login.user.external_id).toString('base64')
}),
params: {arena: this.arena, locale: 'zh-CN'}
}).map(response => response.json()).subscribe((data) => {
this.dialogRef.close(data);
}, (error) => {
......
import { Component, ElementRef, ViewChild } from '@angular/core';
import { Component, ElementRef, HostBinding, ViewChild } from '@angular/core';
import { MdSnackBar } from '@angular/material';
import { LoginService } from '../login.service';
import { routerTransition } from '../router.animations';
......@@ -9,11 +9,13 @@ import { YGOProService } from '../ygopro.service';
selector: 'app-new-room',
templateUrl: 'new-room.component.html',
styleUrls: ['new-room.component.css'],
animations: [routerTransition],
host: { '[@routerTransition]': '' }
animations: [routerTransition]
})
export class NewRoomComponent {
@HostBinding('@routerTransition')
animation = '';
@ViewChild('hostPasswordInput')
hostPasswordInput: ElementRef;
......@@ -22,7 +24,7 @@ export class NewRoomComponent {
room = {
title: this.login.user.username + '的房间',
'private': false,
options: { ...this.ygopro.default_options }
options: {...this.ygopro.default_options}
};
constructor(public ygopro: YGOProService, private login: LoginService, private snackBar: MdSnackBar) {
......@@ -34,7 +36,7 @@ export class NewRoomComponent {
this.hostPasswordInput.nativeElement.select();
if (document.execCommand('copy')) {
this.snackBar.open(`房间密码 ${host_password} 已复制到剪贴板`, undefined, { duration: 3000 });
this.snackBar.open(`房间密码 ${host_password} 已复制到剪贴板`, undefined, {duration: 3000});
} else {
console.log('Oops, unable to copy');
}
......@@ -49,7 +51,7 @@ export class NewRoomComponent {
}
set_start_lp() {
if (this.room.options.mode == 2) {
if (this.room.options.mode === 2) {
this.room.options.start_lp = 16000;
} else {
this.room.options.start_lp = 8000;
......
......@@ -2,20 +2,24 @@ import { Component, Inject } from '@angular/core';
import { Http } from '@angular/http';
import { MD_DIALOG_DATA, MdDialog, MdDialogRef } from '@angular/material';
import { LoginService } from '../login.service';
import { MatchDialog } from '../match/match.component';
import { MatchDialogComponent } from '../match/match.component';
@Component({
selector: 'app-result',
templateUrl: './result.dialog.html',
styleUrls: ['./result.dialog.css']
})
export class ResultDialog {
export class ResultDialogComponent {
result: 'win' | 'lose' | 'draw';
dp: string | undefined;
exp: string | undefined;
firstWin: string | undefined;
constructor(@Inject(MD_DIALOG_DATA) public last: any, public login: LoginService, private http: Http, public dialog: MdDialog, private dialogRef: MdDialogRef<MatchDialog>) {
constructor(@Inject(MD_DIALOG_DATA) public last: any,
public login: LoginService,
private http: Http,
public dialog: MdDialog,
private dialogRef: MdDialogRef<MatchDialogComponent>) {
if (this.last.userscorea === this.last.userscoreb) {
this.result = 'draw';
} else if (this.last.winner === this.login.user.username) {
......@@ -24,7 +28,7 @@ export class ResultDialog {
this.result = 'lose';
}
const index = this.last.usernamea == this.login.user.username ? 'a' : 'b';
const index = this.last.usernamea === this.login.user.username ? 'a' : 'b';
if (this.last.isfirstwin && this.result === 'win') {
this.dp = this.format(this.last[`pt${index}`] - 4, this.last[`pt${index}_ex`]);
......
import { ChangeDetectorRef, Component } from '@angular/core';
import { ChangeDetectorRef, Component, HostBinding, OnInit } from '@angular/core';
import { LoginService } from '../login.service';
import { RoomListDataSource, YGOProService } from '../ygopro.service';
import { routerTransition } from '../router.animations';
import { RoomListDataSource, YGOProService } from '../ygopro.service';
@Component({
selector: 'app-room-list',
styleUrls: ['room-list.component.css'],
templateUrl: 'room-list.component.html',
animations: [routerTransition],
host: {'[@routerTransition]': ''}
animations: [routerTransition]
})
export class RoomListComponent {
export class RoomListComponent implements OnInit {
@HostBinding('@routerTransition')
animation: '';
displayedColumns = ['title', 'users', 'mode', 'extra'];
dataSource = new RoomListDataSource(this.ygopro.servers.filter(server => server.custom));
......
// // import the required animation functions from the angular animations module
// import { trigger, state, animate, transition, style } from '@angular/animations';
//
// export const slideInOutAnimation =
// // trigger name for attaching this animation to an element using the [@triggerName] syntax
// trigger('slideInOutAnimation', [
//
// // end state styles for route container (host)
// state('*', style({
// // the view covers the whole screen with a semi tranparent background
// position: 'fixed',
// top: 0,
// left: 0,
// right: 0,
// bottom: 0,
// backgroundColor: 'rgba(0, 0, 0, 0.8)'
// })),
//
// // route 'enter' transition
// transition(':enter', [
//
// // styles at start of transition
// style({
// // start with the content positioned off the right of the screen,
// // -400% is required instead of -100% because the negative position adds to the width of the element
// right: '-400%',
//
// // start with background opacity set to 0 (invisible)
// backgroundColor: 'rgba(0, 0, 0, 0)'
// }),
//
// // animation and styles at end of transition
// animate('5s ease-in-out', style({
// // transition the right position to 0 which slides the content into view
// right: 0,
//
// // transition the background opacity to 0.8 to fade it in
// backgroundColor: 'rgba(0, 0, 0, 0.8)'
// }))
// ]),
//
// // route 'leave' transition
// transition(':leave', [
// // animation and styles at end of transition
// animate('5s ease-in-out', style({
// // transition the right position to -400% which slides the content out of view
// right: '-400%',
//
// // transition the background opacity to 0 to fade it out
// backgroundColor: 'rgba(0, 0, 0, 0)'
// }))
// ])
// ]);
import { animate, state, style, transition, trigger } from '@angular/animations';
export const routerTransition = trigger('routerTransition', [
state('void', style({ position: 'absolute', width: '100%' })),
state('*', style({ position: 'absolute', width: '100%' })),
state('void', style({position: 'absolute', width: '100%'})),
state('*', style({position: 'absolute', width: '100%'})),
transition(':enter', [ // before 2.1: transition('void => *', [
style({ transform: 'translateX(100%)' }),
animate('.5s ease-in-out', style({ transform: 'translateX(0%)' }))
style({transform: 'translateX(100%)'}),
animate('.5s ease-in-out', style({transform: 'translateX(0%)'}))
]),
transition(':leave', [ // before 2.1: transition('* => void', [
style({ transform: 'translateX(0%)' }),
animate('.5s ease-in-out', style({ transform: 'translateX(100%)' }))
style({transform: 'translateX(0%)'}),
animate('.5s ease-in-out', style({transform: 'translateX(100%)'}))
])
]);
export const routerTransition2 = trigger('routerTransition2', [
state('void', style({ position: 'absolute', width: '100%' })),
state('*', style({ position: 'absolute', width: '100%' })),
state('void', style({position: 'absolute', width: '100%'})),
state('*', style({position: 'absolute', width: '100%'})),
transition(':enter', [ // before 2.1: transition('void => *', [
style({ transform: 'translateX(-100%)' }),
animate('.5s ease-in-out', style({ transform: 'translateX(0%)' }))
style({transform: 'translateX(-100%)'}),
animate('.5s ease-in-out', style({transform: 'translateX(0%)'}))
]),
transition(':leave', [ // before 2.1: transition('* => void', [
style({ transform: 'translateX(0%)' }),
animate('.5s ease-in-out', style({ transform: 'translateX(-100%)' }))
style({transform: 'translateX(0%)'}),
animate('.5s ease-in-out', style({transform: 'translateX(-100%)'}))
])
]);
......@@ -4,24 +4,24 @@ import * as webdav from 'webdav';
import { LoginService } from './login.service';
interface DirectoryStats {
'filename': string,
'basename': string,
'lastmod': string,
'size': 0,
'type': 'directory'
'filename': string;
'basename': string;
'lastmod': string;
'size': 0;
'type': 'directory';
}
interface FileStats {
'filename': string,
'basename': string,
'lastmod': string,
'size': number,
'type': 'file',
'mime': string
'filename': string;
'basename': string;
'lastmod': string;
'size': number;
'type': 'file';
'mime': string;
}
type Stats = DirectoryStats | FileStats
type Stats = DirectoryStats | FileStats;
@Injectable()
export class StorageService {
......@@ -168,7 +168,7 @@ export class StorageService {
async * walk(dir: string): AsyncIterable<Stats> {
const items: Stats[] = await this.client.getDirectoryContents(dir);
// console.log('取远端目录', dir, items);
for (let item of items) {
for (const item of items) {
if (item.type === 'directory') {
yield* this.walk(item.filename);
} else {
......
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { ChangeDetectorRef, Component, HostBinding, OnInit } from '@angular/core';
import { LoginService } from '../login.service';
import { RoomListDataSource, YGOProService } from '../ygopro.service';
import { routerTransition } from '../router.animations';
import { RoomListDataSource, YGOProService } from '../ygopro.service';
@Component({
selector: 'app-watch',
templateUrl: './watch.component.html',
styleUrls: ['./watch.component.css'],
animations: [routerTransition],
host: {'[@routerTransition]': ''}
animations: [routerTransition]
})
export class WatchComponent implements OnInit {
@HostBinding('@routerTransition')
animation = '';
displayedColumns = ['mode', 'title', 'users', 'extra'];
dataSource = new RoomListDataSource(this.ygopro.servers, 'started');
......
import { Component } from '@angular/core';
import { Component, HostBinding } from '@angular/core';
import { LoginService } from '../login.service';
import { YGOProService } from '../ygopro.service';
import { routerTransition } from '../router.animations';
import { YGOProService } from '../ygopro.service';
@Component({
selector: 'app-windbot',
templateUrl: './windbot.component.html',
styleUrls: ['./windbot.component.css'],
animations: [routerTransition],
host: {'[@routerTransition]': ''}
animations: [routerTransition]
})
export class WindbotComponent {
@HostBinding('@routerTransition')
animation = '';
constructor(public login: LoginService, public ygopro: YGOProService) {
}
......
......@@ -5,8 +5,8 @@ import { MdDialog } from '@angular/material';
import { sortBy } from 'lodash';
import { Observable } from 'rxjs/Observable';
import { LoginService } from './login.service';
import { MatchDialog } from './match/match.component';
import { ResultDialog } from './result/result.dialog';
import { MatchDialogComponent } from './match/match.component';
import { ResultDialogComponent } from './result/result.dialog';
import { StorageService } from './storage.service';
export interface User {
......@@ -65,47 +65,47 @@ interface YGOProData {
}
interface App {
id: string,
news: { [locale: string]: News[] },
windbot: { [locale: string]: string[] },
data: any
id: string;
news: { [locale: string]: News[] };
windbot: { [locale: string]: string[] };
data: any;
}
export interface Result {
end_time: string
expa: number
expa_ex: number
expb: number
expb_ex: number
isfirstwin: boolean
pta: number
pta_ex: number
ptb: number
ptb_ex: number
start_time: string
type: 'athletic' | 'entertain'
usernamea: string
usernameb: string
userscorea: number
userscoreb: number
winner: string
end_time: string;
expa: number;
expa_ex: number;
expb: number;
expb_ex: number;
isfirstwin: boolean;
pta: number;
pta_ex: number;
ptb: number;
ptb_ex: number;
start_time: string;
type: 'athletic' | 'entertain';
usernamea: string;
usernameb: string;
userscorea: number;
userscoreb: number;
winner: string;
}
export interface Points {
arena_rank: number
athletic_all: number
athletic_draw: number
athletic_lose: number
athletic_win: number
athletic_wl_ratio: number
entertain_all: number
entertain_draw: number
entertain_lose: number
entertain_win: number
entertain_wl_ratio: number
exp: number
exp_rank: number
pt: number
arena_rank: number;
athletic_all: number;
athletic_draw: number;
athletic_lose: number;
athletic_win: number;
athletic_wl_ratio: number;
entertain_all: number;
entertain_draw: number;
entertain_lose: number;
entertain_win: number;
entertain_wl_ratio: number;
exp: number;
exp_rank: number;
pt: number;
}
@Injectable()
......@@ -154,18 +154,15 @@ export class YGOProService {
async load() {
const apps: App[] = await this.http.get('https://api.mycard.moe/apps.json').map(response => response.json()).toPromise();
const app = apps.find(app => app.id === 'ygopro')!;
const app = apps.find(_app => _app.id === 'ygopro')!;
this.news = app.news['zh-CN'];
this.windbot = (<YGOProData>app.data).windbot['zh-CN'];
// this.topics = this.http.get('https://ygobbs.com/top.json').flatMap(response => promisify(parseString)(response.text())).map(doc => {
// console.log(doc['rss'].channel[0].item)
// return doc['rss'].channel[0].item;
// });
this.topics = this.http.get('https://ygobbs.com/top/quarterly.json').map(response => response.json().topic_list.topics.slice(0, 5).map((topic: any) => ({
...topic,
url: new URL(`/t/${topic.slug}/${topic.id}`, 'https://ygobbs.com').toString(),
image_url: topic.image_url && new URL(topic.image_url, 'https://ygobbs.com').toString()
})));
this.topics = this.http.get('https://ygobbs.com/top/quarterly.json').map(
response => response.json().topic_list.topics.slice(0, 5).map((topic: any) => ({
...topic,
url: new URL(`/t/${topic.slug}/${topic.id}`, 'https://ygobbs.com').toString(),
image_url: topic.image_url && new URL(topic.image_url, 'https://ygobbs.com').toString()
})));
this.storage.sync('ygopro');
this.load_points();
......@@ -178,7 +175,7 @@ export class YGOProService {
async load_result(load_points = true) {
const last = await this.http.get('https://mycard.moe/ygopro/api/history', {
params: { username: this.login.user.username, type: 0, page_num: 1 }
params: {username: this.login.user.username, type: 0, page_num: 1}
}).map((response) => response.json().data[0]).toPromise();
// 从来没打过
......@@ -204,7 +201,7 @@ export class YGOProService {
if (load_points) {
this.load_points();
}
const again = await this.dialog.open(ResultDialog, { data: last }).afterClosed().toPromise();
const again = await this.dialog.open(ResultDialogComponent, {data: last}).afterClosed().toPromise();
if (again) {
this.request_match(last.type);
}
......@@ -212,9 +209,9 @@ export class YGOProService {
}
async request_match(arena: string) {
const data = await this.dialog.open(MatchDialog, { data: arena, disableClose: true }).afterClosed().toPromise();
const data = await this.dialog.open(MatchDialogComponent, {data: arena, disableClose: true}).afterClosed().toPromise();
if (data) {
this.join(data['password'], { address: data['address'], port: data['port'] });
this.join(data['password'], {address: data['address'], port: data['port']});
}
}
......@@ -241,11 +238,12 @@ export class YGOProService {
}
async load_points() {
this.points = await this.http.get('https://api.mycard.moe/ygopro/arena/user', { params: { username: this.login.user.username } }).map(response => response.json()).toPromise();
this.points = await this.http.get('https://api.mycard.moe/ygopro/arena/user', {params: {username: this.login.user.username}}).map(
response => response.json()).toPromise();
}
create_room(room: Room, host_password: string) {
let options_buffer = Buffer.alloc(6);
const options_buffer = Buffer.alloc(6);
// 建主密码 https://docs.google.com/document/d/1rvrCGIONua2KeRaYNjKBLqyG9uybs9ZI-AmzZKNftOI/edit
options_buffer.writeUInt8((room.private ? 2 : 1) << 4, 1);
options_buffer.writeUInt8(
......@@ -263,12 +261,12 @@ export class YGOProService {
}
options_buffer.writeUInt8(checksum & 0xFF, 0);
let secret = this.login.user.external_id % 65535 + 1;
const secret = this.login.user.external_id % 65535 + 1;
for (let i = 0; i < options_buffer.length; i += 2) {
options_buffer.writeUInt16LE(options_buffer.readUInt16LE(i) ^ secret, i);
}
let password = options_buffer.toString('base64') + (room.private ? host_password :
const password = options_buffer.toString('base64') + (room.private ? host_password :
room.title!.replace(/\s/, String.fromCharCode(0xFEFF)));
// let room_id = crypto.createHash('md5').update(password + this.loginService.user.username).digest('base64')
// .slice(0, 10).replace('+', '-').replace('/', '_');
......@@ -282,7 +280,7 @@ export class YGOProService {
}
join_room(room: Room) {
let options_buffer = new Buffer(6);
const options_buffer = new Buffer(6);
options_buffer.writeUInt8(3 << 4, 1);
let checksum = 0;
for (let i = 1; i < options_buffer.length; i++) {
......@@ -290,18 +288,18 @@ export class YGOProService {
}
options_buffer.writeUInt8(checksum & 0xFF, 0);
let secret = this.login.user.external_id % 65535 + 1;
const secret = this.login.user.external_id % 65535 + 1;
for (let i = 0; i < options_buffer.length; i += 2) {
options_buffer.writeUInt16LE(options_buffer.readUInt16LE(i) ^ secret, i);
}
let name = options_buffer.toString('base64') + room.id;
const name = options_buffer.toString('base64') + room.id;
this.join(name, room.server!);
}
join_private(password: string) {
let options_buffer = new Buffer(6);
const options_buffer = new Buffer(6);
options_buffer.writeUInt8(5 << 4, 1);
let checksum = 0;
for (let i = 1; i < options_buffer.length; i++) {
......@@ -309,12 +307,12 @@ export class YGOProService {
}
options_buffer.writeUInt8(checksum & 0xFF, 0);
let secret = this.login.user.external_id % 65535 + 1;
const secret = this.login.user.external_id % 65535 + 1;
for (let i = 0; i < options_buffer.length; i += 2) {
options_buffer.writeUInt16LE(options_buffer.readUInt16LE(i) ^ secret, i);
}
let name = options_buffer.toString('base64') + password.replace(/\s/, String.fromCharCode(0xFEFF));
const name = options_buffer.toString('base64') + password.replace(/\s/, String.fromCharCode(0xFEFF));
this.join(name, this.servers[0]);
}
......@@ -343,7 +341,7 @@ export class YGOProService {
window.ygopro.edit_deck();
} catch (error) {
console.error(error);
alert(JSON.stringify({ method: 'edit_deck', params: [] }));
alert(JSON.stringify({method: 'edit_deck', params: []}));
}
}
......@@ -352,7 +350,7 @@ export class YGOProService {
window.ygopro.watch_replay();
} catch (error) {
console.error(error);
alert(JSON.stringify({ method: 'watch_replay', params: [] }));
alert(JSON.stringify({method: 'watch_replay', params: []}));
}
}
......@@ -361,7 +359,7 @@ export class YGOProService {
window.ygopro.puzzle_mode();
} catch (error) {
console.error(error);
alert(JSON.stringify({ method: 'puzzle_mode', params: [] }));
alert(JSON.stringify({method: 'puzzle_mode', params: []}));
}
}
......@@ -370,7 +368,7 @@ export class YGOProService {
window.ygopro.openDrawer();
} catch (error) {
console.error(error);
alert(JSON.stringify({ method: 'openDrawer', params: [] }));
alert(JSON.stringify({method: 'openDrawer', params: []}));
}
}
......@@ -379,7 +377,7 @@ export class YGOProService {
window.ygopro.backHome();
} catch (error) {
console.error(error);
alert(JSON.stringify({ method: 'backHome', params: [] }));
alert(JSON.stringify({method: 'backHome', params: []}));
}
}
......@@ -388,7 +386,7 @@ export class YGOProService {
window.ygopro.share(text);
} catch (error) {
console.error(error);
alert(JSON.stringify({ method: 'share', params: [text] }));
alert(JSON.stringify({method: 'share', params: [text]}));
}
}
......@@ -399,7 +397,7 @@ type Message =
{ event: 'init', data: Room[] }
| { event: 'update', data: Room }
| { event: 'create', data: Room }
| { event: 'delete', data: string }
| { event: 'delete', data: string };
export class RoomListDataSource extends DataSource<any> {
......@@ -418,18 +416,18 @@ export class RoomListDataSource extends DataSource<any> {
const url = new URL(server.url!);
url.searchParams.set('filter', this.filter);
// 协议处理
return Observable.webSocket({ url: url.toString() })
return Observable.webSocket({url: url.toString()})
.scan((rooms: Room[], message: Message) => {
switch (message.event) {
case 'init':
return message.data.map(room => ({ server: server, ...room }));
return message.data.map(room => ({server: server, ...room}));
case 'create':
return rooms.concat({ server: server, ...message.data });
return rooms.concat({server: server, ...message.data});
case 'update':
Object.assign(rooms.find(room => room.id === message.data.id), message.data);
return rooms;
case 'delete':
return rooms.filter(room => room.id != message.data);
return rooms.filter(room => room.id !== message.data);
}
}, []);
// 把多个服务器的数据拼接起来,这里是 combineLatest 的第二个参数
......@@ -449,7 +447,7 @@ export class RoomListDataSource extends DataSource<any> {
// loading、empty、error
).filter((rooms) => {
this.loading = false;
this.empty = rooms.length == 0;
this.empty = rooms.length === 0;
return true;
}).catch((error) => {
this.loading = false;
......
......@@ -41,7 +41,7 @@
// import 'core-js/es6/reflect';
// import 'core-js/es7/reflect';
import 'core-js/shim'
import 'core-js/shim';
/**
* Required to support Web Animations `@angular/animation`.
......
......@@ -41,7 +41,7 @@
}
],
"no-arg": true,
"no-bitwise": true,
"no-bitwise": false,
"no-console": [
true,
"debug",
......@@ -61,7 +61,7 @@
"ignore-params"
],
"no-misused-new": true,
"no-non-null-assertion": true,
"no-non-null-assertion": false,
"no-shadowed-variable": true,
"no-string-literal": false,
"no-string-throw": true,
......@@ -84,7 +84,7 @@
true,
"single"
],
"radix": true,
"radix": false,
"semicolon": [
true,
"always"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment