Skip to content

Commit

Permalink
Fix APK set download links not functioning
Browse files Browse the repository at this point in the history
Since the introduction of CORS in "4b85891: Add CORS support", APK set
download links have been broken because they reference the frontend
console URL instead of the backend developer service. This commit
corrects the URLs to point to the backend service, allowing APK sets to
be downloaded again.
  • Loading branch information
lberrymage committed Nov 6, 2024
1 parent 25de96c commit 9b97a8d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h4>Draft info</h4>
</ul>
</mat-card-content>
<mat-card-actions align="end">
<a [href]="'/api/v1/drafts/' + draft.id + '/apkset'" mat-stroked-button>
<a [href]="apkSetLink" mat-stroked-button>
Download APK set
</a>
<button type="button" (click)="onPublish()" mat-flat-button color="primary">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,27 @@
//
// SPDX-License-Identifier: AGPL-3.0-only

import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';

import { Draft } from '../../draft';
import { environment } from '../../../environments/environment';

@Component({
selector: 'app-publisher-draft-card',
standalone: true,
imports: [MatButtonModule, MatCardModule],
templateUrl: './publisher-draft-card.component.html',
})
export class PublisherDraftCardComponent {
export class PublisherDraftCardComponent implements OnInit {
@Input({ required: true }) draft!: Draft;
@Output() publish = new EventEmitter<string>();
apkSetLink?: string;

ngOnInit(): void {
this.apkSetLink = `${environment.developerApiUrl}/api/v1/drafts/${this.draft.id}/apkset`;
}

onPublish(): void {
this.publish.emit(this.draft.id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h4>Draft info</h4>
</ul>
</mat-card-content>
<mat-card-actions align="end">
<a [href]="'/api/v1/drafts/' + draft.id + '/apkset'" mat-stroked-button>
<a [href]="apkSetLink" mat-stroked-button>
Download APK set
</a>
<button type="button" (click)="onPostReview()" mat-flat-button color="primary">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,27 @@
//
// SPDX-License-Identifier: AGPL-3.0-only

import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';

import { Draft } from '../../draft';
import { environment } from '../../../environments/environment';

@Component({
selector: 'app-reviewer-draft-card',
standalone: true,
imports: [MatButtonModule, MatCardModule],
templateUrl: './reviewer-draft-card.component.html',
})
export class ReviewerDraftCardComponent {
export class ReviewerDraftCardComponent implements OnInit {
@Input({ required: true }) draft!: Draft;
@Output() postReview = new EventEmitter<string>();
apkSetLink?: string;

ngOnInit(): void {
this.apkSetLink = `${environment.developerApiUrl}/api/v1/drafts/${this.draft.id}/apkset`;
}

onPostReview(): void {
this.postReview.emit(this.draft.id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h4>Update info</h4>
</ul>
</mat-card-content>
<mat-card-actions align="end">
<a [href]="'/api/v1/updates/' + update.id + '/apkset'" mat-stroked-button>
<a [href]="apkSetLink" mat-stroked-button>
Download APK set
</a>
<button type="button" (click)="onPostReview()" mat-flat-button color="primary">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,27 @@
//
// SPDX-License-Identifier: AGPL-3.0-only

import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';

import { Update } from '../../update';
import { environment } from '../../../environments/environment';

@Component({
selector: 'app-reviewer-update-card',
standalone: true,
imports: [MatButtonModule, MatCardModule],
templateUrl: './reviewer-update-card.component.html',
})
export class ReviewerUpdateCardComponent {
export class ReviewerUpdateCardComponent implements OnInit {
@Input({ required: true }) update!: Update;
@Output() postReview = new EventEmitter<string>();
apkSetLink?: string;

ngOnInit(): void {
this.apkSetLink = `${environment.developerApiUrl}/api/v1/updates/${this.update.id}/apkset`;
}

onPostReview(): void {
this.postReview.emit(this.update.id);
Expand Down

0 comments on commit 9b97a8d

Please sign in to comment.