diff --git a/.prettierrc b/.prettierrc index 5c7b5d3..b01337c 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,5 @@ { - "printWidth": 140, + "printWidth": 120, "singleQuote": true, "semi": true, "useTabs": true diff --git a/src/index.ts b/src/index.ts index fe9f845..057f964 100644 --- a/src/index.ts +++ b/src/index.ts @@ -114,7 +114,10 @@ async function handle_get(request: Request, bucket: R2Bucket): Promise let href = `/${object.key + (object.customMetadata?.resourcetype === '' ? '/' : '')}`; page += `${object.httpMetadata?.contentDisposition ?? object.key}
`; } - return new Response(page, { status: 200, headers: { 'Content-Type': 'text/html; charset=utf-8' } }); + return new Response(page, { + status: 200, + headers: { 'Content-Type': 'text/html; charset=utf-8' }, + }); } else { let object = await bucket.get(resource_path, { onlyIf: request.headers, @@ -612,8 +615,8 @@ export default { const { bucket } = env; if ( - request.method !== 'OPTIONS' - && request.headers.get('Authorization') !== `Basic ${btoa(`${env.USERNAME}:${env.PASSWORD}`)}` + request.method !== 'OPTIONS' && + request.headers.get('Authorization') !== `Basic ${btoa(`${env.USERNAME}:${env.PASSWORD}`)}` ) { return new Response('Unauthorized', { status: 401, @@ -634,7 +637,9 @@ export default { ); response.headers.set( 'Access-Control-Expose-Headers', - ['content-type', 'content-length', 'dav', 'etag', 'last-modified', 'location', 'date', 'content-range'].join(', '), + ['content-type', 'content-length', 'dav', 'etag', 'last-modified', 'location', 'date', 'content-range'].join( + ', ', + ), ); response.headers.set('Access-Control-Allow-Credentials', 'false'); response.headers.set('Access-Control-Max-Age', '86400'); diff --git a/tsconfig.json b/tsconfig.json index 2cb9189..cbea026 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,9 @@ /* Language and Environment */ "target": "es2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, - "lib": ["es2021"] /* Specify a set of bundled library declaration files that describe the target runtime environment. */, + "lib": [ + "es2021" + ] /* Specify a set of bundled library declaration files that describe the target runtime environment. */, "jsx": "react" /* Specify what JSX code is generated. */, // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ @@ -31,7 +33,9 @@ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ - "types": ["@cloudflare/workers-types"] /* Specify type package names to be included without being referenced in a source file. */, + "types": [ + "@cloudflare/workers-types" + ] /* Specify type package names to be included without being referenced in a source file. */, // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ "resolveJsonModule": true /* Enable importing .json files */, // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */