-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finished delegate feature (launching from web)
- Loading branch information
1 parent
73627c6
commit 5cc5178
Showing
13 changed files
with
134 additions
and
88 deletions.
There are no files selected for viewing
40 changes: 14 additions & 26 deletions
40
frontend/src/windows/main/components/LoadingSpinner.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,14 @@ | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
viewBox="0 0 100 100" | ||
preserveAspectRatio="xMidYMid" | ||
width="200" | ||
height="200" | ||
style="shape-rendering: auto; display: block; background: transparent;" | ||
xmlns:xlink="http://www.w3.org/1999/xlink" | ||
><g | ||
><g transform="translate(50 50)"> | ||
<g> | ||
<animateTransform | ||
attributeName="transform" | ||
type="rotate" | ||
values="0;45" | ||
keyTimes="0;1" | ||
dur="0.2s" | ||
repeatCount="indefinite" | ||
></animateTransform><path | ||
d="M29.491524206117255 -5.5 L37.491524206117255 -5.5 L37.491524206117255 5.5 L29.491524206117255 5.5 A30 30 0 0 1 24.742744050198738 16.964569457146712 L24.742744050198738 16.964569457146712 L30.399598299691117 22.621423706639092 L22.621423706639096 30.399598299691114 L16.964569457146716 24.742744050198734 A30 30 0 0 1 5.5 29.491524206117255 L5.5 29.491524206117255 L5.5 37.491524206117255 L-5.499999999999997 37.491524206117255 L-5.499999999999997 29.491524206117255 A30 30 0 0 1 -16.964569457146705 24.742744050198738 L-16.964569457146705 24.742744050198738 L-22.621423706639085 30.399598299691117 L-30.399598299691117 22.621423706639092 L-24.742744050198738 16.964569457146712 A30 30 0 0 1 -29.491524206117255 5.500000000000009 L-29.491524206117255 5.500000000000009 L-37.491524206117255 5.50000000000001 L-37.491524206117255 -5.500000000000001 L-29.491524206117255 -5.500000000000002 A30 30 0 0 1 -24.742744050198738 -16.964569457146705 L-24.742744050198738 -16.964569457146705 L-30.399598299691117 -22.621423706639085 L-22.621423706639092 -30.399598299691117 L-16.964569457146712 -24.742744050198738 A30 30 0 0 1 -5.500000000000011 -29.491524206117255 L-5.500000000000011 -29.491524206117255 L-5.500000000000012 -37.491524206117255 L5.499999999999998 -37.491524206117255 L5.5 -29.491524206117255 A30 30 0 0 1 16.964569457146702 -24.74274405019874 L16.964569457146702 -24.74274405019874 L22.62142370663908 -30.39959829969112 L30.399598299691117 -22.6214237066391 L24.742744050198738 -16.964569457146716 A30 30 0 0 1 29.491524206117255 -5.500000000000013 M0 -20A20 20 0 1 0 0 20 A20 20 0 1 0 0 -20" | ||
fill="#e15b64" | ||
></path></g | ||
></g | ||
><g></g></g | ||
><!-- [ldio] generated by https://loading.io --></svg | ||
> | ||
<script lang="ts"> | ||
import CatGif from '@/assets/panel/cat.gif'; | ||
import { sleep } from '../ts/utils'; | ||
import { cn } from '$lib/utils'; | ||
let className = ''; | ||
export { className as class }; | ||
</script> | ||
|
||
{#await sleep(500)} | ||
<div></div> | ||
{:then} | ||
<img src={CatGif} alt="Loading gif" class={cn('w-12 h-12', className)} /> | ||
{/await} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<boolean>('roblox.launching.delegate')) === true) { | ||
await this.toggle(true); | ||
return true; | ||
} else if (toggled && retoggle && (await getValue<boolean>('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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.