improvment

This commit is contained in:
BitcoinVM 2024-02-02 13:06:00 +08:00
parent bd080281a7
commit e19b309980
3 changed files with 36 additions and 26 deletions

View File

@ -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
});

View File

@ -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) {

View File

@ -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"