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

lint & update

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