rework login to wor with authentik

rework env handling a runtime
remove oketbase
This commit is contained in:
2024-05-15 16:00:56 +02:00
parent 206bdd0e55
commit 2eea436641
22 changed files with 1253 additions and 813 deletions

View File

@@ -1,13 +1,16 @@
import vue from '@vitejs/plugin-vue';
import * as path from "path";
import { defineConfig, loadEnv } from 'vite';
import zlib from 'zlib';
import runtimeEnv from 'vite-plugin-runtime-env';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
return {
plugins: [vue()],
plugins: [
runtimeEnv(),
vue(),
],
resolve: {
alias: {
'src': path.resolve(__dirname, './src/'),
@@ -21,74 +24,6 @@ export default defineConfig(({ mode }) => {
watch: {
usePolling: true
},
proxy: {
'/marbas/': {
target: env.MARBAS_URL,
changeOrigin: true,
followRedirects: true,
rewrite: path => path.replace(/^\/marbas/, ''),
selfHandleResponse: true,
configure: proxy => {
proxy.on('proxyRes', (proxyRes, req, res) => {
const chunks = [];
proxyRes.on("data", (chunk) => chunks.push(chunk));
proxyRes.on("end", () => {
const buffer = Buffer.concat(chunks);
const encoding = proxyRes.headers["content-encoding"];
const relace = (b: Buffer) => {
let remoteBody = b.toString();
const modifiedBody = remoteBody.replace(env.MARBAS_URL, '/marbas/');
res.write(modifiedBody);
res.end();
}
if (!encoding) {
relace(buffer);
} else if (encoding === "gzip" || encoding === "deflate") {
zlib.unzip(buffer, (err, b) => {
if (!err) {
relace(b);
} else {
console.error(err);
}
});
} else {
console.error(`Unsupported encoding: ${encoding}`);
}
});
});
}
},
'/pocketbase/': {
target: env.POCKET_BASE_URL,
changeOrigin: true,
followRedirects: true,
rewrite: path => path.replace(/^\/pocketbase/, ''),
},
'/evepraisal/': {
target: env.EVEPRAISAL_URL,
changeOrigin: true,
followRedirects: true,
rewrite: path => path.replace(/^\/evepraisal/, ''),
},
'/fuzzwork/': {
target: env.FUZZWORK_URL,
changeOrigin: true,
followRedirects: true,
rewrite: path => path.replace(/^\/fuzzwork/, ''),
},
'/esi/': {
target: env.ESI_URL,
changeOrigin: true,
followRedirects: true,
rewrite: path => path.replace(/^\/esi/, ''),
headers: {
'User-Agent': env.ESI_USER_AGENT
},
}
}
}
};
})