feat: lots more improvements
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { LocationUri } from '@KTXM/MailManager/models/location'
|
||||
import type { ServiceObject } from '@KTXM/MailManager/models/service'
|
||||
import { ServiceObject } from '@KTXM/MailManager/models/service'
|
||||
import type { ServiceLocationUri, ServiceLocation } from '@KTXM/MailManager/types/service'
|
||||
import type { ProviderProtocolPanelProps, ProviderProtocolPanelEmits } from '@KTXM/MailManager/types/integration'
|
||||
import { JmapServiceObject } from '@/models/JmapServiceObject'
|
||||
|
||||
const props = defineProps<ProviderProtocolPanelProps>()
|
||||
const emit = defineEmits<ProviderProtocolPanelEmits>()
|
||||
@@ -75,8 +74,25 @@ watch(
|
||||
return
|
||||
}
|
||||
|
||||
const nextService = createServiceObject(props.service)
|
||||
nextService.location = location ? LocationUri.fromJson(location) : null
|
||||
const nextService = props.service ?? new ServiceObject()
|
||||
|
||||
if (location === null) {
|
||||
nextService.location = null
|
||||
emit('update:service', nextService)
|
||||
return
|
||||
}
|
||||
|
||||
if (nextService.location instanceof LocationUri) {
|
||||
nextService.location.scheme = location.scheme
|
||||
nextService.location.host = location.host
|
||||
nextService.location.port = location.port
|
||||
nextService.location.path = location.path
|
||||
nextService.location.verifyPeer = location.verifyPeer ?? true
|
||||
nextService.location.verifyHost = location.verifyHost ?? true
|
||||
} else {
|
||||
nextService.location = LocationUri.fromJson(location)
|
||||
}
|
||||
|
||||
emit('update:service', nextService)
|
||||
},
|
||||
{ immediate: true }
|
||||
@@ -94,16 +110,6 @@ function syncFromLocation(location: ServiceLocation | null) {
|
||||
servicePath.value = uriLocation?.path ?? ''
|
||||
}
|
||||
|
||||
function createServiceObject(service?: ServiceObject): JmapServiceObject {
|
||||
const nextService = new JmapServiceObject()
|
||||
|
||||
if (service) {
|
||||
nextService.fromJson(service.toJson())
|
||||
}
|
||||
|
||||
return nextService
|
||||
}
|
||||
|
||||
function sameLocation(a: ServiceLocation | null, b: ServiceLocation | null): boolean {
|
||||
if (a === null || b === null) {
|
||||
return a === b
|
||||
@@ -290,19 +296,9 @@ function getUriVerifyHost(location?: ServiceLocation | null): boolean {
|
||||
/>
|
||||
|
||||
<!-- Info Alert -->
|
||||
<v-alert
|
||||
type="info"
|
||||
variant="tonal"
|
||||
density="compact"
|
||||
class="mt-4"
|
||||
>
|
||||
<template #prepend>
|
||||
<v-icon>mdi-information</v-icon>
|
||||
</template>
|
||||
<div class="text-caption">
|
||||
<v-alert type="info" variant="tonal">
|
||||
JMAP is a modern protocol for mail access. Most JMAP servers use
|
||||
<code>/.well-known/jmap</code> for autodiscovery.
|
||||
</div>
|
||||
</v-alert>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user