mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-02 11:08:13 -05:00
✨ Feature: picbeds config can be reseted to empty now
This commit is contained in:
parent
6f3c14c521
commit
aae3fe5905
@ -48,6 +48,7 @@ COPY_PICBED_CONFIG_SUCCEED: Copy Picbed Config Succeed
|
|||||||
INPUT: Input
|
INPUT: Input
|
||||||
CANCEL: Cancel
|
CANCEL: Cancel
|
||||||
CONFIRM: Confirm
|
CONFIRM: Confirm
|
||||||
|
RESET_PICBED_CONFIG: Reset
|
||||||
CHOOSE_SHOWED_PICBED: Choose Showed Picbed
|
CHOOSE_SHOWED_PICBED: Choose Showed Picbed
|
||||||
CHOOSE_PASTE_FORMAT: Choose Paste Format
|
CHOOSE_PASTE_FORMAT: Choose Paste Format
|
||||||
SEARCH: Search
|
SEARCH: Search
|
||||||
@ -217,6 +218,7 @@ TIPS_NETWORK_ERROR: Network Error
|
|||||||
TIPS_NEED_RELOAD: Need Reload App
|
TIPS_NEED_RELOAD: Need Reload App
|
||||||
TIPS_PLEASE_CHOOSE_LOG_LEVEL: Please choose log level
|
TIPS_PLEASE_CHOOSE_LOG_LEVEL: Please choose log level
|
||||||
TIPS_SET_SUCCEED: Set successfully
|
TIPS_SET_SUCCEED: Set successfully
|
||||||
|
TIPS_RESET_SUCCEED: Reset successfully
|
||||||
TIPS_PLUGIN_NOT_GUI_IMPLEMENT: This plugin is not optimized for the GUI, continue?
|
TIPS_PLUGIN_NOT_GUI_IMPLEMENT: This plugin is not optimized for the GUI, continue?
|
||||||
TIPS_CLICK_NOTIFICATION_TO_RELOAD: Click notification to reload app
|
TIPS_CLICK_NOTIFICATION_TO_RELOAD: Click notification to reload app
|
||||||
TIPS_GET_PLUGIN_LIST_FAILED: Get plugin list failed
|
TIPS_GET_PLUGIN_LIST_FAILED: Get plugin list failed
|
||||||
|
@ -48,6 +48,7 @@ COPY_PICBED_CONFIG_SUCCEED: 复制图床配置成功
|
|||||||
INPUT: 输入框
|
INPUT: 输入框
|
||||||
CANCEL: 取消
|
CANCEL: 取消
|
||||||
CONFIRM: 确定
|
CONFIRM: 确定
|
||||||
|
RESET_PICBED_CONFIG: 重置
|
||||||
CHOOSE_SHOWED_PICBED: 请选择显示的图床
|
CHOOSE_SHOWED_PICBED: 请选择显示的图床
|
||||||
CHOOSE_PASTE_FORMAT: 请选择粘贴的格式
|
CHOOSE_PASTE_FORMAT: 请选择粘贴的格式
|
||||||
SEARCH: 搜索
|
SEARCH: 搜索
|
||||||
@ -217,6 +218,7 @@ TIPS_NETWORK_ERROR: 网络错误暂时无法获取
|
|||||||
TIPS_NEED_RELOAD: 需要重启生效
|
TIPS_NEED_RELOAD: 需要重启生效
|
||||||
TIPS_PLEASE_CHOOSE_LOG_LEVEL: 请选择日志记录等级
|
TIPS_PLEASE_CHOOSE_LOG_LEVEL: 请选择日志记录等级
|
||||||
TIPS_SET_SUCCEED: 设置成功
|
TIPS_SET_SUCCEED: 设置成功
|
||||||
|
TIPS_RESET_SUCCEED: 重置成功
|
||||||
TIPS_PLUGIN_NOT_GUI_IMPLEMENT: 该插件未对可视化界面进行优化, 是否继续安装?
|
TIPS_PLUGIN_NOT_GUI_IMPLEMENT: 该插件未对可视化界面进行优化, 是否继续安装?
|
||||||
TIPS_CLICK_NOTIFICATION_TO_RELOAD: 请点击此通知重启应用以生效
|
TIPS_CLICK_NOTIFICATION_TO_RELOAD: 请点击此通知重启应用以生效
|
||||||
TIPS_GET_PLUGIN_LIST_FAILED: 获取插件列表失败
|
TIPS_GET_PLUGIN_LIST_FAILED: 获取插件列表失败
|
||||||
|
@ -48,6 +48,7 @@ COPY_PICBED_CONFIG_SUCCEED: 複製圖床設定成功
|
|||||||
INPUT: 輸入框
|
INPUT: 輸入框
|
||||||
CANCEL: 取消
|
CANCEL: 取消
|
||||||
CONFIRM: 確定
|
CONFIRM: 確定
|
||||||
|
RESET_PICBED_CONFIG: 重置
|
||||||
CHOOSE_SHOWED_PICBED: 請選擇顯示的圖床
|
CHOOSE_SHOWED_PICBED: 請選擇顯示的圖床
|
||||||
CHOOSE_PASTE_FORMAT: 請選擇貼上的格式
|
CHOOSE_PASTE_FORMAT: 請選擇貼上的格式
|
||||||
SEARCH: 搜尋
|
SEARCH: 搜尋
|
||||||
@ -217,6 +218,7 @@ TIPS_NETWORK_ERROR: 網路錯誤,暫時無法取得
|
|||||||
TIPS_NEED_RELOAD: 需要重新啟動生效
|
TIPS_NEED_RELOAD: 需要重新啟動生效
|
||||||
TIPS_PLEASE_CHOOSE_LOG_LEVEL: 請選擇記錄等級
|
TIPS_PLEASE_CHOOSE_LOG_LEVEL: 請選擇記錄等級
|
||||||
TIPS_SET_SUCCEED: 設定成功
|
TIPS_SET_SUCCEED: 設定成功
|
||||||
|
TIPS_RESET_SUCCEED: 重置成功
|
||||||
TIPS_PLUGIN_NOT_GUI_IMPLEMENT: 該插件未對GUI進行優化,是否繼續安裝?
|
TIPS_PLUGIN_NOT_GUI_IMPLEMENT: 該插件未對GUI進行優化,是否繼續安裝?
|
||||||
TIPS_CLICK_NOTIFICATION_TO_RELOAD: 請點擊此通知重新啟動程式以生效
|
TIPS_CLICK_NOTIFICATION_TO_RELOAD: 請點擊此通知重新啟動程式以生效
|
||||||
TIPS_GET_PLUGIN_LIST_FAILED: 取得插件列表失敗
|
TIPS_GET_PLUGIN_LIST_FAILED: 取得插件列表失敗
|
||||||
|
@ -4,6 +4,7 @@ import { RPC_ACTIONS } from '#/events/constants'
|
|||||||
import {
|
import {
|
||||||
deleteUploaderConfig,
|
deleteUploaderConfig,
|
||||||
getUploaderConfigList,
|
getUploaderConfigList,
|
||||||
|
resetUploaderConfig,
|
||||||
selectUploaderConfig,
|
selectUploaderConfig,
|
||||||
updateUploaderConfig
|
updateUploaderConfig
|
||||||
} from '~/main/utils/handleUploaderConfig'
|
} from '~/main/utils/handleUploaderConfig'
|
||||||
@ -33,6 +34,11 @@ class RPCServer {
|
|||||||
this.sendBack(event, action, true, callbackId)
|
this.sendBack(event, action, true, callbackId)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
case IRPCActionType.RESET_UPLOADER_CONFIG: {
|
||||||
|
this.resetUploaderConfig(args as IResetUploaderConfigArgs)
|
||||||
|
this.sendBack(event, action, true, callbackId)
|
||||||
|
break
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
this.sendBack(event, action, null, callbackId)
|
this.sendBack(event, action, null, callbackId)
|
||||||
break
|
break
|
||||||
@ -74,6 +80,12 @@ class RPCServer {
|
|||||||
const res = updateUploaderConfig(type, id, config)
|
const res = updateUploaderConfig(type, id, config)
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private resetUploaderConfig (args: IResetUploaderConfigArgs) {
|
||||||
|
const [type, id] = args
|
||||||
|
const res = resetUploaderConfig(type, id)
|
||||||
|
return res
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const rpcServer = new RPCServer()
|
const rpcServer = new RPCServer()
|
||||||
|
@ -167,3 +167,23 @@ export const updateUploaderConfig = (type: string, id: string, config: IStringKe
|
|||||||
[`picBed.${type}`]: updatedConfig
|
[`picBed.${type}`]: updatedConfig
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset selected congfig id to default
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const resetUploaderConfig = (type: string, id: string) => {
|
||||||
|
const { configList } = getUploaderConfigList(type)
|
||||||
|
configList.forEach((item: IStringKeyMap) => {
|
||||||
|
if (item._id === id) {
|
||||||
|
Object.keys(item).forEach(key => {
|
||||||
|
if (!['_configName', '_id', '_createdAt', '_updatedAt'].includes(key)) {
|
||||||
|
delete item[key]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
picgo.saveConfig({
|
||||||
|
[`uploader.${type}.configList`]: configList
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -27,14 +27,24 @@
|
|||||||
type="uploader"
|
type="uploader"
|
||||||
>
|
>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
|
<el-button-group>
|
||||||
<el-button
|
<el-button
|
||||||
class="confirm-btn"
|
class="confirm-btn"
|
||||||
type="primary"
|
type="info"
|
||||||
|
round
|
||||||
|
@click="handleReset"
|
||||||
|
>
|
||||||
|
{{ $T('RESET_PICBED_CONFIG') }}
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
class="confirm-btn"
|
||||||
|
type="success"
|
||||||
round
|
round
|
||||||
@click="handleConfirm"
|
@click="handleConfirm"
|
||||||
>
|
>
|
||||||
{{ $T('CONFIRM') }}
|
{{ $T('CONFIRM') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
</el-button-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</config-form>
|
</config-form>
|
||||||
<div
|
<div
|
||||||
@ -63,6 +73,7 @@ import {
|
|||||||
} from 'electron'
|
} from 'electron'
|
||||||
import { OPEN_URL } from '~/universal/events/constants'
|
import { OPEN_URL } from '~/universal/events/constants'
|
||||||
import { Link } from '@element-plus/icons-vue'
|
import { Link } from '@element-plus/icons-vue'
|
||||||
|
|
||||||
const type = ref('')
|
const type = ref('')
|
||||||
const config = ref<IPicGoPluginConfig[]>([])
|
const config = ref<IPicGoPluginConfig[]>([])
|
||||||
const picBedName = ref('')
|
const picBedName = ref('')
|
||||||
@ -90,6 +101,17 @@ const handleConfirm = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleReset = async () => {
|
||||||
|
await triggerRPC<void>(IRPCActionType.RESET_UPLOADER_CONFIG, type.value, $route.params.configId)
|
||||||
|
const successNotification = new Notification($T('SETTINGS_RESULT'), {
|
||||||
|
body: $T('TIPS_RESET_SUCCEED')
|
||||||
|
})
|
||||||
|
successNotification.onclick = () => {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
$router.back()
|
||||||
|
}
|
||||||
|
|
||||||
const linkToLogInList = ['github', 'tcyun', 'aliyun', 'smms', 'qiniu', 'imgur', 'upyun', 'githubPlus']
|
const linkToLogInList = ['github', 'tcyun', 'aliyun', 'smms', 'qiniu', 'imgur', 'upyun', 'githubPlus']
|
||||||
|
|
||||||
function handelNameClick () {
|
function handelNameClick () {
|
||||||
|
@ -63,4 +63,5 @@ export enum IRPCActionType {
|
|||||||
CHANGE_CURRENT_UPLOADER = 'CHANGE_CURRENT_UPLOADER',
|
CHANGE_CURRENT_UPLOADER = 'CHANGE_CURRENT_UPLOADER',
|
||||||
SELECT_UPLOADER = 'SELECT_UPLOADER',
|
SELECT_UPLOADER = 'SELECT_UPLOADER',
|
||||||
UPDATE_UPLOADER_CONFIG = 'UPDATE_UPLOADER_CONFIG',
|
UPDATE_UPLOADER_CONFIG = 'UPDATE_UPLOADER_CONFIG',
|
||||||
|
RESET_UPLOADER_CONFIG = 'RESET_UPLOADER_CONFIG'
|
||||||
}
|
}
|
||||||
|
2
src/universal/types/i18n.d.ts
vendored
2
src/universal/types/i18n.d.ts
vendored
@ -46,6 +46,7 @@ interface ILocales {
|
|||||||
INPUT: string
|
INPUT: string
|
||||||
CANCEL: string
|
CANCEL: string
|
||||||
CONFIRM: string
|
CONFIRM: string
|
||||||
|
RESET_PICBED_CONFIG: string
|
||||||
CHOOSE_SHOWED_PICBED: string
|
CHOOSE_SHOWED_PICBED: string
|
||||||
CHOOSE_PASTE_FORMAT: string
|
CHOOSE_PASTE_FORMAT: string
|
||||||
SEARCH: string
|
SEARCH: string
|
||||||
@ -196,6 +197,7 @@ interface ILocales {
|
|||||||
TIPS_NEED_RELOAD: string
|
TIPS_NEED_RELOAD: string
|
||||||
TIPS_PLEASE_CHOOSE_LOG_LEVEL: string
|
TIPS_PLEASE_CHOOSE_LOG_LEVEL: string
|
||||||
TIPS_SET_SUCCEED: string
|
TIPS_SET_SUCCEED: string
|
||||||
|
TIPS_RESET_SUCCEED: string
|
||||||
TIPS_PLUGIN_NOT_GUI_IMPLEMENT: string
|
TIPS_PLUGIN_NOT_GUI_IMPLEMENT: string
|
||||||
TIPS_CLICK_NOTIFICATION_TO_RELOAD: string
|
TIPS_CLICK_NOTIFICATION_TO_RELOAD: string
|
||||||
TIPS_GET_PLUGIN_LIST_FAILED: string
|
TIPS_GET_PLUGIN_LIST_FAILED: string
|
||||||
|
1
src/universal/types/rpc.d.ts
vendored
1
src/universal/types/rpc.d.ts
vendored
@ -2,3 +2,4 @@ type IGetUploaderConfigListArgs = [type: string]
|
|||||||
type IDeleteUploaderConfigArgs = [type: string, id: string]
|
type IDeleteUploaderConfigArgs = [type: string, id: string]
|
||||||
type ISelectUploaderConfigArgs = [type: string, id: string]
|
type ISelectUploaderConfigArgs = [type: string, id: string]
|
||||||
type IUpdateUploaderConfigArgs = [type: string, id: string, config: IStringKeyMap]
|
type IUpdateUploaderConfigArgs = [type: string, id: string, config: IStringKeyMap]
|
||||||
|
type IResetUploaderConfigArgs = [type: string, id: string]
|
||||||
|
Loading…
Reference in New Issue
Block a user