Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

fix(self-hosted): resolve shared imports without symlinks

Timothy Yin4f7f409fff45
diff --git a/apps/self-hosted/nuxt.config.ts b/apps/self-hosted/nuxt.config.ts
index ae90345a..0df25d14 100644
--- a/apps/self-hosted/nuxt.config.ts
+++ b/apps/self-hosted/nuxt.config.ts
@@ -1,7 +1,7 @@
import { galleryFontFamilies } from '../../packages/gallery/fonts'
import { SELF_HOSTED_CAPABILITIES } from '../../packages/contracts/src/entry'
import pkg from '../../package.json'
-import type { AnalyticsConfig } from './shared/types/config'
+import type { AnalyticsConfig } from '../../packages/gallery/shared/types/config'
import { dayjsLocales } from '../../packages/gallery/i18n/i18n.options'
// https://nuxt.com/docs/api/configuration/nuxt-config
diff --git a/apps/self-hosted/server/api/albums/[albumId]/index.put.ts b/apps/self-hosted/server/api/albums/[albumId]/index.put.ts
index 39de4841..eb33d558 100644
--- a/apps/self-hosted/server/api/albums/[albumId]/index.put.ts
+++ b/apps/self-hosted/server/api/albums/[albumId]/index.put.ts
@@ -4,7 +4,7 @@ import { z } from 'zod'
import {
ALBUM_PASSWORD_MAX_LENGTH,
ALBUM_PASSWORD_MIN_LENGTH,
-} from '~~/shared/utils/album'
+} from '#shared/utils/album'
import {
useAlbumWriter,
mutationResponse,
diff --git a/apps/self-hosted/server/api/albums/[albumId]/photos/index.post.ts b/apps/self-hosted/server/api/albums/[albumId]/photos/index.post.ts
index e9789198..eedd612c 100644
--- a/apps/self-hosted/server/api/albums/[albumId]/photos/index.post.ts
+++ b/apps/self-hosted/server/api/albums/[albumId]/photos/index.post.ts
@@ -5,7 +5,7 @@ import {
readValidatedBody,
} from 'h3'
import { z } from 'zod'
-import { MAX_ALBUM_PHOTOS_PER_REQUEST } from '../../../../../shared/utils/album'
+import { MAX_ALBUM_PHOTOS_PER_REQUEST } from '#shared/utils/album'
import { addExistingPhotosToAlbum } from '../../../../utils/album-photos-add'
import { useDB } from '../../../../utils/db'
import { requireAdminSession } from '../../../../utils/require-admin.ts'
diff --git a/apps/self-hosted/server/api/albums/[albumId]/unlock.post.ts b/apps/self-hosted/server/api/albums/[albumId]/unlock.post.ts
index 1fa74eb4..983b7ef6 100644
--- a/apps/self-hosted/server/api/albums/[albumId]/unlock.post.ts
+++ b/apps/self-hosted/server/api/albums/[albumId]/unlock.post.ts
@@ -2,7 +2,7 @@ import { and as siteAnd, eq as siteEq } from 'drizzle-orm'
import { DEFAULT_SITE } from '@chronoframe/core'
import { eq } from 'drizzle-orm'
import { z } from 'zod'
-import { ALBUM_PASSWORD_MAX_LENGTH } from '~~/shared/utils/album'
+import { ALBUM_PASSWORD_MAX_LENGTH } from '#shared/utils/album'
import {
grantAlbumAccess,
verifyAlbumPassword,
diff --git a/apps/self-hosted/server/api/albums/index.post.ts b/apps/self-hosted/server/api/albums/index.post.ts
index b3272065..2d4d2cce 100644
--- a/apps/self-hosted/server/api/albums/index.post.ts
+++ b/apps/self-hosted/server/api/albums/index.post.ts
@@ -4,7 +4,7 @@ import z from 'zod'
import {
ALBUM_PASSWORD_MAX_LENGTH,
ALBUM_PASSWORD_MIN_LENGTH,
-} from '~~/shared/utils/album'
+} from '#shared/utils/album'
import { useAlbumWriter, mutationResponse } from '../../utils/resource-writer'
export default eventHandler(async (event) => {
diff --git a/apps/self-hosted/server/api/photos/[photoId]/index.put.ts b/apps/self-hosted/server/api/photos/[photoId]/index.put.ts
index d17eec15..fe037bba 100644
--- a/apps/self-hosted/server/api/photos/[photoId]/index.put.ts
+++ b/apps/self-hosted/server/api/photos/[photoId]/index.put.ts
@@ -1,5 +1,5 @@
import { z } from 'zod'
-import { hasValidCoordinates } from '../../../../shared/utils/location'
+import { hasValidCoordinates } from '#shared/utils/location'
import {
usePhotoWriter,
mutationResponse,
diff --git a/apps/self-hosted/server/api/photos/chunks/[id].ts b/apps/self-hosted/server/api/photos/chunks/[id].ts
index 80501ac3..913a3792 100644
--- a/apps/self-hosted/server/api/photos/chunks/[id].ts
+++ b/apps/self-hosted/server/api/photos/chunks/[id].ts
@@ -1,7 +1,7 @@
import { completeLocalUpload } from '@chronoframe/core'
import { mutationResponse } from '../../../utils/resource-writer'
import { open, stat, rm } from 'node:fs/promises'
-import { UPLOAD_CHUNK_SIZE } from '../../../../shared/utils/upload'
+import { UPLOAD_CHUNK_SIZE } from '#shared/utils/upload'
import { logUpload } from '../../../utils/upload-log'
import {
chunkUploads,
diff --git a/apps/self-hosted/server/api/system/settings/avatar.post.ts b/apps/self-hosted/server/api/system/settings/avatar.post.ts
index a1b675a3..5df0e282 100644
--- a/apps/self-hosted/server/api/system/settings/avatar.post.ts
+++ b/apps/self-hosted/server/api/system/settings/avatar.post.ts
@@ -6,7 +6,7 @@ import { storeAvatar } from '~~/server/utils/avatar-store'
import {
AVATAR_ALLOWED_MIME_TYPES,
AVATAR_MAX_INPUT_BYTES,
-} from '~~/shared/utils/avatar'
+} from '#shared/utils/avatar'
/**
* POST /api/system/settings/avatar
diff --git a/apps/self-hosted/server/api/system/settings/fields.get.ts b/apps/self-hosted/server/api/system/settings/fields.get.ts
index 8641f524..20bcad68 100644
--- a/apps/self-hosted/server/api/system/settings/fields.get.ts
+++ b/apps/self-hosted/server/api/system/settings/fields.get.ts
@@ -5,7 +5,7 @@ import {
getHiddenSettingKeys,
} from '~~/server/services/settings/contants'
import { getSettingUIConfig } from '~~/server/services/settings/ui-config'
-import type { SettingsFieldsResponse } from '~~/shared/types/settings'
+import type { SettingsFieldsResponse } from '#shared/types/settings'
/**
* GET /api/system/settings/fields?namespace=app
diff --git a/apps/self-hosted/server/api/system/tours.ts b/apps/self-hosted/server/api/system/tours.ts
index b9a99c92..9310cea2 100644
--- a/apps/self-hosted/server/api/system/tours.ts
+++ b/apps/self-hosted/server/api/system/tours.ts
@@ -1,5 +1,5 @@
import { z } from 'zod'
-import { tourIds } from '~~/shared/types/tours'
+import { tourIds } from '#shared/types/tours'
import { settingsManager } from '~~/server/services/settings/settingsManager'
export default eventHandler(async (event) => {
const session = await requireUserSession(event)
diff --git a/apps/self-hosted/server/api/wizard/schema.get.ts b/apps/self-hosted/server/api/wizard/schema.get.ts
index 69651c24..ab6e6a9d 100644
--- a/apps/self-hosted/server/api/wizard/schema.get.ts
+++ b/apps/self-hosted/server/api/wizard/schema.get.ts
@@ -4,7 +4,7 @@ import { settingsManager } from '~~/server/services/settings/settingsManager'
import { getHiddenSettingKeys } from '~~/server/services/settings/contants'
import { getSettingUIConfig } from '~~/server/services/settings/ui-config'
import { isWizardRenderableField } from '~~/server/services/settings/wizard-fields'
-import type { FieldDescriptor } from '~~/shared/types/settings'
+import type { FieldDescriptor } from '#shared/types/settings'
export default defineWizardHandler(async (event) => {
const query = await getValidatedQuery(
diff --git a/apps/self-hosted/server/api/wizard/storage.post.ts b/apps/self-hosted/server/api/wizard/storage.post.ts
index b5f24887..ac9324bd 100644
--- a/apps/self-hosted/server/api/wizard/storage.post.ts
+++ b/apps/self-hosted/server/api/wizard/storage.post.ts
@@ -1,7 +1,7 @@
import { defineWizardHandler } from '../../utils/wizard-handler'
import { z } from 'zod'
import { settingsManager } from '~~/server/services/settings/settingsManager'
-import { storageConfigSchema } from '~~/shared/types/storage'
+import { storageConfigSchema } from '#shared/types/storage'
export default defineWizardHandler(async (event) => {
const body = await readValidatedBody(
diff --git a/apps/self-hosted/server/api/wizard/submit.post.ts b/apps/self-hosted/server/api/wizard/submit.post.ts
index e583af4d..363a36bb 100644
--- a/apps/self-hosted/server/api/wizard/submit.post.ts
+++ b/apps/self-hosted/server/api/wizard/submit.post.ts
@@ -2,7 +2,7 @@ import { toUserSummary } from '~~/server/utils/dto'
import { defineWizardHandler } from '../../utils/wizard-handler'
import { z } from 'zod'
import { settingsManager } from '~~/server/services/settings/settingsManager'
-import { storageConfigSchema } from '~~/shared/types/storage'
+import { storageConfigSchema } from '#shared/types/storage'
import { useDB, tables, eq } from '~~/server/utils/db'
export default defineWizardHandler(async (event) => {
diff --git a/apps/self-hosted/server/plugins/2.settings-manager.ts b/apps/self-hosted/server/plugins/2.settings-manager.ts
index 840211b1..4617cae7 100644
--- a/apps/self-hosted/server/plugins/2.settings-manager.ts
+++ b/apps/self-hosted/server/plugins/2.settings-manager.ts
@@ -1,7 +1,7 @@
import { and as siteAnd, eq as siteEq } from 'drizzle-orm'
import { DEFAULT_SITE } from '@chronoframe/core'
import { createSettingsRuntimeEffects } from '../runtime/settings-effects'
-import type { SettingValue } from '~~/shared/types/settings'
+import type { SettingValue } from '#shared/types/settings'
import { DEFAULT_SETTINGS } from '../services/settings/contants'
import type { SettingNamespace } from '../services/settings/contants'
import { settingsManager } from '../services/settings/settingsManager'
diff --git a/apps/self-hosted/server/plugins/4.pipeline-queue.ts b/apps/self-hosted/server/plugins/4.pipeline-queue.ts
index 28741fa8..93c12a4a 100644
--- a/apps/self-hosted/server/plugins/4.pipeline-queue.ts
+++ b/apps/self-hosted/server/plugins/4.pipeline-queue.ts
@@ -3,7 +3,7 @@ import { closeDB } from '../utils/db'
import type {} from '../types/worker'
import { WorkerPool } from '../services/pipeline-queue'
import { settingsManager } from '../services/settings/settingsManager'
-import { DEFAULT_QUEUE_WORKER_COUNT } from '~~/shared/utils/queue-config'
+import { DEFAULT_QUEUE_WORKER_COUNT } from '#shared/utils/queue-config'
export default defineNitroPlugin(async (nitroApp) => {
const _logger = logger.dynamic('queue')
diff --git a/apps/self-hosted/server/services/location/geocoding.ts b/apps/self-hosted/server/services/location/geocoding.ts
index 7997a569..691cda78 100644
--- a/apps/self-hosted/server/services/location/geocoding.ts
+++ b/apps/self-hosted/server/services/location/geocoding.ts
@@ -2,7 +2,7 @@ import { createGeocodingServices } from '@chronoframe/geocoding'
import type { GeocodingProvider, LocationInfo } from '@chronoframe/geocoding'
export type { GeocodingProvider, LocationInfo } from '@chronoframe/geocoding'
import { waitForGeocodingSlot } from './rate-limit'
-import { hasValidCoordinates } from '../../../shared/utils/location'
+import { hasValidCoordinates } from '#shared/utils/location'
import { withRetry, RetryPresets } from '../../utils/retry'
import { settingsManager } from '../settings/settingsManager'
import { logger } from '../../utils/logger'
diff --git a/apps/self-hosted/server/services/pipeline-queue/manager.ts b/apps/self-hosted/server/services/pipeline-queue/manager.ts
index a9c6713e..1f073685 100644
--- a/apps/self-hosted/server/services/pipeline-queue/manager.ts
+++ b/apps/self-hosted/server/services/pipeline-queue/manager.ts
@@ -39,7 +39,7 @@ import {
extractLocationFromGPS,
parseGPSCoordinates,
} from '../location/geocoding'
-import { hasValidCoordinates } from '../../../shared/utils/location'
+import { hasValidCoordinates } from '#shared/utils/location'
import {
enqueueLocationMigration,
enqueueLocationMigrationRequest,
diff --git a/apps/self-hosted/server/services/pipeline-queue/worker-pool.ts b/apps/self-hosted/server/services/pipeline-queue/worker-pool.ts
index 4c5db006..d1744423 100644
--- a/apps/self-hosted/server/services/pipeline-queue/worker-pool.ts
+++ b/apps/self-hosted/server/services/pipeline-queue/worker-pool.ts
@@ -4,7 +4,7 @@ import { QueueManager } from './manager'
import {
DEFAULT_QUEUE_WORKER_COUNT,
validateQueueWorkerCount,
-} from '~~/shared/utils/queue-config'
+} from '#shared/utils/queue-config'
export interface WorkerPoolConfig {
/** 工作器数量 */
diff --git a/apps/self-hosted/server/services/settings/contants.ts b/apps/self-hosted/server/services/settings/contants.ts
index 40b12547..4dcc7f29 100644
--- a/apps/self-hosted/server/services/settings/contants.ts
+++ b/apps/self-hosted/server/services/settings/contants.ts
@@ -1,6 +1,6 @@
import { PUBLIC_GALLERY_DEFAULTS } from '@chronoframe/contracts/gallery-settings'
-import { tourIds } from '~~/shared/types/tours'
-import type { SettingConfig } from '~~/shared/types/settings'
+import { tourIds } from '#shared/types/tours'
+import type { SettingConfig } from '#shared/types/settings'
import i18nOptions from '@chronoframe/gallery/i18n/i18n.options'
// 存储提供商的枚举值
diff --git a/apps/self-hosted/server/services/settings/settingsManager.ts b/apps/self-hosted/server/services/settings/settingsManager.ts
index 694a1609..f7f928d3 100644
--- a/apps/self-hosted/server/services/settings/settingsManager.ts
+++ b/apps/self-hosted/server/services/settings/settingsManager.ts
@@ -8,7 +8,7 @@ import type {
SettingConfig,
SettingType,
SettingValue,
-} from '~~/shared/types/settings'
+} from '#shared/types/settings'
import type { SettingKey, SettingNamespace } from './contants'
import { validateSettingWrite, createStorageResolver } from '@chronoframe/core'
diff --git a/apps/self-hosted/server/services/settings/ui-config.ts b/apps/self-hosted/server/services/settings/ui-config.ts
index 88b05425..d6e671be 100644
--- a/apps/self-hosted/server/services/settings/ui-config.ts
+++ b/apps/self-hosted/server/services/settings/ui-config.ts
@@ -1,5 +1,5 @@
import i18nOptions from '@chronoframe/gallery/i18n/i18n.options'
-import type { FieldUIConfig } from '~~/shared/types/settings'
+import type { FieldUIConfig } from '#shared/types/settings'
/**
* Extended settings configuration with UI descriptions
diff --git a/apps/self-hosted/server/services/settings/wizard-fields.ts b/apps/self-hosted/server/services/settings/wizard-fields.ts
index f901cd76..03915743 100644
--- a/apps/self-hosted/server/services/settings/wizard-fields.ts
+++ b/apps/self-hosted/server/services/settings/wizard-fields.ts
@@ -1,4 +1,4 @@
-import type { SettingConfig } from '~~/shared/types/settings'
+import type { SettingConfig } from '#shared/types/settings'
/**
* The setup wizard only renders scalar settings. JSON settings (objects or
diff --git a/apps/self-hosted/server/utils/chunk-upload.ts b/apps/self-hosted/server/utils/chunk-upload.ts
index 53c4260a..dfeecf73 100644
--- a/apps/self-hosted/server/utils/chunk-upload.ts
+++ b/apps/self-hosted/server/utils/chunk-upload.ts
@@ -4,7 +4,7 @@ import { tmpdir } from 'node:os'
import path from 'node:path'
import type { StorageProvider } from '../services/storage/interfaces'
import { logUpload } from './upload-log'
-import { UPLOAD_CHUNK_SIZE } from '../../shared/utils/upload'
+import { UPLOAD_CHUNK_SIZE } from '#shared/utils/upload'
const TTL = 60 * 60 * 1000
export const chunkUploads = new Map<string, ChunkUpload>()
diff --git a/apps/self-hosted/server/utils/direct-upload.ts b/apps/self-hosted/server/utils/direct-upload.ts
index c73b1bc4..418f1929 100644
--- a/apps/self-hosted/server/utils/direct-upload.ts
+++ b/apps/self-hosted/server/utils/direct-upload.ts
@@ -3,7 +3,7 @@ import type {
DirectUploadSetup,
StorageProvider,
} from '../services/storage/interfaces'
-import type { UploadPlan } from '../../shared/types/upload'
+import type { UploadPlan } from '#shared/types/upload'
import { createChunkUpload } from './chunk-upload'
import { logUpload } from './upload-log'