Skip to content

Commit

Permalink
fix: config _enable error
Browse files Browse the repository at this point in the history
  • Loading branch information
csj8520 committed Apr 8, 2024
1 parent 732ff9e commit eb058ed
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "utools-plugin-frpc",
"version": "0.1.2",
"version": "0.1.3",
"description": "utools 插件 frpc 客户端,可视化操作",
"scripts": {
"start": "vite",
Expand Down
2 changes: 1 addition & 1 deletion public/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "frpc 客户端,可视化操作",
"author": "https://github.com/csj8520",
"homepage": "https://github.com/csj8520/utools-plugin-frpc",
"version": "0.1.2",
"version": "0.1.3",
"logo": "logo.png",
"main": "index.html",
"preload": "preload.js",
Expand Down
4 changes: 4 additions & 0 deletions src/preload/frpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export class Frpc extends EventEmitter<FrpcEvent> {
// 读取 db 数据,若无数据则读取 json 配置
const data: FrpcConfig = utools.dbStorage.getItem(CONFIG_KEY) || this.defConfig;
// fix: config error

if (data.proxies.some(it => '_enable' in it)) {
data.proxies.forEach(it => delete it._enable);
}
if (data._custom) {
this.saveCustomConfig({ ...this.defCustomConfig, saveRestart: data._custom.saveRestart || false });
delete data._custom;
Expand Down
3 changes: 3 additions & 0 deletions src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ interface ProxyBaseConfig extends ProxyBackend {
loadBalancer?: LoadBalancerConfig;
/** 健康检查配置。 */
healthCheck?: HealthCheckConfig;

/** @deprecated */
_enable?: boolean;
}

/** 代理后端服务配置。 */
Expand Down
2 changes: 1 addition & 1 deletion src/views/proxy/edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const result = ref<FrpcConfig.Proxie>(null!);
const props = withDefaults(defineProps<{ modelValue?: boolean; data?: FrpcConfig.Proxie }>(), {
modelValue: false,
data: () => ({ type: 'http', name: '', _enable: true, transport: { useCompression: true, useEncryption: true } })
data: () => ({ type: 'http', name: '', transport: { useCompression: true, useEncryption: true } })
});
const emit = defineEmits(['update:modelValue', 'enter']);
Expand Down

0 comments on commit eb058ed

Please sign in to comment.