chore: add patch stream selection

This commit is contained in:
HorizonCode 2025-07-14 19:39:37 +02:00
parent b530dbf72f
commit 86033e2d6a
5 changed files with 74 additions and 4 deletions

View File

@ -444,6 +444,7 @@ pub struct UpdateFile {
pub async fn get_ezpp_launcher_update_files(
folder: String,
update_url: String,
update_stream: String
) -> Result<(Vec<UpdateFile>, Vec<UpdateFile>), String> {
let osu_path = PathBuf::from(folder);
let client = Client::new();
@ -451,6 +452,7 @@ pub async fn get_ezpp_launcher_update_files(
let update_files = client
.patch(update_url)
.header("User-Agent", "EZPPLauncher")
.query(&[("stream", update_stream)])
.send()
.await
.map_err(|e| e.to_string())?

View File

@ -9,6 +9,9 @@ export const currentView = writable<Component>(Loading);
export const launcherVersion = writable<string>('');
export const newVersion = writable<Release | undefined>(undefined);
export const launcherStreams = writable<string[]>(['stable']);
export const launcherStream = writable<string>('stable');
export const discordPresence = writable<boolean>(false);
export const presenceLoading = writable<boolean>(false);

View File

@ -1,8 +1,9 @@
import { invoke } from '@tauri-apps/api/core';
import type { UpdateFile, UpdateStatus } from './types';
import { listen } from '@tauri-apps/api/event';
import { betterFetch } from '@better-fetch/fetch';
const updateUrl = 'https://ez-pp.farm/ezpplauncher';
const updateUrl = 'https://next.ez-pp.farm/api/ezpplauncher';
export const getHWID = async () => {
const hwid = await invoke('get_hwid');
@ -73,8 +74,24 @@ export const runUpdater = async (folder: string) => await invoke('run_osu_update
export const runOsu = async (folder: string, patch: boolean) =>
await invoke('run_osu', { folder, patch });
export const getEZPPLauncherUpdateFiles = async (folder: string) => {
const result = await invoke('get_ezpp_launcher_update_files', { folder, updateUrl });
export const getEZPPLauncherStreams = async () => {
const resp = await betterFetch<{ streams: string[] }>(updateUrl, {
method: 'POST',
});
if (!resp.error) {
return resp.data.streams;
}
return undefined;
};
export const getEZPPLauncherUpdateFiles = async (folder: string, updateStream: string) => {
const result = await invoke('get_ezpp_launcher_update_files', {
folder,
updateUrl,
updateStream,
});
if (typeof result === 'object') {
const [filesToDownload, updateFiles] = result as [UpdateFile[], UpdateFile[]];
return {

View File

@ -9,6 +9,8 @@
currentSkin,
currentView,
discordPresence,
launcherStream,
launcherStreams,
launcherVersion,
launching,
newVersion,
@ -186,7 +188,7 @@
try {
launchInfo = 'Looking for EZPPLauncher File updates...';
const updateResult = await getEZPPLauncherUpdateFiles(osuPath);
const updateResult = await getEZPPLauncherUpdateFiles(osuPath, $launcherStream);
if (updateResult) {
if (updateResult.filesToDownload.length > 0) {
@ -1135,6 +1137,41 @@
onclick={browse_osu_installation}>Browse</Button
>
</div>
<div class="flex flex-col">
<Label class="text-sm" for="setting-custom-cursor">patcher release stream</Label>
<div class="text-muted-foreground text-xs">
test different versions of the patcher
</div>
</div>
<div class="flex flex-row w-full">
<Select.Root
type="single"
value={$launcherStream}
onValueChange={async (newStream) => {
$userSettings.value('patcherStream').set(newStream);
launcherStream.set(newStream);
await $userSettings.save();
}}
>
<Select.Trigger
class="border-theme-800 bg-theme-950 !text-muted-foreground font-semibold"
>
<div class="flex flex-row items-center gap-2 font-normal text-foreground">
{$launcherStream}
</div>
</Select.Trigger>
<Select.Content class="bg-theme-950 border border-theme-950 rounded-lg">
{#each $launcherStreams as stream (stream)}
<Select.Item value={stream}>
<div class="flex flex-row gap-2 items-center">
{stream}
</div>
</Select.Item>
{/each}
</Select.Content>
</Select.Root>
</div>
</div>
</div>
</div>

View File

@ -7,6 +7,8 @@
currentSkin,
currentView,
firstStartup,
launcherStream,
launcherStreams,
launcherVersion,
newVersion,
osuBuild,
@ -30,6 +32,7 @@
import { currentUserInfo } from '@/data';
import {
getBeatmapSetsCount,
getEZPPLauncherStreams,
getReleaseStream,
getSkin,
getSkinsCount,
@ -148,6 +151,14 @@
newVersion.set(launcherUpdate);
}
const ezpplauncherStreams = await getEZPPLauncherStreams();
if (ezpplauncherStreams) launcherStreams.set(ezpplauncherStreams);
const selectedLauncherStream = $userSettings.value('patcherStream').get('stable');
if ($launcherStreams.includes(selectedLauncherStream)) {
launcherStream.set(selectedLauncherStream);
}
animate(ezppLogo, {
opacity: [1, 0],
scale: [1, 1.05],