合并钟仕骏提交的配置服务器IP界面(需要Debug)

This commit is contained in:
fangxiang 2023-01-18 19:08:28 +08:00
parent 2b60548fa9
commit d9c0368b7b
5 changed files with 277 additions and 77 deletions

View File

@ -1443,6 +1443,18 @@ export default class ClientConnection {
);
}
public async setCloudServerSetting(
cloud_server_address: string,
cloud_server_verify_key: string,
cloud_server_use_wss: boolean,
cloud_server_enable: boolean
) {
this.setConfigure("cloud_server_address", cloud_server_address);
this.setConfigure("cloud_server_verify_key", cloud_server_verify_key);
this.setConfigure("cloud_server_use_wss", cloud_server_use_wss ? "1" : "0");
this.setConfigure("cloud_server_enable", cloud_server_enable ? "1" : "0");
}
public destory() {
this.ws?.close();
if (this.ws) {

View File

@ -103,6 +103,14 @@
:label="$t('other setting')"
:disable="loading"
/>
<q-tab
v-if="$store.state.advanced_debug"
name="cloud_server"
no-caps
icon="cloud"
:label="$t('cloud server')"
:disable="loading"
/>
<q-tab
name="user"
no-caps
@ -1023,6 +1031,103 @@
</q-card>
</q-tab-panel>
<q-tab-panel name="cloud_server" class="_panel">
<q-card class="fit">
<q-card-section>
<q-form ref="cloud_server_form" @submit="applyCloudServer">
<q-list>
<q-item class="q-pa-none">
<q-item-section avatar class="width_5_1">{{
$t("enable") + $t(" ") + $t("server") + ":"
}}</q-item-section>
<q-item-section>
<q-select
v-model="cloud_server_enable"
:options="[$t('enable'), $t('disable')]"
:loading="loading"
:disable="loading"
@update:model-value="autoIpChanged"
/>
</q-item-section>
</q-item>
<q-item
class="q-pa-none"
:disable="cloud_server_enable != $t('enable')"
>
<q-item-section avatar class="width_5_1">{{
$t("server address") + ":"
}}</q-item-section>
<q-item-section>
<q-input
v-model="cloud_server_address"
:loading="loading"
:disable="
cloud_server_enable != $t('enable') || loading
"
maxlength="15"
:rules="[
(val) =>
(val && val.length > 0) ||
$t('Please type something'),
(val) =>
isIpAddress(val) ||
$t('Please input vaild ip address'),
]"
lazy-rules
/>
</q-item-section>
</q-item>
<q-item
class="q-pa-none"
:disable="cloud_server_enable != $t('enable')"
>
<q-item-section avatar class="width_5_1">{{
$t("device verify key") + ":"
}}</q-item-section>
<q-item-section>
<q-input
:loading="loading"
:disable="
cloud_server_enable != $t('enable') || loading
"
v-model="cloud_server_verify_key"
maxlength="6"
:rules="[
(val) =>
(val && val.length > 0) ||
$t('Please type something'),
(val) =>
(val && val.length == 6) ||
$t('verify key length is 6'),
]"
lazy-rules
/>
</q-item-section>
</q-item>
<q-item
class="q-pa-none"
:disable="cloud_server_enable != $t('enable')"
>
<q-item-section avatar class="width_5_1">{{
$t("use wss") + ":"
}}</q-item-section>
<q-item-section>
<q-select
v-model="cloud_server_use_wss"
:options="[$t('enable'), $t('disable')]"
:loading="loading"
:disable="
cloud_server_enable != $t('enable') || loading
"
/>
</q-item-section>
</q-item>
</q-list>
</q-form>
</q-card-section>
</q-card>
</q-tab-panel>
<q-tab-panel name="user" class="_panel">
<q-card class="fit">
<q-card-section>
@ -1395,41 +1500,45 @@ import vue3ResizeDrag from "src/third_lib/vue3-resize-drag/components/vue3-resiz
export default defineComponent({
name: "ComponentSystemSettingDialog",
components: { TimingTaskDialog, SystenSettingAdvancedNetworkDialog ,vue3ResizeDrag},
components: {
TimingTaskDialog,
SystenSettingAdvancedNetworkDialog,
vue3ResizeDrag,
},
setup() {
let $store = useStore();
let $q = useQuasar();
let $t = useI18n();
const $store = useStore();
const $q = useQuasar();
const $t = useI18n();
let show_dialog = ref(false);
let loading = ref(false);
const show_dialog = ref(false);
const loading = ref(false);
const timing_task_dialog: Ref<any> = ref(null);
const system_setting_advanced_network_dialog: Ref<any> = ref(null);
let tab = ref("network");
const tab = ref("network");
let auto_ip = ref($t.t("enable"));
let ip_address = ref("127.0.0.1");
let gateway = ref("127.0.0.1");
let netmask = ref("127.0.0.1");
let dns1 = ref();
let dns2 = ref();
let mac_address = ref("11:22:33:44:55:66");
const auto_ip = ref($t.t("enable"));
const ip_address = ref("127.0.0.1");
const gateway = ref("127.0.0.1");
const netmask = ref("127.0.0.1");
const dns1 = ref();
const dns2 = ref();
const mac_address = ref("11:22:33:44:55:66");
let ip_address_list: AdvancedIpAddressEntity[] = [];
let host_name = "player";
let brightness = ref(0);
let contrast = ref(0);
let hue = ref(0);
const brightness = ref(0);
const contrast = ref(0);
const hue = ref(0);
const mirroring_output = ref(false);
let device_resolution = ref("");
let device_resolution_options: Ref<string[]> = ref([]);
let device_rotate = ref(0);
let device_rotate_options = ref([
const device_resolution = ref("");
const device_resolution_options: Ref<string[]> = ref([]);
const device_rotate = ref(0);
const device_rotate_options = ref([
{
label: "0°",
value: 0,
@ -1463,8 +1572,8 @@ export default defineComponent({
// value: 7,
// },
]);
let device_resolution_type = ref("EDID");
let device_resolution_type_options = ref([
const device_resolution_type = ref("EDID");
const device_resolution_type_options = ref([
{ label: "EDID", value: "EDID" },
{ label: $t.t("force output") /*+ "(CVT)"*/, value: "CVT" },
{
@ -1472,61 +1581,67 @@ export default defineComponent({
value: "CUSTOM",
},
]);
let device_resolution_timing = ref("");
const device_resolution_timing = ref("");
let output_board_resolution = ref("");
let output_board_resolution_options = ref(["1", "2", "3"]);
const output_board_resolution = ref("");
const output_board_resolution_options = ref(["1", "2", "3"]);
let system_muted = ref($t.t("off"));
let system_volume = ref(100);
let output_audio_card_options = ref([
const system_muted = ref($t.t("off"));
const system_volume = ref(100);
const output_audio_card_options = ref([
{ label: $t.t("all"), value: "all" },
{ label: "3.5mm", value: "3.5mm" },
{ label: "HDMI1", value: "HDMI1" },
]);
let old_output_audio_card = "";
let output_audio_card = ref(output_audio_card_options.value[0].value);
let use_ntp = ref($t.t("enable"));
let ntp_server = ref("");
let ntp_sync_delay = ref(180);
let current_date = ref("");
let current_time = ref("");
let time_zone = ref("");
let time_zone_options: Ref<string[]> = ref([]);
const output_audio_card = ref(output_audio_card_options.value[0].value);
const use_ntp = ref($t.t("enable"));
const ntp_server = ref("");
const ntp_sync_delay = ref(180);
const current_date = ref("");
const current_time = ref("");
const time_zone = ref("");
const time_zone_options: Ref<string[]> = ref([]);
for (const item of _time_zones) {
time_zone_options.value.push($t.t(item));
}
let network_form: Ref<any> = ref(null);
let other_form: Ref<any> = ref(null);
let graphics_form: Ref<any> = ref(null);
let output_board_form: Ref<any> = ref(null);
const network_form: Ref<any> = ref(null);
const other_form: Ref<any> = ref(null);
const graphics_form: Ref<any> = ref(null);
const output_board_form: Ref<any> = ref(null);
const user_form: Ref<any> = ref(null);
const cloud_server_form: Ref<any> = ref(null);
let output_board_wall_row = ref(2);
let output_board_wall_col = ref(2);
let output_board_splicing = ref($t.t("on"));
let output_board_vertical_blanking = ref(0);
let output_board_horizon_blanking = ref(0);
let output_board_rotate = ref(0);
const output_board_wall_row = ref(2);
const output_board_wall_col = ref(2);
const output_board_splicing = ref($t.t("on"));
const output_board_vertical_blanking = ref(0);
const output_board_horizon_blanking = ref(0);
const output_board_rotate = ref(0);
const output_board_rotate_options = ref([
{ label: "0°", value: 0 },
{ label: "180°", value: 1 },
]);
let output_board_volume = ref(100);
let output_board_mute = ref($t.t("on"));
const output_board_volume = ref(100);
const output_board_mute = ref($t.t("on"));
const timing_tasks: Ref<TimingTaskEntity[]> = ref([]);
let click_count = ref(0);
const click_count = ref(0);
const target_click_count = ref(20);
let client_version = ref(version);
let server_version = ref("unknow");
let server_commit_hash = ref("unknow");
let server_build_date = ref("unknow");
let server_branch_name = ref("unknow");
let kernel_version = ref("unknow");
let rootfs_version = ref("unknow");
const client_version = ref(version);
const server_version = ref("unknow");
const server_commit_hash = ref("unknow");
const server_build_date = ref("unknow");
const server_branch_name = ref("unknow");
const kernel_version = ref("unknow");
const rootfs_version = ref("unknow");
const cloud_server_enable = ref($t.t("enable"));
const cloud_server_address = ref("");
const cloud_server_verify_key = ref("");
const cloud_server_use_wss = ref($t.t("enable"));
const refresh_network = () => {
const config = GlobalData.getInstance()?.applicationConfig;
@ -1643,11 +1758,28 @@ export default defineComponent({
}
};
const refresh_cloud_server = () => {
const config = GlobalData.getInstance()?.applicationConfig;
if (config) {
cloud_server_enable.value = parseInt(config.cloud_server_enable)
? $t.t("enable")
: $t.t("disable");
cloud_server_address.value =
config.cloud_server_address || "192.168.1.1";
cloud_server_verify_key.value =
config.cloud_server_verify_key || "123456";
cloud_server_use_wss.value = parseInt(config.cloud_server_use_wss)
? $t.t("enable")
: $t.t("disable");
}
};
const refresh_all = () => {
refresh_network();
refresh_graphics();
refresh_other();
refresh_output_board();
refresh_cloud_server();
};
const wait_for = async (delay_ms: number) => {
@ -1938,12 +2070,46 @@ export default defineComponent({
case "output_board":
output_board_form.value.submit();
break;
case "cloud_server":
cloud_server_form.value.submit();
break;
case "user":
user_form.value.submit();
break;
}
};
const applyCloudServer = async () => {
loading.value = true;
let success = false;
try {
await GlobalData.getInstance()
.getCurrentClient()
?.setCloudServerSetting(
cloud_server_address.value,
cloud_server_verify_key.value,
cloud_server_use_wss.value == $t.t("enable"),
cloud_server_enable.value == $t.t("enable")
);
success = true;
} catch {}
$q.notify({
color: success ? "positive" : "negative",
icon: success ? "done" : "warning",
message:
$t.t("set system server") +
(success ? $t.t("success") : $t.t("fail")) +
"!",
position: "top",
timeout: 2500,
});
loading.value = false;
};
const applyUser = async () => {
loading.value = true;
console.log("zzz");
@ -2117,6 +2283,7 @@ export default defineComponent({
other_form,
graphics_form,
output_board_form,
cloud_server_form,
user_form,
mirroring_output,
click_count,
@ -2128,6 +2295,10 @@ export default defineComponent({
server_branch_name,
kernel_version,
rootfs_version,
cloud_server_enable,
cloud_server_address,
cloud_server_verify_key,
cloud_server_use_wss,
user_name,
old_password,
new_password,
@ -2140,6 +2311,7 @@ export default defineComponent({
applyGraphics,
applyOther,
applyOutputBoard,
applyCloudServer,
applyUser,
loga(a: any) {
console.log(a);

View File

@ -41,4 +41,8 @@ export default class ApplicationConfigEntity {
image_suffix_filter: string | null = "";
special_video_layout_rotation: string | undefined = "0";
device_hdmi_rotation: number = 0;
cloud_server_address = "";
cloud_server_verify_key = "";
cloud_server_use_wss = "0";
cloud_server_enable = "0";
}

View File

@ -425,4 +425,10 @@ export default {
resetall: "reset all",
"save config": "save config",
"Whether to enable mixing": "Whether to enable mixing",
"device verify key": "Device Verify Key",
"use wss": "Use Wss",
"server address": "Server Address",
"cloud server": "Cloud Server",
"verify key length is 6": "Verify Key Length Is 6",
server: "Server",
};

View File

@ -673,24 +673,30 @@ export default {
"Please input vaild host. example: 192.168.1.1 or 192.168.1.1:8080":
"请输入合法地址. 例: 192.168.1.1 或 192.168.1.1:8080",
"equipment data": "联动设备",
"fusion settings":"融合设置",
"FusionLocale":"融合区域设置",
"FourPointCalibration":"四点校正",
"SurfaceCorrection":"曲面校正",
"DensityCorrection":"疏密校正",
"GridSettings":"网格设置",
"point":"点",
"reset":"重置",
"upper fusion zone parameters":"上融合带参数",
"Left fusion Band Parameters":"左融合带参数",
"Lower fusion Zone Parameters":"下融合带参数",
"Right fusion Band Parameters":"右融合带参数",
"Set the fusion band width":"设置融合带宽度",
"Please enter a number":"请输入数字",
"Please enter 0-100":"请输入 0-你的分辨率",
"Set Fusion Band Parameters":"设置融合带参数",
"Projector":"投影机",
"resetall":"重置所有",
"save config":"保存配置",
"Whether to enable mixing":"是否启用混合"
"fusion settings": "融合设置",
FusionLocale: "融合区域设置",
FourPointCalibration: "四点校正",
SurfaceCorrection: "曲面校正",
DensityCorrection: "疏密校正",
GridSettings: "网格设置",
point: "点",
reset: "重置",
"upper fusion zone parameters": "上融合带参数",
"Left fusion Band Parameters": "左融合带参数",
"Lower fusion Zone Parameters": "下融合带参数",
"Right fusion Band Parameters": "右融合带参数",
"Set the fusion band width": "设置融合带宽度",
"Please enter a number": "请输入数字",
"Please enter 0-100": "请输入 0-你的分辨率",
"Set Fusion Band Parameters": "设置融合带参数",
Projector: "投影机",
resetall: "重置所有",
"save config": "保存配置",
"Whether to enable mixing": "是否启用混合",
"device verify key": "设备校验码",
"use wss": "使用Wss",
"server address": "服务器地址",
"cloud server": "云服务器",
"verify key length is 6": "校验码长度必须为6",
server: "服务",
};