diff --git a/frontend/src/utils/auth.ts b/frontend/src/utils/auth.ts index 4671c1a72b..63dd8d9488 100644 --- a/frontend/src/utils/auth.ts +++ b/frontend/src/utils/auth.ts @@ -9,7 +9,7 @@ import { logoutPage, authLogoutURL, } from "./constants"; -import { StatusError } from "@/api/utils"; +import { fetchURL, StatusError } from "@/api/utils"; import { setSafeTimeout } from "@/api/utils"; export function parseToken(token: string) { @@ -122,20 +122,15 @@ export async function signup(username: string, password: string) { } export function logout(reason?: string) { - document.cookie = "auth=; Max-Age=0; Path=/; SameSite=Strict;"; - if (authMethod === "proxy" && authLogoutURL !== "") { // Hostinger specific - fetch(authLogoutURL, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - }).catch(() => { + fetchURL(authLogoutURL, { method: "POST" }).catch(() => { console.error("Failed to logout using proxy auth"); }); } + document.cookie = "auth=; Max-Age=0; Path=/; SameSite=Strict;"; + const authStore = useAuthStore(); authStore.clearUser(); diff --git a/frontend/src/views/files/FileListing.vue b/frontend/src/views/files/FileListing.vue index ff1936200d..b1dd4be76f 100644 --- a/frontend/src/views/files/FileListing.vue +++ b/frontend/src/views/files/FileListing.vue @@ -292,6 +292,13 @@ :label="t('buttons.share')" show="share" /> + { hideContextMenu(); }); +const router = useRouter(); const { t } = useI18n(); @@ -1162,6 +1170,24 @@ const handleEmptyAreaClick = (e: MouseEvent) => { fileStore.selected = []; }; + +const editAvailable = computed((): boolean => { + return ( + fileStore.selectedCount === 1 && + fileStore.req !== null && + !fileStore.req.items[fileStore.selected[0]].isDir + ); +}); + +const openSelectedFile = () => { + if ( + fileStore.selectedCount === 1 && + fileStore.req !== null && + !fileStore.req.items[fileStore.selected[0]].isDir + ) { + router.push({ path: fileStore.req.items[fileStore.selected[0]].url }); + } +};