Compare commits

..

4 Commits

Author SHA1 Message Date
DecDuck 79c3c68818 Fix server lint 2026-06-21 16:37:29 +10:00
DecDuck d5e99306c7 Migrate to Astro v6 2026-06-21 16:34:33 +10:00
DecDuck 2ececf1b03 Fix sitemap gen 2026-06-21 16:20:30 +10:00
DecDuck 920a5297b1 Publish docs, update links 2026-06-21 15:58:56 +10:00
9 changed files with 45 additions and 160 deletions
-4
View File
@@ -19,7 +19,6 @@ pub enum ProcessError {
OpenerError(Arc<tauri_plugin_opener::Error>), OpenerError(Arc<tauri_plugin_opener::Error>),
InvalidArguments(String), InvalidArguments(String),
FailedLaunch(String), FailedLaunch(String),
NotExecutable(String),
NoCompat, NoCompat,
} }
@@ -40,9 +39,6 @@ impl Display for ProcessError {
ProcessError::FailedLaunch(game_id) => { ProcessError::FailedLaunch(game_id) => {
&format!("Drop detected that the game {game_id} may have failed to launch properly") &format!("Drop detected that the game {game_id} may have failed to launch properly")
} }
ProcessError::NotExecutable(command) => {
&format!("The command '{command}' exists but is not marked as executable")
}
ProcessError::RequiredDependency(game_id, version_id) => &format!( ProcessError::RequiredDependency(game_id, version_id) => &format!(
"Missing a required dependency to launch this game: {} {}", "Missing a required dependency to launch this game: {} {}",
game_id, version_id game_id, version_id
+1 -38
View File
@@ -1,6 +1,4 @@
use std::path::{Path, PathBuf}; use std::path::PathBuf;
use log::info;
use crate::error::ProcessError; use crate::error::ProcessError;
@@ -40,41 +38,6 @@ impl ParsedCommand {
.to_string(); .to_string();
} }
pub fn make_command_absolute_if_local(&mut self, base: &Path) {
let candidate = base.join(&self.command);
if candidate.is_file() {
info!(
"resolved local command '{}' to absolute path '{}'",
self.command,
candidate.display()
);
self.command = candidate.to_string_lossy().to_string();
} else {
info!(
"command '{}' is not a local file in '{}', leaving as-is for PATH resolution",
self.command,
base.display()
);
}
}
pub fn ensure_executable(&self) -> Result<(), ProcessError> {
#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
if let Ok(metadata) = std::fs::metadata(&self.command) {
let is_executable =
metadata.is_file() && metadata.permissions().mode() & 0o111 != 0;
if !is_executable {
return Err(ProcessError::NotExecutable(self.command.clone()));
}
}
}
Ok(())
}
pub fn reconstruct(self) -> String { pub fn reconstruct(self) -> String {
let mut v = vec![]; let mut v = vec![];
v.extend(self.env); v.extend(self.env);
@@ -312,12 +312,9 @@ impl ProcessHandler for UMUNativeLauncher {
let pfx_dir = pfx_dir.join(meta.id.clone()); let pfx_dir = pfx_dir.join(meta.id.clone());
create_dir_all(&pfx_dir)?; create_dir_all(&pfx_dir)?;
let game_id_env = shell_words::quote(&format!("GAMEID={game_id}")).into_owned();
let wineprefix_env =
shell_words::quote(&format!("WINEPREFIX={}", pfx_dir.to_string_lossy())).into_owned();
Ok(format!( Ok(format!(
"{game_id_env} UMU_NO_PROTON=1 {wineprefix_env} {umu:?} {launch}", "GAMEID={game_id} UMU_NO_PROTON=1 WINEPREFIX={} {umu:?} {launch}",
pfx_dir.to_string_lossy(),
umu = UMU_LAUNCHER_EXECUTABLE umu = UMU_LAUNCHER_EXECUTABLE
.as_ref() .as_ref()
.expect("Failed to get UMU_LAUNCHER_EXECUTABLE as ref"), .expect("Failed to get UMU_LAUNCHER_EXECUTABLE as ref"),
@@ -391,17 +388,12 @@ impl ProcessHandler for UMUCompatLauncher {
if !proton_valid { if !proton_valid {
return Err(ProcessError::NoCompat); return Err(ProcessError::NoCompat);
} }
let proton_env = format!("PROTONPATH={}", proton_path);
// Shell-quote the env assignments so values containing spaces (e.g. a
// Proton install named "Proton-GE Latest") aren't split into separate
// tokens and misinterpreted as the command by the launch parser.
let game_id_env = shell_words::quote(&format!("GAMEID={game_id}")).into_owned();
let proton_env = shell_words::quote(&format!("PROTONPATH={proton_path}")).into_owned();
let wineprefix_env =
shell_words::quote(&format!("WINEPREFIX={}", pfx_dir.to_string_lossy())).into_owned();
Ok(format!( Ok(format!(
"{game_id_env} {proton_env} {wineprefix_env} {umu:?} {launch}", "GAMEID={game_id} {} WINEPREFIX={} {umu:?} {launch}",
proton_env,
pfx_dir.to_string_lossy(),
umu = UMU_LAUNCHER_EXECUTABLE umu = UMU_LAUNCHER_EXECUTABLE
.as_ref() .as_ref()
.expect("Failed to get UMU_LAUNCHER_EXECUTABLE as ref"), .expect("Failed to get UMU_LAUNCHER_EXECUTABLE as ref"),
@@ -523,13 +523,6 @@ impl ProcessManager<'_> {
install_dir.into(), install_dir.into(),
); );
let mut launch_parameters = launch_parameters;
launch_parameters
.0
.make_command_absolute_if_local(&launch_parameters.1);
launch_parameters.0.ensure_executable()?;
info!( info!(
"launching (in {}): {:?}", "launching (in {}): {:?}",
launch_parameters.1.to_string_lossy(), launch_parameters.1.to_string_lossy(),
+1 -6
View File
@@ -9,12 +9,7 @@ export const updateUser = async () => {
const user = useUser(); const user = useUser();
if (user.value === null) return; if (user.value === null) return;
user.value = await $dropFetch<UserModel | null>("/api/v1/user", { user.value = await $dropFetch<UserModel | null>("/api/v1/user");
// Forward headers manually when called outside a component
headers: import.meta.server
? useRequestHeaders(["cookie", "authorization"])
: undefined,
});
}; };
export async function completeSignin() { export async function completeSignin() {
-3
View File
@@ -547,9 +547,6 @@
"sources": { "sources": {
"create": "Create source", "create": "Create source",
"createDesc": "Drop will use this source to access your game library, and make them available.", "createDesc": "Drop will use this source to access your game library, and make them available.",
"deleteButton": "Delete source",
"deleteDesc": "Deleting \"{0}\" will cascade delete the library, all of its games, all of their versions, and all of their metadata. This action cannot be undone.",
"deleteTitle": "Delete library source?",
"desc": "Configure your library sources, where Drop will look for new games and versions to import.", "desc": "Configure your library sources, where Drop will look for new games and versions to import.",
"documentationLink": "Documentation {arrow}", "documentationLink": "Documentation {arrow}",
"edit": "Edit source", "edit": "Edit source",
+6 -43
View File
@@ -126,9 +126,8 @@
</div> </div>
<div <div
class="sticky top-0 z-40 lg:pl-20 border-b border-zinc-800 bg-zinc-950 shadow-sm" class="sticky top-0 z-40 flex items-center gap-x-6 bg-zinc-900 px-4 py-4 shadow-sm sm:px-6 lg:hidden"
> >
<div class="flex items-center gap-x-4 px-4 py-2 sm:px-6 lg:px-8">
<button <button
type="button" type="button"
class="-m-2.5 p-2.5 text-zinc-400 lg:hidden" class="-m-2.5 p-2.5 text-zinc-400 lg:hidden"
@@ -137,39 +136,6 @@
<span class="sr-only">{{ $t("header.openSidebar") }}</span> <span class="sr-only">{{ $t("header.openSidebar") }}</span>
<Bars3Icon class="h-6 w-6" aria-hidden="true" /> <Bars3Icon class="h-6 w-6" aria-hidden="true" />
</button> </button>
<div class="flex-1" />
<ol class="inline-flex items-center gap-3">
<li>
<Menu as="div" class="relative inline-block">
<MenuButton>
<UserHeaderWidget :notifications="unreadNotifications.length">
<BellIcon class="h-5" />
</UserHeaderWidget>
</MenuButton>
<transition
enter-active-class="transition ease-out duration-100"
enter-from-class="transform opacity-0 scale-95"
enter-to-class="transform opacity-100 scale-100"
leave-active-class="transition ease-in duration-75"
leave-from-class="transform opacity-100 scale-100"
leave-to-class="transform opacity-0 scale-95"
>
<MenuItems
class="absolute right-0 top-10 z-50 w-96 focus:outline-none shadow-md"
>
<UserHeaderNotificationWidgetPanel
:notifications="unreadNotifications"
/>
</MenuItems>
</transition>
</Menu>
</li>
<UserHeaderUserWidget />
</ol>
</div>
</div> </div>
<main class="lg:pl-20 min-h-screen bg-zinc-900 flex flex-col"> <main class="lg:pl-20 min-h-screen bg-zinc-900 flex flex-col">
@@ -190,9 +156,6 @@ import {
DialogPanel, DialogPanel,
TransitionChild, TransitionChild,
TransitionRoot, TransitionRoot,
Menu,
MenuButton,
MenuItems,
} from "@headlessui/vue"; } from "@headlessui/vue";
import { import {
Bars3Icon, Bars3Icon,
@@ -205,7 +168,7 @@ import {
} from "@heroicons/vue/24/outline"; } from "@heroicons/vue/24/outline";
import type { NavigationItem } from "~/composables/types"; import type { NavigationItem } from "~/composables/types";
import { useCurrentNavigationIndex } from "~/composables/current-page-engine"; import { useCurrentNavigationIndex } from "~/composables/current-page-engine";
import { ArrowLeftIcon, BellIcon } from "@heroicons/vue/16/solid"; import { ArrowLeftIcon } from "@heroicons/vue/16/solid";
import { XMarkIcon } from "@heroicons/vue/24/solid"; import { XMarkIcon } from "@heroicons/vue/24/solid";
import type { Settings } from "~/server/internal/utils/types"; import type { Settings } from "~/server/internal/utils/types";
@@ -256,10 +219,10 @@ const navigation: Array<NavigationItem & { icon: Component }> = [
}, },
]; ];
const notifications = useNotifications(); // const notifications = useNotifications();
const unreadNotifications = computed(() => // const unreadNotifications = computed(() =>
notifications.value.filter((e) => !e.read), // notifications.value.filter((e) => !e.read)
); // );
const currentNavigationIndex = useCurrentNavigationIndex(navigation); const currentNavigationIndex = useCurrentNavigationIndex(navigation);
+2 -1
View File
@@ -2,13 +2,14 @@ const whitelistedPrefixes = ["/auth", "/api", "/setup"];
const requireAdmin = ["/admin"]; const requireAdmin = ["/admin"];
export default defineNuxtRouteMiddleware(async (to, _from) => { export default defineNuxtRouteMiddleware(async (to, _from) => {
if (import.meta.server) return;
const error = useError(); const error = useError();
if (error.value !== undefined) return; if (error.value !== undefined) return;
if (whitelistedPrefixes.findIndex((e) => to.fullPath.startsWith(e)) != -1) if (whitelistedPrefixes.findIndex((e) => to.fullPath.startsWith(e)) != -1)
return; return;
const user = useUser(); const user = useUser();
if (user.value === undefined) { if (user === undefined) {
await updateUser(); await updateUser();
} }
if (!user.value) { if (!user.value) {
+2 -17
View File
@@ -347,20 +347,10 @@ function edit(index: number) {
actionSourceOpen.value = true; actionSourceOpen.value = true;
} }
function deleteSource(index: number) { async function deleteSource(index: number) {
const source = sources.value[index]; const source = sources.value[index];
if (!source) return; if (!source) return;
createModal(
ModalType.Confirmation,
{
title: t("library.admin.sources.deleteTitle"),
description: t("library.admin.sources.deleteDesc", [source.name]),
buttonText: t("library.admin.sources.deleteButton"),
},
async (event, close) => {
if (event !== "confirm") return close();
try { try {
await $dropFetch("/api/v1/admin/library/sources", { await $dropFetch("/api/v1/admin/library/sources", {
method: "DELETE", method: "DELETE",
@@ -379,13 +369,8 @@ function deleteSource(index: number) {
}, },
(_, c) => c(), (_, c) => c(),
); );
return close();
} }
const currentIndex = sources.value.findIndex((s) => s.id === source.id); sources.value.splice(index, 1);
if (currentIndex !== -1) sources.value.splice(currentIndex, 1);
close();
},
);
} }
</script> </script>