From 4522c8c96391e3277b538610102f38dcac451b9d Mon Sep 17 00:00:00 2001 From: SukkaW Date: Tue, 10 Sep 2024 01:09:46 +0800 Subject: [PATCH] Fix: drop corrupted files --- Build/download-previous-build.ts | 21 +++++++++++++++++---- Script/abema_unlock.js | 24 ------------------------ Source/domainset/cdn.conf | 1 + 3 files changed, 18 insertions(+), 28 deletions(-) delete mode 100644 Script/abema_unlock.js diff --git a/Build/download-previous-build.ts b/Build/download-previous-build.ts index b12c1223..2f704d20 100644 --- a/Build/download-previous-build.ts +++ b/Build/download-previous-build.ts @@ -2,7 +2,7 @@ import path from 'node:path'; import { pipeline } from 'node:stream/promises'; import { task } from './trace'; import { defaultRequestInit, fetchWithRetry } from './lib/fetch-retry'; -import { extract as tarExtract } from 'tar-fs'; +import { extract as tarExtract, type Headers as TarEntryHeaders } from 'tar-fs'; import zlib from 'node:zlib'; import { Readable } from 'node:stream'; @@ -62,9 +62,7 @@ export const downloadPreviousBuild = task(require.main === module, __filename)(a const extract = tarExtract( publicDir, { - ignore(_, header) { - return header?.type !== 'file' && header?.type !== 'directory'; - }, + ignore: tarOnIgnore, map(header) { header.name = header.name.replace(pathPrefix, ''); return header; @@ -79,3 +77,18 @@ export const downloadPreviousBuild = task(require.main === module, __filename)(a ); }); }); + +function tarOnIgnore(_: string, header?: TarEntryHeaders) { + if (header) { + if (header.type !== 'file' && header.type !== 'directory') { + return true; + } + + const extname = path.extname(header.name); + if (extname === '.ts') { + return true; + } + } + + return false; +} diff --git a/Script/abema_unlock.js b/Script/abema_unlock.js deleted file mode 100644 index 56c2ebcc..00000000 --- a/Script/abema_unlock.js +++ /dev/null @@ -1,24 +0,0 @@ -/* global $request, $response, $done */ - -const url = $request.url; -const body = url.endsWith('region') || url.endsWith('region/') - ? 'OK' - : $response.body; - -if ($request.method === 'OPTION') { - $done({}); -} else { - $done({ - status: 200, - body, - headers: { - 'Content-Type': 'text/plain; charset=utf-8', - 'Access-Control-Allow-Origin': '*', - 'Access-Control-Allow-Credentials': '*', - 'Access-Control-Allow-Headers': 'origin,range,hdntl,hdnts', - 'Access-Control-Allow-Methods': 'GET,HEAD,POST,PUT,DELETE,OPTIONS', - 'Access-Control-Expose-Headers': 'Server,range,hdntl,hdnts,Akamai-Mon-Iucid-Ing,Akamai-Mon-Iucid-Del,Akamai-Request-BC', - 'Access-Control-Max-Age': '86400' - } - }); -} diff --git a/Source/domainset/cdn.conf b/Source/domainset/cdn.conf index e30f4cab..dc8f36db 100644 --- a/Source/domainset/cdn.conf +++ b/Source/domainset/cdn.conf @@ -83,6 +83,7 @@ vuejs.org .react.dev .reactjs.org .radix-ui.com +.nextui.org storybook.js.org www.typescriptlang.org typescript.azureedge.net