mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-24 19:56:37 +00:00
Add possibile authorization as a query param
Change-type: patch Signed-off-by: Andrea Rosci <andrear@balena.io>
This commit is contained in:
parent
9f96558cdd
commit
d1a3f1cb88
@ -61,6 +61,7 @@ import ImageSvg from '../../../assets/image.svg';
|
|||||||
import SrcSvg from '../../../assets/src.svg';
|
import SrcSvg from '../../../assets/src.svg';
|
||||||
import { DriveSelector } from '../drive-selector/drive-selector';
|
import { DriveSelector } from '../drive-selector/drive-selector';
|
||||||
import { DrivelistDrive } from '../../../../shared/drive-constraints';
|
import { DrivelistDrive } from '../../../../shared/drive-constraints';
|
||||||
|
import axios, { AxiosRequestConfig } from 'axios';
|
||||||
|
|
||||||
const recentUrlImagesKey = 'recentUrlImages';
|
const recentUrlImagesKey = 'recentUrlImages';
|
||||||
|
|
||||||
@ -334,14 +335,34 @@ export class SourceSelector extends React.Component<
|
|||||||
analytics.logException(error);
|
analytics.logException(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.isJson(decodeURIComponent(selected))) {
|
||||||
|
const config: AxiosRequestConfig = JSON.parse(
|
||||||
|
decodeURIComponent(selected),
|
||||||
|
);
|
||||||
|
return new sourceDestination.Http({
|
||||||
|
url: config.url!,
|
||||||
|
axiosInstance: axios.create(_.omit(config, ['url'])),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (SourceType === sourceDestination.File) {
|
if (SourceType === sourceDestination.File) {
|
||||||
return new sourceDestination.File({
|
return new sourceDestination.File({
|
||||||
path: selected,
|
path: selected,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return new sourceDestination.Http({ url: selected });
|
return new sourceDestination.Http({ url: selected });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public isJson(jsonString: string) {
|
||||||
|
try {
|
||||||
|
JSON.parse(jsonString);
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private reselectSource() {
|
private reselectSource() {
|
||||||
analytics.logEvent('Reselect image', {
|
analytics.logEvent('Reselect image', {
|
||||||
previousImage: selectionState.getImage(),
|
previousImage: selectionState.getImage(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user