From ae370e8a62338b3d2375bb92f5a3ed06e65f1e66 Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Fri, 22 Nov 2024 18:05:18 +0800 Subject: [PATCH] chore(ui): use innerText instead of innerHTML --- flake.lock | 18 +++++++++--------- ui/src/main.ts | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/flake.lock b/flake.lock index 539e40c..0ac025d 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1730272153, - "narHash": "sha256-B5WRZYsRlJgwVHIV6DvidFN7VX7Fg9uuwkRW9Ha8z+w=", + "lastModified": 1731890469, + "narHash": "sha256-D1FNZ70NmQEwNxpSSdTXCSklBH1z2isPR84J6DQrJGs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2d2a9ddbe3f2c00747398f3dc9b05f7f2ebb0f53", + "rev": "5083ec887760adfe12af64830a66807423a859a7", "type": "github" }, "original": { @@ -66,11 +66,11 @@ ] }, "locked": { - "lastModified": 1730321837, - "narHash": "sha256-vK+a09qq19QNu2MlLcvN4qcRctJbqWkX7ahgPZ/+maI=", + "lastModified": 1732187120, + "narHash": "sha256-XdW2mYXvPHYtZ8oQqO3tRYtxx7kI0Hs3NU64IwAtD68=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "746901bb8dba96d154b66492a29f5db0693dbfcc", + "rev": "37f8f47cb618eddee0c0dd31a582b1cd3013c7f6", "type": "github" }, "original": { diff --git a/ui/src/main.ts b/ui/src/main.ts index 5e792af..e96574c 100644 --- a/ui/src/main.ts +++ b/ui/src/main.ts @@ -1,4 +1,4 @@ -async function main() { +async function main(): Promise { fetch("https://ip.ny4.dev/api/v1/ip") .then((response) => { if (!response.ok) { @@ -7,8 +7,8 @@ async function main() { return response.json(); }) .then((data) => { - document.getElementById("check-ny4-ip")!.innerHTML = data.ip; - document.getElementById("check-ny4-location")!.innerHTML = [ + document.getElementById("check-ny4-ip")!.innerText = data.ip; + document.getElementById("check-ny4-location")!.innerText = [ data.city, data.region, data.country, @@ -25,8 +25,8 @@ async function main() { return response.json(); }) .then((data) => { - document.getElementById("check-ipsb-ip")!.innerHTML = data.ip; - document.getElementById("check-ipsb-location")!.innerHTML = [ + document.getElementById("check-ipsb-ip")!.innerText = data.ip; + document.getElementById("check-ipsb-location")!.innerText = [ data.city, data.region, data.country, @@ -43,8 +43,8 @@ async function main() { return response.json(); }) .then((data) => { - document.getElementById("check-ipapiis-ip")!.innerHTML = data.ip; - document.getElementById("check-ipapiis-location")!.innerHTML = [ + document.getElementById("check-ipapiis-ip")!.innerText = data.ip; + document.getElementById("check-ipapiis-location")!.innerText = [ data.location.city, data.location.state, data.location.country, @@ -62,8 +62,8 @@ async function main() { }) .then((data) => { const v = data.data; - document.getElementById("check-speedtestcn-ip")!.innerHTML = v.ip; - document.getElementById("check-speedtestcn-location")!.innerHTML = [ + document.getElementById("check-speedtestcn-ip")!.innerText = v.ip; + document.getElementById("check-speedtestcn-location")!.innerText = [ v.city, v.province, v.country,