Desktop: fix bugs when changing numbers in configuration

This commit is contained in:
Igor Katson 2023-12-08 12:14:17 +00:00
parent 7b5c9cad60
commit 808bef11db
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
8 changed files with 21 additions and 19 deletions

View file

@ -29,7 +29,7 @@ jobs:
with:
generate_release_notes: true
files: |
desktop/src-tauri/target/release/bundle/msi/rqbit-desktop_5.0.1_x64_en-US.msi
desktop/src-tauri/target/release/bundle/msi/rqbit-desktop_5.0.2_x64_en-US.msi
- name: Build release
run: cargo build --profile release-github

File diff suppressed because one or more lines are too long

View file

@ -4,7 +4,7 @@
"src": "assets/logo.svg"
},
"index.html": {
"file": "assets/index-8d982016.js",
"file": "assets/index-b673c0d1.js",
"isEntry": true,
"src": "index.html"
}

View file

@ -67,12 +67,12 @@ async fn forward_port(
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:AddPortMapping xmlns:u="{}">
<u:AddPortMapping xmlns:u="{SERVICE_TYPE_WAN_IP_CONNECTION}">
<NewRemoteHost></NewRemoteHost>
<NewExternalPort>{}</NewExternalPort>
<NewExternalPort>{port}</NewExternalPort>
<NewProtocol>TCP</NewProtocol>
<NewInternalPort>{}</NewInternalPort>
<NewInternalClient>{}</NewInternalClient>
<NewInternalPort>{port}</NewInternalPort>
<NewInternalClient>{local_ip}</NewInternalClient>
<NewEnabled>1</NewEnabled>
<NewPortMappingDescription>rust UPnP</NewPortMappingDescription>
<NewLeaseDuration>{}</NewLeaseDuration>
@ -80,10 +80,6 @@ async fn forward_port(
</s:Body>
</s:Envelope>
"#,
SERVICE_TYPE_WAN_IP_CONNECTION,
port,
port,
local_ip,
lease_duration.as_secs()
);

View file

@ -3011,7 +3011,7 @@ dependencies = [
[[package]]
name = "rqbit-desktop"
version = "5.0.1"
version = "5.0.2"
dependencies = [
"anyhow",
"base64 0.21.5",

View file

@ -1,6 +1,6 @@
[package]
name = "rqbit-desktop"
version = "5.0.1"
version = "5.0.2"
description = "rqbit torrent client"
authors = ["you"]
license = ""

View file

@ -24,7 +24,7 @@ function errorToUIError(
let reason: ErrorDetails = {
method: "INVOKE",
path: path,
text: e.human_readable,
text: e.human_readable ?? e.toString(),
status: e.status,
statusText: e.status_text,
};

View file

@ -9,7 +9,7 @@ const FormCheck: React.FC<{
label: string;
name: string;
checked: boolean;
onChange: (e: any) => void;
onChange: React.ChangeEventHandler<HTMLInputElement>;
disabled?: boolean;
help?: string;
}> = ({ label, name, checked, onChange, disabled, help }) => {
@ -35,7 +35,7 @@ const FormInput: React.FC<{
name: string;
value: string | number;
inputType: string;
onChange: (e: any) => void;
onChange: React.ChangeEventHandler<HTMLInputElement>;
disabled?: boolean;
help?: string;
}> = ({ label, name, value, inputType, onChange, disabled, help }) => {
@ -76,9 +76,13 @@ export const ConfigModal: React.FC<{
const [error, setError] = useState<any | null>(null);
const handleInputChange = (e: any) => {
const handleInputChange: React.ChangeEventHandler<HTMLInputElement> = (e) => {
const name: string = e.target.name;
const value: any = e.target.value;
let value: string | number = e.target.value;
if (e.target.type == "number") {
value = e.target.valueAsNumber;
}
console.log(value, typeof value);
const [mainField, subField] = name.split(".", 2);
if (subField) {
@ -97,7 +101,9 @@ export const ConfigModal: React.FC<{
}
};
const handleToggleChange = (e: any) => {
const handleToggleChange: React.ChangeEventHandler<HTMLInputElement> = (
e
) => {
const name: string = e.target.name;
const [mainField, subField] = name.split(".", 2);