Skip to content

Commit

Permalink
Fix redirects problem (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
andraghetti authored Jan 14, 2025
1 parent 23ecedb commit b461a87
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 18 deletions.
15 changes: 15 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@
<link rel="icon" type="image/x-icon" href="/images/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>The Good AI Lab</title>
<script type="text/javascript">
// Single Page Apps for GitHub Pages
// MIT License
// https://github.com/rafgraph/spa-github-pages
(function(l) {
if (l.search[1] === '/' ) {
var decoded = l.search.slice(1).split('&').map(function(s) {
return s.replace(/~and~/g, '&')
}).join('?');
window.history.replaceState(null, null,
l.pathname.slice(0, -1) + decoded + l.hash
);
}
}(window.location))
</script>
</head>
<body>
<div id="root"></div>
Expand Down
24 changes: 24 additions & 0 deletions frontend/public/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>The Good AI Lab</title>
<script type="text/javascript">
// Single Page Apps for GitHub Pages
// MIT License
// https://github.com/rafgraph/spa-github-pages
var pathSegmentsToKeep = 0;

var l = window.location;
l.replace(
l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' +
l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') +
(l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') +
l.hash
);
</script>
</head>
<body>
</body>
</html>
1 change: 1 addition & 0 deletions frontend/public/_redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* /index.html 200
33 changes: 15 additions & 18 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,21 @@ import react from '@vitejs/plugin-react';
import ViteYaml from '@modyfi/vite-plugin-yaml';

// https://vitejs.dev/config/
export default defineConfig(() => {
return {
base: './',
plugins: [
react(),
ViteYaml(),
],
optimizeDeps: {
exclude: ['lucide-react'],
include: ['@modyfi/vite-plugin-yaml']
},
build: {
assetsDir: 'assets',
rollupOptions: {
output: {
assetFileNames: 'assets/[name].[hash][extname]'
}
export default defineConfig({
plugins: [
react(),
ViteYaml(),
],
optimizeDeps: {
exclude: ['lucide-react'],
include: ['@modyfi/vite-plugin-yaml']
},
build: {
assetsDir: 'assets',
rollupOptions: {
output: {
assetFileNames: 'assets/[name].[hash][extname]'
}
}
};
}
});

0 comments on commit b461a87

Please sign in to comment.