mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
refactor: app init event (#17937)
This commit is contained in:
parent
895b2bf5cd
commit
7f69abbf0d
19 changed files with 81 additions and 75 deletions
|
|
@ -3,11 +3,12 @@ import FormatBoldMessage from '$lib/components/i18n/format-bold-message.svelte';
|
|||
import type { InterpolationValues } from '$lib/components/i18n/format-message';
|
||||
import { NotificationType, notificationController } from '$lib/components/shared-components/notification/notification';
|
||||
import { AppRoute } from '$lib/constants';
|
||||
import { authManager } from '$lib/managers/auth-manager.svelte';
|
||||
import { downloadManager } from '$lib/managers/download-manager.svelte';
|
||||
import type { AssetInteraction } from '$lib/stores/asset-interaction.svelte';
|
||||
import { assetsSnapshot, isSelectingAllAssets, type AssetStore } from '$lib/stores/assets-store.svelte';
|
||||
import { preferences } from '$lib/stores/user.store';
|
||||
import { downloadRequest, getKey, withError } from '$lib/utils';
|
||||
import { downloadRequest, withError } from '$lib/utils';
|
||||
import { createAlbum } from '$lib/utils/album-utils';
|
||||
import { getByteUnitString } from '$lib/utils/byte-units';
|
||||
import { getFormatter } from '$lib/utils/i18n';
|
||||
|
|
@ -44,7 +45,7 @@ export const addAssetsToAlbum = async (albumId: string, assetIds: string[], show
|
|||
bulkIdsDto: {
|
||||
ids: assetIds,
|
||||
},
|
||||
key: getKey(),
|
||||
key: authManager.key,
|
||||
});
|
||||
const count = result.filter(({ success }) => success).length;
|
||||
const $t = get(t);
|
||||
|
|
@ -178,7 +179,7 @@ export const downloadArchive = async (fileName: string, options: Omit<DownloadIn
|
|||
const $preferences = get<UserPreferencesResponseDto | undefined>(preferences);
|
||||
const dto = { ...options, archiveSize: $preferences?.download.archiveSize };
|
||||
|
||||
const [error, downloadInfo] = await withError(() => getDownloadInfo({ downloadInfoDto: dto, key: getKey() }));
|
||||
const [error, downloadInfo] = await withError(() => getDownloadInfo({ downloadInfoDto: dto, key: authManager.key }));
|
||||
if (error) {
|
||||
const $t = get(t);
|
||||
handleError(error, $t('errors.unable_to_download_files'));
|
||||
|
|
@ -193,7 +194,7 @@ export const downloadArchive = async (fileName: string, options: Omit<DownloadIn
|
|||
const archive = downloadInfo.archives[index];
|
||||
const suffix = downloadInfo.archives.length > 1 ? `+${index + 1}` : '';
|
||||
const archiveName = fileName.replace('.zip', `${suffix}-${DateTime.now().toFormat('yyyyLLdd_HHmmss')}.zip`);
|
||||
const key = getKey();
|
||||
const key = authManager.key;
|
||||
|
||||
let downloadKey = `${archiveName} `;
|
||||
if (downloadInfo.archives.length > 1) {
|
||||
|
|
@ -240,7 +241,7 @@ export const downloadFile = async (asset: AssetResponseDto) => {
|
|||
};
|
||||
|
||||
if (asset.livePhotoVideoId) {
|
||||
const motionAsset = await getAssetInfo({ id: asset.livePhotoVideoId, key: getKey() });
|
||||
const motionAsset = await getAssetInfo({ id: asset.livePhotoVideoId, key: authManager.key });
|
||||
if (!isAndroidMotionVideo(motionAsset) || get(preferences)?.download.includeEmbeddedVideos) {
|
||||
assets.push({
|
||||
filename: motionAsset.originalFileName,
|
||||
|
|
@ -252,7 +253,7 @@ export const downloadFile = async (asset: AssetResponseDto) => {
|
|||
|
||||
for (const { filename, id } of assets) {
|
||||
try {
|
||||
const key = getKey();
|
||||
const key = authManager.key;
|
||||
|
||||
notificationController.show({
|
||||
type: NotificationType.Info,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue