1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-09 23:17:29 +02:00

feat: storage template file move hardening (#5917)

* fix: pgvecto.rs extension breaks typeorm schema:drop command

* fix: parse postgres bigints to javascript number types when selecting data

* feat: verify file size is the same as original asset after copying file for storage template job

* feat: allow disabling of storage template job, defaults to disabled for new instances

* fix: don't allow setting concurrency for storage template migration, can cause race conditions above 1

* feat: add checksum verification when file is copied for storage template job

* fix: extract metadata for assets that aren't visible on timeline
This commit is contained in:
Zack Pollard
2023-12-29 18:41:33 +00:00
committed by GitHub
parent 5f6bd4ae7e
commit 2e38fa73bf
36 changed files with 686 additions and 225 deletions

View File

@@ -21,7 +21,6 @@ class SystemConfigJobDto {
required this.search,
required this.sidecar,
required this.smartSearch,
required this.storageTemplateMigration,
required this.thumbnailGeneration,
required this.videoConversion,
});
@@ -42,8 +41,6 @@ class SystemConfigJobDto {
JobSettingsDto smartSearch;
JobSettingsDto storageTemplateMigration;
JobSettingsDto thumbnailGeneration;
JobSettingsDto videoConversion;
@@ -58,7 +55,6 @@ class SystemConfigJobDto {
other.search == search &&
other.sidecar == sidecar &&
other.smartSearch == smartSearch &&
other.storageTemplateMigration == storageTemplateMigration &&
other.thumbnailGeneration == thumbnailGeneration &&
other.videoConversion == videoConversion;
@@ -73,12 +69,11 @@ class SystemConfigJobDto {
(search.hashCode) +
(sidecar.hashCode) +
(smartSearch.hashCode) +
(storageTemplateMigration.hashCode) +
(thumbnailGeneration.hashCode) +
(videoConversion.hashCode);
@override
String toString() => 'SystemConfigJobDto[backgroundTask=$backgroundTask, library_=$library_, metadataExtraction=$metadataExtraction, migration=$migration, recognizeFaces=$recognizeFaces, search=$search, sidecar=$sidecar, smartSearch=$smartSearch, storageTemplateMigration=$storageTemplateMigration, thumbnailGeneration=$thumbnailGeneration, videoConversion=$videoConversion]';
String toString() => 'SystemConfigJobDto[backgroundTask=$backgroundTask, library_=$library_, metadataExtraction=$metadataExtraction, migration=$migration, recognizeFaces=$recognizeFaces, search=$search, sidecar=$sidecar, smartSearch=$smartSearch, thumbnailGeneration=$thumbnailGeneration, videoConversion=$videoConversion]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@@ -90,7 +85,6 @@ class SystemConfigJobDto {
json[r'search'] = this.search;
json[r'sidecar'] = this.sidecar;
json[r'smartSearch'] = this.smartSearch;
json[r'storageTemplateMigration'] = this.storageTemplateMigration;
json[r'thumbnailGeneration'] = this.thumbnailGeneration;
json[r'videoConversion'] = this.videoConversion;
return json;
@@ -112,7 +106,6 @@ class SystemConfigJobDto {
search: JobSettingsDto.fromJson(json[r'search'])!,
sidecar: JobSettingsDto.fromJson(json[r'sidecar'])!,
smartSearch: JobSettingsDto.fromJson(json[r'smartSearch'])!,
storageTemplateMigration: JobSettingsDto.fromJson(json[r'storageTemplateMigration'])!,
thumbnailGeneration: JobSettingsDto.fromJson(json[r'thumbnailGeneration'])!,
videoConversion: JobSettingsDto.fromJson(json[r'videoConversion'])!,
);
@@ -170,7 +163,6 @@ class SystemConfigJobDto {
'search',
'sidecar',
'smartSearch',
'storageTemplateMigration',
'thumbnailGeneration',
'videoConversion',
};

View File

@@ -13,25 +13,37 @@ part of openapi.api;
class SystemConfigStorageTemplateDto {
/// Returns a new [SystemConfigStorageTemplateDto] instance.
SystemConfigStorageTemplateDto({
required this.enabled,
required this.hashVerificationEnabled,
required this.template,
});
bool enabled;
bool hashVerificationEnabled;
String template;
@override
bool operator ==(Object other) => identical(this, other) || other is SystemConfigStorageTemplateDto &&
other.enabled == enabled &&
other.hashVerificationEnabled == hashVerificationEnabled &&
other.template == template;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(enabled.hashCode) +
(hashVerificationEnabled.hashCode) +
(template.hashCode);
@override
String toString() => 'SystemConfigStorageTemplateDto[template=$template]';
String toString() => 'SystemConfigStorageTemplateDto[enabled=$enabled, hashVerificationEnabled=$hashVerificationEnabled, template=$template]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'enabled'] = this.enabled;
json[r'hashVerificationEnabled'] = this.hashVerificationEnabled;
json[r'template'] = this.template;
return json;
}
@@ -44,6 +56,8 @@ class SystemConfigStorageTemplateDto {
final json = value.cast<String, dynamic>();
return SystemConfigStorageTemplateDto(
enabled: mapValueOfType<bool>(json, r'enabled')!,
hashVerificationEnabled: mapValueOfType<bool>(json, r'hashVerificationEnabled')!,
template: mapValueOfType<String>(json, r'template')!,
);
}
@@ -92,6 +106,8 @@ class SystemConfigStorageTemplateDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'enabled',
'hashVerificationEnabled',
'template',
};
}