Compat with latest JS lib

This commit is contained in:
Sacha Weatherstone
2023-01-19 19:46:29 +10:00
parent 8ddb900f81
commit d538ba5a9d
51 changed files with 800 additions and 1027 deletions
+10 -10
View File
@@ -49,27 +49,27 @@ export const ImportDialog = ({
const apply = () => {
channelSet?.settings.map((ch, index) => {
connection?.setChannel({
channel: {
connection?.setChannel(
new Protobuf.Channel({
index,
role:
index === 0
? Protobuf.Channel_Role.PRIMARY
: Protobuf.Channel_Role.SECONDARY,
settings: ch
}
});
})
);
});
if (channelSet?.loraConfig) {
connection?.setConfig({
config: {
connection?.setConfig(
new Protobuf.Config({
payloadVariant: {
oneofKind: "lora",
lora: channelSet.loraConfig
case: "lora",
value: channelSet.loraConfig
}
}
});
})
);
}
};
+3 -3
View File
@@ -32,13 +32,13 @@ export const QRDialog = ({
.filter((channel) => selectedChannels.includes(channel.index))
.map((channel) => channel.settings)
.filter((ch): ch is Protobuf.ChannelSettings => !!ch);
const encoded = Protobuf.ChannelSet.toBinary(
Protobuf.ChannelSet.create({
const encoded = new Protobuf.ChannelSet(
new Protobuf.ChannelSet({
loraConfig,
settings: channelsToEncode
})
);
const base64 = fromByteArray(encoded)
const base64 = fromByteArray(encoded.toBinary())
.replace(/=/g, "")
.replace(/\+/g, "-")
.replace(/\//g, "_");
+2 -8
View File
@@ -37,9 +37,7 @@ export const RebootDialog = ({
icon: <ClockIcon className="w-4" />,
action() {
connection
?.reboot({
time: time * 60
})
?.reboot(time * 60)
.then(() => setRebootDialogOpen(false));
}
}}
@@ -48,11 +46,7 @@ export const RebootDialog = ({
className="w-24"
iconBefore={<ArrowPathIcon className="w-4" />}
onClick={() => {
connection
?.reboot({
time: 0
})
.then(() => setRebootDialogOpen(false));
connection?.reboot(2).then(() => setRebootDialogOpen(false));
}}
>
Now
+2 -8
View File
@@ -37,9 +37,7 @@ export const ShutdownDialog = ({
icon: <ClockIcon className="w-4" />,
action() {
connection
?.shutdown({
time: time * 60
})
?.shutdown(time * 60)
.then(() => setShutdownDialogOpen(false));
}
}}
@@ -48,11 +46,7 @@ export const ShutdownDialog = ({
className="w-24"
iconBefore={<PowerIcon className="w-4" />}
onClick={() => {
connection
?.shutdown({
time: 0
})
.then(() => setShutdownDialogOpen(false));
connection?.shutdown(2).then(() => setShutdownDialogOpen(false));
}}
>
Now