🚨 Clean up eslint issues
This commit is contained in:
@@ -58,7 +58,6 @@ const props = defineProps<{
|
||||
maxHeight?: number
|
||||
}>()
|
||||
|
||||
const apiBase = useSolarNetworkUrl()
|
||||
|
||||
const isAllImages = computed(
|
||||
() =>
|
||||
@@ -194,8 +193,4 @@ function calculateAspectRatio(): number {
|
||||
? (mostFrequent[mid - 1]! + mostFrequent[mid]!) / 2
|
||||
: mostFrequent[mid]!
|
||||
}
|
||||
|
||||
function getAttachmentUrl(attachment: SnAttachment): string {
|
||||
return `${apiBase}/drive/files/${attachment.id}`
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -4,49 +4,23 @@ import { useSiteConfig } from "#site-config/app/composables"
|
||||
import { computed, defineComponent, h, resolveComponent } from "vue"
|
||||
|
||||
const props = defineProps({
|
||||
colorMode: { type: String, required: false },
|
||||
colorMode: { type: String, required: false, default: "light" },
|
||||
title: { type: String, required: false, default: "title" },
|
||||
description: { type: String, required: false },
|
||||
icon: { type: [String, Boolean], required: false },
|
||||
siteName: { type: String, required: false },
|
||||
siteLogo: { type: String, required: false },
|
||||
description: { type: String, required: false, default: null },
|
||||
icon: { type: [String, Boolean], required: false, default: null },
|
||||
siteName: { type: String, required: false, default: null },
|
||||
siteLogo: { type: String, required: false, default: null },
|
||||
theme: { type: String, required: false, default: "#3f51b5" },
|
||||
backgroundImage: { type: String, required: false },
|
||||
avatarUrl: { type: String, required: false }
|
||||
backgroundImage: { type: String, required: false, default: null },
|
||||
avatarUrl: { type: String, required: false, default: null }
|
||||
})
|
||||
const HexRegex = /^#(?:[0-9a-f]{3}){1,2}$/i
|
||||
const runtimeConfig = useOgImageRuntimeConfig()
|
||||
const colorMode = computed(() => {
|
||||
return props.colorMode || runtimeConfig.colorPreference || "light"
|
||||
})
|
||||
|
||||
const themeHex = computed(() => {
|
||||
if (HexRegex.test(props.theme)) return props.theme
|
||||
if (HexRegex.test(`#${props.theme}`)) return `#${props.theme}`
|
||||
if (props.theme.startsWith("rgb")) {
|
||||
const rgb = props.theme
|
||||
.replace("rgb(", "")
|
||||
.replace("rgba(", "")
|
||||
.replace(")", "")
|
||||
.split(",")
|
||||
.map((v) => Number.parseInt(v.trim(), 10))
|
||||
const hex = rgb
|
||||
.map((v) => {
|
||||
const hex2 = v.toString(16)
|
||||
return hex2.length === 1 ? `0${hex2}` : hex2
|
||||
})
|
||||
.join("")
|
||||
return `#${hex}`
|
||||
}
|
||||
return "#FFFFFF"
|
||||
})
|
||||
const themeRgb = computed(() => {
|
||||
return themeHex.value
|
||||
.replace("#", "")
|
||||
.match(/.{1,2}/g)
|
||||
?.map((v) => Number.parseInt(v, 16))
|
||||
.join(", ")
|
||||
})
|
||||
|
||||
|
||||
const textShadow = computed(() => {
|
||||
return '2px 2px 8px rgba(0,0,0,0.8)'
|
||||
})
|
||||
@@ -54,9 +28,7 @@ const siteConfig = useSiteConfig()
|
||||
const siteName = computed(() => {
|
||||
return props.siteName || siteConfig.name
|
||||
})
|
||||
const siteLogo = computed(() => {
|
||||
return props.siteLogo || siteConfig.logo
|
||||
})
|
||||
|
||||
const IconComponent = runtimeConfig.hasNuxtIcon
|
||||
? resolveComponent("Icon")
|
||||
: defineComponent({
|
||||
@@ -67,7 +39,7 @@ const IconComponent = runtimeConfig.hasNuxtIcon
|
||||
if (
|
||||
typeof props.icon === "string" &&
|
||||
!runtimeConfig.hasNuxtIcon &&
|
||||
process.dev
|
||||
import.meta.dev
|
||||
) {
|
||||
console.warn(
|
||||
"Please install `@nuxt/icon` to use icons with the fallback OG Image component."
|
||||
|
||||
@@ -3,14 +3,14 @@ import { useOgImageRuntimeConfig } from "#og-image/app/utils"
|
||||
import { useSiteConfig } from "#site-config/app/composables"
|
||||
import { computed, defineComponent, h, resolveComponent } from "vue"
|
||||
const props = defineProps({
|
||||
colorMode: { type: String, required: false },
|
||||
colorMode: { type: String, required: false, default: "light" },
|
||||
title: { type: String, required: false, default: "title" },
|
||||
description: { type: String, required: false },
|
||||
icon: { type: [String, Boolean], required: false },
|
||||
siteName: { type: String, required: false },
|
||||
siteLogo: { type: String, required: false },
|
||||
description: { type: String, required: false, default: null },
|
||||
icon: { type: [String, Boolean], required: false, default: null },
|
||||
siteName: { type: String, required: false, default: null },
|
||||
siteLogo: { type: String, required: false, default: null },
|
||||
theme: { type: String, required: false, default: "#3f51b5" },
|
||||
backgroundImage: { type: String, required: false }
|
||||
backgroundImage: { type: String, required: false, default: null }
|
||||
})
|
||||
const HexRegex = /^#(?:[0-9a-f]{3}){1,2}$/i
|
||||
const runtimeConfig = useOgImageRuntimeConfig()
|
||||
@@ -62,7 +62,7 @@ const IconComponent = runtimeConfig.hasNuxtIcon
|
||||
if (
|
||||
typeof props.icon === "string" &&
|
||||
!runtimeConfig.hasNuxtIcon &&
|
||||
process.dev
|
||||
import.meta.dev
|
||||
) {
|
||||
console.warn(
|
||||
"Please install `@nuxt/icon` to use icons with the fallback OG Image component."
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import * as tus from 'tus-js-client'
|
||||
import { useSolarNetwork } from '~/composables/useSolarNetwork'
|
||||
|
||||
// Interface for uploaded files in the editor
|
||||
@@ -35,7 +34,6 @@ const emits = defineEmits(['posted'])
|
||||
const publisher = ref<string | undefined>()
|
||||
const content = ref('')
|
||||
|
||||
const selectedFiles = ref<File[]>([])
|
||||
const fileList = ref<UploadedFile[]>([])
|
||||
|
||||
const submitting = ref(false)
|
||||
@@ -61,54 +59,4 @@ async function submit() {
|
||||
fileList.value = []
|
||||
emits('posted')
|
||||
}
|
||||
|
||||
function handleFileSelect() {
|
||||
selectedFiles.value.forEach(file => {
|
||||
uploadFile(file)
|
||||
})
|
||||
selectedFiles.value = []
|
||||
}
|
||||
|
||||
function uploadFile(file: File) {
|
||||
const upload = new tus.Upload(file, {
|
||||
endpoint: '/cgi/drive/tus',
|
||||
retryDelays: [0, 3000, 5000, 10000, 20000],
|
||||
removeFingerprintOnSuccess: false,
|
||||
uploadDataDuringCreation: false,
|
||||
metadata: {
|
||||
filename: file.name,
|
||||
'content-type': file.type ?? 'application/octet-stream',
|
||||
},
|
||||
headers: {
|
||||
'X-DirectUpload': 'true',
|
||||
},
|
||||
onShouldRetry: () => false,
|
||||
onError: function (error) {
|
||||
console.error('[DRIVE] Upload failed:', error)
|
||||
},
|
||||
onProgress: function (_bytesUploaded, _bytesTotal) {
|
||||
// Could show progress
|
||||
},
|
||||
onSuccess: function (payload) {
|
||||
const rawInfo = payload.lastResponse.getHeader('x-fileinfo')
|
||||
const jsonInfo = JSON.parse(rawInfo as string)
|
||||
console.log('[DRIVE] Upload successful: ', jsonInfo)
|
||||
fileList.value.push({
|
||||
name: file.name,
|
||||
url: `/cgi/drive/files/${jsonInfo.id}`,
|
||||
type: jsonInfo.mime_type,
|
||||
})
|
||||
},
|
||||
onBeforeRequest: function (req) {
|
||||
const xhr = req.getUnderlyingObject()
|
||||
xhr.withCredentials = true
|
||||
},
|
||||
})
|
||||
upload.findPreviousUploads().then(function (previousUploads) {
|
||||
if (previousUploads.length > 0 && previousUploads[0]) {
|
||||
upload.resumeFromPreviousUpload(previousUploads[0])
|
||||
}
|
||||
upload.start()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -62,7 +62,7 @@ const router = useRouter()
|
||||
|
||||
const props = defineProps<{
|
||||
params: RepliesListParams
|
||||
hideQuickReply: boolean
|
||||
hideQuickReply?: boolean
|
||||
}>()
|
||||
|
||||
defineEmits<{
|
||||
|
||||
Reference in New Issue
Block a user