diff --git a/src/main.ts b/src/main.ts
index 332b7bd..3a2df23 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -14,9 +14,6 @@ import VueVideoPlayer from '@videojs-player/vue'
// Electron 相关
import { webFrame } from 'electron'
-// Axios
-import axios from 'axios'
-
// Mixins
import { mainMixin } from './renderer/utils/mainMixin'
import { dragMixin } from '@/utils/mixin'
@@ -25,7 +22,7 @@ import { dragMixin } from '@/utils/mixin'
import db from './renderer/utils/db'
// 国际化
-import { i18nManager, T } from './renderer/i18n/index'
+import { T } from './renderer/i18n/index'
// 工具函数
import { getConfig, saveConfig, sendToMain, triggerRPC } from '@/utils/dataSender'
@@ -45,27 +42,8 @@ webFrame.setVisualZoomLevelLimits(1, 1)
const app = createApp(App)
-app.config.globalProperties.$builtInPicBed = [
- 'smms',
- 'imgur',
- 'qiniu',
- 'tcyun',
- 'upyun',
- 'aliyun',
- 'github',
- 'webdavplist',
- 'local',
- 'sftpplist',
- 'telegraphplist',
- 'piclist',
- 'lskyplist',
- 'aws-s3-plist'
-]
-
app.config.globalProperties.$$db = db
-app.config.globalProperties.$http = axios
app.config.globalProperties.$T = T
-app.config.globalProperties.$i18n = i18nManager
app.config.globalProperties.getConfig = getConfig
app.config.globalProperties.triggerRPC = triggerRPC
app.config.globalProperties.saveConfig = saveConfig
diff --git a/src/renderer/App.vue b/src/renderer/App.vue
index 6ea7ee1..07db2e0 100644
--- a/src/renderer/App.vue
+++ b/src/renderer/App.vue
@@ -5,19 +5,10 @@
-
-
diff --git a/src/renderer/i18n/index.ts b/src/renderer/i18n/index.ts
index 08bf77a..2bc47f1 100644
--- a/src/renderer/i18n/index.ts
+++ b/src/renderer/i18n/index.ts
@@ -10,14 +10,14 @@ export class I18nManager {
#getLanguageList () {
ipcRenderer.send(GET_LANGUAGE_LIST)
- ipcRenderer.once(GET_LANGUAGE_LIST, (event, list: II18nItem[]) => {
+ ipcRenderer.once(GET_LANGUAGE_LIST, (_, list: II18nItem[]) => {
this.#i18nFileList = list
})
}
#getCurrentLanguage () {
ipcRenderer.send(GET_CURRENT_LANGUAGE)
- ipcRenderer.once(GET_CURRENT_LANGUAGE, (event, lang: string, locales: ILocales) => {
+ ipcRenderer.once(GET_CURRENT_LANGUAGE, (_, lang: string, locales: ILocales) => {
this.#setLocales(lang, locales)
bus.emit(FORCE_UPDATE)
})
@@ -36,7 +36,7 @@ export class I18nManager {
constructor () {
this.#getCurrentLanguage()
this.#getLanguageList()
- ipcRenderer.on(SET_CURRENT_LANGUAGE, (event, lang: string, locales: ILocales) => {
+ ipcRenderer.on(SET_CURRENT_LANGUAGE, (_, lang: string, locales: ILocales) => {
this.#setLocales(lang, locales)
bus.emit(FORCE_UPDATE)
})
diff --git a/src/renderer/manage/components/DynamicSwitch.vue b/src/renderer/manage/components/DynamicSwitch.vue
index c69e1f1..ac13873 100644
--- a/src/renderer/manage/components/DynamicSwitch.vue
+++ b/src/renderer/manage/components/DynamicSwitch.vue
@@ -35,12 +35,12 @@
import { InfoFilled } from '@element-plus/icons-vue'
defineProps<{
- tooltip: string,
+ tooltip?: string,
activeText?: string,
inactiveText?: string,
segments?: { text: string, style: string }[],
}>()
-const value = defineModel()
+const value = defineModel()
diff --git a/src/renderer/manage/pages/bucketPage.vue b/src/renderer/manage/pages/bucketPage.vue
index 4e3961c..fdfc7e6 100644
--- a/src/renderer/manage/pages/bucketPage.vue
+++ b/src/renderer/manage/pages/bucketPage.vue
@@ -50,7 +50,10 @@
style="display: flex;"
@click="showUploadDialog"
>
-
+
-
+
-
+
-
+
@@ -207,7 +221,10 @@
-
+
@@ -230,7 +247,8 @@
{{ $T(`MANAGE_SETTING_CHOOSE_COPY_FORMAT_${item.toUpperCase().replace(/-/g, '_')}` as any) }}
diff --git a/src/renderer/pages/Gallery.vue b/src/renderer/pages/Gallery.vue
index 40bae8a..b583eba 100644
--- a/src/renderer/pages/Gallery.vue
+++ b/src/renderer/pages/Gallery.vue
@@ -24,7 +24,8 @@
@change="handleDeleteCloudFile"
/>
-
+
@@ -590,6 +590,7 @@
v-for="item in picBed"
:key="item.name"
:label="item.name"
+ :value="item.name"
/>
@@ -1480,10 +1481,10 @@
:label="$T('UPLOAD_PAGE_IMAGE_PROCESS_WMTYPE')"
>
-
+
{{ $T('UPLOAD_PAGE_IMAGE_PROCESS_WMTYPE_TEXT') }}
-
+
{{ $T('UPLOAD_PAGE_IMAGE_PROCESS_WMTYPE_IMAGE') }}
@@ -1554,7 +1555,7 @@
{{ item[1] }}
@@ -2230,8 +2231,6 @@ function confirmCustomLink () {
saveConfig(configPaths.settings.customLink, customLink.value)
customLinkVisible.value = false
sendToMain('updateCustomLink')
- } else {
- return false
}
})
}
diff --git a/src/renderer/pages/Plugin.vue b/src/renderer/pages/Plugin.vue
index f54e34b..95f275b 100644
--- a/src/renderer/pages/Plugin.vue
+++ b/src/renderer/pages/Plugin.vue
@@ -534,7 +534,6 @@ async function handleConfirmConfig () {
}
function _getSearchResult (val: string) {
- // this.$http.get(`https://api.npms.io/v2/search?q=${val}`)
axios.get(`https://registry.npmjs.com/-/v1/search?text=${val}`)
.then((res: INPMSearchResult) => {
pluginList.value = res.data.objects
diff --git a/src/renderer/pages/ShortKey.vue b/src/renderer/pages/ShortKey.vue
index c25eeab..d0bd555 100644
--- a/src/renderer/pages/ShortKey.vue
+++ b/src/renderer/pages/ShortKey.vue
@@ -58,7 +58,8 @@
:class="{
disabled: scope.row.enable
}"
- type="text"
+ type="info"
+ :link="true"
@click="toggleEnable(scope.row)"
>
{{ scope.row.enable ? $T('SHORTCUT_DISABLE') : $T('SHORTCUT_ENABLE') }}
@@ -66,7 +67,8 @@
{{ $T('SHORTCUT_EDIT') }}
diff --git a/src/renderer/pages/Upload.vue b/src/renderer/pages/Upload.vue
index 06060a0..79e6e79 100644
--- a/src/renderer/pages/Upload.vue
+++ b/src/renderer/pages/Upload.vue
@@ -82,27 +82,13 @@
@change="handlePasteStyleChange"
>
- Markdown
+ {{ key }}
-
-
-
-
{{ $T('UPLOAD_SHORT_URL') }}
{{ $T('UPLOAD_NORMAL_URL') }}
@@ -180,10 +166,10 @@
:label="$T('UPLOAD_PAGE_IMAGE_PROCESS_WMTYPE')"
>
-
+
{{ $T('UPLOAD_PAGE_IMAGE_PROCESS_WMTYPE_TEXT') }}
-
+
{{ $T('UPLOAD_PAGE_IMAGE_PROCESS_WMTYPE_IMAGE') }}
@@ -254,7 +240,7 @@
{{ item[1] }}
@@ -473,6 +459,22 @@ const $router = useRouter()
const imageProcessDialogVisible = ref(false)
const useShortUrl = ref(false)
+const dragover = ref(false)
+const progress = ref(0)
+const showProgress = ref(false)
+const showError = ref(false)
+const pasteStyle = ref('')
+const picBed = ref([])
+const picBedName = ref('')
+const picBedConfigName = ref('')
+
+const pasteFormatList = ref({
+ [IPasteStyle.MARKDOWN]: '![alt](url)',
+ [IPasteStyle.HTML]: '',
+ [IPasteStyle.URL]: 'http://test.com/test.png',
+ [IPasteStyle.UBB]: '[img]url[/img]',
+ [IPasteStyle.CUSTOM]: ''
+})
const waterMarkPositionMap = new Map([
['north', $T('UPLOAD_PAGE_IMAGE_PROCESS_POSITION_TOP')],
@@ -519,6 +521,8 @@ const compressForm = reactive({
isFlip: false,
isFlop: false
})
+const waterMarkFormKeys = Object.keys(waterMarkForm)
+const compressFormKeys = Object.keys(compressForm)
const formatConvertObj = ref('{}')
@@ -548,20 +552,9 @@ async function initData () {
const compress = await getConfig(configPaths.buildIn.compress)
const watermark = await getConfig(configPaths.buildIn.watermark)
if (compress) {
- compressForm.quality = compress.quality ?? 100
- compressForm.isConvert = compress.isConvert ?? false
- compressForm.convertFormat = compress.convertFormat ?? 'jpg'
- compressForm.isReSize = compress.isReSize ?? false
- compressForm.reSizeWidth = compress.reSizeWidth ?? 500
- compressForm.reSizeHeight = compress.reSizeHeight ?? 500
- compressForm.skipReSizeOfSmallImg = compress.skipReSizeOfSmallImg ?? false
- compressForm.isReSizeByPercent = compress.isReSizeByPercent ?? false
- compressForm.reSizePercent = compress.reSizePercent ?? 50
- compressForm.isRotate = compress.isRotate ?? false
- compressForm.rotateDegree = compress.rotateDegree ?? 0
- compressForm.isRemoveExif = compress.isRemoveExif ?? false
- compressForm.isFlip = compress.isFlip ?? false
- compressForm.isFlop = compress.isFlop ?? false
+ compressFormKeys.forEach((key) => {
+ compressForm[key] = compress[key] ?? compressForm[key]
+ })
try {
if (typeof compress.formatConvertObj === 'object') {
formatConvertObj.value = JSON.stringify(compress.formatConvertObj)
@@ -573,29 +566,13 @@ async function initData () {
}
}
if (watermark) {
- waterMarkForm.isAddWatermark = watermark.isAddWatermark ?? false
- waterMarkForm.watermarkType = watermark.watermarkType ?? 'text'
- waterMarkForm.isFullScreenWatermark = watermark.isFullScreenWatermark ?? false
- waterMarkForm.watermarkDegree = watermark.watermarkDegree ?? 0
- waterMarkForm.watermarkText = watermark.watermarkText ?? ''
- waterMarkForm.watermarkFontPath = watermark.watermarkFontPath ?? ''
- waterMarkForm.watermarkScaleRatio = watermark.watermarkScaleRatio ?? 0.15
- waterMarkForm.watermarkColor = watermark.watermarkColor === undefined || watermark.watermarkColor === '' ? '#CCCCCC73' : watermark.watermarkColor
- waterMarkForm.watermarkImagePath = watermark.watermarkImagePath ?? ''
- waterMarkForm.watermarkPosition = watermark.watermarkPosition ?? 'southeast'
+ waterMarkFormKeys.forEach((key) => {
+ waterMarkForm[key] = watermark[key as keyof IBuildInWaterMarkOptions] ?? waterMarkForm[key]
+ })
+ waterMarkForm.watermarkColor = watermark.watermarkColor === '' ? '#CCCCCC73' : watermark.watermarkColor
}
}
-const dragover = ref(false)
-const progress = ref(0)
-const showProgress = ref(false)
-const showError = ref(false)
-const pasteStyle = ref('')
-const picBed = ref([])
-const picBedName = ref('')
-const customLink = ref('')
-const picBedConfigName = ref('')
-
onBeforeMount(() => {
ipcRenderer.on('uploadProgress', (_event: IpcRendererEvent, _progress: number) => {
if (_progress !== -1) {
@@ -723,7 +700,7 @@ function ipcSendFiles (files: FileList) {
async function getPasteStyle () {
pasteStyle.value = await getConfig(configPaths.settings.pasteStyle) || IPasteStyle.MARKDOWN
- customLink.value = await getConfig(configPaths.settings.customLink) || '![$fileName]($url)'
+ pasteFormatList.value.Custom = await getConfig(configPaths.settings.customLink) || '![$fileName]($url)'
}
async function getUseShortUrl () {
@@ -736,9 +713,9 @@ async function handleUseShortUrlChange () {
})
}
-function handlePasteStyleChange (val: string | number | boolean) {
+function handlePasteStyleChange (val: string | number | boolean | undefined) {
saveConfig({
- [configPaths.settings.pasteStyle]: val
+ [configPaths.settings.pasteStyle]: val || IPasteStyle.MARKDOWN
})
}
diff --git a/src/renderer/utils/mainMixin.ts b/src/renderer/utils/mainMixin.ts
index 03212df..8208501 100644
--- a/src/renderer/utils/mainMixin.ts
+++ b/src/renderer/utils/mainMixin.ts
@@ -1,13 +1,6 @@
-// Vue 组件选项
import { ComponentOptions } from 'vue'
-
-// 事件常量
import { FORCE_UPDATE, GET_PICBEDS } from '~/universal/events/constants'
-
-// 事件总线
import bus from '~/renderer/utils/bus'
-
-// Electron 相关
import { ipcRenderer } from 'electron'
export const mainMixin: ComponentOptions = {
diff --git a/src/universal/types/extra-vue.d.ts b/src/universal/types/extra-vue.d.ts
index 9f482ce..c21d9e0 100644
--- a/src/universal/types/extra-vue.d.ts
+++ b/src/universal/types/extra-vue.d.ts
@@ -17,11 +17,8 @@ declare module 'vue/types/vue' {
declare module 'vue' {
interface ComponentCustomProperties {
- $http: typeof axios
- $builtInPicBed: string[]
$$db: IGalleryDB
$T: typeof import('~/renderer/i18n/index').T
- $i18n: import('~/renderer/i18n/index').I18nManager
saveConfig(data: IObj | string, value?: any): void
getConfig(key?: string): Promise
setDefaultPicBed(picBed: string): void