feat: enhance authentication with JWT support and clean up unused code

This commit is contained in:
Noooste
2025-12-08 22:37:14 +01:00
parent f4eaca62e8
commit d8694bc272
15 changed files with 145 additions and 156 deletions
@@ -100,7 +100,6 @@ export function ObjectBrowserView({
return new Promise((resolve) => {
if (item.isFile) {
item.file((file: File) => {
// Add the relative path to the file object
const fullPath = path + file.name;
Object.defineProperty(file, 'webkitRelativePath', {
value: fullPath,
-10
View File
@@ -16,7 +16,6 @@ import type {
StorageMetrics,
} from '@/types';
// Configure axios instance with base URL
const api = axios.create({
baseURL: import.meta.env.VITE_API_URL || 'http://localhost:8080/api',
headers: {
@@ -24,7 +23,6 @@ const api = axios.create({
},
});
// Add request interceptor for authentication
api.interceptors.request.use((config) => {
const token = localStorage.getItem('auth-token');
if (token) {
@@ -33,7 +31,6 @@ api.interceptors.request.use((config) => {
return config;
});
// Add response interceptor for error handling
api.interceptors.response.use(
(response) => {
// If response has success=false in data, treat it as an error
@@ -119,7 +116,6 @@ export const bucketsApi = {
},
updateSettings: async (name: string, settings: Partial<BucketDetails>): Promise<void> => {
// TODO: Implement when backend endpoint is ready
await api.patch(`/v1/buckets/${name}/settings`, settings);
},
};
@@ -185,12 +181,6 @@ export const objectsApi = {
});
},
uploadStream: async (bucket: string, key: string, data: Blob | File, contentType?: string): Promise<void> => {
await api.put(`/v1/buckets/${bucket}/objects/${encodeURIComponent(key)}`, data, {
headers: { 'Content-Type': contentType || 'application/octet-stream' },
});
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
uploadMultiple: async (bucket: string, files: File[]): Promise<any> => {
const formData = new FormData();
-2
View File
@@ -199,10 +199,8 @@ export function AccessControl() {
try {
const updates: { status?: string; expiration?: string } = {};
// Add status change
updates.status = keyStatus;
// Add expiration if set and not "never expires"
if (!neverExpires && expirationDate) {
updates.expiration = new Date(expirationDate).toISOString();
} else if (neverExpires) {