From dad22dda984a242c0d03ee89e09cbe87df006a0c Mon Sep 17 00:00:00 2001 From: Caryl Wyatt Date: Wed, 23 Apr 2025 16:57:07 -0400 Subject: [PATCH 1/7] add cloudlfare error page --- src/cloudflare.html | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/cloudflare.html diff --git a/src/cloudflare.html b/src/cloudflare.html new file mode 100644 index 0000000..5f374ac --- /dev/null +++ b/src/cloudflare.html @@ -0,0 +1,29 @@ + + + + + + Error - Blocked from HathiTrust + + + + +

Sorry, you have been blocked

+

::CLOUDFLARE_ERROR_500S_BOX::

+

If you have questions about why you've been blocked, please contact HathiTrust at support@hathitrust.org and provide these details:

+

+ + \ No newline at end of file From 6dd1ca8c48264d554b05236fb9684380739a3653 Mon Sep 17 00:00:00 2001 From: Caryl Wyatt Date: Thu, 24 Apr 2025 09:29:51 -0400 Subject: [PATCH 2/7] style updates --- src/cloudflare.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/cloudflare.html b/src/cloudflare.html index 5f374ac..84495fa 100644 --- a/src/cloudflare.html +++ b/src/cloudflare.html @@ -5,12 +5,21 @@ Error - Blocked from HathiTrust

Sorry, you have been blocked

::CLOUDFLARE_ERROR_500S_BOX::

-

If you have questions about why you've been blocked, please contact HathiTrust at support@hathitrust.org and provide these details:

+

+

Why have I been blocked?

+

This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.

+
+
+

What can I do to resolve this?

+

You can e-mail HathiTrust Support at support@hathitrust.org. Please include what you were doing when this page came up and provide these details:

  • IP address: ::CLIENT_IP::
  • Cloudflare Ray ID: ::RAY_ID::
+
\ No newline at end of file From bfd56faf6c5c5c188d31d4d7be6f12a2525df1e9 Mon Sep 17 00:00:00 2001 From: Caryl Wyatt Date: Thu, 24 Apr 2025 16:53:08 -0400 Subject: [PATCH 4/7] update vite config to include cloudflare page in build output --- src/{cloudflare.html => cloudflare/index.html} | 2 +- vite.config.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) rename src/{cloudflare.html => cloudflare/index.html} (92%) diff --git a/src/cloudflare.html b/src/cloudflare/index.html similarity index 92% rename from src/cloudflare.html rename to src/cloudflare/index.html index d73fd91..7e35682 100644 --- a/src/cloudflare.html +++ b/src/cloudflare/index.html @@ -10,7 +10,7 @@ font-family: 'Mulish'; font-style: normal; font-weight: 400; - src: url('../dist/fonts/mulish-v12-cyrillic_cyrillic-ext_latin_latin-ext_vietnamese-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ + src: url('/common/firebird/dist/fonts/mulish-v12-cyrillic_cyrillic-ext_latin_latin-ext_vietnamese-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ } body { height: 100vh; diff --git a/vite.config.js b/vite.config.js index 5e5aa5b..49229c5 100644 --- a/vite.config.js +++ b/vite.config.js @@ -9,7 +9,7 @@ import fs from 'fs'; // Find all HTML files and build an object of names and paths to work from const files = glob - .sync(path.resolve(__dirname, 'src') + '/**/*.html') + .sync(path.resolve(__dirname, 'src') + '/**/*.html', { ignore: [(path.resolve(__dirname, 'src') + '/coverage')] }) .reduce((acc, cur) => { // we want to keep the path let name = cur @@ -23,6 +23,7 @@ const files = glob acc[name] = cur; return acc; }, {}); + console.log(files) const scssOptions = { quietDeps: true, @@ -41,8 +42,9 @@ export default defineConfig({ //hopefully temporary workaround until we can upgrade to svelte 5/vite 6 { name: 'postbuild-commands', - closeBundle: () => { - const path = './dist/manifest.json'; + // enforce: 'post', + writeBundle: () => { + const path = 'dist/manifest.json'; const manifest = JSON.parse(fs.readFileSync(path).toString()); if (manifest['style.css']) { const newKey = 'index.css'; @@ -64,6 +66,10 @@ export default defineConfig({ //renames the style asset file to index //hopefully temporary workaround until we can upgrade to svelte 5/vite 6 rollupOptions: { + input: { + main: path.resolve(__dirname, 'src/index.html'), + cloudflare: path.resolve(__dirname, 'src/cloudflare/index.html'), + }, output: { assetFileNames: (assetInfo) => { if (assetInfo.name == 'style.css') { From c6a9c8df1458aeccd573723bc136dbc254d97779 Mon Sep 17 00:00:00 2001 From: Caryl Wyatt Date: Fri, 25 Apr 2025 09:20:24 -0400 Subject: [PATCH 5/7] update content, remove console logs from config --- src/cloudflare/index.html | 2 +- vite.config.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cloudflare/index.html b/src/cloudflare/index.html index 7e35682..e90e4da 100644 --- a/src/cloudflare/index.html +++ b/src/cloudflare/index.html @@ -52,7 +52,7 @@

Sorry, you have been blocked

-

::CLOUDFLARE_ERROR_500S_BOX::

+

You are unable to access hathitrust.org

Why have I been blocked?

This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.

diff --git a/vite.config.js b/vite.config.js index 49229c5..859b6cf 100644 --- a/vite.config.js +++ b/vite.config.js @@ -18,12 +18,11 @@ const files = glob .replace('/', '-'); // let name = path.basename(cur, '.html'); - console.log(name, '->', cur); + // console.log(name, '->', cur); acc[name] = cur; return acc; }, {}); - console.log(files) const scssOptions = { quietDeps: true, From d24c36435a45d0fc2a497fa1c1d691e7f50ee6e1 Mon Sep 17 00:00:00 2001 From: Caryl Wyatt Date: Fri, 25 Apr 2025 09:30:10 -0400 Subject: [PATCH 6/7] change input option name for js to index --- vite.config.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vite.config.js b/vite.config.js index 859b6cf..e3457bf 100644 --- a/vite.config.js +++ b/vite.config.js @@ -41,8 +41,7 @@ export default defineConfig({ //hopefully temporary workaround until we can upgrade to svelte 5/vite 6 { name: 'postbuild-commands', - // enforce: 'post', - writeBundle: () => { + closeBundle: () => { const path = 'dist/manifest.json'; const manifest = JSON.parse(fs.readFileSync(path).toString()); if (manifest['style.css']) { @@ -66,7 +65,7 @@ export default defineConfig({ //hopefully temporary workaround until we can upgrade to svelte 5/vite 6 rollupOptions: { input: { - main: path.resolve(__dirname, 'src/index.html'), + index: path.resolve(__dirname, 'src/index.html'), cloudflare: path.resolve(__dirname, 'src/cloudflare/index.html'), }, output: { From 0f07dcf461b4d26fb8291099d04aa7c79c77c62e Mon Sep 17 00:00:00 2001 From: Caryl Wyatt Date: Fri, 25 Apr 2025 13:09:44 -0400 Subject: [PATCH 7/7] add plugin to remove stylesheet from html --- vite.config.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/vite.config.js b/vite.config.js index e3457bf..5967eeb 100644 --- a/vite.config.js +++ b/vite.config.js @@ -31,6 +31,17 @@ const scssOptions = { // scssOptions.additionalData = `$firebird-font-path: "//localhost:5173"; $fa-font-path: "//localhost:5173/fonts";`; // } +const removeStylesheet = () => { + return { + name: 'remove-stylesheet', + enforce: 'post', + apply: 'build', + transformIndexHtml(html) { + return html.replaceAll(//gi, ""); + }, + } +} + export default defineConfig({ plugins: [ svelte({ @@ -53,6 +64,7 @@ export default defineConfig({ } } }, + removeStylesheet() ], root: path.resolve(__dirname, 'src'), publicDir: 'public',