skot / ESP-Miner

A bitcoin ASIC miner for the ESP32
GNU General Public License v3.0
328 stars 121 forks source link

Exclude pre releases of updated check #246

Closed WantClue closed 1 month ago

WantClue commented 3 months ago

With the latest pre-release which has been removed now we had experienced the issue, that certain people updated. In order to fight this issue of not downloading pre-releases I suggest an change to the github-update.service.ts

The change would be as followed:

import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

interface GithubRelease {
  tag_name: string;
  prerelease: boolean;
}

@Injectable({
  providedIn: 'root'
})
export class GithubUpdateService {

  constructor(
    private httpClient: HttpClient
  ) { }

  public getReleases(): Observable<GithubRelease[]> {
    return this.httpClient.get<GithubRelease[]>(
      'https://api.github.com/repos/skot/esp-miner/releases?per_page=100'
    );
  }

  public getLatestStableRelease(): Observable<GithubRelease | null> {
    return this.getReleases().pipe(
      map(releases => releases.find(release => !release.prerelease) || null)
    );
  }
}

in settings.components.ts:

this.latestRelease$ = this.githubUpdateService.getLatestStableRelease();

skot commented 3 months ago

This would be amazing. I think pre-releases are a good way to roll out firmware to more experienced users who are willing to beta test new firmware.

WantClue commented 1 month ago

Done in PR #285