♻️ Refactor urls with aliased services
This commit is contained in:
		@@ -14,7 +14,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      <div v-if="post.body?.thumbnail" class="mb-5">
 | 
					      <div v-if="post.body?.thumbnail" class="mb-5">
 | 
				
			||||||
        <v-img
 | 
					        <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"
 | 
					          :aspect-ratio="16 / 9"
 | 
				
			||||||
          alt="Post thumbnail"
 | 
					          alt="Post thumbnail"
 | 
				
			||||||
          class="rounded-md"
 | 
					          class="rounded-md"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,7 +33,7 @@ async function loadPost({ done }: any) {
 | 
				
			|||||||
    searchQueries.set("category", props.category)
 | 
					    searchQueries.set("category", props.category)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const res = await fetch(`${config.public.solarNetworkApi}/cgi/interactive/posts?` + searchQueries)
 | 
					  const res = await fetch(`${config.public.solarNetworkApi}/cgi/co/posts?` + searchQueries)
 | 
				
			||||||
  const result = await res.json()
 | 
					  const result = await res.json()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (result.data.length > 0) {
 | 
					  if (result.data.length > 0) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,7 +19,7 @@ async function loadPost({ done }: any) {
 | 
				
			|||||||
    offset: posts.value.length.toString(),
 | 
					    offset: posts.value.length.toString(),
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const res = await fetch(`${config.public.solarNetworkApi}/cgi/interactive/posts/${props.postId}/replies?` + searchQueries)
 | 
					  const res = await fetch(`${config.public.solarNetworkApi}/cgi/co/posts/${props.postId}/replies?` + searchQueries)
 | 
				
			||||||
  const result = await res.json()
 | 
					  const result = await res.json()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (result.data.length > 0) {
 | 
					  if (result.data.length > 0) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,7 +46,7 @@ const nickname = computed(() => {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
const avatar = computed(() => {
 | 
					const avatar = computed(() => {
 | 
				
			||||||
  return id.userinfo?.avatar ? `${config.public.solarNetworkApi}/cgi/files/attachments/${id.userinfo?.avatar}` : void 0
 | 
					  return id.userinfo?.avatar ? `${config.public.solarNetworkApi}/cgi/uc/attachments/${id.userinfo?.avatar}` : void 0
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function signOut() {
 | 
					function signOut() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -126,7 +126,7 @@ async function readTickets({ page, itemsPerPage }: { page?: number; itemsPerPage
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  reverting.sessions = true
 | 
					  reverting.sessions = true
 | 
				
			||||||
  const res = await solarFetch(
 | 
					  const res = await solarFetch(
 | 
				
			||||||
    "/cgi/auth/users/me/tickets?" +
 | 
					    "/cgi/id/users/me/tickets?" +
 | 
				
			||||||
    new URLSearchParams({
 | 
					    new URLSearchParams({
 | 
				
			||||||
      take: pagination.tickets.pageSize.toString(),
 | 
					      take: pagination.tickets.pageSize.toString(),
 | 
				
			||||||
      offset: ((pagination.tickets.page - 1) * pagination.tickets.pageSize).toString(),
 | 
					      offset: ((pagination.tickets.page - 1) * pagination.tickets.pageSize).toString(),
 | 
				
			||||||
@@ -148,7 +148,7 @@ async function readEvents({ page, itemsPerPage }: { page?: number; itemsPerPage?
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  reverting.events = true
 | 
					  reverting.events = true
 | 
				
			||||||
  const res = await solarFetch(
 | 
					  const res = await solarFetch(
 | 
				
			||||||
    "/cgi/auth/users/me/events?" +
 | 
					    "/cgi/id/users/me/events?" +
 | 
				
			||||||
    new URLSearchParams({
 | 
					    new URLSearchParams({
 | 
				
			||||||
      take: pagination.events.pageSize.toString(),
 | 
					      take: pagination.events.pageSize.toString(),
 | 
				
			||||||
      offset: ((pagination.events.page - 1) * pagination.events.pageSize).toString(),
 | 
					      offset: ((pagination.events.page - 1) * pagination.events.pageSize).toString(),
 | 
				
			||||||
@@ -168,7 +168,7 @@ Promise.all([readTickets({}), readEvents({})])
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
async function killTicket(item: any) {
 | 
					async function killTicket(item: any) {
 | 
				
			||||||
  reverting.sessions = true
 | 
					  reverting.sessions = true
 | 
				
			||||||
  const res = await solarFetch(`/cgi/auth/users/me/tickets/${item.id}`, {
 | 
					  const res = await solarFetch(`/cgi/id/users/me/tickets/${item.id}`, {
 | 
				
			||||||
    method: "DELETE",
 | 
					    method: "DELETE",
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
  if (res.status !== 200) {
 | 
					  if (res.status !== 200) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,7 +21,7 @@ const loading = ref(false)
 | 
				
			|||||||
async function load() {
 | 
					async function load() {
 | 
				
			||||||
  loading.value = true
 | 
					  loading.value = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const res = await fetch(`${config.public.solarNetworkApi}/cgi/interactive/posts?take=5&realmId=${config.public.solarRealmId}`)
 | 
					  const res = await fetch(`${config.public.solarNetworkApi}/cgi/co/posts?take=5&realmId=${config.public.solarRealmId}`)
 | 
				
			||||||
  const result = await res.json()
 | 
					  const result = await res.json()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  items.value.push(...result.data)
 | 
					  items.value.push(...result.data)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,7 @@ const emits = defineEmits(["update:metadata"])
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const config = useRuntimeConfig()
 | 
					const config = useRuntimeConfig()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const { data } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/files/attachments?take=${props.attachments.length}&id=${props.attachments.join(",")}`)
 | 
					const { data } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/uc/attachments?take=${props.attachments.length}&id=${props.attachments.join(",")}`)
 | 
				
			||||||
const metadata = computed(() => data.value.data)
 | 
					const metadata = computed(() => data.value.data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
watch(metadata, (value) => {
 | 
					watch(metadata, (value) => {
 | 
				
			||||||
@@ -32,6 +32,6 @@ watch(metadata, (value) => {
 | 
				
			|||||||
}, { deep: true, immediate: true })
 | 
					}, { deep: true, immediate: true })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getAttachmentUrl(id: number) {
 | 
					function getAttachmentUrl(id: number) {
 | 
				
			||||||
  return `${config.public.solarNetworkApi}/cgi/files/attachments/${id}`
 | 
					  return `${config.public.solarNetworkApi}/cgi/uc/attachments/${id}`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -56,6 +56,6 @@ const item = computed(() => props.item)
 | 
				
			|||||||
const showMature = ref(false)
 | 
					const showMature = ref(false)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getAttachmentUrl(id: number) {
 | 
					function getAttachmentUrl(id: number) {
 | 
				
			||||||
  return `${config.public.solarNetworkApi}/cgi/files/attachments/${id}`
 | 
					  return `${config.public.solarNetworkApi}/cgi/uc/attachments/${id}`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,7 +47,7 @@ async function submit() {
 | 
				
			|||||||
  if (!probe.value || !password.value) return
 | 
					  if (!probe.value || !password.value) return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  emits("update:loading", true)
 | 
					  emits("update:loading", true)
 | 
				
			||||||
  const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/auth`, {
 | 
					  const res = await fetch(`${config.public.solarNetworkApi}/cgi/id/auth`, {
 | 
				
			||||||
    method: "POST",
 | 
					    method: "POST",
 | 
				
			||||||
    headers: { "Content-Type": "application/json" },
 | 
					    headers: { "Content-Type": "application/json" },
 | 
				
			||||||
    body: JSON.stringify({ username: probe.value, password: password.value }),
 | 
					    body: JSON.stringify({ username: probe.value, password: password.value }),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,7 +36,7 @@ async function load() {
 | 
				
			|||||||
onMounted(() => load())
 | 
					onMounted(() => load())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function getToken(tk: string) {
 | 
					async function getToken(tk: string) {
 | 
				
			||||||
  const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/auth/token`, {
 | 
					  const res = await fetch(`${config.public.solarNetworkApi}/cgi/id/auth/token`, {
 | 
				
			||||||
    method: "POST",
 | 
					    method: "POST",
 | 
				
			||||||
    headers: { "Content-Type": "application/json" },
 | 
					    headers: { "Content-Type": "application/json" },
 | 
				
			||||||
    body: JSON.stringify({
 | 
					    body: JSON.stringify({
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -58,7 +58,7 @@ const emits = defineEmits(["swap", "update:ticket", "update:loading"])
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
async function submit() {
 | 
					async function submit() {
 | 
				
			||||||
  emits("update:loading", true)
 | 
					  emits("update:loading", true)
 | 
				
			||||||
  const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/auth/mfa`, {
 | 
					  const res = await fetch(`${config.public.solarNetworkApi}/cgi/id/auth/mfa`, {
 | 
				
			||||||
    method: "POST",
 | 
					    method: "POST",
 | 
				
			||||||
    headers: { "Content-Type": "application/json" },
 | 
					    headers: { "Content-Type": "application/json" },
 | 
				
			||||||
    body: JSON.stringify({
 | 
					    body: JSON.stringify({
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,7 +44,7 @@ const emits = defineEmits(["swap", "update:loading", "update:currentFactor"])
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
async function load() {
 | 
					async function load() {
 | 
				
			||||||
  emits("update:loading", true)
 | 
					  emits("update:loading", true)
 | 
				
			||||||
  const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/auth/factors?ticketId=${props.ticket.id}`)
 | 
					  const res = await fetch(`${config.public.solarNetworkApi}/cgi/id/auth/factors?ticketId=${props.ticket.id}`)
 | 
				
			||||||
  if (res.status !== 200) {
 | 
					  if (res.status !== 200) {
 | 
				
			||||||
    error.value = await res.text()
 | 
					    error.value = await res.text()
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
@@ -59,7 +59,7 @@ async function submit() {
 | 
				
			|||||||
  if (!focus.value) return
 | 
					  if (!focus.value) return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  emits("update:loading", true)
 | 
					  emits("update:loading", true)
 | 
				
			||||||
  const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/auth/factors/${focus.value}`, {
 | 
					  const res = await fetch(`${config.public.solarNetworkApi}/cgi/id/auth/factors/${focus.value}`, {
 | 
				
			||||||
    method: "POST",
 | 
					    method: "POST",
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
  if (res.status !== 200 && res.status !== 204) {
 | 
					  if (res.status !== 200 && res.status !== 204) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,7 +14,7 @@ const { t } = useI18n()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const config = useRuntimeConfig()
 | 
					const config = useRuntimeConfig()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const { status, data: post } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/interactive/posts/${props.id}`)
 | 
					const { status, data: post } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/co/posts/${props.id}`)
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<style scoped>
 | 
					<style scoped>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -86,7 +86,7 @@ const panel = ref("confirm")
 | 
				
			|||||||
async function tryAuthorize() {
 | 
					async function tryAuthorize() {
 | 
				
			||||||
  loading.value = true
 | 
					  loading.value = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const res = await solarFetch(`/cgi/auth/auth/o/authorize${window.location.search}`)
 | 
					  const res = await solarFetch(`/cgi/id/auth/o/authorize${window.location.search}`)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (res.status !== 200) {
 | 
					  if (res.status !== 200) {
 | 
				
			||||||
    error.value = await res.text()
 | 
					    error.value = await res.text()
 | 
				
			||||||
@@ -115,7 +115,7 @@ function decline() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
async function approve() {
 | 
					async function approve() {
 | 
				
			||||||
  loading.value = true
 | 
					  loading.value = true
 | 
				
			||||||
  const res = await solarFetch(`/cgi/auth/auth/o/authorize${window.location.search}`, {
 | 
					  const res = await solarFetch(`/cgi/id/auth/o/authorize${window.location.search}`, {
 | 
				
			||||||
    method: "POST",
 | 
					    method: "POST",
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -120,7 +120,7 @@ async function submit() {
 | 
				
			|||||||
  if (!payload.name || !payload.nick || !payload.email || !payload.password) return
 | 
					  if (!payload.name || !payload.nick || !payload.email || !payload.password) return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  loading.value = true
 | 
					  loading.value = true
 | 
				
			||||||
  const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/users`, {
 | 
					  const res = await fetch(`${config.public.solarNetworkApi}/cgi/id/users`, {
 | 
				
			||||||
    method: "POST",
 | 
					    method: "POST",
 | 
				
			||||||
    headers: { "Content-Type": "application/json" },
 | 
					    headers: { "Content-Type": "application/json" },
 | 
				
			||||||
    body: JSON.stringify(payload),
 | 
					    body: JSON.stringify(payload),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -64,7 +64,7 @@ const config = useRuntimeConfig()
 | 
				
			|||||||
const firstImage = ref<string | null>()
 | 
					const firstImage = ref<string | null>()
 | 
				
			||||||
const firstVideo = 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) {
 | 
					if (!attachment.value) {
 | 
				
			||||||
  throw createError({
 | 
					  throw createError({
 | 
				
			||||||
@@ -77,11 +77,11 @@ const title = computed(() => `Attachment from ${attachment.value.account.nick}`)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
watch(attachment, (value) => {
 | 
					watch(attachment, (value) => {
 | 
				
			||||||
  if (value.mimetype.split("/")[0] == "image") {
 | 
					  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") {
 | 
					  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 })
 | 
					}, { immediate: true, deep: true })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,7 +44,7 @@ const loading = ref(false)
 | 
				
			|||||||
async function load() {
 | 
					async function load() {
 | 
				
			||||||
  loading.value = true
 | 
					  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()
 | 
					  const result = await res.json()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  items.value.push(...result.data)
 | 
					  items.value.push(...result.data)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    <v-card v-if="post.body?.thumbnail" class="mb-5">
 | 
					    <v-card v-if="post.body?.thumbnail" class="mb-5">
 | 
				
			||||||
      <v-img
 | 
					      <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"
 | 
					        :aspect-ratio="16 / 9"
 | 
				
			||||||
        cover
 | 
					        cover
 | 
				
			||||||
      />
 | 
					      />
 | 
				
			||||||
@@ -91,7 +91,7 @@ const slug = computed(() => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const { t } = useI18n()
 | 
					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) {
 | 
					if (!post.value) {
 | 
				
			||||||
  throw createError({
 | 
					  throw createError({
 | 
				
			||||||
@@ -105,14 +105,14 @@ const description = computed(() => post.value.body?.description ?? post.value.bo
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
watch(attachments, (value) => {
 | 
					watch(attachments, (value) => {
 | 
				
			||||||
  if (post.value.body?.thumbnail) {
 | 
					  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") {
 | 
					  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") {
 | 
					  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 })
 | 
					}, { immediate: true, deep: true })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,7 +38,7 @@ const { t } = useI18n()
 | 
				
			|||||||
const route = useRoute()
 | 
					const route = useRoute()
 | 
				
			||||||
const config = useRuntimeConfig()
 | 
					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) {
 | 
					if (account.value == null) {
 | 
				
			||||||
  throw createError({
 | 
					  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 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/files/attachments/${account.value.banner}` : 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}`)
 | 
					const externalOpenLink = computed(() => `${config.public.solianUrl}/accounts/view/${route.params.name}`)
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,7 +63,7 @@ async function confirm() {
 | 
				
			|||||||
    return
 | 
					    return
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/users/me/confirm`, {
 | 
					  const res = await fetch(`${config.public.solarNetworkApi}/cgi/id/users/me/confirm`, {
 | 
				
			||||||
    method: "POST",
 | 
					    method: "POST",
 | 
				
			||||||
    headers: { "Content-Type": "application/json" },
 | 
					    headers: { "Content-Type": "application/json" },
 | 
				
			||||||
    body: JSON.stringify({
 | 
					    body: JSON.stringify({
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -84,7 +84,7 @@ async function confirm() {
 | 
				
			|||||||
    return
 | 
					    return
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/users/me/password-reset`, {
 | 
					  const res = await fetch(`${config.public.solarNetworkApi}/cgi/id/users/me/password-reset`, {
 | 
				
			||||||
    method: "PATCH",
 | 
					    method: "PATCH",
 | 
				
			||||||
    headers: { "Content-Type": "application/json" },
 | 
					    headers: { "Content-Type": "application/json" },
 | 
				
			||||||
    body: JSON.stringify({
 | 
					    body: JSON.stringify({
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -60,7 +60,7 @@ const config = useRuntimeConfig()
 | 
				
			|||||||
const firstImage = ref<string | null>()
 | 
					const firstImage = ref<string | null>()
 | 
				
			||||||
const firstVideo = 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) {
 | 
					if (!attachment.value) {
 | 
				
			||||||
  throw createError({
 | 
					  throw createError({
 | 
				
			||||||
@@ -73,11 +73,11 @@ const title = computed(() => `Attachment from ${attachment.value.account.nick}`)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
watch(attachment, (value) => {
 | 
					watch(attachment, (value) => {
 | 
				
			||||||
  if (value.mimetype.split("/")[0] == "image") {
 | 
					  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") {
 | 
					  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 })
 | 
					}, { immediate: true, deep: true })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -40,7 +40,7 @@ const loading = ref(false)
 | 
				
			|||||||
async function load() {
 | 
					async function load() {
 | 
				
			||||||
  loading.value = true
 | 
					  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()
 | 
					  const result = await res.json()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  items.value.push(...result.data)
 | 
					  items.value.push(...result.data)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    <v-card v-if="post.body?.thumbnail" class="mb-5">
 | 
					    <v-card v-if="post.body?.thumbnail" class="mb-5">
 | 
				
			||||||
      <v-img
 | 
					      <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"
 | 
					        :aspect-ratio="16 / 9"
 | 
				
			||||||
        cover
 | 
					        cover
 | 
				
			||||||
      />
 | 
					      />
 | 
				
			||||||
@@ -90,7 +90,7 @@ const slug = computed(() => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const { t } = useI18n()
 | 
					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) {
 | 
					if (!post.value) {
 | 
				
			||||||
  throw createError({
 | 
					  throw createError({
 | 
				
			||||||
@@ -104,14 +104,14 @@ const description = computed(() => post.value.body?.description ?? post.value.bo
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
watch(attachments, (value) => {
 | 
					watch(attachments, (value) => {
 | 
				
			||||||
  if (post.value.body?.thumbnail) {
 | 
					  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") {
 | 
					  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") {
 | 
					  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 })
 | 
					}, { immediate: true, deep: true })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,7 +37,7 @@ const { t } = useI18n()
 | 
				
			|||||||
const route = useRoute()
 | 
					const route = useRoute()
 | 
				
			||||||
const config = useRuntimeConfig()
 | 
					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) {
 | 
					if (account.value == null) {
 | 
				
			||||||
  throw createError({
 | 
					  throw createError({
 | 
				
			||||||
@@ -46,8 +46,8 @@ if (account.value == null) {
 | 
				
			|||||||
  })
 | 
					  })
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const urlOfAvatar = computed(() => account.value?.avatar ? `${config.public.solarNetworkApi}/cgi/files/attachments/${account.value.avatar}` : 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/files/attachments/${account.value.banner}` : 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}`)
 | 
					const externalOpenLink = computed(() => `${config.public.solianUrl}/accounts/view/${route.params.name}`)
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,6 +52,6 @@ const config = useRuntimeConfig()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const auth = useUserinfo()
 | 
					const auth = useUserinfo()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const urlOfAvatar = computed(() => auth.userinfo?.avatar ? `${config.public.solarNetworkApi}/cgi/files/attachments/${auth.userinfo.avatar}` : void 0)
 | 
					const urlOfAvatar = computed(() => auth.userinfo?.avatar ? `${config.public.solarNetworkApi}/cgi/uc/attachments/${auth.userinfo.avatar}` : void 0)
 | 
				
			||||||
const urlOfBanner = computed(() => auth.userinfo?.banner ? `${config.public.solarNetworkApi}/cgi/files/attachments/${auth.userinfo.banner}` : void 0)
 | 
					const urlOfBanner = computed(() => auth.userinfo?.banner ? `${config.public.solarNetworkApi}/cgi/uc/attachments/${auth.userinfo.banner}` : void 0)
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
export default defineSitemapEventHandler(async () => {
 | 
					export default defineSitemapEventHandler(async () => {
 | 
				
			||||||
  const config = useRuntimeConfig();
 | 
					  const config = useRuntimeConfig();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const res = await fetch(`${config.public.solarNetworkApi}/cgi/interactive/posts/minimal?take=500`)
 | 
					  const res = await fetch(`${config.public.solarNetworkApi}/cgi/co/posts/minimal?take=500`)
 | 
				
			||||||
  const result = await res.json()
 | 
					  const result = await res.json()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return result.data.map((item: any) => asSitemapUrl({
 | 
					  return result.data.map((item: any) => asSitemapUrl({
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,13 +19,13 @@ export default defineEventHandler((event) => {
 | 
				
			|||||||
    "subject_types_supported": [
 | 
					    "subject_types_supported": [
 | 
				
			||||||
      "public",
 | 
					      "public",
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
    "token_endpoint": `${config.public.solarNetworkApi}/cgi/auth/auth/token`,
 | 
					    "token_endpoint": `${config.public.solarNetworkApi}/cgi/id/auth/token`,
 | 
				
			||||||
    "token_endpoint_auth_methods_supported": [
 | 
					    "token_endpoint_auth_methods_supported": [
 | 
				
			||||||
      "client_secret_post",
 | 
					      "client_secret_post",
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
    "token_endpoint_auth_signing_alg_values_supported": [
 | 
					    "token_endpoint_auth_signing_alg_values_supported": [
 | 
				
			||||||
      "HS512",
 | 
					      "HS512",
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
    "userinfo_endpoint": `${config.public.solarNetworkApi}/cgi/auth/users/me`,
 | 
					    "userinfo_endpoint": `${config.public.solarNetworkApi}/cgi/id/users/me`,
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,7 +39,7 @@ export default defineEventHandler(async (event) => {
 | 
				
			|||||||
    searchQuery.set("author", queries.author)
 | 
					    searchQuery.set("author", queries.author)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const res = await fetch(`${config.public.solarNetworkApi}/cgi/interactive/posts?` + searchQuery)
 | 
					  const res = await fetch(`${config.public.solarNetworkApi}/cgi/co/posts?` + searchQuery)
 | 
				
			||||||
  const posts: any[] = (await res.json())["data"]
 | 
					  const posts: any[] = (await res.json())["data"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  for (const post of posts) {
 | 
					  for (const post of posts) {
 | 
				
			||||||
@@ -64,7 +64,7 @@ export default defineEventHandler(async (event) => {
 | 
				
			|||||||
          link: `https://solsynth.dev/@${post.author.name}`,
 | 
					          link: `https://solsynth.dev/@${post.author.name}`,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
      image: post.body.thumbnail ? `${config.public.solarNetworkApi}/cgi/files/attachments/${post.body.thumbnail}` : void 0,
 | 
					      image: post.body.thumbnail ? `${config.public.solarNetworkApi}/cgi/uc/attachments/${post.body.thumbnail}` : void 0,
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,7 +44,7 @@ export const useUserinfo = defineStore("userinfo", () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const config = useRuntimeConfig()
 | 
					    const config = useRuntimeConfig()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/auth/token`, {
 | 
					    const res = await fetch(`${config.public.solarNetworkApi}/cgi/id/auth/token`, {
 | 
				
			||||||
      method: "POST",
 | 
					      method: "POST",
 | 
				
			||||||
      headers: { "Content-Type": "application/json" },
 | 
					      headers: { "Content-Type": "application/json" },
 | 
				
			||||||
      body: JSON.stringify({
 | 
					      body: JSON.stringify({
 | 
				
			||||||
@@ -77,7 +77,7 @@ export const useUserinfo = defineStore("userinfo", () => {
 | 
				
			|||||||
      isReady.value = true
 | 
					      isReady.value = true
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const res = await solarFetch("/cgi/auth/users/me")
 | 
					    const res = await solarFetch("/cgi/id/users/me")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (res.status !== 200) {
 | 
					    if (res.status !== 200) {
 | 
				
			||||||
      fetchCompleter.complete(true)
 | 
					      fetchCompleter.complete(true)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user