Skip to content
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

Remove VITE_CALDERA_URL and use window.location.origin to route API requests #67

Merged
merged 1 commit into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .env.template

This file was deleted.

1 change: 0 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const app = createApp(App);
const $api = axios.create({
withCredentials: true,
});
if (import.meta.env.DEV) $api.defaults.baseURL = "http://localhost:8888";
app.provide("$api", $api);

app.use(createPinia());
Expand Down
7 changes: 1 addition & 6 deletions src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import NotFoundView from "./views/NotFoundView.vue";
// Cant use global API variable because we aren't in a component
const $api = axios.create({
withCredentials: true,
baseURL: import.meta.env.VITE_CALDERA_URL || "http://localhost:8888",
baseURL: window.location.origin,
});

const router = createRouter({
Expand Down Expand Up @@ -113,11 +113,6 @@ const router = createRouter({
{
path: '/docs/index.html',
beforeEnter: () => {
// Redirect to the external docs page
if (!import.meta.env.PROD) {
window.location.href = (import.meta.env.VITE_CALDERA_URL || 'http://localhost:8888') + '/docs/index.html';
return;
}
window.location.href = '/docs/index.html';
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/views/ExfilledFilesView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function downloadSelectedFiles() {
let filename = filePath.split(/[\/\\]/);
filename = filename[filename.length - 1];
let uri = `${
import.meta.env.VITE_CALDERA_URL || "http://localhost:8888"
window.location.origin
}/file/download_exfil?file=${btoa(filePath)}`;
let downloadAnchorNode = document.createElement("a");
downloadAnchorNode.setAttribute("href", uri);
Expand Down