mirror of
https://github.com/Alamantus/Lexiconga.git
synced 2025-04-29 14:53:16 +02:00
Remove HyperExpress & build out Fastify asset routes
This commit is contained in:
parent
5f2b4b63d9
commit
ae3523bc24
21 changed files with 283 additions and 2403 deletions
|
@ -1,8 +1,7 @@
|
|||
APP_NAME=Lexiconga
|
||||
APP_DESCRIPTION=The quick and easy dictionary builder for constructed languages.
|
||||
# .env is only used in non-production environments,
|
||||
# but it is useful to indicate what environment variables should be set on the server
|
||||
APP_DOMAIN=lexiconga.com
|
||||
REPOSITORY_LINK=https://github.com/Alamantus/Lexiconga
|
||||
SUPPORT_LINK=https://liberapay.com/robbieantenesse
|
||||
APP_PORT=8080
|
||||
|
||||
JWT_SECRET=
|
||||
|
||||
|
|
2311
package-lock.json
generated
2311
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -25,21 +25,18 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"dotenv": "^16.4.5",
|
||||
"minify-html-literals": "^1.3.5",
|
||||
"nodemon": "^3.1.3",
|
||||
"sharp": "^0.29.3"
|
||||
"nodemon": "^3.1.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fastify/helmet": "^11.1.1",
|
||||
"@fastify/jwt": "^8.0.1",
|
||||
"@fastify/mysql": "^4.3.0",
|
||||
"@fastify/static": "^7.0.4",
|
||||
"@fastify/websocket": "^10.0.1",
|
||||
"bulma": "^1.0.1",
|
||||
"esbuild": "^0.21.5",
|
||||
"fastify": "^4.27.0",
|
||||
"hyper-express": "^6.16.3",
|
||||
"marked": "^3.0.8",
|
||||
"minify-html-literals": "^1.3.5",
|
||||
"papaparse": "^5.4.1",
|
||||
"require-overrides": "^0.3.0",
|
||||
"sass": "^1.77.4",
|
||||
|
|
|
@ -2,13 +2,13 @@ const { html } = require('uhtml');
|
|||
|
||||
module.exports = (app) => {
|
||||
return html`<footer id="bottom">
|
||||
<a href="${process.env.SUPPORT_LINK}" target="_blank" rel="noopener" class="small button">Support ${process.env.APP_NAME}</a>
|
||||
<a href="https://blog.${process.env.APP_DOMAIN}" target="_blank" rel="noopener" class="small button">Blog</a>
|
||||
<a href="${process.env.REPOSITORY_LINK}/issues" target="_blank" rel="noopener" class="small button">Issues</a>
|
||||
<a href="${process.env.REPOSITORY_LINK}/releases" target="_blank" rel="noopener" class="small button">Updates</a>
|
||||
<a href="https://liberapay.com/robbieantenesse" target="_blank" rel="noopener" class="small button">Support Lexiconga</a>
|
||||
<a href="https://www.tumblr.com/lexiconga" target="_blank" rel="noopener" class="small button">Blog</a>
|
||||
<a href="https://github.com/Alamantus/Lexiconga/issues" target="_blank" rel="noopener" class="small button">Issues</a>
|
||||
<a href="https://github.com/Alamantus/Lexiconga/releases" target="_blank" rel="noopener" class="small button">Updates</a>
|
||||
<span class="separator">|</span>
|
||||
<a class="button" href="/help">Help</a>
|
||||
<a class="button" href="/terms">Terms</a>
|
||||
<a class="button" href="/privacy">Privacy</a>
|
||||
<a class="button" href="/help.html">Help</a>
|
||||
<a class="button" href="/terms.html">Terms</a>
|
||||
<a class="button" href="/privacy.html">Privacy</a>
|
||||
</footer>`;
|
||||
};
|
||||
|
|
|
@ -3,23 +3,23 @@ const search = require('./search');
|
|||
|
||||
module.exports = (app) => {
|
||||
return html`<header>
|
||||
<a href="/" title="${process.env.APP_NAME}"><svg id="title" alt="${process.env.APP_NAME} Logo" viewBox="0 0 249.78 55.087">
|
||||
<g transform="translate(-107.53 -155.84)">
|
||||
<g id="lexi">
|
||||
<path d="m144.03 159.39-11.339 22.409h-21.62l11.339-22.409z" />
|
||||
<path d="m132.69 183.97 11.339 22.409h-21.62l-11.339-22.409z" />
|
||||
<path d="m160.1 186.76v7.0042h-6.1056q-1.2442 0-1.7741 0.36864-0.50688 0.36864-0.50688 1.2442 0 0.99072 0.52992 1.3133 0.52992 0.29952 2.1658 0.29952h6.2899v8.9856h-7.3498q-5.184 0-7.9258-2.4653-2.7418-2.4883-2.7418-7.1655v-12.326q0-4.5159 2.5805-7.0042 2.6035-2.4883 7.3037-2.4883h8.1332v9.0317h-5.9674q-2.4192 0-2.4192 1.5667 0 0.92161 0.576 1.2902 0.57601 0.3456 2.0506 0.3456z" />
|
||||
<path d="m187.75 174.53-8.1792 15.299 8.4557 16.151h-9.8381l-3.8707-7.6263-3.2717 7.6263h-9.6768l8.64-15.898-8.1792-15.552h9.746l3.6634 7.1424 2.9491-7.1424z" />
|
||||
<path d="m198.95 174.53v31.45h-9.3543v-31.45z" />
|
||||
</g>
|
||||
<g id="conga">
|
||||
<path d="m218.5 205.38h-3.2347q-7.6994 0-10.114-3.918-1.8223-2.9613-1.8223-11.481 0-7.5172 1.8223-10.478 2.4146-3.918 9.294-3.918h4.7381q6.5604 0 8.7928 1.8679 2.5513 2.1413 2.5513 8.4739-0.77449-0.13667-1.4123-0.13667-0.68338 0-2.0501 0.13667-1.3668 0.13668-2.0957 0.13668l-1.7768-0.13668q0-2.5057-1.5946-3.3713-1.0934-0.59227-3.6902-0.59227h-1.8679q-3.3258 0-4.5559 1.8679-0.95673 1.4579-0.95673 4.647 0 1.1845 0.0456 3.098 0.0911 1.9135 0.0911 1.959 0 4.0092 1.7768 4.9203 1.0478 0.5467 5.6493 0.5467 2.1868 0 3.0069-0.22779 2.0957-0.59226 2.0957-3.6447 0.45558-0.13668 1.139-0.27335 0.72894-0.13668 1.1845-0.13668 0.68338 0 2.0501 0.2278 1.3668 0.22779 2.0957 0.22779 0.5467 0 0.86561-0.0456 0 6.606-2.7791 8.6106-2.2324 1.6401-9.2484 1.6401zm3.0069-31.208q3.8269 0.68338 7.0616 1.549 0.63782 1.0023 1.0934 2.1412 0.50114 1.139 0.50114 2.0046l-1.5946-3.0524-3.5991-1.4123q-1.4579-0.18224-2.1868-0.18224-0.68338 0-1.6401 0h-3.8725q1.0478-0.13667 2.1868-0.36447 1.6401-0.36447 2.0501-0.68338zm10.797 13.303q-0.50115 0-2.1868-0.45559-0.82006-0.22779-1.3668-0.22779-0.27335 0-0.63782 0.0911-0.31891 0.0456-0.82006 0.2278-1.7312-0.18224-2.7335-0.31891-1.0023-0.13668-1.0934-0.31891l4.5559-0.13668q0.7745 0 1.5034 0 0.72894 0 1.5946 0.13668l-0.0911-8.0183q0.22779 2.1413 0.59226 4.3281 0.36447 2.1412 0.95673 4.6925h-0.27335zm-0.59226 13.531-1.2301-0.22779 0.31891-0.59227q0.0456-0.0911 0.0456-0.91117v-1.3668q0-0.91117 0.2278-1.8679 0.22779-1.0023 0.50114-1.959l0.13668 5.1481v1.7768zm-23.28-25.604q0.13668-0.0456 0.63782-0.31891 0.54671-0.27336 0.72894-0.27336l0.13668 0.18224q0.22779 0 0.68338-0.22779 0.50114-0.27336 0.72893-0.36447 0.2278-0.0911 1.6857-0.13668 1.4579-0.0911 2.7791-0.0911l-3.7358 0.68338-3.6447 0.54671zm8.6561-0.59227-0.95673 0.36447-1.9135-0.13667q1.3212-0.41003 2.688-0.82006l2.369-0.13667q-0.5467 0.13667-1.0023 0.27335-0.41003 0.0911-1.1845 0.45558zm-5.786 14.032q0-0.5467 0.0911-1.0023 0.13668-0.50114 0.36447-1.139v0.50114q0 0.13668 0.31891 2.1413 0.0911 0.59226 0.0911 1.2756v5.5582l-0.86562-4.1458 0.18224-0.59226q0-0.0911-0.0911-1.139-0.0911-1.0478-0.0911-1.4579zm0.72894-5.4215 0.82006-0.63782q-0.36447 0.82005-0.36447 1.6401v0.31891l-0.68338 1.3668zm0.45559 13.759q0.18223 0.0455 1.0023 0.31891 1.0934 0.27335 1.6857 0.27335l3.3258-0.68338q0.27335-0.0456 1.0023-0.18224 0.7745 0 1.5946 0l1.4123-2.4602q-0.36447 1.0478-0.45559 1.4579-0.22779 0.86561-0.22779 1.4579l0.0911 0.22779 0.13667-0.0456q-4.237 0.41002-8.4739 0.77449l-1.0934-1.139zm19.18 4.9659q-0.68338 0.63782-1.6857 1.2756-0.95673 0.63782-1.7312 0.91118 0.41003-0.36447 1.2756-1.0934 0.50115-0.45559 1.139-1.1845l1.0023 0.0911zm-4.8292 3.4169-1.5034 0.0456 2.7335-1.0934q-0.31891 0.22779-0.63782 0.50115-0.31891 0.22779-0.59226 0.5467zm-24.921-21.64-0.13667-4.5103 1.5946-2.2779q1.0023-0.22779 1.6401-0.77449 0.95673-1.0478 1.959-2.1413 0.31891-0.31891 1.7768-0.45558 1.4579-0.13668 3.9636-0.2278-1.0023 0.2278-2.0501 0.50115-1.0478 0.22779-1.959 0.50114-1.7768 0.63782-3.7814 2.2324-2.4146 1.9135-2.5968 3.4625zm5.3759 22.233q-2.688-2.7335-3.9636-7.4716-1.0023-3.7814-1.0023-8.5195 0.22779 1.5946 0.68338 4.647 0.45559 3.0069 1.1845 5.0114 0.13668 0.41002 0.45559 1.2756 0.31891 0.86561 0.63782 1.3668l1.6401 2.1868zm-4.9659-16.811v-2.8702q0-0.41003 0.50115-2.7335 0.50114-2.3235 1.3212-5.6493 0.27335-0.18223 1.7768-1.1845 1.549-1.0478 1.5946-1.4123l0.95673 0.82006q-0.63782 0.0911-1.8679 0.86561-0.86561 0.54671-1.6857 1.2301-0.18223 0.95673-0.50114 1.9135-0.27335 0.95673-0.63782 1.6857 0 0.0456-0.31891 0.45559-0.13668 0.22779-0.18224 0.41003zm20.957 16.447q0.59226 0 0.86561 0.0911-2.1412 0.45558-4.6925 0.95673-2.5057 0.5467-3.6902 0.5467-1.3668 0-3.2802-0.27335-1.8679-0.27335-3.1891-0.63782l-0.72894-1.0478 5.9682 0.7745q0.27335 0.0456 0.91117-0.0456 0.68338-0.0911 0.82005-0.0911 0.0911 0 1.0478 0.0911 1.0023 0.0911 1.3668 0.0911 0.59226 0 2.9158-0.31891 1.0023-0.13668 1.6857-0.13668zm-21.003-9.8407q0.31891 0.54671 0.59226 2.5513 0.0911 0.86561 0.27336 1.0478l0.50114 0.63782-0.0456 0.18224 0.18224 0.36447q0.45558 0.63782 0.59226 1.7312 0.18223 1.0478 0.31891 2.0046l2.0501 2.2779-2.4146-1.8679q-0.72894-2.0046-1.3668-4.0092-0.77449-2.5057-1.8679-6.8794l1.1845 1.959zm26.06-1.2756q-0.68338 0-1.9135-0.0911-1.1845-0.13668-2.5513-0.27336 0.68338-0.36446 3.5991-0.50114 2.9158-0.18223 2.9613-0.18223l-0.63782 0.68337-1.4579 0.36447zm-9.1117-12.027 2.8702 1.0478 0.27335 1.0934q-2.1868-1.0023-4.4192-1.549-2.2324-0.59227-4.4647-0.59227z" />
|
||||
<path d="m262.61 195.81q0 0.77449-0.0911 2.6424-0.0911 1.8223-0.0911 1.959-1.2301 1.7768-2.9613 3.7358 0.91118-1.2756 1.4579-2.1868 1.0934-1.7312 1.0934-2.4146 0-2.4146-0.0911-4.4192-0.31891-6.9249-0.31891-7.426 0-0.59226-0.13668-1.4123-0.31891-1.959-0.31891-2.4146 0-0.72894 0.18224-1.5946 0.18223-0.86561 0.36447-1.7312 0.36446 3.5536 0.63782 7.7905 0.27335 4.1914 0.27335 7.4716zm-12.939 8.9295h-4.0547q-5.9682 0-8.7472-2.688-2.7791-2.688-2.7791-8.6561v-5.1026q0-5.6037 2.9158-8.2917 2.9158-2.688 8.565-2.688h3.6447q5.7859 0 8.7928 2.5513 3.1891 2.7335 3.1891 8.4283v5.1026q0 6.1504-2.688 8.7472-2.688 2.5968-8.8384 2.5968zm4.4192-16.264q0-3.098-1.0934-4.2825-1.0934-1.1845-4.1914-1.1845h-2.4146q-3.0069 0-4.1003 1.1845-1.0934 1.1845-1.0934 4.1914v4.7836q0 3.1435 1.0478 4.4647 1.0934 1.3212 4.1458 1.3212h2.4146q3.0524 0 4.1458-1.3212 1.139-1.3668 1.139-4.5103zm-1.2301-11.8q1.4123 0.45558 3.508 1.5034 1.7312 0.91117 3.4624 1.8224 0.41003 0.59226 0.68338 1.5034 0.0911 0.27335 0.22779 0.86561l0.27336-2.8702q-3.0524-0.63782-5.8315-1.2301-2.7335-0.59226-3.098-0.7745l-1.4123-1.1845q0.54671 0.0911 1.139 0.18223 0.63782 0.0456 1.0478 0.18224zm-14.67 2.0501q-1.8679 1.2756-2.4602 1.9135-0.5467 0.63782-0.82005 1.5946 1.5034-1.549 2.8702-2.8702 1.7312-1.6401 3.0524-2.5968 1.8679-0.22779 3.8269-0.50114t3.5991-0.27335q0.50114 0 1.139 0.13667 0.63782 0.13668 1.4579 0.31891-1.139 0.36447-2.2779 0.50115-1.139 0.0911-2.7791 0.0911-0.86561 0-2.4146-0.0456-1.5034-0.0456-2.1413-0.0456-0.41002 0-1.549 0.72894-0.77449 0.5467-1.5034 1.0478zm17.221 25.832q1.0934-0.50115 2.4146-1.2301 1.5946-0.86562 2.2779-1.2756l-6.3782 4.1458-2.369-1.3212q0.59227-0.13668 2.1868-0.18224 1.6401-0.0455 1.8679-0.13667zm-3.7358 1.6401q-0.68338-0.13668-1.4579-0.27335-0.72894-0.0911-1.139-0.0911l-0.27335 0.0911q-0.22779-0.0911-0.68338-0.27335-0.45558-0.13668-0.82005-0.36447zm-18.315-24.055q1.5946-1.139 3.1891-2.5057 1.9135-1.5946 3.0069-2.8246-0.82006 0.2278-1.549 0.45559-0.72893 0.22779-0.77449 0.27335-1.959 1.6857-2.8246 3.3713-0.86562 1.6401-0.86562 4.1003 0 0.45559 0.18224 1.4579 0.18223 1.0023 0.18223 1.5034l-0.13668 9.5673q-0.13667-1.2756-0.36446-2.9613-0.45559-3.3713-0.45559-5.0114 0-3.7358 0.41003-7.426zm4.4647 21.549q3.3713 1.7312 6.9705 2.0501 0.86561 0.0911 1.6401 0.18224 0.7745 0.0911 1.1845 0.27335-1.6857-0.68338-4.2825-1.2756-6.4693-1.4123-7.3805-1.7312-0.54671-0.63782-1.139-2.0957-0.59226-1.4579-1.2756-4.0547 0.72894 1.4123 2.0501 3.5991 1.7312 2.7791 2.2324 3.0524zm14.989-13.622 0.45558 0.86561-0.0911 6.1048-0.59226-1.5034q0.27335-2.0046 0.27335-3.9636l-0.0456-1.5034zm-0.31891-4.647q0.59226 0.45558 0.82005 1.4123 0.2278 0.95674 0.2278 2.0046l-0.13668 1.2301zm-10.023 0.77449q0 0.68338 0.13667 2.0501 0.13668 1.3668 0.13668 2.0957v2.1868q0 1.3212 0.22779 2.1412 0.41003 1.0934 0.68338 2.0046 0.18223-0.0456 0.82006 0.68338 0.63782 0.68338 0.82005 1.0023l-1.1845-0.36447q-1.5946-1.7768-2.0501-3.4624-0.41003-1.7312-0.41003-4.647v-1.4579q0-1.2756 0.27335-2.3235 0.31891-1.0934 1.1845-1.8224zm9.5673-2.3235q-0.36447 0.41002-1.2301 0.72893-0.82005 0.27336-1.5034 0.27336h-3.508l-1.5034-1.0934 7.745 0.0911zm-4.7836 13.986q0.59226-0.0911 1.2756-0.2278 0.68338-0.13667 1.0934-0.13667l2.4146 0.13667-3.3258 0.72894z" />
|
||||
<path d="m287.51 205.02q-0.82006 0-1.6401 0-0.68338-0.13668-1.0023-0.18224l-11.891-20.274v20.866h-7.1071v-29.431q3.0524-0.36447 5.7859-0.36447 2.4602 0 5.1481 0.36447 2.1412 5.057 4.8292 10.023 2.4146 4.4192 5.7404 9.5673 0-3.2802-0.0911-5.8771-0.31891-9.1573-0.31891-9.7951 0-2.7335 0.0455-3.1436 0.0456-0.45558 0.36447-2.0046h7.0616v29.75q-0.95673 0.13668-2.9158 0.31891-1.9135 0.18224-4.0092 0.18224zm-10.114-31.39q0.0911 0.22779 0.31891 0.63782 0.22779 0.41003 0.31891 0.7745l-0.0456-0.18224q0.2278 0.45559 0.72894 1.4579 0.45559 1.2301 0.91117 2.4146l-1.2301-0.45558q-0.0911-1.0934-0.36447-2.0957-0.22779-1.0023-0.63782-2.5513zm18.725 1.3668v1.959q0 2.6424-0.27335 4.647-0.27335 1.959-1.139 3.2347 0.31891-2.6424 0.45558-5.1026 0.18224-2.4602 0.18224-4.7381zm-0.95673 30.752 0.0456-19.772q0 3.2802 0.31891 9.8407t0.31891 9.8407l-2.2779 0.59226q-1.4123 0-3.1891-0.2278-1.7768-0.22779-3.4169-0.41002l8.2005 0.13667zm-8.4283-12.665q-2.0046-3.4624-4.0092-6.9705-3.0524-5.5126-3.0524-6.8338 2.4146 3.918 3.7358 6.1504 2.4602 4.1914 2.4602 6.3782 0 0.31891-0.0911 0.68338t-0.18223 0.72894l1.139-0.13668zm-14.533-18.406q-2.5057 0.27335-5.2848 0.7745l-1.3212-1.2301zm3.8269-0.22779 1.0023 0.5467-3.3713-0.27335zm5.1026 24.966q2.1868 3.4169 4.5103 6.3782l4.5103 0.27335-4.6014 0.72894q-0.18223-0.27335-0.7745-0.7745-0.5467-0.45558-0.77449-0.91117-1.549-2.8246-3.0524-5.6948-1.7312-3.1891-3.3258-5.7404-1.959-3.098-3.6902-5.1481l1.0934-0.22779q0.27336 2.4602 2.5057 5.9682 1.7768 2.5968 3.5991 5.1481zm-15.9 5.6493q-0.27336-1.7768-0.59227-3.8269-0.27335-2.0501-0.27335-3.4624 0-2.4602 0.63782-12.392 0.27335-4.237 0.27335-7.426 0-0.82006-0.0911-1.4123t-0.31891-2.0957q-0.13668 0.63782-0.2278 1.2301-0.0911 0.5467-0.0911 1.2301 0 2.3235 0.18223 8.2006 0.18224 5.8771 0.31891 10.342 0.18224 4.4647 0.18224 9.6129zm7.6083 0.59227q0.41003-2.6424 0.50115-4.3736 0.13667-1.7768 0.13667-4.8748-0.0456-2.3235-0.0911-4.647-0.0455-2.369-0.0455-4.6925 0.63782 3.6902 0.68337 4.1003 0.0911 0.36447 0.31891 2.2324 0.2278 0.2278 0.27336 1.3212 0.0455 1.0478 0.0455 1.9135l0.18224-0.18223q-0.18224 0.5467-0.36447 1.0934-0.45559 1.4123-1.0023 1.4123-0.41003 0-0.59226-0.31891-0.13668-0.36447-0.13668-0.77449v-0.2278h1.2756l0.0456 8.155-1.2301-0.13667zm-8.4283-28.747q0 1.2756-0.41003 12.848-0.13667 3.8725-0.13667 7.6994h0.45558q0-5.1481-0.22779-11.162-0.22779-6.0137-0.68338-10.57l1.2301-1.0934q-0.22779 1.2756-0.22779 2.2779zm0.68338 29.613 0.18223-0.95673h0.50115q1.7312 0 3.7814 0.22779 2.0957 0.22779 3.7814 0.59226zm29.294-33.076 1.6401 0.59226-0.59226 0.63782q-0.86562-0.0911-1.7768-0.18224-0.91117-0.0911-1.6857-0.0911h-2.2324l-2.7335 0.0911q1.0023-0.59226 2.0046-0.82005 1.0478-0.22779 2.2324-0.22779z" />
|
||||
<path d="m314.06 205.29h-3.1891q-6.4693 0-9.4306-4.2825-2.5513-3.6902-2.5513-10.478 0-7.5627 1.8223-10.752 2.4602-4.2825 9.294-4.2825h4.6014q4.8748 0 7.9728 2.2324 3.508 2.5057 3.508 7.1982h-7.426q-0.31891-1.9135-2.1868-2.5968-1.2756-0.45558-3.6902-0.45558h-1.1845q-3.2347 0-4.3281 1.7312-0.82006 1.3212-0.82006 4.7837v3.5536q0 4.5103 1.3212 5.7404 1.3212 1.1845 5.8771 1.1845 3.5991 0 4.4192-1.0478 0.68337-0.86562 0.68337-4.5559h-5.1937v-5.6948q1.4123 0 4.2825 0.18224 2.8702 0.13667 3.918 0.13667 2.2779 0 4.3281-0.31891v7.4716q0 5.6493-3.2802 8.1094-2.8702 2.1413-8.7472 2.1413zm10.114-29.203 2.0501 2.8246q0.27336 0.86561 0.54671 3.2802 0.13667 1.3212 0.36447 3.3713 0.0456-0.18223-0.45559-0.45558-0.50114-0.27335-0.50114-0.41003 0-0.0911 0.0911-0.59226 0.13668-0.50115 0.13668-0.7745 0-0.77449-0.86561-2.5968-0.86562-1.8679-1.4579-2.2324 0.22779-0.59226 0.59226-0.95673-0.18223-0.13667-0.63782-0.27335-0.41003-0.13668-0.59226-0.22779l0.72894-0.95673zm-3.098-0.31891-3.4169-0.82006q-0.95673 0.0456-1.9135 0.0911-0.95673 0.0456-1.9135 0.0456-0.31891 0-0.63782 0-0.27336 0-0.59227-0.0456l-7.016-0.63782 12.848 0.22779 2.6424 1.139zm2.2779 0.45558v0.27335l-1.7768-0.31891 1.7768 0.0456zm3.9636 14.305-0.13667 0.7745q-0.18224 0.91117-0.31891 2.5057-0.13668 1.549-0.27336 2.7791v-0.36446q0-1.1845 0.0911-3.1436 0.13668-2.0046 0.13668-2.4146 0-0.68338-0.0911-1.2301-0.0911-0.5467-0.13668-0.86561 0.13668 0.41003 0.31891 0.95673 0.2278 0.54671 0.41003 1.0023zm-16.037-7.6538h1.6401q1.549 0.63782 3.2802 1.3212 1.7312 0.63782 3.0069 0.86561l4.7836 0.18223 2.369 0.0911-1.0934 0.63782q-1.7768-0.13667-3.8269-0.27335-2.0501-0.18223-3.098-0.50114-0.18224-0.0456-1.8224-1.2301-1.6401-1.1845-1.9135-1.2756l-3.1435-0.27333zm-8.0639-6.9249q-0.68338 0.5467-2.0501 1.959-1.0023 1.0478-2.0046 2.0501 1.139-2.0957 2.2779-4.237l3.8269-0.68338zm8.9295 17.449q0-1.0934 0.0911-3.6902 0.0911-2.6424 0.0911-2.8246l0.72894 0.18224-0.0456 0.86561q0 0.86561 0.0456 2.5968t0.0456 2.6424l3.6447 1.2756 1.4579 2.688-0.27335-2.5513q-0.0456-0.45559-1.0023-0.59227-0.91117-0.18223-2.4146-0.18223-0.54671 0-1.0023 0.0456-0.41003 0-0.72894 0-0.63782 0-0.63782-0.45559zm11.207 11.162q0.63782 0 0.91118-0.59226 0.68337-1.5946 1.139-3.1891 0.45559-1.6401 0.68338-3.3258l1.139 0.45558-0.36446-0.86561q-0.13668 0.31891-0.36447 1.0023-0.18224 0.68338-0.41003 1.4579-0.86561 2.5968-1.0478 2.8702-0.41003 0.68338-2.369 2.2779-0.18223 0.18223-0.63782 0.27335-0.41002 0.0911-0.77449 0.0911l1.139-0.63783q0.54671 0.18224 0.95673 0.18224zm-15.718-10.433q0-0.22779-0.0911-3.4169-0.0911-3.1891-0.0911-4.5103v-0.5467q0-0.91117 0.18224-1.2301 0.22779-0.31891 0.5467-0.31891t0.59226 0.41003q0.0911 0.13667 0.0911 0.31891 0 1.0934-0.7745 4.4647-1.0934 4.8292-1.139 4.9659l1.6401 3.2802-0.0911 0.0456q-0.0911-0.31891-0.0911-1.139 0-0.82006-0.0911-1.0478-0.0456-0.22779-0.50115-0.86561-0.18223-0.2278-0.18223-0.41003zm1.0934 12.073q2.0501 0 6.1049-0.36447 4.0547-0.36447 6.0593-0.36447l-1.139 0.82006q-0.63782-0.36447-1.0478-0.45559-0.36447-0.0911-1.5946-0.27335-0.50115-0.0456-2.9613 0.50114-2.4602 0.54671-3.0069 0.82006zm-10.433-11.071q-0.31891 0.0911-0.50114 0.45559l1.0478 1.1845q-0.68338-1.4123-0.86562-2.5057-0.13667-1.139-0.13667-3.0069v-2.4146q0-0.59226 0.31891-3.0069 0.13667-1.0478 0.13667-1.7312 0-0.13668-0.27335-0.50115-0.27335-0.36446-0.27335-0.59226 0-0.50114 2.8246-4.6925 2.688-3.9636 2.9613-4.1914l1.8224-0.82006q-1.2756 1.0934-4.4192 5.6493-3.1435 4.5103-3.1435 5.467l-0.0456 3.9636q0 1.3212 0.13668 3.918 0.18223 2.5968 0.41002 2.8246zm-1.6857-5.9226q0.27335 2.3235 0.68338 4.4192 0.41002 2.0501 0.63782 2.4146l-0.2278 0.59226q2.4602 2.5968 4.8292 4.6014 3.098 2.6424 5.9226 4.0547 3.4169 1.7312 6.3782 1.7312l4.1914-0.27335q-1.139-0.18223-5.9682-0.45558-4.8292-0.27336-7.6538-1.3668-0.18224-0.0911-1.9135-1.6857-1.3212-1.2301-1.8679-1.7768-1.7768-1.7768-2.2779-2.369-1.4123-1.6401-1.5946-2.7335-0.13667-1.0934-0.13667-2.0501 0-0.86561 0.13667-2.6424 0.13668-1.7768 0.13668-2.5968zm12.756 8.6561 8.2006-0.0911-0.82005 0.50114-6.4693 0.0456-0.91118-0.45558zm4.6014-10.843 10.57 0.31891q-1.0023 0-2.2324 0.0456-1.1845 0-2.6424 0h-0.95673q-1.139 0-2.5968-0.0456-1.4579-0.0456-2.1413-0.31891z" />
|
||||
<path d="m345.75 204.47-1.6401-6.3782h-8.1094l-1.7312 6.3782h-5.8771l7.0616-26.515h9.1117l7.0616 26.515zm-5.7404-21.504-2.9158 10.752h5.8315zm-2.1413-6.3326q0.18224 0 1.3212 0.13667 1.139 0.0911 1.7768 0.0911 0.59226 0 1.139 0 0.59226-0.0456 1.1845-0.0456h0.82005l-0.0456 0.63782q-0.18223 0-2.9613 0.0911-2.7335 0.0911-3.9636 0.0911h-2.5513q0.45559-0.13668 0.91117-0.36447 0.68338-0.36447 0.72894-0.59226 0.27335-0.0456 0.68338-0.0456t0.95673 0zm7.0616 0.63782 1.139 0.5467q0.59226 2.8246 0.86561 4.237 0.54671 2.5513 1.0934 4.237-1.0934-2.6424-1.7312-4.4647-0.86561-2.4602-1.3668-4.5559zm5.7404 22.688-0.18224 0.41003q-0.0456-0.59226-0.0911-1.2301 0-4.2825-1.0934-7.4716-0.45559-1.3212-1.8679-4.647l0.95673-0.36447q0.59226 3.5536 1.0478 5.467 0.22779 1.0023 2.2779 8.8839l-1.0478-1.0478zm1.0478 1.7312q0.36446 0.95673 0.95673 1.8223 0.95673 1.4123 1.0934 1.5946l-1.0478-0.18223q-0.13667-0.36447-0.45558-1.0478-0.27335-0.68338-0.36447-1.0934-0.0911-0.45558-0.18223-1.0934zm-17.631-22.962 0.68338-0.36446q-1.0023 3.5536-2.1413 7.5172-1.2756 4.4192-2.2324 7.5172-0.41003 1.3212-2.369 7.5627 1.3212-5.6037 2.8702-11.162 0.45558-1.6857 3.1891-11.071zm6.2871 19.454q0.86562 0 1.959 0.18223 0.36447 0.0456 1.139 0.18223l-0.18223-0.45558q-2.9158 0-4.2825 0.50114-0.31891 0.13668-2.7791 1.1845l0.54671-1.4579zm-13.394 6.2415q0.86561-1.0934 2.369-7.0616 0.95673-3.9636 1.9135-7.9728l-3.4625 15.809zm6.1048-24.647 0.27335-0.18223q-0.7745 2.9158-1.7312 6.196-0.91117 3.2802-2.0046 6.7427 0.68337-3.2347 1.4123-6.4693 1.0023-4.0547 2.0501-6.2871zm10.387 20q0.36447-0.0456 1.0023 2.5513 0.68338 2.5968 1.0478 2.5968 0.86561 0 1.8223 0t2.0046-0.0456q1.3212 0 2.0957 0.0456 0.82006 0.0456 1.5946 0.27335-0.50114 0.31891-1.6857 0.41003-1.139 0.0911-2.0046 0.0911l-5.1026-0.13667q-0.13668 0.0456-0.18224-0.13668 0-0.18223 0-0.63782v-0.68338q0-0.63782-0.18223-1.7768-0.18224-1.1845-0.41003-2.5513zm-7.745 0.77449q0.18223 0.59226 0.18223 1.4579 0 0.5467-0.0456 1.1845-0.0455 0.63782-0.0455 0.68338l0.13667 1.4123h-1.8679q-1.139 0-3.7814-0.0911-2.6424-0.0911-2.8246-0.0911 4.237 0 7.6538-0.36447 0.13667-0.45558 0.18223-1.2301 0.0456-0.77449 0.0456-0.86561 0.18223-0.0911 0.27335-1.0023 0.0911-0.95673 0.0911-1.0934zm6.0137-11.982-1.2301-2.5057 1.0934 4.237zm0.54671 4.5559-0.54671 0.22779-0.0456-0.86561v-0.27335l0.0456-0.50115zm-2.2779-8.7017-1.9135 8.7017 3.0524-0.0456 0.0911 0.41003h-3.6447l2.4146-9.0662z" />
|
||||
</g>
|
||||
<a href="/" title="Lexiconga"><svg id="title" alt="Lexiconga Logo" viewBox="0 0 158.68 26.458">
|
||||
<g transform="translate(-30.83 -76.907)">
|
||||
<g id="lexi"><!-- fill="#f50" -->
|
||||
<path d="m49.385 76.907-6.3837 12.615h-12.172l6.3837-12.615z"/>
|
||||
<path d="m43.002 90.75 6.3837 12.615h-12.172l-6.3837-12.615z"/>
|
||||
<path d="m97.054 83.522 0.05101 19.844h-6.7528c0.07652-3.1032 0.14454-6.385 0.20405-9.8454-0.0085-3.4093-0.08502-6.7421-0.22956-9.9984z"/>
|
||||
<path d="m80.001 98.018-2.0473 5.3469h-7.8003l6.0618-9.8761-6.0618-9.9676h6.6794l2.3561 4.7751 2.5734-4.7751h7.8003l-6.5765 9.8761 6.5765 9.9676h-6.6794z"/>
|
||||
<path d="m69.388 83.522v4.3042h-12.587v3.2073h10.368v4.2915h-10.368v3.7492h12.422v4.2915h-19.047c0.07652-3.1032 0.14454-6.385 0.20405-9.8454-0.0085-3.4093-0.08502-6.7421-0.22956-9.9984z"/>
|
||||
</g>
|
||||
<g id="conga"><!-- fill="#d70000" -->
|
||||
<path d="m182.16 84.27c-0.65493-0.96818-3.8157-0.85427-4.5846-0.45561-0.62646 0.37018-7.7739 16.687-7.7739 17.342-0.0285 0.79732 3.531 2.392 4.1575 2.0787 0.3417-0.14238 0.68342-1.2245 1.3953-2.7337 0.85427 0.0285 5.866 0 8.5142-0.0854 0.42713 1.0251 0.91122 1.9933 1.4807 2.933 0.28476 0.17085 4.2429-1.0251 4.1574-1.9933-0.1139-0.79732-6.9196-16.43-7.3467-17.085zm-5.325 11.931c1.2244-2.933 2.7621-6.5494 2.7621-6.5494 0.48409 1.0821 2.1072 5.0117 2.8191 6.5494-2.1072-0.08542-5.0402 0.02848-5.5812 0z"/>
|
||||
<path d="m170.53 95.127c-0.10826-0.21652-0.92023-0.51425-0.92023-0.51425l-5.0613-1.9217s-0.9473-0.35185-1.0556-0.18946c-0.6225 0.97437-1.1097 2.0299-1.4345 3.1667-0.0541 0.18946 0.92024 0.64958 0.92024 0.64958 0.56838 0.29772 1.5428 0.78491 2.1111 1.0826-0.37892 0.51425-0.89317 0.89317-1.5157 1.0826-2.4089 0.81197-5.0884-0.92023-5.6568-3.3561-0.59544-2.5171 0.29773-5.9274 3.0314-6.7394 1.8134-0.54131 3.7621 0 5.0072 1.4074 0 0 0.27066 0.37892 0.59545 0.37892 0.78491-0.13533 1.4886-0.40599 2.1382-0.8661 0.24359-0.13533 1.0014-0.62251 1.3533-0.89317 0.21652-0.1624 0.13533-0.37892 0.0812-0.51425-0.37891-0.8661-0.97436-1.6239-1.7593-2.1923-5.0613-4.4117-13.208-1.8134-14.859 4.7906-3.2208 12.721 14.318 18.594 17.106 5.4131 0.0271-0.35185 0.0271-0.73077-0.0812-0.78491z"/>
|
||||
<path d="m152.15 83.828c-1.1237-0.42137-3.3991-0.3371-4.3823-0.16855-0.25282 0.05619-0.25282 1.236-0.25282 1.236-0.0843 3.062-0.16855 6.2644-0.25282 9.3264-1.9664-3.0901-4.0171-6.2925-5.9835-9.3825 0 0-0.50564-0.78656-0.75847-0.87084-1.0956-0.50565-3.8485-0.36519-4.4665-0.3371-0.25283 0.02809-0.28092 1.236-0.28092 1.236-0.22473 5.6183-0.44946 11.377-0.64611 16.995 0 0-0.0562 1.1237 0.16855 1.1798 1.2079 0.30901 2.2754 0.42137 4.3823 0.22473 0.22473 0 0.25282-1.236 0.25282-1.236 0.14046-3.1462 0.28092-6.5453 0.39328-9.6915 2.0226 3.1462 4.1014 6.4329 6.1239 9.5792 0 0 0.50564 0.75847 0.73037 0.89893 0.0281 0.0281 0.0562 0.0562 0.0843 0.0562 1.1798 0.28091 3.371 0.25282 4.3823 0.16855 0.25282-0.0281 0.25282-1.236 0.25282-1.236 0.14046-5.5621 0.28091-11.208 0.44946-16.771 0 0 0-1.1237-0.19664-1.2079z"/>
|
||||
<path d="m134.11 91.164c-0.89073-6.8754-8.2671-9.5754-13.946-6.1795-4.231 2.5887-5.2888 8.6012-3.5073 12.999 1.6701 3.9526 6.4857 6.1238 10.605 5.1496 5.5114-1.2526 7.9053-6.7362 6.8475-11.969zm-4.6207 3.5908c-0.30619 3.2846-4.0083 4.7877-6.7362 3.1454-2.533-1.3361-2.5052-4.9269-1.5031-7.2372 0.72372-1.5588 2.4495-2.366 4.1196-2.3382 3.6464-0.16701 4.4537 3.4794 4.1197 6.43z"/>
|
||||
<path d="m115.04 97.845c-0.3897-1.0021-2.728-2.2826-3.7857-2.0877-0.22269 0.02784-0.64024 0.64023-0.66807 0.66807-0.55673 0.83509-1.2805 1.531-2.1712 2.0042-2.0877 1.0021-4.2033-0.33404-5.1775-2.2826-1.7537-3.563 0.47321-8.5179 4.2033-8.3509 1.3083 0 2.5331 0.69591 3.2012 1.8372 0.13918 0.13918 0.33403 0.19485 0.52889 0.13918 1.0578-0.16702 2.0599-0.52889 2.9785-1.0856 0.19486-0.0835 0.27837-0.3062 0.22269-0.52889-1.197-3.6465-6.0126-5.3724-9.5757-4.3425-3.3125 0.72374-5.8178 3.6465-6.5415 6.9034-2.8115 10.606 10.606 17.899 16.563 7.8777 0.16702-0.3062 0.3062-0.55672 0.22269-0.75158z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg></a>
|
||||
|
||||
${search(app)}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
const { html } = require('uhtml-ssr');
|
||||
|
||||
module.exports = (pageTitle, pageDescription) => {
|
||||
pageTitle = pageTitle ?? process.env.APP_NAME;
|
||||
pageDescription = pageDescription ?? process.env.APP_DESCRIPTION;
|
||||
pageTitle = pageTitle ?? 'Lexiconga';
|
||||
pageDescription = pageDescription ?? 'The quick and easy dictionary builder for constructed languages.';
|
||||
let ogUrl = typeof window !== 'undefined' ? window.location.href : 'https://lexiconga.com';
|
||||
ogUrl = ogUrl.split('?')[0].split('#')[0];
|
||||
|
||||
return html`<head>
|
||||
<meta charset="utf-8">
|
||||
|
@ -12,14 +14,14 @@ module.exports = (pageTitle, pageDescription) => {
|
|||
<meta name="description" content="${pageDescription}">
|
||||
<meta name="keywords" content="conlanging, dictionary, dictionaries, lexicon, conlangs, constructed languages, glossopoeia, builder, app, tool">
|
||||
|
||||
<meta property="og:url" content="https://${process.env.APP_DOMAIN}/">
|
||||
<meta property="og:url" content="${ogUrl}/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:title" content="${pageTitle}">
|
||||
<meta property="og:description" content="${pageDescription}">
|
||||
<meta property="og:image" content="images/social.jpg">
|
||||
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image:alt" content="${process.env.APP_NAME} logo">
|
||||
<meta name="twitter:image:alt" content="Lexiconga logo">
|
||||
|
||||
<link rel="icon" href="images/favicon.png" type="image/x-icon">
|
||||
|
||||
|
@ -27,7 +29,7 @@ module.exports = (pageTitle, pageDescription) => {
|
|||
<meta name="theme-color" content="#000000">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="apple-mobile-web-app-title" content="${process.env.APP_NAME}">
|
||||
<meta name="apple-mobile-web-app-title" content="Lexiconga">
|
||||
<link rel="apple-touch-icon" href="images/icon-152.png">
|
||||
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
|
|
|
@ -29,7 +29,7 @@ const footer = require('./elements/body/footer');
|
|||
}
|
||||
}
|
||||
|
||||
if (window.isOffline) {
|
||||
if (window?.isOffline) {
|
||||
// addMessage('<strong>You are using the Offline version of Lexiconga.</strong><br>Refresh the page while connected to the internet to enable using accounts.', 0);
|
||||
}
|
||||
// Migrate Old Dictionaries
|
||||
|
|
|
@ -3,14 +3,14 @@ const overrides = require('require-overrides');
|
|||
overrides.set('uhtml', 'uhtml-ssr'); // Replace instances of `uhtml` with `uhtml-ssr` so Node can return strings from the generated html
|
||||
const { render } = require('uhtml-ssr');
|
||||
|
||||
module.exports = (pageContent) => `<!DOCTYPE html>
|
||||
module.exports = (title, description, content) => `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
${render(String, require('../elements/head')(`Help | ${process.env.APP_NAME}`))}
|
||||
${render(String, require('../elements/head')(title, description))}
|
||||
<body class="defaultTheme">
|
||||
${render(String, require('../elements/body/header')())}
|
||||
<main>
|
||||
<article>
|
||||
${marked.parse(pageContent)}
|
||||
${marked.parse(content)}
|
||||
</article>
|
||||
</main>
|
||||
${render(String, require('../elements/body/footer')())}
|
||||
|
|
8
src/pages/help/index.js
Normal file
8
src/pages/help/index.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const genericPage = require('../generic');
|
||||
|
||||
module.exports = () => {
|
||||
const pageContent = fs.readFileSync(path.resolve(__dirname, './content.md'), 'utf-8');
|
||||
return genericPage('Help | Lexiconga', 'The complete guide to using Lexiconga', pageContent);
|
||||
};
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This document was last updated on June 5, 2019 to update information about our hosting service and how your data is used (i.e. to display your dicitonaries and sometimes send you emails if you agree to receive them) and to reflect changes to Lexiconga made during the app update.
|
||||
|
||||
This Privacy Policy governs the manner in which Lexiconga collects, uses, maintains and discloses information collected from users (each, a "User") of the https://lexicon.ga website ("Site") and its accounts ("Account").
|
||||
This Privacy Policy governs the manner in which Lexiconga collects, uses, maintains and discloses information collected from users (each, a "User") of the https://lexiconga.com website ("Site") and its accounts ("Account").
|
||||
|
||||
### Personal identification information
|
||||
We may collect personal identification information from Users in a variety of ways, including, but not limited to, when Users visit our site, register on the site, and in connection with other activities, services, features or resources we make available on our Site. Users may be asked for, as appropriate, their name and email address. Users may, however, use our Site anonymously. We will collect personal identification information from Users only if they voluntarily submit such information to us. Users can always refuse to supply personal identification information, except that it may prevent them from engaging in certain Site-related activities.
|
8
src/pages/privacy/index.js
Normal file
8
src/pages/privacy/index.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const genericPage = require('../generic');
|
||||
|
||||
module.exports = () => {
|
||||
const pageContent = fs.readFileSync(path.resolve(__dirname, './content.md'), 'utf-8');
|
||||
return genericPage('Privacy Policy | Lexiconga', 'Details about how Lexiconga uses your data.', pageContent);
|
||||
};
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Last updated: June 5, 2019 — Minor text fixes and link additions.
|
||||
|
||||
Please read these Terms of Service ("Terms", "Terms of Service") carefully before using the https://lexicon.ga website (the "Service") or the cloud account service (an "Account") operated by [Robbie Antenesse](https://robbie.antenesse.net) and [Alamantus GameDev](https://alamantus.com) ("us", "we", or "our").
|
||||
Please read these Terms of Service ("Terms", "Terms of Service") carefully before using the https://lexiconga.com website (the "Service") or the cloud account service (an "Account") operated by [Robbie Antenesse](https://robbie.antenesse.net) and [Alamantus GameDev](https://alamantus.com) ("us", "we", or "our").
|
||||
|
||||
Your access to and use of the Service is conditioned on your acceptance of and compliance with these Terms. These Terms apply to all visitors, users and others who access or use the Service. By accessing or using the Service you agree to be bound by these Terms. If you disagree with any part of the terms then you may not access the Service.
|
||||
|
8
src/pages/terms/index.js
Normal file
8
src/pages/terms/index.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const genericPage = require('../generic');
|
||||
|
||||
module.exports = () => {
|
||||
const pageContent = fs.readFileSync(path.resolve(__dirname, './content.md'), 'utf-8');
|
||||
return genericPage('Terms of Service | Lexiconga', 'The legal terms and conditions for using Lexiconga\'s services', pageContent);
|
||||
};
|
8
src/routes/api.js
Normal file
8
src/routes/api.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
module.exports = (fastify, options, done) => {
|
||||
|
||||
// fastify.get('/(index.html)?', async (request, response) => {
|
||||
// return response.sendFile(() => require('../pages/index')(), 'index.html');
|
||||
// });
|
||||
|
||||
done();
|
||||
}
|
|
@ -1,36 +1,101 @@
|
|||
const path = require('node:path');
|
||||
const esbuild = require('esbuild');
|
||||
const sass = require('sass');
|
||||
const HyperExpress = require('hyper-express');
|
||||
const router = new HyperExpress.Router();
|
||||
const { minifyHTMLLiterals, defaultShouldMinify } = require('minify-html-literals');
|
||||
|
||||
router.get('/lexiconga.js', async (request, response) => {
|
||||
const filePath = path.join(process.cwd(), '/src/lexiconga.js');
|
||||
return response.type('text/javascript').sendFile(() => {
|
||||
const build = esbuild.buildSync({
|
||||
entryPoints: [filePath],
|
||||
sourcemap: false,
|
||||
write: false,
|
||||
bundle: true,
|
||||
minify: true,
|
||||
treeShaking: true,
|
||||
platform: 'browser',
|
||||
format: 'iife',
|
||||
target: 'es2015',
|
||||
// require('require-overrides').set('uhtml', 'uhtml-ssr'); // Replace instances of `uhtml` with `uhtml-ssr` so Node can return strings from the generated html
|
||||
// const { render } = require('uhtml-ssr');
|
||||
|
||||
module.exports = (fastify, options, done) => {
|
||||
|
||||
fastify.get('/', async (request, reply) => {
|
||||
return reply.sendFile(() => require('../pages/index')(), 'index.html');
|
||||
});
|
||||
|
||||
fastify.get('/index.html', async (request, reply) => {
|
||||
return reply.sendFile(() => require('../pages/index')(), 'index.html');
|
||||
});
|
||||
|
||||
fastify.get('/offline.html', async (request, reply) => {
|
||||
return reply.sendFile(() => require('../pages/offline')(), 'index.html');
|
||||
});
|
||||
|
||||
fastify.get('/help.html', async (request, reply) => {
|
||||
return reply.sendFile(() => require('../pages/help')());
|
||||
});
|
||||
|
||||
fastify.get('/privacy.html', async (request, reply) => {
|
||||
return reply.sendFile(() => require('../pages/privacy')());
|
||||
});
|
||||
|
||||
fastify.get('/terms.html', async (request, reply) => {
|
||||
return reply.sendFile(() => require('../pages/terms')());
|
||||
});
|
||||
|
||||
fastify.get('/lexiconga.js', (request, reply) => {
|
||||
const { isProd } = fastify;
|
||||
const filePath = path.join(process.cwd(), '/src/lexiconga.js');
|
||||
|
||||
reply.sendFile(() => {
|
||||
const build = esbuild.buildSync({
|
||||
entryPoints: [filePath],
|
||||
sourcemap: !isProd,
|
||||
write: false,
|
||||
bundle: true,
|
||||
minify: isProd,
|
||||
treeShaking: true,
|
||||
platform: 'browser',
|
||||
format: 'iife',
|
||||
target: 'es2015',
|
||||
});
|
||||
|
||||
const { text } = build.outputFiles[0];
|
||||
|
||||
if (isProd) {
|
||||
const final = minifyHTMLLiterals(text, {
|
||||
minifyOptions: {
|
||||
collapseWhitespace: true,
|
||||
conservativeCollapse: true,
|
||||
collapseInlineTagWhitespace: true,
|
||||
decodeEntities: true,
|
||||
removeAttributeQuotes: true,
|
||||
continueOnParseError: true,
|
||||
removeComments: true,
|
||||
removeEmptyAttributes: true,
|
||||
removeRedundantAttributes: true,
|
||||
},
|
||||
shouldMinify(template) {
|
||||
return (
|
||||
defaultShouldMinify(template) ||
|
||||
template.parts.some(part => {
|
||||
return part.text.includes('<!DOCTYPE html>');
|
||||
})
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
if (final && typeof final.code !== 'undefined') {
|
||||
return final.code;
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
});
|
||||
console.log(build);
|
||||
const file = build.outputFiles[0];
|
||||
return file.contents;
|
||||
});
|
||||
});
|
||||
|
||||
router.get('styles.css', async (request, response) => {
|
||||
const filePath = path.join(process.cwd(), '/src/styles.scss');
|
||||
return response.type('text/css').sendFile(() => {
|
||||
const compiledSass = sass.compile(filePath, { style: 'compressed' });
|
||||
return compiledSass.css;
|
||||
fastify.get('/styles.css', (request, reply) => {
|
||||
const { isProd } = fastify;
|
||||
const filePath = path.join(process.cwd(), '/src/styles.scss');
|
||||
|
||||
return reply.sendFile(() => {
|
||||
const compiledSass = sass.compile(filePath, {
|
||||
style: isProd ? 'compressed' : 'expanded',
|
||||
sourceMap: !isProd,
|
||||
});
|
||||
|
||||
return compiledSass.css;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
||||
done();
|
||||
};
|
||||
|
|
41
src/routes/index.js
Normal file
41
src/routes/index.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
// const overrides = require('require-overrides');
|
||||
// overrides.set('uhtml', 'uhtml-ssr'); // Replace instances of `uhtml` with `uhtml-ssr` so Node can return strings from the generated html
|
||||
// const { render } = require('uhtml-ssr');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
module.exports = (fastify, options, done) => {
|
||||
fastify.decorate('files', {});
|
||||
fastify.decorate('getFile', (path, generateFile = () => undefined) => {
|
||||
if (typeof fastify.files[path] === 'undefined') {
|
||||
fastify.files[path] = generateFile();
|
||||
}
|
||||
return fastify.files[path];
|
||||
});
|
||||
fastify.decorateReply('sendFile', function (generateFile = () => undefined, path = undefined) {
|
||||
if (typeof path === 'undefined') {
|
||||
path = this.request.url;
|
||||
}
|
||||
const file = fastify.getFile(path, generateFile);
|
||||
|
||||
let type = 'text/html';
|
||||
const fileExt = path.split('.').pop();
|
||||
switch (fileExt) {
|
||||
case 'js': {
|
||||
type = 'text/javascript';
|
||||
break;
|
||||
}
|
||||
case 'css': {
|
||||
type = 'text/css';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return this.type(type).send(file);
|
||||
});
|
||||
|
||||
fastify.register(require('./assets'))
|
||||
.register(require('./api'));
|
||||
|
||||
done();
|
||||
};
|
|
@ -1,18 +0,0 @@
|
|||
// const overrides = require('require-overrides');
|
||||
// overrides.set('uhtml', 'uhtml-ssr'); // Replace instances of `uhtml` with `uhtml-ssr` so Node can return strings from the generated html
|
||||
// const { render } = require('uhtml-ssr');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
module.exports = (fastify, options, done) => {
|
||||
console.log(path.resolve('./public'));
|
||||
fastify.register(require('@fastify/static'), {
|
||||
root: path.resolve('./public'),
|
||||
});
|
||||
|
||||
fastify.get('/', (request, reply) => {
|
||||
reply.sendFile('index.html');
|
||||
});
|
||||
|
||||
done();
|
||||
};
|
|
@ -1,22 +0,0 @@
|
|||
const path = require('path');
|
||||
const sass = require('sass');
|
||||
const overrides = require('require-overrides');
|
||||
overrides.set('uhtml', 'uhtml-ssr'); // Replace instances of `uhtml` with `uhtml-ssr` so Node can return strings from the generated html
|
||||
const { render } = require('uhtml-ssr');
|
||||
const HyperExpress = require('hyper-express');
|
||||
const router = new HyperExpress.Router();
|
||||
|
||||
router.get('/', async (request, response) => {
|
||||
return response.type('text/html').sendFile(() => {
|
||||
return require('../pages/index')();
|
||||
});
|
||||
});
|
||||
|
||||
router.get('/help', async (request, response) => {
|
||||
return response.type('text/html').sendFile(() => {
|
||||
return require('../pages/help')();
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
require('dotenv').config();
|
||||
|
||||
const fastify = require('fastify')()
|
||||
.register(require('@fastify/helmet'))
|
||||
// .register(require('@fastify/mysql'), {
|
||||
// connectionString: 'mysql://root@localhost/mysql',
|
||||
// })
|
||||
.register(require('@fastify/jwt'), {
|
||||
secret: process.env.JWT_SECRET,
|
||||
})
|
||||
.register(require('@fastify/websocket'))
|
||||
.register(require('./routes/routes'));
|
||||
|
||||
fastify.listen({ port: 3000 }, err => {
|
||||
if (err) throw err;
|
||||
console.log(`server listening on http://localhost:${fastify.server.address().port}`);
|
||||
});
|
|
@ -1,28 +1,24 @@
|
|||
const HyperExpress = require('hyper-express');
|
||||
require('dotenv').config();
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
require('dotenv').config();
|
||||
}
|
||||
|
||||
const server = new HyperExpress.Server();
|
||||
server.files = {};
|
||||
const fastify = require('fastify')();
|
||||
|
||||
server.use((req, res, next) => {
|
||||
req.hasFile = typeof server.files[req.path] !== 'undefined';
|
||||
res.sendFile = (setFile = () => {}) => {
|
||||
if (!req.hasFile) {
|
||||
server.files[req.path] = setFile();
|
||||
}
|
||||
return res.send(server.files[req.path]);
|
||||
};
|
||||
fastify.decorate('isProd', process.env.NODE_ENV === 'production');
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
server.use('/', require('./routes/assets'));
|
||||
server.use('/', require('./routes/web'));
|
||||
fastify.register(require('@fastify/helmet'))
|
||||
// .register(require('@fastify/mysql'), {
|
||||
// connectionString: 'mysql://root@localhost/mysql',
|
||||
// })
|
||||
.register(require('@fastify/jwt'), {
|
||||
secret: process.env.JWT_SECRET,
|
||||
})
|
||||
// .register(require('@fastify/websocket'))
|
||||
.register(require('./routes'))
|
||||
;
|
||||
|
||||
const port = process.env.APP_PORT ?? 8080;
|
||||
server.listen(port)
|
||||
.then(socket => console.log(`Web server started on http://localhost:${port}`))
|
||||
.catch(error => console.error('Failed to start web server: ', error));
|
||||
|
||||
return server;
|
||||
|
||||
fastify.listen({ port }, err => {
|
||||
if (err) throw err;
|
||||
console.log(`server listening on http://localhost:${fastify.server.address().port}`);
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue