Files
RetroHub/resources/js/Features/Settings/Pages/WebDav.vue
T

125 lines
5.2 KiB
Vue

<script setup lang="ts">
import AppLayout from '@/Shared/Layouts/AppLayout.vue';
import { Head, Link, useForm, router } from '@inertiajs/vue3';
import type { WebDavAccountData } from '@/types';
interface Props {
webDavAccounts: WebDavAccountData[];
appUrl: string;
user: {
name: string;
email: string;
};
}
defineProps<Props>();
const form = useForm({
username: '',
password: '',
});
const submit = () => {
form.post(route('settings.webdav.store'), {
preserveScroll: true,
onSuccess: () => {
form.reset();
},
});
};
const deleteAccount = (id: number) => {
if (confirm('Are you sure you want to delete this WebDAV account?')) {
router.delete(route('settings.webdav.destroy', id));
}
};
</script>
<template>
<AppLayout title="WebDAV Settings" :user="user">
<template #header>
<h2 class="font-semibold text-xl text-gray-800 leading-tight">WebDAV Settings</h2>
</template>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6">
<!-- Instructions -->
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-6">
<h3 class="text-lg font-semibold mb-4">EmuDeck Setup Instructions</h3>
<div class="prose max-w-none">
<ol class="list-decimal list-inside space-y-2">
<li>Install rclone on your Steam Deck or Desktop</li>
<li>Run <code class="bg-gray-100 px-2 py-1 rounded">rclone config</code> and create a new WebDAV remote</li>
<li>Set the URL to: <code class="bg-gray-100 px-2 py-1 rounded">{{ appUrl }}/webdav/default</code></li>
<li>Set the vendor to "other"</li>
<li>Enter your WebDAV username and password below</li>
<li>Configure EmuDeck CloudSync to use this remote</li>
</ol>
</div>
</div>
<!-- Create Account -->
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-6">
<h3 class="text-lg font-semibold mb-4">Create WebDAV Account</h3>
<form @submit.prevent="submit" class="space-y-4">
<div>
<label for="username" class="block text-sm font-medium text-gray-700">Username</label>
<input
id="username"
v-model="form.username"
type="text"
class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-purple-500 focus:border-purple-500"
required
/>
</div>
<div>
<label for="password" class="block text-sm font-medium text-gray-700">Password</label>
<input
id="password"
v-model="form.password"
type="password"
class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-purple-500 focus:border-purple-500"
required
minlength="8"
/>
</div>
<button
type="submit"
:disabled="form.processing"
class="bg-purple-600 hover:bg-purple-700 text-white font-bold py-2 px-4 rounded disabled:opacity-50"
>
Create Account
</button>
</form>
</div>
<!-- Existing Accounts -->
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-6">
<h3 class="text-lg font-semibold mb-4">Existing Accounts</h3>
<div v-if="webDavAccounts.length === 0" class="text-gray-500">
No WebDAV accounts created yet.
</div>
<div v-else class="space-y-3">
<div
v-for="account in webDavAccounts"
:key="account.id"
class="flex items-center justify-between p-3 bg-gray-50 rounded-lg"
>
<div>
<div class="font-medium">{{ account.username }}</div>
<div class="text-sm text-gray-500">{{ account.displayName }}</div>
</div>
<button
@click="deleteAccount(account.id)"
class="text-red-500 hover:text-red-700 text-sm"
>
Delete
</button>
</div>
</div>
</div>
</div>
</div>
</AppLayout>
</template>