Skip to content

Commit

Permalink
Desktop: fix bugs when changing numbers in configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ikatson committed Dec 8, 2023
1 parent 7b5c9ca commit 808bef1
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/librqbit/webui/dist/assets/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion crates/librqbit/webui/dist/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
12 changes: 4 additions & 8 deletions crates/upnp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,19 @@ 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>
</u:AddPortMapping>
</s:Body>
</s:Envelope>
"#,
SERVICE_TYPE_WAN_IP_CONNECTION,
port,
port,
local_ip,
lease_duration.as_secs()
);

Expand Down
2 changes: 1 addition & 1 deletion desktop/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion desktop/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rqbit-desktop"
version = "5.0.1"
version = "5.0.2"
description = "rqbit torrent client"
authors = ["you"]
license = ""
Expand Down
2 changes: 1 addition & 1 deletion desktop/src/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
16 changes: 11 additions & 5 deletions desktop/src/configure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand All @@ -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 }) => {
Expand Down Expand Up @@ -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) {
Expand All @@ -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);

Expand Down

0 comments on commit 808bef1

Please sign in to comment.