Commit d5ed1549 authored by 神楽坂玲奈's avatar 神楽坂玲奈

login required

parent 2e1b6eaa
{ {
"name": "mycard-mobile", "name": "mycard-mobile",
"version": "1.0.30", "version": "1.0.31",
"license": "UNLISENCED", "license": "UNLISENCED",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
<br>编辑卡组 <br>编辑卡组
</button> </button>
</mat-grid-tile> </mat-grid-tile>
<mat-grid-tile><a mat-raised-button href="https://ygobbs.com" target="_blank"> <mat-grid-tile><a mat-raised-button href="https://ygobbs.com/login" target="_blank">
<mat-icon>forum</mat-icon> <mat-icon>forum</mat-icon>
<br>社区</a></mat-grid-tile> <br>社区</a></mat-grid-tile>
<mat-grid-tile><a mat-raised-button [href]="arena_url" target="_blank"> <mat-grid-tile><a mat-raised-button [href]="arena_url" target="_blank">
......
...@@ -150,18 +150,35 @@ export class YGOProService { ...@@ -150,18 +150,35 @@ export class YGOProService {
constructor(private login: LoginService, private http: HttpClient, private dialog: MatDialog, private storage: StorageService) { constructor(private login: LoginService, private http: HttpClient, private dialog: MatDialog, private storage: StorageService) {
const app = this.http.get<App[]>('https://api.mycard.moe/apps.json').pipe(map(apps => apps.find(_app => _app.id === 'ygopro')!)); const app = this.http.get<App[]>('https://api.mycard.moe/apps.json').pipe(map(apps => apps.find(_app => _app.id === 'ygopro')!));
this.news = app.pipe(map(_app => _app.news['zh-CN'])).toPromise(); this.news = app
.pipe(
map(_app =>
_app.news['zh-CN'].map(item => {
const url = new URL(item.url);
if (url.origin === 'https://ygobbs.com') {
url.searchParams.set('login_required', 'true');
}
item.url = url.toString();
return item;
})
)
)
.toPromise();
this.windbot = app.pipe(map(_app => (<YGOProData>_app.data).windbot['zh-CN'])).toPromise(); this.windbot = app.pipe(map(_app => (<YGOProData>_app.data).windbot['zh-CN'])).toPromise();
this.topics = this.http this.topics = this.http
.get<TopResponse>('https://ygobbs.com/top/quarterly.json') .get<TopResponse>('https://ygobbs.com/top/quarterly.json')
.pipe( .pipe(
map(data => map(data =>
data.topic_list.topics.slice(0, 5).map((topic: any) => ({ data.topic_list.topics.slice(0, 5).map((topic: any) => {
...topic, const url = new URL(`/t/${topic.slug}/${topic.id}`, 'https://ygobbs.com');
url: new URL(`/t/${topic.slug}/${topic.id}`, 'https://ygobbs.com').toString(), url.searchParams.set('login_required', 'true');
image_url: topic.image_url && new URL(topic.image_url, 'https://ygobbs.com').toString() return {
})) ...topic,
url: url.toString(),
image_url: topic.image_url && new URL(topic.image_url, 'https://ygobbs.com').toString()
};
})
) )
) )
.toPromise(); .toPromise();
......
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