Add admin/image domain separation with host isolation middleware, optional hide-folder public URLs, GitHub release update check, and Lucky/Nginx deployment docs. Switch license to GPL-3.0-only.
30 lines
708 B
TypeScript
30 lines
708 B
TypeScript
import { requireAdminAuth } from '../../utils/access'
|
|
import {
|
|
fetchLatestGitHubRelease,
|
|
isVersionNewer
|
|
} from '../../utils/app-version'
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
await requireAdminAuth(event)
|
|
|
|
const config = useRuntimeConfig(event)
|
|
const currentVersion = String(config.appVersion ?? '')
|
|
const latest = await fetchLatestGitHubRelease()
|
|
|
|
if (!latest) {
|
|
return {
|
|
currentVersion,
|
|
latestVersion: null,
|
|
updateAvailable: false,
|
|
releaseUrl: null
|
|
}
|
|
}
|
|
|
|
return {
|
|
currentVersion,
|
|
latestVersion: latest.latestVersion,
|
|
updateAvailable: isVersionNewer(latest.latestVersion, currentVersion),
|
|
releaseUrl: latest.releaseUrl
|
|
}
|
|
})
|