Backend: - Add MCP Serializer to centralize entity-to-array conversion (~300 lines deduped) - Fix race condition in task/ticket number generation (SELECT FOR UPDATE + transaction) - Add unique constraint on task (project_id, number) with migration - Fix MIME type validation: use server-detected finfo instead of client-supplied type - Add allowlist of permitted MIME types for uploads - Fix TaskDocumentDownloadController: allow ROLE_CLIENT access, add priority:1 - Fix notification sent even when ticket status unchanged - Remove redundant exception constructors - Simplify services (BookStackApi double fetch, TokenEncryptor, GiteaApi) - Consolidate duplicate checks in processors Frontend: - Fix useApi isHandlingUnauthorized scope (module-level to prevent double 401 redirect) - Fix client-tickets toast key copy-paste bug - Merge duplicated tasks service methods (getByProject + getByProjectArchived) - Extract shared uploadWithRelation helper in task-documents service - Extract formatFileSize utility from duplicated component code - Extract status transition logic into useClientTicketHelpers composable - Remove dead code (unused router, handleLogout, empty script blocks) - Merge duplicate watchers and onMounted calls - Normalize arrow functions to function declarations per convention Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
115 lines
3.6 KiB
Vue
115 lines
3.6 KiB
Vue
<template>
|
|
<div>
|
|
<h2 class="text-lg font-bold text-neutral-900">{{ $t('bookstack.settings.title') }}</h2>
|
|
|
|
<form class="mt-6 max-w-lg space-y-4" @submit.prevent="handleSave">
|
|
<MalioInputText
|
|
v-model="form.url"
|
|
:label="$t('bookstack.settings.url')"
|
|
:placeholder="$t('bookstack.settings.urlPlaceholder')"
|
|
input-class="w-full"
|
|
/>
|
|
|
|
<MalioInputText
|
|
v-model="form.tokenId"
|
|
:label="$t('bookstack.settings.tokenId')"
|
|
:placeholder="$t('bookstack.settings.tokenIdPlaceholder')"
|
|
input-class="w-full"
|
|
type="password"
|
|
/>
|
|
|
|
<div>
|
|
<MalioInputText
|
|
v-model="form.tokenSecret"
|
|
:label="$t('bookstack.settings.tokenSecret')"
|
|
:placeholder="$t('bookstack.settings.tokenSecretPlaceholder')"
|
|
input-class="w-full"
|
|
type="password"
|
|
/>
|
|
<p v-if="hasToken && !form.tokenId && !form.tokenSecret" class="mt-1 text-xs text-green-600">
|
|
{{ $t('bookstack.settings.tokenConfigured') }}
|
|
</p>
|
|
</div>
|
|
|
|
<div class="flex gap-3">
|
|
<button
|
|
type="submit"
|
|
class="rounded-md bg-primary-500 px-4 py-2 text-sm font-semibold text-white hover:bg-secondary-500 disabled:opacity-50"
|
|
:disabled="isSaving"
|
|
>
|
|
{{ $t('bookstack.settings.save') }}
|
|
</button>
|
|
<button
|
|
type="button"
|
|
class="rounded-md border border-neutral-300 px-4 py-2 text-sm font-semibold text-neutral-700 hover:bg-neutral-50 disabled:opacity-50"
|
|
:disabled="isTesting"
|
|
@click="handleTest"
|
|
>
|
|
{{ $t('bookstack.settings.testConnection') }}
|
|
</button>
|
|
</div>
|
|
|
|
<p v-if="testResult !== null" class="text-sm font-medium" :class="testResult ? 'text-green-600' : 'text-red-600'">
|
|
{{ testResult ? $t('bookstack.settings.testSuccess') : $t('bookstack.settings.testFailed') }}
|
|
</p>
|
|
</form>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { useBookStackService } from '~/services/bookstack'
|
|
|
|
const { getSettings, saveSettings, testConnection } = useBookStackService()
|
|
|
|
const form = reactive({
|
|
url: '',
|
|
tokenId: '',
|
|
tokenSecret: '',
|
|
})
|
|
|
|
const hasToken = ref(false)
|
|
const isSaving = ref(false)
|
|
const isTesting = ref(false)
|
|
const testResult = ref<boolean | null>(null)
|
|
|
|
async function loadSettings() {
|
|
const settings = await getSettings()
|
|
form.url = settings.url ?? ''
|
|
hasToken.value = settings.hasToken
|
|
}
|
|
|
|
async function handleSave() {
|
|
isSaving.value = true
|
|
try {
|
|
const result = await saveSettings({
|
|
url: form.url.trim() || null,
|
|
tokenId: form.tokenId || null,
|
|
tokenSecret: form.tokenSecret || null,
|
|
})
|
|
hasToken.value = result.hasToken
|
|
form.tokenId = ''
|
|
form.tokenSecret = ''
|
|
testResult.value = null
|
|
} finally {
|
|
isSaving.value = false
|
|
}
|
|
}
|
|
|
|
async function handleTest() {
|
|
isTesting.value = true
|
|
testResult.value = null
|
|
try {
|
|
const result = await testConnection()
|
|
testResult.value = result.success
|
|
} catch {
|
|
testResult.value = false
|
|
} finally {
|
|
isTesting.value = false
|
|
}
|
|
}
|
|
|
|
onMounted(() => {
|
|
loadSettings()
|
|
})
|
|
</script>
|