mirror of
https://github.com/mifi/lossless-cut.git
synced 2024-11-22 02:12:30 +01:00
fix type
This commit is contained in:
parent
efbb30ff21
commit
cb55bca74c
@ -287,7 +287,7 @@ function BottomBar({
|
|||||||
if (newRate != null) setOutputPlaybackRate(newRate);
|
if (newRate != null) setOutputPlaybackRate(newRate);
|
||||||
}, [detectedFps, outputPlaybackRate, setOutputPlaybackRate]);
|
}, [detectedFps, outputPlaybackRate, setOutputPlaybackRate]);
|
||||||
|
|
||||||
function renderJumpCutpointButton(direction) {
|
function renderJumpCutpointButton(direction: number) {
|
||||||
const newIndex = currentSegIndexSafe + direction;
|
const newIndex = currentSegIndexSafe + direction;
|
||||||
const seg = cutSegments[newIndex];
|
const seg = cutSegments[newIndex];
|
||||||
|
|
||||||
|
@ -366,12 +366,13 @@ export async function withErrorHandling(operation: () => Promise<void>, errorMsg
|
|||||||
|
|
||||||
export async function checkAppPath() {
|
export async function checkAppPath() {
|
||||||
try {
|
try {
|
||||||
const forceCheck = false;
|
const forceCheckMs = false;
|
||||||
// const forceCheck = isDev;
|
const forceCheckTitle = false;
|
||||||
// this code is purposefully obfuscated to try to detect the most basic cloned app submissions to the MS Store
|
// this code is purposefully obfuscated to try to detect the most basic cloned app submissions to the MS Store
|
||||||
if (!isWindowsStoreBuild && !forceCheck) return;
|
|
||||||
// eslint-disable-next-line no-useless-concat, one-var, one-var-declaration-per-line
|
// eslint-disable-next-line no-useless-concat, one-var, one-var-declaration-per-line
|
||||||
const mf = 'mi' + 'fi.no', llc = 'Los' + 'slessC' + 'ut';
|
const mf = 'mi' + 'fi.no', ap = 'Los' + 'slessC' + 'ut';
|
||||||
|
let payload: string | undefined;
|
||||||
|
if (isWindowsStoreBuild || (isDev && forceCheckMs)) {
|
||||||
const appPath = isDev ? 'C:\\Program Files\\WindowsApps\\37672NoveltyStudio.MediaConverter_9.0.6.0_x64__vjhnv588cyf84' : remote.app.getAppPath();
|
const appPath = isDev ? 'C:\\Program Files\\WindowsApps\\37672NoveltyStudio.MediaConverter_9.0.6.0_x64__vjhnv588cyf84' : remote.app.getAppPath();
|
||||||
const pathMatch = appPath.replaceAll('\\', '/').match(/Windows ?Apps\/([^/]+)/); // find the first component after WindowsApps
|
const pathMatch = appPath.replaceAll('\\', '/').match(/Windows ?Apps\/([^/]+)/); // find the first component after WindowsApps
|
||||||
// example pathMatch: 37672NoveltyStudio.MediaConverter_9.0.6.0_x64__vjhnv588cyf84
|
// example pathMatch: 37672NoveltyStudio.MediaConverter_9.0.6.0_x64__vjhnv588cyf84
|
||||||
@ -381,12 +382,23 @@ export async function checkAppPath() {
|
|||||||
}
|
}
|
||||||
const pathSeg = pathMatch[1];
|
const pathSeg = pathMatch[1];
|
||||||
if (pathSeg == null) return;
|
if (pathSeg == null) return;
|
||||||
if (pathSeg.startsWith(`57275${mf}.${llc}_`)) return;
|
if (pathSeg.startsWith(`57275${mf}.${ap}_`)) return;
|
||||||
// this will report the path and may return a msg
|
// this will report the path and may return a msg
|
||||||
const url = `https://losslesscut-analytics.mifi.no/${pathSeg.length}/${encodeURIComponent(btoa(pathSeg))}`;
|
payload = `msstore-app-id:${pathSeg}`;
|
||||||
|
// and non ms store fakes:)
|
||||||
|
} else if (isMac || isWindows || (isDev && forceCheckTitle)) {
|
||||||
|
const { title } = document;
|
||||||
|
if (!title.includes(ap)) {
|
||||||
|
payload = `app-title:${title}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (payload) {
|
||||||
|
const url = `https://losslesscut-analytics.mifi.no/${payload.length}/${encodeURIComponent(btoa(payload))}`;
|
||||||
// console.log('Reporting app', pathSeg, url);
|
// console.log('Reporting app', pathSeg, url);
|
||||||
const response = await ky(url).json<{ invalid?: boolean, title: string, text: string }>();
|
const response = await ky(url).json<{ invalid?: boolean, title: string, text: string }>();
|
||||||
if (response.invalid) toast.fire({ timer: 60000, icon: 'error', title: response.title, text: response.text });
|
if (response.invalid) toast.fire({ timer: 60000, icon: 'error', title: response.title, text: response.text });
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (isDev) console.warn(err instanceof Error && err.message);
|
if (isDev) console.warn(err instanceof Error && err.message);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user