mirror of
https://github.com/immich-app/immich.git
synced 2025-01-19 18:26:46 +01:00
fix(cli): read-only and sidecar support for import (#3372)
* added flag to support toggling read-only mode (read-only true by default), added sidecarPath to import request payload * removed default on --no-read-only to prevent confusion since true is the default
This commit is contained in:
parent
8f08100a30
commit
c40aa4399b
3 changed files with 5 additions and 0 deletions
|
@ -70,11 +70,13 @@ export default class Upload extends BaseCommand {
|
||||||
if (options.import) {
|
if (options.import) {
|
||||||
const importData = {
|
const importData = {
|
||||||
assetPath: asset.path,
|
assetPath: asset.path,
|
||||||
|
sidecarPath: asset.sidecarPath,
|
||||||
deviceAssetId: asset.deviceAssetId,
|
deviceAssetId: asset.deviceAssetId,
|
||||||
deviceId: this.deviceId,
|
deviceId: this.deviceId,
|
||||||
fileCreatedAt: asset.fileCreatedAt,
|
fileCreatedAt: asset.fileCreatedAt,
|
||||||
fileModifiedAt: asset.fileModifiedAt,
|
fileModifiedAt: asset.fileModifiedAt,
|
||||||
isFavorite: false,
|
isFavorite: false,
|
||||||
|
isReadOnly: options.readOnly,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!this.dryRun) {
|
if (!this.dryRun) {
|
||||||
|
|
|
@ -5,4 +5,5 @@ export class UploadOptionsDto {
|
||||||
skipHash = false;
|
skipHash = false;
|
||||||
delete = false;
|
delete = false;
|
||||||
import = false;
|
import = false;
|
||||||
|
readOnly = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,11 @@ program
|
||||||
.default(false),
|
.default(false),
|
||||||
)
|
)
|
||||||
.addOption(new Option('-i, --ignore [paths...]', 'Paths to ignore').env('IMMICH_IGNORE_PATHS').default(false))
|
.addOption(new Option('-i, --ignore [paths...]', 'Paths to ignore').env('IMMICH_IGNORE_PATHS').default(false))
|
||||||
|
.addOption(new Option('--no-read-only', 'Import files without read-only protection, allowing Immich to manage them'))
|
||||||
.argument('[paths...]', 'One or more paths to assets to be uploaded')
|
.argument('[paths...]', 'One or more paths to assets to be uploaded')
|
||||||
.action((paths, options) => {
|
.action((paths, options) => {
|
||||||
options.import = true;
|
options.import = true;
|
||||||
|
options.excludePatterns = options.ignore;
|
||||||
new Upload().run(paths, options);
|
new Upload().run(paths, options);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue