prettierrc printWidth 120

This commit is contained in:
abersheeran 2024-03-02 13:54:52 +08:00
parent 11d1825dae
commit b3c8753308
3 changed files with 16 additions and 7 deletions

View File

@ -1,5 +1,5 @@
{ {
"printWidth": 140, "printWidth": 120,
"singleQuote": true, "singleQuote": true,
"semi": true, "semi": true,
"useTabs": true "useTabs": true

View File

@ -114,7 +114,10 @@ async function handle_get(request: Request, bucket: R2Bucket): Promise<Response>
let href = `/${object.key + (object.customMetadata?.resourcetype === '<collection />' ? '/' : '')}`; let href = `/${object.key + (object.customMetadata?.resourcetype === '<collection />' ? '/' : '')}`;
page += `<a href="${href}">${object.httpMetadata?.contentDisposition ?? object.key}</a><br>`; page += `<a href="${href}">${object.httpMetadata?.contentDisposition ?? object.key}</a><br>`;
} }
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 { } else {
let object = await bucket.get(resource_path, { let object = await bucket.get(resource_path, {
onlyIf: request.headers, onlyIf: request.headers,
@ -612,8 +615,8 @@ export default {
const { bucket } = env; const { bucket } = env;
if ( if (
request.method !== 'OPTIONS' request.method !== 'OPTIONS' &&
&& request.headers.get('Authorization') !== `Basic ${btoa(`${env.USERNAME}:${env.PASSWORD}`)}` request.headers.get('Authorization') !== `Basic ${btoa(`${env.USERNAME}:${env.PASSWORD}`)}`
) { ) {
return new Response('Unauthorized', { return new Response('Unauthorized', {
status: 401, status: 401,
@ -634,7 +637,9 @@ export default {
); );
response.headers.set( response.headers.set(
'Access-Control-Expose-Headers', '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-Allow-Credentials', 'false');
response.headers.set('Access-Control-Max-Age', '86400'); response.headers.set('Access-Control-Max-Age', '86400');

View File

@ -12,7 +12,9 @@
/* Language and Environment */ /* Language and Environment */
"target": "es2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, "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. */, "jsx": "react" /* Specify what JSX code is generated. */,
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ // "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. */ // "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. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ // "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. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
"resolveJsonModule": true /* Enable importing .json files */, "resolveJsonModule": true /* Enable importing .json files */,
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */ // "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */