+
{/if}
diff --git a/frontend/src/windows/main/pages/Roblox.svelte b/frontend/src/windows/main/pages/Roblox.svelte
index 4e95b0d..e91f574 100644
--- a/frontend/src/windows/main/pages/Roblox.svelte
+++ b/frontend/src/windows/main/pages/Roblox.svelte
@@ -7,6 +7,8 @@
import { toast } from 'svelte-sonner';
import Panel from '../components/settings/panel.svelte';
import { SettingsPanelBuilder } from '../components/settings';
+ import type { SettingsOutput } from '../components/settings/types';
+ import LoadingSpinner from '../components/LoadingSpinner.svelte';
export let render = true;
@@ -49,11 +51,9 @@
async function switchClicked(e: CustomEvent) {
const { id, state } = e.detail;
switch (id) {
- case 'redirect_appleblox':
- Roblox.Utils.toggleURI(state).catch((err) => {
- toast.error('An error occured');
- console.error('[RobloxPanel] ', err);
- });
+ case 'delegate':
+ await Roblox.Delegate.toggle(state);
+ break;
}
}
@@ -92,7 +92,7 @@
category
.setName('Launching')
.setDescription('Launching phase settings')
- .setId('roblox_launching')
+ .setId('launching')
.addButton({
label: 'Create a launch shortcut',
description:
@@ -113,11 +113,20 @@
label: 'Delegate launching to AppleBlox',
description:
'When you launch Roblox, AppleBlox will open first in the background and apply the chosen settings',
- id: 'delegate_launching',
+ id: 'delegate',
default: false,
})
)
.build();
+
+ let overrides: SettingsOutput = {};
+ async function loadOverrides() {
+ overrides = {
+ launching: {
+ delegate: await Roblox.Delegate.check(true),
+ },
+ };
+ }
@@ -138,4 +147,13 @@
-
+{#await loadOverrides()}
+ {#if render}
+
+ {/if}
+{:then}
+
+{:catch error}
+
An error occured while loading settings overrides
+
{error}
+{/await}
diff --git a/frontend/src/windows/main/ts/libraries.ts b/frontend/src/windows/main/ts/libraries.ts
index 80b6896..4d8a5d2 100644
--- a/frontend/src/windows/main/ts/libraries.ts
+++ b/frontend/src/windows/main/ts/libraries.ts
@@ -8,31 +8,31 @@ const LibPaths = {
notifications: {
darwin: {
prod: '/lib/alerter_ablox',
- dev: '/build/lib/MacOS/alerter_ablox',
+ dev: '/bin/alerter_ablox',
},
},
discordrpc: {
darwin: {
prod: '/lib/discordrpc_ablox',
- dev: '/build/lib/MacOS/discordrpc_ablox',
+ dev: '/bin/discordrpc_ablox',
},
},
watchdog: {
darwin: {
prod: '/lib/watchdog',
- dev: '/build/lib/MacOS/watchdog',
+ dev: '/bin/watchdog',
},
},
window_manager: {
darwin: {
prod: '/lib/window_manager',
- dev: '/build/lib/MacOS/window_manager',
+ dev: '/bin/window_manager',
},
},
urlscheme: {
darwin: {
prod: '/lib/urlscheme',
- dev: '/build/lib/MacOS/urlscheme',
+ dev: '/bin/urlscheme',
},
},
} as const;
diff --git a/frontend/src/windows/main/ts/roblox/delegate.ts b/frontend/src/windows/main/ts/roblox/delegate.ts
new file mode 100644
index 0000000..ff444e3
--- /dev/null
+++ b/frontend/src/windows/main/ts/roblox/delegate.ts
@@ -0,0 +1,51 @@
+import { shell } from '../tools/shell';
+import { getValue } from '../../components/settings';
+import { libraryPath } from '../libraries';
+import { toast } from 'svelte-sonner';
+
+const urlscheme = libraryPath('urlscheme');
+
+async function setUrlscheme(
+ uri: string,
+ bundleId: string
+): Promise<{ toggled: true } | { toggled: false; stdErr: string; stdOut: string }> {
+ const command = await shell(`${urlscheme}`, ['set', uri, bundleId], { skipStderrCheck: true });
+ if (!command.stdout.includes('Successfully') && !command.stderr.includes('Successfully')) {
+ return { toggled: false, stdErr: command.stderr, stdOut: command.stdout };
+ }
+ return { toggled: true };
+}
+
+export class RobloxDelegate {
+ /** Checks if the app is already redirected */
+ static async check(retoggle = false) {
+ // If it's not active but toggled in settings, retoggle.
+ const cmd = await shell(`${urlscheme}`, ['check', 'roblox-player', 'ch.origaming.appleblox'], { skipStderrCheck: true });
+ const toggled = cmd.stdout.includes('true') || cmd.stderr.includes('true');
+ if (!toggled && retoggle && (await getValue
('roblox.launching.delegate')) === true) {
+ await this.toggle(true);
+ return true;
+ } else if (toggled && retoggle && (await getValue('roblox.launching.delegate')) === false) {
+ await this.toggle(false);
+ return false;
+ }
+ return toggled;
+ }
+
+ /** Enable/disable delegation */
+ static async toggle(delegate: boolean) {
+ if (delegate) {
+ const toggled = await setUrlscheme('roblox-player', 'ch.origaming.appleblox');
+ if (!toggled.toggled) {
+ toast.error("Couldn't set Roblox's URI");
+ console.error("Couldn't set Roblox's URI:", toggled.stdErr, toggled.stdOut);
+ }
+ } else {
+ const toggled = await setUrlscheme('roblox-player', 'com.roblox.RobloxPlayer');
+ if (!toggled.toggled) {
+ toast.error("Couldn't set Roblox's URI");
+ console.error("Couldn't set Roblox's URI:", toggled.stdErr, toggled.stdOut);
+ }
+ }
+ }
+}
diff --git a/frontend/src/windows/main/ts/roblox/fflags.ts b/frontend/src/windows/main/ts/roblox/fflags.ts
index 8c4583e..cbe5d70 100644
--- a/frontend/src/windows/main/ts/roblox/fflags.ts
+++ b/frontend/src/windows/main/ts/roblox/fflags.ts
@@ -256,9 +256,7 @@ async function buildFlagsList(): Promise {
name: 'Menu version (Version 4 Chrome)',
flags: {
FFlagEnableInGameMenuChrome: true,
- FFlagEnableReportAbuseMenuRoactABTest2: true,
FFlagChromeBetaFeature: true,
- FFlagEnableInGameMenuChromeABTest2: true,
},
path: 'fastflags.ui.menu_version',
type: 'select',
@@ -391,7 +389,6 @@ export class RobloxFFlags {
if (preset) {
flagsList = await buildFlagsList();
const data = await flagsList.build();
- console.log(data)
const { validFlags, invalidFlags, nameMap } = data;
return { validFlags, invalidFlags, nameMap };
@@ -619,7 +616,6 @@ export class FastFlagsList {
}
if (!addFlag && opts.value != null) continue;
- // console.log(opts,addFlag)
// Check if the flag is valid from the flag tracker repository
await this.fetchTracker();
diff --git a/frontend/src/windows/main/ts/roblox/index.ts b/frontend/src/windows/main/ts/roblox/index.ts
index ae4cb76..1177c42 100644
--- a/frontend/src/windows/main/ts/roblox/index.ts
+++ b/frontend/src/windows/main/ts/roblox/index.ts
@@ -5,6 +5,7 @@ import { RobloxMods } from './mods';
import { robloxPath } from './path';
import { RobloxUtils } from './utils';
import { RobloxWindow } from './window';
+import { RobloxDelegate } from './delegate';
// Simple export
class Roblox {
@@ -13,6 +14,7 @@ class Roblox {
static Utils = RobloxUtils;
static Window = RobloxWindow;
static Mods = RobloxMods;
+ static Delegate = RobloxDelegate;
static launch = launchRoblox;
static path = robloxPath;
}
diff --git a/frontend/src/windows/main/ts/roblox/instance.ts b/frontend/src/windows/main/ts/roblox/instance.ts
index 42e9413..f2ac12d 100644
--- a/frontend/src/windows/main/ts/roblox/instance.ts
+++ b/frontend/src/windows/main/ts/roblox/instance.ts
@@ -1,7 +1,9 @@
-import { events, filesystem, os } from '@neutralinojs/lib';
+import { clipboard, events, filesystem, os } from '@neutralinojs/lib';
import path from 'path-browserify';
import Roblox from '.';
import { isProcessAlive, sleep } from '../utils';
+import { getValue } from '../../components/settings';
+import { shell } from '../tools/shell';
type EventHandler = (data?: any) => void;
type Event = 'exit' | 'gameInfo' | 'gameEvent';
@@ -122,7 +124,7 @@ export class RobloxInstance {
}
watchLogs: boolean;
- constructor(watch: boolean, url?: string) {
+ constructor(watch: boolean) {
this.watchLogs = watch;
}
@@ -140,17 +142,21 @@ export class RobloxInstance {
// Launch Roblox
if (url) {
console.info(`[Roblox.Instance] Opening from URL: ${url}`);
- await Roblox.Utils.toggleURI(false, false);
- await os.execCommand(`open ${url}`);
+ await Roblox.Delegate.toggle(false);
+ await clipboard.writeText(url)
+ await shell("open",[url]);
} else {
- await os.execCommand(`open "${Roblox.path}"`);
+ await shell("open",[Roblox.path]);
}
await sleep(1000);
- await Roblox.Utils.toggleURI(true, false);
+ // If block because settings can be edited and maybe it will not be boolean
+ if ((await getValue('roblox.launching.delegate')) === true) {
+ await Roblox.Delegate.toggle(true);
+ }
// We find every roblox processes and get the RobloxPlayer one
- const robloxProcess = await (await os.execCommand('pgrep -f "Roblox"')).stdOut.split('\n');
+ const robloxProcess = (await os.execCommand('pgrep -f "Roblox"')).stdOut.split('\n');
for (const pid of robloxProcess) {
const info = (await os.execCommand(`ps -p ${pid} -o command=`)).stdOut.trim();
if (info.length < 2) continue;
diff --git a/frontend/src/windows/main/ts/roblox/launch.ts b/frontend/src/windows/main/ts/roblox/launch.ts
index b4d76a4..bca0699 100644
--- a/frontend/src/windows/main/ts/roblox/launch.ts
+++ b/frontend/src/windows/main/ts/roblox/launch.ts
@@ -16,6 +16,7 @@ let rbxInstance: RobloxInstance | null = null;
/** Launches a Roblox instance */
export async function launchRoblox(
+ // We use multiple functions as argument so things like launchProgress, the text to show in the UI, etc... can be read by App.svelte
setRobloxConnected: (value: boolean) => void,
setLaunchingRoblox: (value: boolean) => void,
setLaunchProgress: (value: number) => void,
@@ -29,7 +30,6 @@ export async function launchRoblox(
toast.error('Due to technical reasons, you must close all instances of Roblox before launching from AppleBlox.');
return;
}
- // We use multiple functions as argument so things like launchProgress, the text to show in the UI, etc... can be read by App.svelte
try {
console.info('[Launch] Launching Roblox');
setLaunchingRoblox(true);
diff --git a/frontend/src/windows/main/ts/roblox/utils.ts b/frontend/src/windows/main/ts/roblox/utils.ts
index 662c87b..d1fd4e9 100644
--- a/frontend/src/windows/main/ts/roblox/utils.ts
+++ b/frontend/src/windows/main/ts/roblox/utils.ts
@@ -124,31 +124,6 @@ END`);
toast.success(`Created a shortcut at "${path.join(savePath, 'Launch Roblox.app')}"`);
}
- /* Checks if the URI feature is enabled*/
- static async isUriEnabled() {
- return (
- await os.execCommand(`${libraryPath('urlscheme')} check roblox-player ch.origaming.appleblox.url`)
- ).stdOut.includes('true');
- }
-
- /** Toggles wether or not opening roblox:// and roblox-player:// links should open AppleBlox */
- static async toggleURI(state: boolean, notif = true) {
- const urlscheme = `${libraryPath('urlscheme')}`;
- if (state) {
- await os.execCommand(`${urlscheme} set roblox ch.origaming.appleblox.url`);
- await os.execCommand(`${urlscheme} set roblox-player ch.origaming.appleblox.url`);
- if (notif) {
- toast.success('Replaced roblox URI');
- }
- } else {
- await os.execCommand(`${urlscheme} set roblox com.roblox.RobloxPlayer`);
- await os.execCommand(`${urlscheme} set roblox-player com.roblox.RobloxPlayer`);
- if (notif) {
- toast.success('Restored roblox URI');
- }
- }
- }
-
static async killAll() {
await os.execCommand(`ps aux | grep -i roblox | grep -v grep | awk '{print $2}' | xargs kill -9`);
}