mirror of https://github.com/mifi/lossless-cut
parent
d08ce601db
commit
faa07424fb
@ -1,13 +1,35 @@
|
|||||||
import axios from 'axios';
|
import ky from 'ky';
|
||||||
|
|
||||||
|
import { runFfmpegStartupCheck, getFfmpegPath } from './ffmpeg';
|
||||||
|
import { toast, handleError } from './util';
|
||||||
|
import isDev from './isDev';
|
||||||
|
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
|
||||||
export async function loadMifiLink() {
|
export async function loadMifiLink() {
|
||||||
try {
|
try {
|
||||||
// In old versions: https://mifi.no/losslesscut/config.json
|
// In old versions: https://mifi.no/losslesscut/config.json
|
||||||
const resp = await axios.get('https://losslesscut.mifi.no/config.json');
|
return await ky('https://losslesscut.mifi.no/config.json').json();
|
||||||
// const resp = await axios.get('http://localhost:8080/losslesscut/config-dev.json');
|
// return await ky('http://localhost:8080/losslesscut/config-dev.json').json();
|
||||||
return resp.data;
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (isDev) console.error(err);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function runStartupCheck({ ffmpeg }) {
|
||||||
|
try {
|
||||||
|
if (ffmpeg) await runFfmpegStartupCheck();
|
||||||
|
} catch (err) {
|
||||||
|
if (['EPERM', 'EACCES'].includes(err.code)) {
|
||||||
|
toast.fire({
|
||||||
|
timer: 30000,
|
||||||
|
icon: 'error',
|
||||||
|
title: 'Fatal: ffmpeg not accessible',
|
||||||
|
text: `Got ${err.code}. This probably means that anti-virus is blocking execution of ffmpeg. Please make sure the following file exists and is executable:\n\n${getFfmpegPath()}\n\nSee this issue: https://github.com/mifi/lossless-cut/issues/1114`,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
handleError('Fatal: ffmpeg non-functional', err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue