feat(settings): Nextcloud server-URL hint + edit-mode test uses stored password
Provider-aware Server URL placeholder/hint (Nextcloud/ownCloud: enter just the server URL); Test in edit mode passes the target id so the backend reuses the stored credential.
This commit is contained in:
1 parent
8f6e8041d6
commit
9c670f9b6b
1 file changed
+18
-4
@@ -345,6 +345,10 @@
|
|||||||
let form = $state<SyncTargetConfig>(blankForm("webdav"));
|
let form = $state<SyncTargetConfig>(blankForm("webdav"));
|
||||||
// When set, the form is editing an existing target rather than adding one.
|
// When set, the form is editing an existing target rather than adding one.
|
||||||
let editingId = $state<string | null>(null);
|
let editingId = $state<string | null>(null);
|
||||||
|
// Nextcloud/ownCloud only need the server URL — the app builds the DAV path.
|
||||||
|
let davAutoPath = $derived(
|
||||||
|
form.provider_hint === "nextcloud" || form.provider_hint === "owncloud",
|
||||||
|
);
|
||||||
|
|
||||||
function blankForm(kind: SyncKind): SyncTargetConfig {
|
function blankForm(kind: SyncKind): SyncTargetConfig {
|
||||||
return {
|
return {
|
||||||
@@ -370,7 +374,9 @@
|
|||||||
testResult = null;
|
testResult = null;
|
||||||
}
|
}
|
||||||
async function testConnection() {
|
async function testConnection() {
|
||||||
const r = await settings.test(form);
|
// In edit mode, pass the id so the backend reuses the stored password
|
||||||
|
// (unless a new one was typed) while still testing the edited URL/fields.
|
||||||
|
const r = await settings.test(editingId ? { ...form, id: editingId } : form);
|
||||||
testResult = { ok: r.ok, message: r.message };
|
testResult = { ok: r.ok, message: r.message };
|
||||||
}
|
}
|
||||||
// Load an existing target into the form for editing. The secret is never
|
// Load an existing target into the form for editing. The secret is never
|
||||||
@@ -786,9 +792,17 @@
|
|||||||
<label class="wide"
|
<label class="wide"
|
||||||
>Server URL<input
|
>Server URL<input
|
||||||
bind:value={form.base_url}
|
bind:value={form.base_url}
|
||||||
placeholder="https://cloud.example.com/remote.php/dav/files/me/"
|
placeholder={davAutoPath
|
||||||
/></label
|
? "https://cloud.example.com"
|
||||||
>
|
: "https://host/remote.php/dav/… (or /seafdav, /dav)"}
|
||||||
|
/>
|
||||||
|
{#if davAutoPath}
|
||||||
|
<small class="muted"
|
||||||
|
>Just your server URL — WhispAssist adds
|
||||||
|
<code>/remote.php/dav/files/<username>/</code> automatically.</small
|
||||||
|
>
|
||||||
|
{/if}
|
||||||
|
</label>
|
||||||
<label>Remote folder<input bind:value={form.remote_base_path} /></label>
|
<label>Remote folder<input bind:value={form.remote_base_path} /></label>
|
||||||
<label>Username<input bind:value={form.username} /></label>
|
<label>Username<input bind:value={form.username} /></label>
|
||||||
<label
|
<label
|
||||||
|
|||||||
Reference in new issue
Block a user