♻️ Refactor urls with aliased services
This commit is contained in:
		| @@ -64,7 +64,7 @@ const config = useRuntimeConfig() | ||||
| const firstImage = ref<string | null>() | ||||
| const firstVideo = ref<string | null>() | ||||
|  | ||||
| const { data: attachment } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/files/attachments/${route.params.id}/meta`) | ||||
| const { data: attachment } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/uc/attachments/${route.params.id}/meta`) | ||||
|  | ||||
| if (!attachment.value) { | ||||
|   throw createError({ | ||||
| @@ -77,11 +77,11 @@ const title = computed(() => `Attachment from ${attachment.value.account.nick}`) | ||||
|  | ||||
| watch(attachment, (value) => { | ||||
|   if (value.mimetype.split("/")[0] == "image") { | ||||
|     firstImage.value = `${config.public.solarNetworkApi}/cgi/files/attachments/${value.id}` | ||||
|     firstImage.value = `${config.public.solarNetworkApi}/cgi/uc/attachments/${value.id}` | ||||
|   } | ||||
|  | ||||
|   if (value.mimetype.split("/")[0] == "video") { | ||||
|     firstVideo.value = `${config.public.solarNetworkApi}/cgi/files/attachments/${value.id}` | ||||
|     firstVideo.value = `${config.public.solarNetworkApi}/cgi/uc/attachments/${value.id}` | ||||
|   } | ||||
| }, { immediate: true, deep: true }) | ||||
|  | ||||
|   | ||||
| @@ -44,7 +44,7 @@ const loading = ref(false) | ||||
| async function load() { | ||||
|   loading.value = true | ||||
|  | ||||
|   const res = await fetch(`${config.public.solarNetworkApi}/cgi/files/attachments?take=20&offset=${items.value.length}&original=true`) | ||||
|   const res = await fetch(`${config.public.solarNetworkApi}/cgi/uc/attachments?take=20&offset=${items.value.length}&original=true`) | ||||
|   const result = await res.json() | ||||
|  | ||||
|   items.value.push(...result.data) | ||||
|   | ||||
| @@ -12,7 +12,7 @@ | ||||
|  | ||||
|     <v-card v-if="post.body?.thumbnail" class="mb-5"> | ||||
|       <v-img | ||||
|         :src="`${config.public.solarNetworkApi}/cgi/files/attachments/${post.body?.thumbnail}`" | ||||
|         :src="`${config.public.solarNetworkApi}/cgi/uc/attachments/${post.body?.thumbnail}`" | ||||
|         :aspect-ratio="16 / 9" | ||||
|         cover | ||||
|       /> | ||||
| @@ -91,7 +91,7 @@ const slug = computed(() => { | ||||
|  | ||||
| const { t } = useI18n() | ||||
|  | ||||
| const { data: post } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/interactive/posts/${slug.value}`) | ||||
| const { data: post } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/co/posts/${slug.value}`) | ||||
|  | ||||
| if (!post.value) { | ||||
|   throw createError({ | ||||
| @@ -105,14 +105,14 @@ const description = computed(() => post.value.body?.description ?? post.value.bo | ||||
|  | ||||
| watch(attachments, (value) => { | ||||
|   if (post.value.body?.thumbnail) { | ||||
|     firstImage.value = `${config.public.solarNetworkApi}/cgi/files/attachments/${post.value.body?.thumbnail}` | ||||
|     firstImage.value = `${config.public.solarNetworkApi}/cgi/uc/attachments/${post.value.body?.thumbnail}` | ||||
|   } | ||||
|   if (value.length > 0 && value[0].mimetype.split("/")[0] == "image") { | ||||
|     firstImage.value = `${config.public.solarNetworkApi}/cgi/files/attachments/${attachments.value[0].id}` | ||||
|     firstImage.value = `${config.public.solarNetworkApi}/cgi/uc/attachments/${attachments.value[0].id}` | ||||
|   } | ||||
|  | ||||
|   if (value.length > 0 && value[0].mimetype.split("/")[0] == "video") { | ||||
|     firstVideo.value = `${config.public.solarNetworkApi}/cgi/files/attachments/${attachments.value[0].id}` | ||||
|     firstVideo.value = `${config.public.solarNetworkApi}/cgi/uc/attachments/${attachments.value[0].id}` | ||||
|   } | ||||
| }, { immediate: true, deep: true }) | ||||
|  | ||||
|   | ||||
| @@ -38,7 +38,7 @@ const { t } = useI18n() | ||||
| const route = useRoute() | ||||
| const config = useRuntimeConfig() | ||||
|  | ||||
| const { data: account } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/auth/users/${route.params.name}`) | ||||
| const { data: account } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/id/users/${route.params.name}`) | ||||
|  | ||||
| if (account.value == null) { | ||||
|   throw createError({ | ||||
| @@ -47,8 +47,8 @@ if (account.value == null) { | ||||
|   }) | ||||
| } | ||||
|  | ||||
| const urlOfAvatar = computed(() => account.value?.avatar ? `${config.public.solarNetworkApi}/cgi/files/attachments/${account.value.avatar}` : void 0) | ||||
| const urlOfBanner = computed(() => account.value?.banner ? `${config.public.solarNetworkApi}/cgi/files/attachments/${account.value.banner}` : void 0) | ||||
| const urlOfAvatar = computed(() => account.value?.avatar ? `${config.public.solarNetworkApi}/cgi/uc/attachments/${account.value.avatar}` : void 0) | ||||
| const urlOfBanner = computed(() => account.value?.banner ? `${config.public.solarNetworkApi}/cgi/uc/attachments/${account.value.banner}` : void 0) | ||||
|  | ||||
| const externalOpenLink = computed(() => `${config.public.solianUrl}/accounts/view/${route.params.name}`) | ||||
| </script> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user