Enhance version check to differentiate between ESP32 and ESP32-S3 bin versions #1240

This commit is contained in:
proddy
2023-08-04 16:42:37 +02:00
parent 0cc14215e6
commit 9b92bfa81c
10 changed files with 174 additions and 993 deletions

View File

@@ -54,7 +54,7 @@ export const alovaInstance = createAlova({
});
export const alovaInstanceGH = createAlova({
baseURL: 'https://api.github.com/repos/emsesp/EMS-ESP32',
baseURL: 'https://api.github.com/repos/emsesp/EMS-ESP32/releases',
statesHook: ReactHook,
requestAdapter: xhrRequestAdapter()
});

View File

@@ -1,5 +1,5 @@
import { alovaInstance, alovaInstanceGH } from './endpoints';
import type { OTASettings, SystemStatus, LogSettings, Version } from 'types';
import type { OTASettings, SystemStatus, LogSettings } from 'types';
// SystemStatus - also used to ping in Restart monitor for pinging
export const readSystemStatus = () => alovaInstance.Get<SystemStatus>('/rest/systemStatus');
@@ -20,24 +20,15 @@ export const fetchLog = () => alovaInstance.Post('/rest/fetchLog');
// Get versions from github
export const getStableVersion = () =>
alovaInstanceGH.Get<Version>('releases/latest', {
alovaInstanceGH.Get('latest', {
transformData(response: any) {
return {
version: response.data.name,
url: response.data.assets[1].browser_download_url,
changelog: response.data.assets[0].browser_download_url
};
return response.data.name.substring(1);
}
});
export const getDevVersion = () =>
alovaInstanceGH.Get<Version>('releases/tags/latest', {
alovaInstanceGH.Get('tags/latest', {
transformData(response: any) {
return {
version: response.data.name.split(/\s+/).splice(-1),
url: response.data.assets[1].browser_download_url,
changelog: response.data.assets[0].browser_download_url
};
return response.data.name.split(/\s+/).splice(-1)[0].substring(1);
}
});