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: with:
generate_release_notes: true generate_release_notes: true
files: | 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 - name: Build release
run: cargo build --profile release-github 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" "src": "assets/logo.svg"
}, },
"index.html": { "index.html": {
"file": "assets/index-8d982016.js", "file": "assets/index-b673c0d1.js",
"isEntry": true, "isEntry": true,
"src": "index.html" "src": "index.html"
} }

View file

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

View file

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

View file

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

View file

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

View file

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