1
0
mirror of https://github.com/mifi/lossless-cut.git synced 2024-11-24 19:32:29 +01:00
This commit is contained in:
Mikael Finstad 2024-10-20 21:29:03 +02:00
parent efbb30ff21
commit cb55bca74c
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26
2 changed files with 31 additions and 19 deletions

View File

@ -287,7 +287,7 @@ function BottomBar({
if (newRate != null) setOutputPlaybackRate(newRate);
}, [detectedFps, outputPlaybackRate, setOutputPlaybackRate]);
function renderJumpCutpointButton(direction) {
function renderJumpCutpointButton(direction: number) {
const newIndex = currentSegIndexSafe + direction;
const seg = cutSegments[newIndex];

View File

@ -366,12 +366,13 @@ export async function withErrorHandling(operation: () => Promise<void>, errorMsg
export async function checkAppPath() {
try {
const forceCheck = false;
// const forceCheck = isDev;
const forceCheckMs = false;
const forceCheckTitle = false;
// 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
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 pathMatch = appPath.replaceAll('\\', '/').match(/Windows ?Apps\/([^/]+)/); // find the first component after WindowsApps
// example pathMatch: 37672NoveltyStudio.MediaConverter_9.0.6.0_x64__vjhnv588cyf84
@ -381,12 +382,23 @@ export async function checkAppPath() {
}
const pathSeg = pathMatch[1];
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
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);
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 });
}
} catch (err) {
if (isDev) console.warn(err instanceof Error && err.message);
}