Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ tauri-plugin-deep-link = { version = "=2.2.1" }
tauri-plugin-dialog = { version = "=2.2.1" }
tauri-plugin-fs = { version = "=2.2.1", features = ["watch"] }
tauri-plugin-os = { version = "=2.2.1" }
tauri-plugin-global-shortcut = { version = "=2.2.1" }
tauri-plugin-single-instance = { version = "=2.2.3" }
tauri-plugin-updater = { version = "=2.7.1" }
tauri-plugin-window-state = { version = "=2.2.2" }
Expand Down
1 change: 1 addition & 0 deletions apps/oneclient/desktop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ tauri-plugin-clipboard-manager = { workspace = true }
tauri-plugin-dialog = { workspace = true }
tauri-plugin-fs = { workspace = true }
tauri-plugin-os = { workspace = true }
tauri-plugin-global-shortcut = { workspace = true }
tauri-plugin-deep-link = { workspace = true }

# code gen
Expand Down
9 changes: 7 additions & 2 deletions apps/oneclient/desktop/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,19 @@
"fs:allow-download-write",
"fs:allow-data-read-recursive",
"fs:allow-data-write-recursive",
"fs:allow-watch",
"fs:allow-watch",

"os:deny-hostname",
"os:allow-locale",
"os:allow-os-type",
"os:allow-platform",
"os:allow-version",
"os:allow-arch",
"os:deny-exe-extension",
"os:allow-family"
"os:allow-family",

"global-shortcut:allow-is-registered",
"global-shortcut:allow-register",
"global-shortcut:allow-unregister"
]
}
14 changes: 13 additions & 1 deletion apps/oneclient/desktop/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use onelauncher_core::api::proxy::ProxyTauri;
use onelauncher_core::api::tauri::TauRPCLauncherExt;
use onelauncher_core::api::tauri::{TauRPCLauncherExt, TauriLauncherDebugApi};
use onelauncher_core::error::LauncherResult;
use onelauncher_core::store::proxy::ProxyState;
use onelauncher_core::store::semaphore::SemaphoreStore;
Expand Down Expand Up @@ -48,6 +48,12 @@ async fn initialize_core() -> LauncherResult<()> {
SemaphoreStore::get().await;
tracing::info!("initialized core modules");

let debug_info = onelauncher_core::api::tauri::TauriLauncherDebugApiImpl
.get_full_debug_info_parsed_string()
.await;

tracing::info!("\n{}", debug_info);

Ok(())
}

Expand Down Expand Up @@ -75,11 +81,17 @@ async fn initialize_tauri(builder: tauri::Builder<tauri::Wry>) -> LauncherResult
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_fs::init())
.plugin(tauri_plugin_deep_link::init())
.plugin(tauri_plugin_os::init())
.menu(tauri::menu::Menu::default)
.invoke_handler(router.into_handler())
.setup(move |app| {
app.manage(ext::updater::UpdaterState::default());
setup_window(app.handle()).expect("failed to setup main window");

#[cfg(desktop)]
app.handle()
.plugin(tauri_plugin_global_shortcut::Builder::new().build())?;

Ok(())
});

Expand Down
1 change: 1 addition & 0 deletions apps/oneclient/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@tauri-apps/plugin-clipboard-manager": "catalog:",
"@tauri-apps/plugin-dialog": "catalog:",
"@tauri-apps/plugin-fs": "catalog:",
"@tauri-apps/plugin-global-shortcut": "catalog:",
"@untitled-theme/icons-react": "catalog:",
"fuse.js": "^7.1.0",
"motion": "catalog:",
Expand Down
32 changes: 20 additions & 12 deletions apps/oneclient/frontend/src/bindings.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export type DaoError = { type: "NotFound"; data: string } | { type: "AlreadyExis

export type DbVec = T[]

export type DebugInfoData = { inDev: boolean; platform: string; arch: string; family: string; locale: string; osType: string; osVersion: string; osDistro: string; commitHash: string; buildTimestamp: string; buildVersion: string }

export type DebugInfoParsedLine = { title: string; value: string }

export type DirectoryError = { type: "BaseDir"; data: string }

export type DiscordError = { type: "MissingClientId"; data: string } | { type: "ConnectError"; data: string }
Expand Down Expand Up @@ -244,9 +248,9 @@ gallery: string[] }

export type SettingProfileModel = { name: string; java_id: number | null; res: Resolution | null; force_fullscreen: boolean | null; mem_max: number | null; launch_args: string | null; launch_env: string | null; hook_pre: string | null; hook_wrapper: string | null; hook_post: string | null; os_extra: SettingsOsExtra | null }

export type Settings = { global_game_settings: SettingProfileModel; allow_parallel_running_clusters: boolean; enable_gamemode: boolean; discord_enabled: boolean; seen_onboarding: boolean; mod_list_use_grid: boolean; max_concurrent_requests: number; settings_version: number; native_window_frame: boolean; show_tanstack_dev_tools: boolean }
export type Settings = { global_game_settings: SettingProfileModel; allow_parallel_running_clusters: boolean; enable_gamemode: boolean; discord_enabled: boolean; seen_onboarding: boolean; mod_list_use_grid: boolean; max_concurrent_requests: number; settings_version: number; native_window_frame: boolean; log_debug_info: boolean; show_tanstack_dev_tools: boolean }

export type SettingsOsExtra = Record<string, never>
export type SettingsOsExtra = { enable_gamemode: boolean | null }

export type SkinVariant = "classic" | "slim"

Expand Down Expand Up @@ -313,18 +317,27 @@ export type VersionType =
*/
"old_beta"

const ARGS_MAP = { 'oneclient':'{"getBundlesFor":["cluster_id"],"extractBundleOverrides":["bundle_path","cluster_id"],"getVersions":[],"isBundleSyncing":[],"cacheArt":["path"],"checkForUpdate":[],"updateBundlePackages":["cluster_id"],"refreshArt":["path"],"getClustersGroupedByMajor":[],"downloadPackageFromBundle":["package","cluster_id","bundle_name","skip_compatibility"],"installUpdate":[]}', 'core':'{"getLogs":["id"],"getProfileOrDefault":["name"],"getClusters":[],"installModpack":["modpack","cluster_id"],"downloadExternalPackage":["package","cluster_id","force","skip_compatibility"],"refreshAccounts":[],"updateClusterById":["id","request"],"launchCluster":["id","uuid","search_for_java"],"getGlobalProfile":[],"createCluster":["options"],"searchPackages":["provider","query"],"removeUser":["uuid"],"getPackageVersions":["provider","slug","mc_version","loader","offset","limit"],"getDefaultUser":["fallback"],"removeCape":["access_token"],"removePackage":["cluster_id","package_hash"],"removeCluster":["id"],"getMultiplePackages":["provider","slugs"],"syncCluster":["cluster_id"],"getLinkedPackages":["cluster_id"],"fetchMinecraftProfile":["uuid"],"refreshAccount":["uuid"],"getRunningProcessesByClusterId":["cluster_id"],"downloadPackage":["provider","package_id","version_id","cluster_id","skip_compatibility"],"isClusterRunning":["cluster_id"],"setClusterStage":["id","stage"],"killProcess":["pid"],"getLogByName":["id","name"],"getUsersFromAuthor":["provider","author"],"togglePackage":["cluster_id","package_hash"],"getScreenshots":["id"],"writeSettings":["setting"],"fetchLoggedInProfile":["access_token"],"changeSkin":["access_token","skin_url","skin_variant"],"openMsaLogin":[],"convertUsernameUUID":["username_uuid"],"getClusterById":["id"],"getRunningProcesses":[],"getLoadersForVersion":["mc_version"],"getUsers":[],"createSettingsProfile":["name"],"getUser":["uuid"],"readSettings":[],"setDefaultUser":["uuid"],"getPackageBody":["provider","body"],"updateClusterProfile":["name","profile"],"uploadSkinBytes":["access_token","skin_data","image_format","skin_variant"],"getWorlds":["id"],"getProcessLogTail":["id","max_lines"],"changeCape":["access_token","cape_uuid"],"getGameVersions":[],"setDiscordRPCMessage":["message"],"open":["input"],"getPackage":["provider","slug"]}', 'events':'{"process":["event"],"ingress":["event"],"message":["event"]}', 'debug':'{"getGitCommitHash":[],"getPackageVersion":[],"getFamily":[],"getOsVersion":[],"openDevTools":[],"getArch":[],"getBuildTimestamp":[],"getType":[],"isInDev":[],"getLocale":[],"getPlatform":[]}', 'folders':'{"fromCluster":["folder_name"],"openCluster":["folder_name"]}' }
export type Router = { 'debug': { openDevTools: () => Promise<void>,
const ARGS_MAP = { 'debug':'{"getFullDebugInfoParsedString":[],"getBuildTimestamp":[],"getPackageVersion":[],"openDevTools":[],"getFamily":[],"getArch":[],"isInDev":[],"getFullDebugInfo":[],"getType":[],"getLocale":[],"getPlatform":[],"getOsDistro":[],"getGitCommitHash":[],"getOsVersion":[],"getFullDebugInfoParsed":[]}', 'oneclient':'{"updateBundlePackages":["cluster_id"],"installUpdate":[],"checkForUpdate":[],"cacheArt":["path"],"extractBundleOverrides":["bundle_path","cluster_id"],"isBundleSyncing":[],"getBundlesFor":["cluster_id"],"downloadPackageFromBundle":["package","cluster_id","bundle_name","skip_compatibility"],"getVersions":[],"getClustersGroupedByMajor":[],"refreshArt":["path"]}', 'events':'{"ingress":["event"],"message":["event"],"process":["event"]}', 'folders':'{"fromCluster":["folder_name"],"openCluster":["folder_name"]}', 'core':'{"removeCape":["access_token"],"changeSkin":["access_token","skin_url","skin_variant"],"getLinkedPackages":["cluster_id"],"fetchMinecraftProfile":["uuid"],"downloadPackage":["provider","package_id","version_id","cluster_id","skip_compatibility"],"updateClusterById":["id","request"],"getLogs":["id"],"openMsaLogin":[],"getGameVersions":[],"setDefaultUser":["uuid"],"syncCluster":["cluster_id"],"refreshAccount":["uuid"],"removeCluster":["id"],"removePackage":["cluster_id","package_hash"],"convertUsernameUUID":["username_uuid"],"getClusterById":["id"],"fetchLoggedInProfile":["access_token"],"removeUser":["uuid"],"getLogByName":["id","name"],"launchCluster":["id","uuid","search_for_java"],"readSettings":[],"createCluster":["options"],"getGlobalProfile":[],"isClusterRunning":["cluster_id"],"searchPackages":["provider","query"],"getRunningProcessesByClusterId":["cluster_id"],"refreshAccounts":[],"getDefaultUser":["fallback"],"getUsers":[],"getPackage":["provider","slug"],"getPackageBody":["provider","body"],"getClusters":[],"getPackageVersions":["provider","slug","mc_version","loader","offset","limit"],"downloadExternalPackage":["package","cluster_id","force","skip_compatibility"],"setDiscordRPCMessage":["message"],"updateClusterProfile":["name","profile"],"setClusterStage":["id","stage"],"getUser":["uuid"],"killProcess":["pid"],"getWorlds":["id"],"installModpack":["modpack","cluster_id"],"open":["input"],"createSettingsProfile":["name"],"getProcessLogTail":["id","max_lines"],"getMultiplePackages":["provider","slugs"],"getRunningProcesses":[],"getLoadersForVersion":["mc_version"],"getProfileOrDefault":["name"],"writeSettings":["setting"],"getScreenshots":["id"],"getUsersFromAuthor":["provider","author"],"togglePackage":["cluster_id","package_hash"],"changeCape":["access_token","cape_uuid"],"uploadSkinBytes":["access_token","skin_data","image_format","skin_variant"]}' }
export type Router = { 'events': { ingress: (event: IngressPayload) => Promise<void>,
message: (event: MessagePayload) => Promise<void>,
process: (event: ProcessPayload) => Promise<void> },
'folders': { fromCluster: (folderName: string) => Promise<string>,
openCluster: (folderName: string) => Promise<null> },
'debug': { openDevTools: () => Promise<void>,
isInDev: () => Promise<boolean>,
getArch: () => Promise<string>,
getFamily: () => Promise<string>,
getLocale: () => Promise<string | null>,
getLocale: () => Promise<string>,
getType: () => Promise<string>,
getPlatform: () => Promise<string>,
getOsVersion: () => Promise<string>,
getOsDistro: () => Promise<string>,
getGitCommitHash: () => Promise<string>,
getBuildTimestamp: () => Promise<string>,
getPackageVersion: () => Promise<string> },
getPackageVersion: () => Promise<string>,
getFullDebugInfo: () => Promise<DebugInfoData>,
getFullDebugInfoParsed: () => Promise<DebugInfoParsedLine[]>,
getFullDebugInfoParsedString: () => Promise<string> },
'core': { getClusters: () => Promise<ClusterModel[]>,
getClusterById: (id: number) => Promise<ClusterModel | null>,
removeCluster: (id: number) => Promise<null>,
Expand Down Expand Up @@ -389,12 +402,7 @@ downloadPackageFromBundle: (package: ModpackFileKind, clusterId: number, bundleN
updateBundlePackages: (clusterId: number) => Promise<ApplyBundleUpdatesResult>,
isBundleSyncing: () => Promise<boolean>,
cacheArt: (path: string) => Promise<string>,
refreshArt: (path: string) => Promise<null> },
'events': { ingress: (event: IngressPayload) => Promise<void>,
message: (event: MessagePayload) => Promise<void>,
process: (event: ProcessPayload) => Promise<void> },
'folders': { fromCluster: (folderName: string) => Promise<string>,
openCluster: (folderName: string) => Promise<null> } };
refreshArt: (path: string) => Promise<null> } };


export type { InferCommandOutput }
Expand Down
21 changes: 21 additions & 0 deletions apps/oneclient/frontend/src/components/MadeBy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { bindings } from '@/main';
import { copyDebugInfo } from '@/utils/debugInfo';
import { useCommand } from '@onelauncher/common';
import { Button } from '@onelauncher/common/components';

export function MadeBy() {
const { data: version } = useCommand(['getPackageVersion'], () => bindings.debug.getPackageVersion());
const { data: isInDev } = useCommand(['isInDev'], () => bindings.debug.isInDev());

return (
<Button
className="flex flex-col items-start p-4 text-xs text-fg-secondary"
color="ghost"
onClick={copyDebugInfo}
>
<p>OneClient by Polyfrost</p>
<p>Version {version}</p>
<p>{isInDev ? 'Development' : 'Release'} Build</p>
</Button>
);
}
1 change: 1 addition & 0 deletions apps/oneclient/frontend/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export * from './GameBackground';
export * from './LaunchButton';
export * from './Loader';
export * from './LogViewer';
export * from './MadeBy';
export * from './ManageSkinButton';
export * from './Markdown';
export * from './Navbar';
Expand Down
106 changes: 3 additions & 103 deletions apps/oneclient/frontend/src/components/overlay/DebugInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,106 +1,7 @@
import type { DebugInfoArray } from '@/utils/debugInfo';
import { Overlay } from '@/components';
import { bindings } from '@/main';
import { copyDebugInfo, useDebugInfo } from '@/utils/debugInfo';
import { Button } from '@onelauncher/common/components';
import { writeText } from '@tauri-apps/plugin-clipboard-manager';
import { useEffect, useState } from 'react';

export type DebugInfoArray = Array<{ title: string; value: string }>;
export interface DebugInfoData {
inDev: boolean;
platform: string;
arch: string;
family: string;
locale: string;
type: string;
osVersion: string;
commitHash: string;
buildTimestamp: string;
buildVersion: string;
}

export function useDebugInfo(): DebugInfoArray {
const [devInfo, setDevInfo] = useState<DebugInfoData>({
inDev: false,
platform: 'UNKNOWN',
arch: 'UNKNOWN',
family: 'UNKNOWN',
locale: 'UNKNOWN',
type: 'UNKNOWN',
osVersion: 'UNKNOWN',
commitHash: 'UNKNOWN',
buildTimestamp: 'UNKNOWN',
buildVersion: 'UNKNOWN',
});

useEffect(() => {
const fetchDevInfo = async () => {
const [
inDev,
platform,
arch,
family,
locale,
type,
osVersion,
commitHash,
buildTimestamp,
buildVersion,
] = await Promise.all([
bindings.debug.isInDev(),
bindings.debug.getPlatform(),
bindings.debug.getArch(),
bindings.debug.getFamily(),
bindings.debug.getLocale(),
bindings.debug.getType(),
bindings.debug.getOsVersion(),
bindings.debug.getGitCommitHash(),
bindings.debug.getBuildTimestamp(),
bindings.debug.getPackageVersion(),
]);

setDevInfo({
inDev,
platform,
arch,
family,
locale: locale ?? 'UNKNOWN',
type,
osVersion,
commitHash,
buildTimestamp,
buildVersion,
});
};

void fetchDevInfo();
}, []);

return [
{ title: 'inDev', value: devInfo.inDev ? 'yes' : 'no' },
{ title: 'Platform', value: devInfo.platform },
{ title: 'Arch', value: devInfo.arch },
{ title: 'Family', value: devInfo.family },
{ title: 'Locale', value: devInfo.locale },
{ title: 'Type', value: devInfo.type },
{ title: 'Os Version', value: devInfo.osVersion },
{ title: 'Commit Hash', value: devInfo.commitHash },
{ title: 'Build Timestamp', value: devInfo.buildTimestamp },
{ title: 'Version', value: devInfo.buildVersion },
];
}

export function copyDebugInfo(debugInfo: DebugInfoArray) {
const timestamp = Math.floor(new Date().getTime() / 1000);
const lines = [
`**Data exported at:** <t:${timestamp}> (\`${timestamp}\`)`,
...debugInfo.map((lineData) => {
if (lineData.title === 'Build Timestamp')
return `**${lineData.title}:** <t:${lineData.value}> (\`${lineData.value}\`)`;
return `**${lineData.title}:** \`${lineData.value}\``;
}),
];
writeText(lines.join('\n'));
}

export function DebugInfo() {
const debugInfo = useDebugInfo();
Expand All @@ -113,7 +14,6 @@ export function DebugInfo() {
}

export function RawDebugInfo({ debugInfo }: { debugInfo: DebugInfoArray }) {
const copy = () => copyDebugInfo(debugInfo);
return (
<>
<div>
Expand All @@ -126,7 +26,7 @@ export function RawDebugInfo({ debugInfo }: { debugInfo: DebugInfoArray }) {
return <p key={lineData.title}>{line}</p>;
})}
</div>
<Button onPress={copy}>Copy Data</Button>
<Button onPress={copyDebugInfo}>Copy Data</Button>
</>
);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { MinecraftAuthErrorModal, minecraftAuthErrors, Overlay, RawDebugInfo, SettingsRow, SettingsSwitch, useDebugInfo } from '@/components';
import { MinecraftAuthErrorModal, minecraftAuthErrors, Overlay, RawDebugInfo, SettingsRow, SettingsSwitch } from '@/components';
import { useSettings } from '@/hooks/useSettings';
import { bindings } from '@/main';
import { useDebugInfo } from '@/utils/debugInfo';
import { Button } from '@onelauncher/common/components';
import { Link } from '@tanstack/react-router';
import { dataDir, join } from '@tauri-apps/api/path';
Expand Down Expand Up @@ -34,6 +35,10 @@ export function SuperSecretDevOptions() {
<Overlay.Title>Super Secret Dev Options</Overlay.Title>

<div>
<SettingsRow description="WARNING! This requires a restart to apply. Logs out debug info" icon={<Code02Icon />} title="Log Debug Info">
<SettingsSwitch setting={createSetting('log_debug_info')} />
</SettingsRow>

<SettingsRow description="Enable The Tanstack Dev Tools" icon={<Code02Icon />} title="Tanstack Dev Tools">
<SettingsSwitch setting={createSetting('show_tanstack_dev_tools')} />
</SettingsRow>
Expand Down
Loading
Loading