piclist 2.0.5 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ import { IPicGo } from '../../types';
2
+ declare const configCmd: {
3
+ handle: (ctx: IPicGo) => void;
4
+ };
5
+ export default configCmd;
@@ -1,6 +1,7 @@
1
1
  import { Command } from 'commander';
2
2
  import { Inquirer } from 'inquirer';
3
3
  import { FormatEnum, GravityEnum } from 'sharp';
4
+ import type { ConfigManager } from '../utils/configManager';
4
5
  import { IRequestPromiseOptions } from './oldRequest';
5
6
  export interface IPicGo extends NodeJS.EventEmitter {
6
7
  configPath: string;
@@ -13,6 +14,7 @@ export interface IPicGo extends NodeJS.EventEmitter {
13
14
  processedInput: any[];
14
15
  pluginLoader: IPluginLoader;
15
16
  pluginHandler: IPluginHandler;
17
+ configManager: ConfigManager;
16
18
  /**
17
19
  * @deprecated will be removed in v1.5.0+
18
20
  */
@@ -359,6 +361,19 @@ export interface IAwsS3PListUserConfig {
359
361
  disableBucketPrefixToURL?: boolean | string;
360
362
  options?: string;
361
363
  }
364
+ /** Base config item with metadata */
365
+ export interface IConfigItem {
366
+ _id: string;
367
+ _configName: string;
368
+ _createdAt: number;
369
+ _updatedAt: number;
370
+ [key: string]: any;
371
+ }
372
+ /** Multi-config structure for uploaders */
373
+ export interface IUploaderConfigList {
374
+ configList: IConfigItem[];
375
+ defaultId: string;
376
+ }
362
377
  /** PicGo 配置文件类型定义 */
363
378
  export interface IConfig {
364
379
  picBed: {
@@ -378,6 +393,8 @@ export interface IConfig {
378
393
  proxy?: string;
379
394
  [others: string]: any;
380
395
  };
396
+ /** Multi-config structure for uploaders (new format) */
397
+ uploader?: Record<string, IUploaderConfigList>;
381
398
  picgoPlugins: Record<string, boolean>;
382
399
  debug?: boolean;
383
400
  silent?: boolean;
@@ -632,4 +649,16 @@ export interface IBuildInCompressOptionsTreated {
632
649
  export interface IBuildInSkipProcessOptions {
633
650
  skipProcessExtList?: string;
634
651
  }
652
+ export interface IBuildInListItem {
653
+ id: string;
654
+ compress?: Partial<IBuildInCompressOptionsTreated>;
655
+ watermark?: Partial<IBuildInWaterMarkOptionsTreated>;
656
+ skipProcess?: IBuildInSkipProcessOptions;
657
+ rename?: {
658
+ enable?: boolean;
659
+ format?: string;
660
+ };
661
+ autoRename?: boolean;
662
+ manualRename?: boolean;
663
+ }
635
664
  export {};
@@ -34,8 +34,8 @@ export declare function safeParse<T>(str: string): T | string;
34
34
  export declare const forceNumber: (num?: string | number) => number;
35
35
  export declare const isDev: () => boolean;
36
36
  export declare function AddWatermark(img: Buffer, watermarkType: 'text' | 'image', defaultWatermarkFontPath: string, isFullScreenWatermark?: boolean, watermarkDegree?: number, text?: string, watermarkFontPath?: string, watermarkScaleRatio?: number, watermarkColor?: string, watermarkImagePath?: string, position?: sharp.Gravity, watermarkImageOpacity?: number): Promise<Buffer>;
37
- export declare function getTreatedWaterMarkOptions(raw: IBuildInWaterMarkOptions | undefined, picBed: string): IBuildInWaterMarkOptionsTreated;
38
- export declare function getTreatedCompressOptions(raw: IBuildInCompressOptions | undefined, picBed: string): IBuildInCompressOptionsTreated;
37
+ export declare function getTreatedWaterMarkOptions(global: IBuildInWaterMarkOptions | undefined, idSpecificConfig: Partial<IBuildInWaterMarkOptions>, picBed: string, id: string): IBuildInWaterMarkOptionsTreated;
38
+ export declare function getTreatedCompressOptions(global: IBuildInCompressOptions | undefined, idSpecificConfig: Partial<IBuildInCompressOptions>, picBed: string, id: string): IBuildInCompressOptionsTreated;
39
39
  export declare function imageAddWaterMark(img: Buffer, options: IBuildInWaterMarkOptions, defaultWatermarkFontPath: string, logger: ILogger): Promise<Buffer>;
40
40
  export declare function imageCompress(img: Buffer, options: IBuildInCompressOptions, rawFormat: string, logger: ILogger): Promise<Buffer>;
41
41
  export declare function getConvertedFormat(options: IBuildInCompressOptions | undefined, rawFormat: string): string;
@@ -0,0 +1,15 @@
1
+ import { IConfigItem, IPicGo } from '../types';
2
+ export declare class ConfigManager {
3
+ private readonly ctx;
4
+ constructor(ctx: IPicGo);
5
+ migrateToMultiConfig(uploaderName: string): void;
6
+ getCurrentUploaderConfig(uploaderName: string): IConfigItem | null;
7
+ getAllUploaderConfigs(uploaderName: string): IConfigItem[];
8
+ addUploaderConfig(uploaderName: string, configName: string, configData: any): IConfigItem;
9
+ updateUploaderConfig(uploaderName: string, configId: string, configData: any): boolean;
10
+ deleteUploaderConfig(uploaderName: string, configId: string): boolean;
11
+ setDefaultConfig(uploaderName: string, configId: string): boolean;
12
+ private syncConfigToPicBed;
13
+ getConfigByName(uploaderName: string, configName: string): IConfigItem | null;
14
+ renameConfig(uploaderName: string, configId: string, newName: string): boolean;
15
+ }
@@ -7,11 +7,14 @@ declare class DB {
7
7
  private readonly db;
8
8
  constructor(ctx: IPicGo);
9
9
  read(flush?: boolean): IJSON;
10
- get(key?: string): any;
10
+ getSingle(key?: string): any;
11
+ get(key: string): any;
12
+ get(key: string[]): any[];
11
13
  set(key: string, value: any): void;
12
14
  has(key: string): boolean;
13
15
  unset(key: string, value: any): boolean;
14
16
  saveConfig(config: Partial<IConfig>): void;
15
17
  removeConfig(config: IConfig): void;
18
+ getConfigPath(): string;
16
19
  }
17
20
  export default DB;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piclist",
3
- "version": "2.0.5",
3
+ "version": "2.2.0",
4
4
  "description": "Modified PicGo core, A tool for picture uploading",
5
5
  "author": {
6
6
  "name": "Kuingsmile",
@@ -92,11 +92,11 @@
92
92
  "typescript-eslint": "^8.52.0"
93
93
  },
94
94
  "dependencies": {
95
- "@aws-sdk/client-s3": "3.962.0",
96
- "@aws-sdk/lib-storage": "3.962.0",
97
- "@aws-sdk/s3-request-presigner": "3.962.0",
95
+ "@aws-sdk/client-s3": "3.965.0",
96
+ "@aws-sdk/lib-storage": "3.965.0",
97
+ "@aws-sdk/s3-request-presigner": "3.965.0",
98
98
  "@piclist/i18n": "^2.0.0",
99
- "@piclist/store": "^3.0.0",
99
+ "@piclist/store": "^3.0.1",
100
100
  "@smithy/node-http-handler": "4.4.7",
101
101
  "axios": "^1.13.2",
102
102
  "chalk": "^5.6.2",
package/renovate.json CHANGED
@@ -1,6 +1,4 @@
1
1
  {
2
2
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
- "extends": [
4
- "config:recommended"
5
- ]
3
+ "extends": ["config:recommended"]
6
4
  }