mirror of
https://github.com/Molunerfinn/PicGo.git
synced 2024-04-21 10:31:33 +00:00
Compare commits
3
Commits
v2.4.0-beta.5
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cede85732 | ||
|
|
050a3dd602 | ||
|
|
cd07b33e6b |
@@ -1,3 +1,13 @@
|
|||||||
|
# :tada: 2.4.0-beta.6 (2023-11-19)
|
||||||
|
|
||||||
|
|
||||||
|
### :bug: Bug Fixes
|
||||||
|
|
||||||
|
* app.asar directroy copy error ([#1180](https://github.com/Molunerfinn/PicGo/issues/1180)) ([cd07b33](https://github.com/Molunerfinn/PicGo/commit/cd07b33)), closes [#1179](https://github.com/Molunerfinn/PicGo/issues/1179)
|
||||||
|
* can't add new config for picbed ([050a3dd](https://github.com/Molunerfinn/PicGo/commit/050a3dd)), closes [#1184](https://github.com/Molunerfinn/PicGo/issues/1184)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# :tada: 2.4.0-beta.5 (2023-09-10)
|
# :tada: 2.4.0-beta.5 (2023-09-10)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "picgo",
|
"name": "picgo",
|
||||||
"version": "2.4.0-beta.5",
|
"version": "2.4.0-beta.6",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vue-cli-service electron:build",
|
"build": "vue-cli-service electron:build",
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ import {
|
|||||||
OPEN_WINDOW,
|
OPEN_WINDOW,
|
||||||
GET_LANGUAGE_LIST,
|
GET_LANGUAGE_LIST,
|
||||||
SET_CURRENT_LANGUAGE,
|
SET_CURRENT_LANGUAGE,
|
||||||
GET_CURRENT_LANGUAGE
|
GET_CURRENT_LANGUAGE,
|
||||||
|
GET_PICBED_CONFIG
|
||||||
} from '#/events/constants'
|
} from '#/events/constants'
|
||||||
|
|
||||||
import { GalleryDB } from 'apis/core/datastore'
|
import { GalleryDB } from 'apis/core/datastore'
|
||||||
@@ -223,14 +224,14 @@ const handleNPMError = (): IDispose => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleGetPicBedConfig = () => {
|
const handleGetPicBedConfig = () => {
|
||||||
ipcMain.on('getPicBedConfig', (event: IpcMainEvent, type: string) => {
|
ipcMain.on(GET_PICBED_CONFIG, (event: IpcMainEvent, type: string) => {
|
||||||
const name = picgo.helper.uploader.get(type)?.name || type
|
const name = picgo.helper.uploader.get(type)?.name || type
|
||||||
if (picgo.helper.uploader.get(type)?.config) {
|
if (picgo.helper.uploader.get(type)?.config) {
|
||||||
const _config = picgo.helper.uploader.get(type)!.config!(picgo)
|
const _config = picgo.helper.uploader.get(type)!.config!(picgo)
|
||||||
const config = handleConfigWithFunction(_config)
|
const config = handleConfigWithFunction(_config)
|
||||||
event.sender.send('getPicBedConfig', config, name)
|
event.sender.send(GET_PICBED_CONFIG, config, name)
|
||||||
} else {
|
} else {
|
||||||
event.sender.send('getPicBedConfig', [], name)
|
event.sender.send(GET_PICBED_CONFIG, [], name)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,29 @@ function beforeOpen () {
|
|||||||
resolveClipboardImageGenerator()
|
resolveClipboardImageGenerator()
|
||||||
resolveOtherI18nFiles()
|
resolveOtherI18nFiles()
|
||||||
}
|
}
|
||||||
|
function copyFileOutsideOfElectronAsar (
|
||||||
|
sourceInAsarArchive: string,
|
||||||
|
destOutsideAsarArchive: string
|
||||||
|
) {
|
||||||
|
if (fs.existsSync(sourceInAsarArchive)) {
|
||||||
|
// file will be copied
|
||||||
|
if (fs.statSync(sourceInAsarArchive).isFile()) {
|
||||||
|
const file = destOutsideAsarArchive;
|
||||||
|
const dir = path.dirname(file)
|
||||||
|
if (!fs.existsSync(dir)) {
|
||||||
|
fs.mkdirSync(dir, { recursive: true })
|
||||||
|
}
|
||||||
|
fs.writeFileSync(file, fs.readFileSync(sourceInAsarArchive))
|
||||||
|
} else if (fs.statSync(sourceInAsarArchive).isDirectory()) {
|
||||||
|
fs.readdirSync(sourceInAsarArchive).forEach(function (fileOrFolderName) {
|
||||||
|
copyFileOutsideOfElectronAsar(
|
||||||
|
`${sourceInAsarArchive}/${fileOrFolderName}`,
|
||||||
|
`${destOutsideAsarArchive}/${fileOrFolderName}`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macOS 右键菜单
|
* macOS 右键菜单
|
||||||
@@ -26,7 +49,7 @@ function resolveMacWorkFlow () {
|
|||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
fs.copySync(path.join(__static, 'Upload pictures with PicGo.workflow'), dest)
|
copyFileOutsideOfElectronAsar(path.join(__static, 'Upload pictures with PicGo.workflow'), dest)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,13 +45,7 @@ const $route = useRoute()
|
|||||||
const $form = ref<IFormInstance>()
|
const $form = ref<IFormInstance>()
|
||||||
const configList = ref<IPicGoPluginConfig[]>([])
|
const configList = ref<IPicGoPluginConfig[]>([])
|
||||||
const formModel = reactive<IStringKeyMap>({})
|
const formModel = reactive<IStringKeyMap>({})
|
||||||
|
const isUploader = props.type === 'uploader'
|
||||||
watch(toRefs(props.config), (val: IPicGoPluginConfig[]) => {
|
|
||||||
handleConfig(val)
|
|
||||||
}, {
|
|
||||||
deep: true,
|
|
||||||
immediate: true
|
|
||||||
})
|
|
||||||
|
|
||||||
async function validate (): Promise<IStringKeyMap | false> {
|
async function validate (): Promise<IStringKeyMap | false> {
|
||||||
const res = await $form.value?.validate() || false
|
const res = await $form.value?.validate() || false
|
||||||
@@ -74,14 +68,13 @@ function getConfigType () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const isUploader = props.type === 'uploader'
|
|
||||||
|
|
||||||
const handleConfigForm = useConfigForm()
|
const handleConfigForm = useConfigForm()
|
||||||
|
|
||||||
async function handleConfig (inputConfig: IPicGoPluginConfig[]) {
|
async function handleConfig (inputConfig: IPicGoPluginConfig[]) {
|
||||||
const currentConfig = await getCurConfigFormData()
|
const currentConfig = await getCurConfigFormData()
|
||||||
|
const resetConfig = isUploader && !$route.params.configId
|
||||||
Object.assign(formModel, currentConfig)
|
Object.assign(formModel, currentConfig)
|
||||||
configList.value = handleConfigForm(inputConfig, formModel, currentConfig)
|
configList.value = handleConfigForm(inputConfig, formModel, currentConfig, resetConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getCurConfigFormData () {
|
async function getCurConfigFormData () {
|
||||||
@@ -101,6 +94,13 @@ async function resetConfig () {
|
|||||||
Object.assign(formModel, config)
|
Object.assign(formModel, config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(toRefs(props.config), (val: IPicGoPluginConfig[]) => {
|
||||||
|
handleConfig(val)
|
||||||
|
}, {
|
||||||
|
deep: true,
|
||||||
|
immediate: true
|
||||||
|
})
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
validate,
|
validate,
|
||||||
getConfigType,
|
getConfigType,
|
||||||
|
|||||||
@@ -4,13 +4,15 @@ import { cloneDeep, union } from 'lodash'
|
|||||||
* @param configList origin config list
|
* @param configList origin config list
|
||||||
* @param formModel el-form form model for default value
|
* @param formModel el-form form model for default value
|
||||||
* @param currentConfig current config
|
* @param currentConfig current config
|
||||||
|
* @param resetConfigForm reset form model -> clear default value
|
||||||
* @returns transformed config list
|
* @returns transformed config list
|
||||||
*/
|
*/
|
||||||
export const useConfigForm = () => {
|
export const useConfigForm = () => {
|
||||||
return (configList: IPicGoPluginConfig[], formModel: IStringKeyMap, currentConfig?: IStringKeyMap) => {
|
return (configList: IPicGoPluginConfig[], formModel: IStringKeyMap, currentConfig?: IStringKeyMap, resetConfigForm?: boolean) => {
|
||||||
if (configList.length > 0) {
|
if (configList.length > 0) {
|
||||||
return cloneDeep(configList).map((item) => {
|
return cloneDeep(configList).map((item) => {
|
||||||
// if (!configId) return item
|
// if (!configId) return item
|
||||||
|
if (resetConfigForm) return item
|
||||||
let defaultValue = item.default !== undefined
|
let defaultValue = item.default !== undefined
|
||||||
? item.default
|
? item.default
|
||||||
: item.type === 'checkbox'
|
: item.type === 'checkbox'
|
||||||
|
|||||||
@@ -43,16 +43,17 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { IRPCActionType } from '~/universal/types/enum'
|
import { IRPCActionType } from '~/universal/types/enum'
|
||||||
import { ref, onBeforeUnmount, onBeforeMount } from 'vue'
|
import { ref, onBeforeMount } from 'vue'
|
||||||
import { T as $T } from '@/i18n/index'
|
import { T as $T } from '@/i18n/index'
|
||||||
import { sendToMain, triggerRPC } from '@/utils/dataSender'
|
import { sendToMain, triggerRPC } from '@/utils/dataSender'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import ConfigForm from '@/components/ConfigForm.vue'
|
import ConfigForm from '@/components/ConfigForm.vue'
|
||||||
// import mixin from '@/utils/ConfirmButtonMixin'
|
// import mixin from '@/utils/ConfirmButtonMixin'
|
||||||
import {
|
import {
|
||||||
ipcRenderer,
|
|
||||||
IpcRendererEvent
|
IpcRendererEvent
|
||||||
} from 'electron'
|
} from 'electron'
|
||||||
|
import { GET_PICBED_CONFIG } from '~/universal/events/constants'
|
||||||
|
import { useIPCOn } from '@/hooks/useIPC'
|
||||||
const type = ref('')
|
const type = ref('')
|
||||||
const config = ref<IPicGoPluginConfig[]>([])
|
const config = ref<IPicGoPluginConfig[]>([])
|
||||||
const picBedName = ref('')
|
const picBedName = ref('')
|
||||||
@@ -61,9 +62,10 @@ const $router = useRouter()
|
|||||||
const $configForm = ref<InstanceType<typeof ConfigForm> | null>(null)
|
const $configForm = ref<InstanceType<typeof ConfigForm> | null>(null)
|
||||||
type.value = $route.params.type as string
|
type.value = $route.params.type as string
|
||||||
|
|
||||||
|
useIPCOn(GET_PICBED_CONFIG, getPicBeds)
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
sendToMain('getPicBedConfig', $route.params.type)
|
sendToMain(GET_PICBED_CONFIG, $route.params.type)
|
||||||
ipcRenderer.on('getPicBedConfig', getPicBeds)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleConfirm = async () => {
|
const handleConfirm = async () => {
|
||||||
@@ -85,10 +87,6 @@ function getPicBeds (event: IpcRendererEvent, _config: IPicGoPluginConfig[], nam
|
|||||||
picBedName.value = name
|
picBedName.value = name
|
||||||
}
|
}
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
|
||||||
ipcRenderer.removeListener('getPicBedConfig', getPicBeds)
|
|
||||||
})
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ export const FORCE_UPDATE = 'FORCE_UPDATE'
|
|||||||
export const OPEN_WINDOW = 'OPEN_WINDOW'
|
export const OPEN_WINDOW = 'OPEN_WINDOW'
|
||||||
export const GET_PICBEDS = 'GET_PICBEDS'
|
export const GET_PICBEDS = 'GET_PICBEDS'
|
||||||
export const RPC_ACTIONS = 'RPC_ACTIONS'
|
export const RPC_ACTIONS = 'RPC_ACTIONS'
|
||||||
|
export const GET_PICBED_CONFIG = 'GET_PICBED_CONFIG'
|
||||||
// i18n
|
// i18n
|
||||||
export const GET_CURRENT_LANGUAGE = 'GET_CURRENT_LANGUAGE'
|
export const GET_CURRENT_LANGUAGE = 'GET_CURRENT_LANGUAGE'
|
||||||
export const GET_LANGUAGE_LIST = 'GET_LANGUAGE_LIST'
|
export const GET_LANGUAGE_LIST = 'GET_LANGUAGE_LIST'
|
||||||
|
|||||||
Reference in New Issue
Block a user