注册协议增加attribute字段

This commit is contained in:
fangxiang 2023-02-23 16:45:39 +08:00
parent 5c7ac2a7d0
commit 3bc125cff0
4 changed files with 28 additions and 21 deletions

View File

@ -1,6 +1,6 @@
{
"name": "media_player_client",
"version": "1.5.9",
"version": "1.6.0",
"description": "A Quasar Framework app",
"productName": "MediaPlayerClient",
"author": "fangxiang <fangxiang@cloudview.work>",

View File

@ -823,6 +823,7 @@ export default class ClientConnection {
active_code: string,
online: boolean,
active_forever: boolean,
attribute: number,
secret_key?: string,
hour?: number
) {
@ -833,6 +834,7 @@ export default class ClientConnection {
active_code,
online,
active_forever,
attribute,
secret_key,
hour,
0

View File

@ -461,7 +461,7 @@ import {
nextTick,
} from "vue";
import { useStore } from "src/store";
import { useQuasar, copyToClipboard } from "quasar";
import { useQuasar, copyToClipboard, Cookies } from "quasar";
import { useI18n } from "vue-i18n";
import GlobalData from "src/common/GlobalData";
import QrcodeVue from "qrcode.vue";
@ -707,22 +707,9 @@ export default defineComponent({
}
let success = false;
const response = await GlobalData.getInstance()
.getCurrentClient()
?.registerDevice(
register_code.value,
active_code.value,
register_type.value == "online",
active_type.value == "forever",
secret_key.value,
parseInt(active_hour.value.toString())
);
if (response) {
success = response.success;
}
if (success) {
let attribute = EDeviceAttribute.None;
{
if (function_center_control.value) {
attribute |= EDeviceAttribute.CenterControl;
}
@ -745,14 +732,28 @@ export default defineComponent({
function_fusion_count.value
);
}
}
GlobalData.getInstance()
const response = await GlobalData.getInstance()
.getCurrentClient()
?.setDeviceAttribute(attribute);
?.registerDevice(
register_code.value,
active_code.value,
register_type.value == "online",
active_type.value == "forever",
attribute,
secret_key.value,
parseInt(active_hour.value.toString())
);
if (response) {
success = response.success;
}
if (success) {
GlobalData.getInstance()
.getCurrentClient()
?.setServerLanguage(target_language.value);
Cookies.remove("language");
}
$q.notify({
@ -765,7 +766,7 @@ export default defineComponent({
position: "top",
timeout: 1500,
});
show_dialog.value = false;
show_dialog.value = !success;
} catch {}
loading.value = false;
},

View File

@ -1828,11 +1828,14 @@ export namespace Protocol {
online: boolean = false;
active_forever: boolean = false;
hour: number = 0;
attribute: number = 0;
constructor(
register_code: string,
active_code: string,
online: boolean,
active_forever: boolean,
attribute: number,
secret_key?: string,
hour?: number,
rcp_id?: number
@ -1847,6 +1850,7 @@ export namespace Protocol {
this.online = online;
this.active_forever = active_forever;
this.secret_key = secret_key ?? "";
this.attribute = attribute ?? 0;
if (active_forever) {
this.hour = 0;
} else {