Skip to content

Commit

Permalink
refactor: rename OwnCloudInstance to OwnCloudServer
Browse files Browse the repository at this point in the history
  • Loading branch information
kulmann committed Apr 25, 2023
1 parent 55c6931 commit 18d852f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/web-app-webfinger/src/discovery/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface OwnCloudInstance {
export interface OwnCloudServer {
rel: string
href: string
titles?: any
titles?: Record<string, string>
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { OwnCloudInstance } from 'web-app-webfinger/src/discovery/types'
import { OwnCloudServer } from 'web-app-webfinger/src/discovery/types'
import { ClientService } from 'web-pkg'
import { urlJoin } from 'web-client/src/utils'

interface OwnCloudInstancesResponse {
subject: string
links: OwnCloudInstance[]
links: OwnCloudServer[]
}

const OWNCLOUD_REL = 'http://webfinger.owncloud/rel/server-instance'
Expand All @@ -18,7 +18,7 @@ export class WebfingerDiscovery {
this.clientService = clientService
}

public async discoverOwnCloudInstances(): Promise<OwnCloudInstance[]> {
public async discoverOwnCloudServers(): Promise<OwnCloudServer[]> {
const client = this.clientService.httpAuthenticated
const url =
urlJoin(this.serverUrl, '.well-known', 'webfinger') + `?resource=${encodeURI(this.serverUrl)}`
Expand Down
16 changes: 8 additions & 8 deletions packages/web-app-webfinger/src/views/Resolve.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<script lang="ts">
import { computed, defineComponent, ref, unref, watch } from 'vue'
import { useClientService, useConfigurationManager, useLoadingService, useRouteMeta } from 'web-pkg'
import { OwnCloudInstance, WebfingerDiscovery } from 'web-app-webfinger/src/discovery'
import { OwnCloudServer, WebfingerDiscovery } from 'web-app-webfinger/src/discovery'
import { useGettext } from 'vue3-gettext'
export default defineComponent({
Expand All @@ -40,14 +40,14 @@ export default defineComponent({
return $gettext(unref(title))
})
const ownCloudInstances = ref<OwnCloudInstance[]>([])
const ownCloudServers = ref<OwnCloudServer[]>([])
const hasError = ref(false)
const webfingerDiscovery = new WebfingerDiscovery(configurationManager.serverUrl, clientService)
loadingService.addTask(async () => {
try {
const instances = await webfingerDiscovery.discoverOwnCloudInstances()
ownCloudInstances.value = instances
if (instances.length === 0) {
const servers = await webfingerDiscovery.discoverOwnCloudServers()
ownCloudServers.value = servers
if (servers.length === 0) {
hasError.value = true
}
} catch (e) {
Expand All @@ -56,17 +56,17 @@ export default defineComponent({
}
})
watch(ownCloudInstances, (instances) => {
watch(ownCloudServers, (instances) => {
if (instances.length === 0) {
return
}
// we can't deal with multi-instance results. just pick the first one for now.
// window.location.href = ownCloudInstances.value[0].href
window.location.href = ownCloudServers.value[0].href
})
return {
pageTitle,
ownCloudInstances,
ownCloudInstances: ownCloudServers,
hasError
}
}
Expand Down

0 comments on commit 18d852f

Please sign in to comment.