fixed
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
document.getElementById('getSecretValue').addEventListener('click', async () => {
|
document.getElementById('getSecretValue').addEventListener('click', async () => {
|
||||||
const tmp = Math.floor(Date.now() / 1000);
|
const tmp = Math.floor(Date.now() / 1000);
|
||||||
const secretValue = get_secret_value(
|
const secretValue = get_secret_value(
|
||||||
BigInt(tmp),
|
getHTTPFormattedTime(),
|
||||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36',
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36',
|
||||||
'/api/v1/guestlogin'
|
'/api/v1/guestlogin'
|
||||||
);
|
);
|
||||||
@@ -62,6 +62,24 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getHTTPFormattedTime() {
|
||||||
|
const now = new Date();
|
||||||
|
const days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
||||||
|
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||||
|
|
||||||
|
const day = days[now.getUTCDay()];
|
||||||
|
const date = now.getUTCDate().toString().padStart(2, '0');
|
||||||
|
const month = months[now.getUTCMonth()];
|
||||||
|
const year = now.getUTCFullYear();
|
||||||
|
const hours = now.getUTCHours().toString().padStart(2, '0');
|
||||||
|
const minutes = now.getUTCMinutes().toString().padStart(2, '0');
|
||||||
|
const seconds = now.getUTCSeconds().toString().padStart(2, '0');
|
||||||
|
|
||||||
|
return `${day}, ${date} ${month} ${year} ${hours}:${minutes}:${seconds} GMT`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const httpTime = getHTTPFormattedTime();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
runWasm();
|
runWasm();
|
||||||
|
|||||||
8
web/hublib.d.ts
vendored
8
web/hublib.d.ts
vendored
@@ -1,6 +1,6 @@
|
|||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
export function get_secret_value(given_time: bigint, user_agent: string, url: string): string;
|
export function get_secret_value(http_time: string, user_agent: string, url: string): string;
|
||||||
|
|
||||||
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
||||||
|
|
||||||
@@ -63,10 +63,10 @@ export interface InitOutput {
|
|||||||
readonly ffi_hublib_rust_future_cancel_void: (a: bigint) => void;
|
readonly ffi_hublib_rust_future_cancel_void: (a: bigint) => void;
|
||||||
readonly ffi_hublib_rust_future_complete_void: (a: bigint, b: number) => void;
|
readonly ffi_hublib_rust_future_complete_void: (a: bigint, b: number) => void;
|
||||||
readonly ffi_hublib_rust_future_free_void: (a: bigint) => void;
|
readonly ffi_hublib_rust_future_free_void: (a: bigint) => void;
|
||||||
readonly uniffi_hublib_fn_func_get_secret_value: (a: number, b: bigint, c: bigint, d: bigint, e: number, f: number, g: bigint, h: bigint, i: number, j: number, k: number) => void;
|
readonly uniffi_hublib_fn_func_get_secret_value: (a: number, b: bigint, c: bigint, d: number, e: number, f: bigint, g: bigint, h: number, i: number, j: bigint, k: bigint, l: number, m: number, n: number) => void;
|
||||||
readonly uniffi_hublib_checksum_func_get_secret_value: () => number;
|
readonly uniffi_hublib_checksum_func_get_secret_value: () => number;
|
||||||
readonly get_secret_value: (a: bigint, b: number, c: number, d: number, e: number) => [number, number];
|
readonly get_secret_value: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
||||||
readonly uniffi_hublib_fn_func_recreate_secret_value: (a: number, b: bigint, c: bigint, d: bigint, e: number, f: number, g: bigint, h: bigint, i: number, j: number, k: bigint, l: bigint, m: number, n: number, o: number) => void;
|
readonly uniffi_hublib_fn_func_recreate_secret_value: (a: number, b: bigint, c: bigint, d: number, e: number, f: bigint, g: bigint, h: number, i: number, j: bigint, k: bigint, l: number, m: number, n: bigint, o: bigint, p: number, q: number, r: number) => void;
|
||||||
readonly uniffi_hublib_checksum_func_recreate_secret_value: () => number;
|
readonly uniffi_hublib_checksum_func_recreate_secret_value: () => number;
|
||||||
readonly __wbindgen_export_0: WebAssembly.Table;
|
readonly __wbindgen_export_0: WebAssembly.Table;
|
||||||
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
||||||
|
|||||||
@@ -74,25 +74,27 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param {bigint} given_time
|
* @param {string} http_time
|
||||||
* @param {string} user_agent
|
* @param {string} user_agent
|
||||||
* @param {string} url
|
* @param {string} url
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export function get_secret_value(given_time, user_agent, url) {
|
export function get_secret_value(http_time, user_agent, url) {
|
||||||
let deferred3_0;
|
let deferred4_0;
|
||||||
let deferred3_1;
|
let deferred4_1;
|
||||||
try {
|
try {
|
||||||
const ptr0 = passStringToWasm0(user_agent, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
const ptr0 = passStringToWasm0(http_time, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||||
const len0 = WASM_VECTOR_LEN;
|
const len0 = WASM_VECTOR_LEN;
|
||||||
const ptr1 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
const ptr1 = passStringToWasm0(user_agent, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||||
const len1 = WASM_VECTOR_LEN;
|
const len1 = WASM_VECTOR_LEN;
|
||||||
const ret = wasm.get_secret_value(given_time, ptr0, len0, ptr1, len1);
|
const ptr2 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||||
deferred3_0 = ret[0];
|
const len2 = WASM_VECTOR_LEN;
|
||||||
deferred3_1 = ret[1];
|
const ret = wasm.get_secret_value(ptr0, len0, ptr1, len1, ptr2, len2);
|
||||||
|
deferred4_0 = ret[0];
|
||||||
|
deferred4_1 = ret[1];
|
||||||
return getStringFromWasm0(ret[0], ret[1]);
|
return getStringFromWasm0(ret[0], ret[1]);
|
||||||
} finally {
|
} finally {
|
||||||
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
6
web/hublib_bg.wasm.d.ts
vendored
6
web/hublib_bg.wasm.d.ts
vendored
@@ -58,10 +58,10 @@ export const ffi_hublib_rust_future_poll_void: (a: bigint, b: number, c: bigint)
|
|||||||
export const ffi_hublib_rust_future_cancel_void: (a: bigint) => void;
|
export const ffi_hublib_rust_future_cancel_void: (a: bigint) => void;
|
||||||
export const ffi_hublib_rust_future_complete_void: (a: bigint, b: number) => void;
|
export const ffi_hublib_rust_future_complete_void: (a: bigint, b: number) => void;
|
||||||
export const ffi_hublib_rust_future_free_void: (a: bigint) => void;
|
export const ffi_hublib_rust_future_free_void: (a: bigint) => void;
|
||||||
export const uniffi_hublib_fn_func_get_secret_value: (a: number, b: bigint, c: bigint, d: bigint, e: number, f: number, g: bigint, h: bigint, i: number, j: number, k: number) => void;
|
export const uniffi_hublib_fn_func_get_secret_value: (a: number, b: bigint, c: bigint, d: number, e: number, f: bigint, g: bigint, h: number, i: number, j: bigint, k: bigint, l: number, m: number, n: number) => void;
|
||||||
export const uniffi_hublib_checksum_func_get_secret_value: () => number;
|
export const uniffi_hublib_checksum_func_get_secret_value: () => number;
|
||||||
export const get_secret_value: (a: bigint, b: number, c: number, d: number, e: number) => [number, number];
|
export const get_secret_value: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
||||||
export const uniffi_hublib_fn_func_recreate_secret_value: (a: number, b: bigint, c: bigint, d: bigint, e: number, f: number, g: bigint, h: bigint, i: number, j: number, k: bigint, l: bigint, m: number, n: number, o: number) => void;
|
export const uniffi_hublib_fn_func_recreate_secret_value: (a: number, b: bigint, c: bigint, d: number, e: number, f: bigint, g: bigint, h: number, i: number, j: bigint, k: bigint, l: number, m: number, n: bigint, o: bigint, p: number, q: number, r: number) => void;
|
||||||
export const uniffi_hublib_checksum_func_recreate_secret_value: () => number;
|
export const uniffi_hublib_checksum_func_recreate_secret_value: () => number;
|
||||||
export const __wbindgen_export_0: WebAssembly.Table;
|
export const __wbindgen_export_0: WebAssembly.Table;
|
||||||
export const __wbindgen_malloc: (a: number, b: number) => number;
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
||||||
|
|||||||
Reference in New Issue
Block a user