diff --git a/src/home.html b/src/home.html index 28f4019..8ddfd0a 100644 --- a/src/home.html +++ b/src/home.html @@ -363,7 +363,7 @@ const init=async()=>{await checkAuth();await loadBuckets();}; document.getElementById('authLoginBtn').addEventListener('click',handleLogin); document.getElementById('authTokenInput').addEventListener('keydown',e=>{if(e.key==='Enter')handleLogin();}); - Object.assign(window, { switchBucket, navigateTo, debouncedSearch, downloadObject, copyLink, deleteObject, closeModal, showCreateBucketModal, createBucket, showCredentialsModal, logout }); + Object.assign(window, { switchBucket, navigateTo, debouncedSearch, downloadObject, copyLink, deleteObject, closeModal, showCreateBucketModal, createBucket, showCredentialsModal, showAuthScreen, logout }); init(); diff --git a/src/interfaces/http/controllers/home.html b/src/interfaces/http/controllers/home.html index 28f4019..8ddfd0a 100644 --- a/src/interfaces/http/controllers/home.html +++ b/src/interfaces/http/controllers/home.html @@ -363,7 +363,7 @@ const init=async()=>{await checkAuth();await loadBuckets();}; document.getElementById('authLoginBtn').addEventListener('click',handleLogin); document.getElementById('authTokenInput').addEventListener('keydown',e=>{if(e.key==='Enter')handleLogin();}); - Object.assign(window, { switchBucket, navigateTo, debouncedSearch, downloadObject, copyLink, deleteObject, closeModal, showCreateBucketModal, createBucket, showCredentialsModal, logout }); + Object.assign(window, { switchBucket, navigateTo, debouncedSearch, downloadObject, copyLink, deleteObject, closeModal, showCreateBucketModal, createBucket, showCredentialsModal, showAuthScreen, logout }); init(); diff --git a/test/production-e2e.test.ts b/test/production-e2e.test.ts index 7d1f1d1..80bb52c 100644 --- a/test/production-e2e.test.ts +++ b/test/production-e2e.test.ts @@ -18,7 +18,7 @@ */ import { afterAll, beforeAll, describe, expect, it } from 'bun:test'; -import { createReadStream, existsSync } from 'node:fs'; +import { existsSync } from 'node:fs'; // ── Config ─────────────────────────────────────────────────────────────────── const BASE_URL = process.env.BASE_URL || 'https://upload.asepharyana.my.id'; @@ -127,50 +127,6 @@ async function s3Request( }); } -/** - * Issue a SigV4-signed S3 request with a streaming body using - * "UNSIGNED-PAYLOAD" so we don't need to load the entire file into - * memory to compute a SHA-256 hash. - * - * The server's verifyBodyHash() skips verification when the header - * value is "UNSIGNED-PAYLOAD". This lets us send large files without - * pre-computing the body hash. - * - * The body is sent as a ReadableStream, which triggers chunked - * transfer encoding. This avoids setting Content-Length, which helps - * bypass intermediate proxy limits. - */ -async function s3StreamRequest( - method: string, - path: string, - opts: { - stream: ReadableStream | NodeJS.ReadableStream; - query?: Record; - extraHeaders?: Record; - }, -): Promise { - const url = new URL(path, BASE_URL); - if (opts.query) { - for (const [k, v] of Object.entries(opts.query)) url.searchParams.set(k, v); - } - const payloadHash = 'UNSIGNED-PAYLOAD'; - const headers = s3Headers( - method, - url.host, - url.pathname, - url.searchParams.toString(), - payloadHash, - opts.extraHeaders, - ); - // Omit Content-Type for streaming bodies so Bun uses chunked encoding - // and does not set Content-Length. - return fetch(url.toString(), { - method, - headers: { ...headers }, - body: opts.stream, - }); -} - // ── Web API helper ─────────────────────────────────────────────────────────── const api = (p: string) => `${BASE_URL}/api/v1${p}`; const authHeaders: Record = AUTH_TOKEN