diff --git a/.changeset/orange-guests-kneel.md b/.changeset/orange-guests-kneel.md new file mode 100644 index 0000000..fce6bfb --- /dev/null +++ b/.changeset/orange-guests-kneel.md @@ -0,0 +1,5 @@ +--- +'@dolphin/chrome-extension': patch +--- + +feat: support encode image as Base64 (< 100 KiB) diff --git a/apps/chrome-extension/src/common/settings.ts b/apps/chrome-extension/src/common/settings.ts index c983935..6444dd7 100644 --- a/apps/chrome-extension/src/common/settings.ts +++ b/apps/chrome-extension/src/common/settings.ts @@ -11,6 +11,7 @@ export enum SettingKey { Grid = 'general.grid', TextHighlight = 'general.text_highlight', DownloadFileWithUniqueName = 'download.file_with_unique_name', + EncodeImageAsBase64 = 'download.encode_image_as_base64', } export enum Theme { @@ -44,6 +45,7 @@ export interface Settings { [SettingKey.Grid]: (typeof Grid)[keyof typeof Grid] [SettingKey.TextHighlight]: boolean [SettingKey.DownloadFileWithUniqueName]: boolean + [SettingKey.EncodeImageAsBase64]: boolean } export const fallbackSettings: Settings = { @@ -56,6 +58,7 @@ export const fallbackSettings: Settings = { [SettingKey.Grid]: Grid.Flatten, [SettingKey.TextHighlight]: true, [SettingKey.DownloadFileWithUniqueName]: false, + [SettingKey.EncodeImageAsBase64]: false, } export const getSettings = async ( diff --git a/apps/chrome-extension/src/pages/options/download.vue b/apps/chrome-extension/src/pages/options/download.vue index d6da09c..b7840ce 100644 --- a/apps/chrome-extension/src/pages/options/download.vue +++ b/apps/chrome-extension/src/pages/options/download.vue @@ -34,6 +34,7 @@ const { t } = useI18n() const schema = z.object({ [SettingKey.DownloadMethod]: z.enum(DownloadMethod), [SettingKey.DownloadFileWithUniqueName]: z.boolean(), + [SettingKey.EncodeImageAsBase64]: z.boolean(), }) const { query, mutation } = useSettings() @@ -49,6 +50,7 @@ watch(query.data, newValues => { values: pick(newValues, [ SettingKey.DownloadMethod, SettingKey.DownloadFileWithUniqueName, + SettingKey.EncodeImageAsBase64, ]), }) } @@ -143,6 +145,28 @@ const downloadMethodDescription = computed(() => { /> + + + + {{ + t('download.encode_image_as_base64') + }} + + + + + +