chore: add patch stream selection
This commit is contained in:
parent
b530dbf72f
commit
86033e2d6a
@ -444,6 +444,7 @@ pub struct UpdateFile {
|
|||||||
pub async fn get_ezpp_launcher_update_files(
|
pub async fn get_ezpp_launcher_update_files(
|
||||||
folder: String,
|
folder: String,
|
||||||
update_url: String,
|
update_url: String,
|
||||||
|
update_stream: String
|
||||||
) -> Result<(Vec<UpdateFile>, Vec<UpdateFile>), String> {
|
) -> Result<(Vec<UpdateFile>, Vec<UpdateFile>), String> {
|
||||||
let osu_path = PathBuf::from(folder);
|
let osu_path = PathBuf::from(folder);
|
||||||
let client = Client::new();
|
let client = Client::new();
|
||||||
@ -451,6 +452,7 @@ pub async fn get_ezpp_launcher_update_files(
|
|||||||
let update_files = client
|
let update_files = client
|
||||||
.patch(update_url)
|
.patch(update_url)
|
||||||
.header("User-Agent", "EZPPLauncher")
|
.header("User-Agent", "EZPPLauncher")
|
||||||
|
.query(&[("stream", update_stream)])
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
.map_err(|e| e.to_string())?
|
.map_err(|e| e.to_string())?
|
||||||
|
@ -9,6 +9,9 @@ export const currentView = writable<Component>(Loading);
|
|||||||
export const launcherVersion = writable<string>('');
|
export const launcherVersion = writable<string>('');
|
||||||
export const newVersion = writable<Release | undefined>(undefined);
|
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 discordPresence = writable<boolean>(false);
|
||||||
export const presenceLoading = writable<boolean>(false);
|
export const presenceLoading = writable<boolean>(false);
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import { invoke } from '@tauri-apps/api/core';
|
import { invoke } from '@tauri-apps/api/core';
|
||||||
import type { UpdateFile, UpdateStatus } from './types';
|
import type { UpdateFile, UpdateStatus } from './types';
|
||||||
import { listen } from '@tauri-apps/api/event';
|
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 () => {
|
export const getHWID = async () => {
|
||||||
const hwid = await invoke('get_hwid');
|
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) =>
|
export const runOsu = async (folder: string, patch: boolean) =>
|
||||||
await invoke('run_osu', { folder, patch });
|
await invoke('run_osu', { folder, patch });
|
||||||
|
|
||||||
export const getEZPPLauncherUpdateFiles = async (folder: string) => {
|
export const getEZPPLauncherStreams = async () => {
|
||||||
const result = await invoke('get_ezpp_launcher_update_files', { folder, updateUrl });
|
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') {
|
if (typeof result === 'object') {
|
||||||
const [filesToDownload, updateFiles] = result as [UpdateFile[], UpdateFile[]];
|
const [filesToDownload, updateFiles] = result as [UpdateFile[], UpdateFile[]];
|
||||||
return {
|
return {
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
currentSkin,
|
currentSkin,
|
||||||
currentView,
|
currentView,
|
||||||
discordPresence,
|
discordPresence,
|
||||||
|
launcherStream,
|
||||||
|
launcherStreams,
|
||||||
launcherVersion,
|
launcherVersion,
|
||||||
launching,
|
launching,
|
||||||
newVersion,
|
newVersion,
|
||||||
@ -186,7 +188,7 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
launchInfo = 'Looking for EZPPLauncher File updates...';
|
launchInfo = 'Looking for EZPPLauncher File updates...';
|
||||||
const updateResult = await getEZPPLauncherUpdateFiles(osuPath);
|
const updateResult = await getEZPPLauncherUpdateFiles(osuPath, $launcherStream);
|
||||||
|
|
||||||
if (updateResult) {
|
if (updateResult) {
|
||||||
if (updateResult.filesToDownload.length > 0) {
|
if (updateResult.filesToDownload.length > 0) {
|
||||||
@ -1135,6 +1137,41 @@
|
|||||||
onclick={browse_osu_installation}>Browse</Button
|
onclick={browse_osu_installation}>Browse</Button
|
||||||
>
|
>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
currentSkin,
|
currentSkin,
|
||||||
currentView,
|
currentView,
|
||||||
firstStartup,
|
firstStartup,
|
||||||
|
launcherStream,
|
||||||
|
launcherStreams,
|
||||||
launcherVersion,
|
launcherVersion,
|
||||||
newVersion,
|
newVersion,
|
||||||
osuBuild,
|
osuBuild,
|
||||||
@ -30,6 +32,7 @@
|
|||||||
import { currentUserInfo } from '@/data';
|
import { currentUserInfo } from '@/data';
|
||||||
import {
|
import {
|
||||||
getBeatmapSetsCount,
|
getBeatmapSetsCount,
|
||||||
|
getEZPPLauncherStreams,
|
||||||
getReleaseStream,
|
getReleaseStream,
|
||||||
getSkin,
|
getSkin,
|
||||||
getSkinsCount,
|
getSkinsCount,
|
||||||
@ -148,6 +151,14 @@
|
|||||||
newVersion.set(launcherUpdate);
|
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, {
|
animate(ezppLogo, {
|
||||||
opacity: [1, 0],
|
opacity: [1, 0],
|
||||||
scale: [1, 1.05],
|
scale: [1, 1.05],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user