From e19b309980a51e9375216f43860b07a61e698252 Mon Sep 17 00:00:00 2001 From: BitcoinVM <18786721@qq.com> Date: Fri, 2 Feb 2024 13:06:00 +0800 Subject: [PATCH] improvment --- src/libs/http.ts | 28 +++++++------------------ src/modules/[chain]/consensus/index.vue | 10 ++++----- yarn.lock | 24 +++++++++++++++++++++ 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/src/libs/http.ts b/src/libs/http.ts index 0c134fa8..5451a682 100644 --- a/src/libs/http.ts +++ b/src/libs/http.ts @@ -28,26 +28,12 @@ try { console.error(error.message); } // */ -const policies = [ - // Referer will never be set. - // 'no-referrer', - - // Referer will be set to just the origin except when navigating from HTTPS to HTTP, - // in which case no Referer is sent. - // 'strict-origin', - - // Full Referer for same-origin requests, and bare origin for cross-origin requests. - // 'origin-when-cross-origin', - - // Full Referer for same-origin requests, and bare origin for cross-origin requests - // except when navigating from HTTPS to HTTP, in which case no Referer is sent. - // 'strict-origin-when-cross-origin', - - // Full Referer for all requests, whether same- or cross-origin. - 'unsafe-url' -]; export async function get(url: string) { - return (await fetch(url, {referrerPolicy: 'unsafe-url'})).json(); + return (await fetch(url, {referrerPolicy: 'origin-when-cross-origin'})).json(); +} + +export async function getB(url: string) { + return (await fetch(url, {referrerPolicy: 'origin-when-cross-origin'})).arrayBuffer(); } export async function post(url: string, data: any) { @@ -55,11 +41,11 @@ export async function post(url: string, data: any) { method: 'POST', // *GET, POST, PUT, DELETE, etc. // mode: 'cors', // no-cors, *cors, same-origin // credentials: 'same-origin', // redirect: 'follow', // manual, *follow, error - referrerPolicy: 'unsafe-url', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url + referrerPolicy: 'origin-when-cross-origin', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url headers: { 'Content-Type': 'application/json', Accept: '*/*', - 'Accept-Encoding': 'gzip, deflate, br', + // 'Accept-Encoding': 'gzip, deflate, br', }, body: JSON.stringify(data), // body data type must match "Content-Type" header }); diff --git a/src/modules/[chain]/consensus/index.vue b/src/modules/[chain]/consensus/index.vue index e7b9a77a..241f47d0 100644 --- a/src/modules/[chain]/consensus/index.vue +++ b/src/modules/[chain]/consensus/index.vue @@ -68,11 +68,11 @@ function showName(i: number, text: string) { } return i; } - const txt = text.substring(text.indexOf(':') + 1, text.indexOf(' ')); - const sig = text.split(' '); - // @ts-ignore - const val = validators.value.find((x) => x?.hex?.startsWith(txt)); - return `${val?.description?.moniker || txt} - ${sig[2]}`; + // const txt = text.substring(text.indexOf(':') + 1, text.indexOf(' ')); + // const sig = text.split(' '); + // // @ts-ignore + // const val = validators.value.find((x) => x?.hex?.startsWith(txt)); + // return `${val?.description?.moniker || txt} - ${sig[2]}`; } function color(i: number, txt: string) { if (i === roundState.value?.proposer?.index) { diff --git a/yarn.lock b/yarn.lock index 930383d7..54429d52 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2184,6 +2184,11 @@ estree-walker "^2.0.2" picomatch "^2.3.1" +"@shikijs/core@1.0.0-beta.0": + version "1.0.0-beta.0" + resolved "https://registry.yarnpkg.com/@shikijs/core/-/core-1.0.0-beta.0.tgz#e38a10ce3398342553e37fe9b10db61fc00cc186" + integrity sha512-uicyrkx379Q5sxQuGV3kduHPWIAkjxmeA5A4J6syscx8wiEyIV06i/Q6s9GeKLCb857Hi90H8e/FoFSbcjnZsw== + "@sinclair/typebox@^0.24.1": version "0.24.51" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.51.tgz#645f33fe4e02defe26f2f5c0410e1c094eac7f5f" @@ -2194,6 +2199,13 @@ resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad" integrity sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA== +"@types/adm-zip@^0.5.5": + version "0.5.5" + resolved "https://registry.yarnpkg.com/@types/adm-zip/-/adm-zip-0.5.5.tgz#4588042726aa5f351d7ea88232e4a952f60e7c1a" + integrity sha512-YCGstVMjc4LTY5uK9/obvxBya93axZOVOyf2GSUulADzmLhYE45u2nAssCs/fWBs1Ifq5Vat75JTPwd5XZoPJw== + dependencies: + "@types/node" "*" + "@types/debug@^4.1.7": version "4.1.8" resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.8.tgz#cef723a5d0a90990313faec2d1e22aee5eecb317" @@ -2595,6 +2607,11 @@ acorn@^8.10.0, acorn@^8.8.2, acorn@^8.9.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== +adm-zip@^0.5.10: + version "0.5.10" + resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.5.10.tgz#4a51d5ab544b1f5ce51e1b9043139b639afff45b" + integrity sha512-x0HvcHqVJNTPk/Bw8JbLWlWoo6Wwnsug0fnYYro1HBrjxZ3G7/AZk7Ahv8JwDe1uIcz8eBqvu86FuF1POiG7vQ== + agent-base@6: version "6.0.2" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" @@ -6008,6 +6025,13 @@ shelljs@0.8.5: interpret "^1.0.0" rechoir "^0.6.2" +shiki@^1.0.0-beta.0: + version "1.0.0-beta.0" + resolved "https://registry.yarnpkg.com/shiki/-/shiki-1.0.0-beta.0.tgz#34d5d672fbc0f5ac65892cd681404fefaa565c8f" + integrity sha512-CcP0IhEDQ3LWfJC44cfxfId9pjJi9Nephl8DxgrL4tKWprI/oz6deZyL0vB+XWxhTx/1uonzWQKaSQPwKx5dTA== + dependencies: + "@shikijs/core" "1.0.0-beta.0" + side-channel@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf"