-
Notifications
You must be signed in to change notification settings - Fork 476
Use custom live server to handle BR url mode history #1509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,27 +13,27 @@ | |
| <script type="text/javascript" src="https://unpkg.com/@webcomponents/[email protected]/webcomponents-bundle.js"></script> | ||
|
|
||
| <!-- JS dependencies --> | ||
| <script src="../BookReader/webcomponents-bundle.js"></script> | ||
| <script src="../BookReader/jquery-3.js"></script> | ||
| <script src="/BookReader/webcomponents-bundle.js"></script> | ||
| <script src="/BookReader/jquery-3.js"></script> | ||
|
|
||
| <!-- Bookreader --> | ||
| <script src="../BookReader/BookReader.js"></script> | ||
| <link rel="stylesheet" href="../BookReader/BookReader.css"/> | ||
| <script src="/BookReader/BookReader.js"></script> | ||
| <link rel="stylesheet" href="/BookReader/BookReader.css"/> | ||
|
|
||
| <!-- plugins needed for archive.org, in same order as archive.org --> | ||
| <script src="../BookReader/plugins/plugin.search.js"></script> | ||
| <script src="../BookReader/plugins/plugin.chapters.js"></script> | ||
| <script src="../BookReader/plugins/plugin.tts.js"></script> | ||
| <script src="../BookReader/plugins/plugin.url.js"></script> | ||
| <script src="../BookReader/plugins/plugin.autoplay.js"></script> | ||
| <script src="../BookReader/plugins/plugin.resume.js"></script> | ||
| <script src="../BookReader/plugins/plugin.archive_analytics.js"></script> | ||
| <script src="../BookReader/plugins/plugin.text_selection.js"></script> | ||
| <script src="../BookReader/plugins/plugin.experiments.js"></script> | ||
| <script src="/BookReader/plugins/plugin.search.js"></script> | ||
| <script src="/BookReader/plugins/plugin.chapters.js"></script> | ||
| <script src="/BookReader/plugins/plugin.tts.js"></script> | ||
| <script src="/BookReader/plugins/plugin.url.js"></script> | ||
| <script src="/BookReader/plugins/plugin.autoplay.js"></script> | ||
| <script src="/BookReader/plugins/plugin.resume.js"></script> | ||
| <script src="/BookReader/plugins/plugin.archive_analytics.js"></script> | ||
| <script src="/BookReader/plugins/plugin.text_selection.js"></script> | ||
| <script src="/BookReader/plugins/plugin.experiments.js"></script> | ||
|
|
||
| <script type="module" src="../BookReader/ia-bookreader-bundle.js"></script> | ||
| <script type="module" src="/BookReader/ia-bookreader-bundle.js"></script> | ||
|
|
||
| <link rel="stylesheet" href="BookReaderDemo.css"/> | ||
| <link rel="stylesheet" href="/BookReaderDemo/BookReaderDemo.css"/> | ||
|
Comment on lines
+16
to
+36
|
||
|
|
||
| <!-- IA scripts --> | ||
| <script src="https://archive.org/bookreader/BookReaderJSIA.js"></script> | ||
|
|
@@ -272,6 +272,6 @@ <h3>Placeholder div to allow scrolling</h3> | |
| </script> | ||
|
|
||
| <!-- IA fetch demo --> | ||
| <script type="module" src="IADemoBr.js"></script> | ||
| <script type="module" src="/BookReaderDemo/IADemoBr.js"></script> | ||
| </body> | ||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -124,7 +124,7 @@ | |
| "lint": "npx eslint src/ tests/ *.js *.cjs", | ||
| "lint:fix": "npx eslint --fix src/ tests/ *.js *.cjs", | ||
| "serve": "npx http-server . --port=8000", | ||
| "serve-live": "npx live-server . --cors --port=8000 --watch=index.html,BookReader,BookReaderDemo", | ||
| "serve-live": "node scripts/live-server.js", | ||
|
||
| "serve-dev": "env NODE_ENV='development' npm run build-css && env NODE_ENV='development' npx concurrently --kill-others npm:serve-live npm:build-*:watch", | ||
| "test": "npx jest --coverage --colors", | ||
| "test:watch": "npx jest --watch", | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,21 @@ | ||||||
| import liveServer from 'live-server'; | ||||||
|
|
||||||
| liveServer.start({ | ||||||
| root: '.', | ||||||
| port: 8000, | ||||||
| watch: ['index.html', 'BookReader', 'BookReaderDemo'], | ||||||
| cors: true, | ||||||
| middleware: [function (req, res, next) { | ||||||
| console.log(`${req.method} ${req.url}`); | ||||||
|
|
||||||
| // Handle /details/<identifier> requests | ||||||
| const detailsMatch = req.url.match(/^\/details\/([^/?]+)/); | ||||||
|
||||||
| const detailsMatch = req.url.match(/^\/details\/([^/?]+)/); | |
| const detailsMatch = req.url.match(/^\/details\/[^/?]+/); |
Uh oh!
There was an error while loading. Please reload this page.