SIWE auth, API proxy fixes, dashboard, login, usage pages

- SIWE auth flow: challenge/login/logout/me API routes + JWT middleware
- Fixed [...path] catch-all: Kubo proxy with matchRoute() + mapToKuboAPI()
- Fixed session_id → nonce field mismatch in AuthProvider
- Fixed dashboard pins crash: Kubo returns {Keys: {...}}, not array
- Added middleware route guard (307 redirect to /login)
- Added login, register, profile, usage, upload pages
- Added dashboard components (StorageGauge, FreeTierProgress)
- Added SWR hooks + AuthGuard + Providers + Toast/ErrorBoundary
- Added payment integration (smart contract ABI, tiers, tokens)
- Fixed IPNS key listing: Name/Id → name/id mapping
- Added PWA support (manifest, service worker, icons)
- Added tests for helpers, limits, search-index, wallet
This commit is contained in:
maikrolf
2026-06-28 18:31:05 +02:00
parent 1ddc89479c
commit c9432a16ba
84 changed files with 6679 additions and 1426 deletions
+10
View File
@@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<defs>
<linearGradient id="g" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#6366f1"/>
<stop offset="100%" stop-color="#a855f7"/>
</linearGradient>
</defs>
<rect width="32" height="32" rx="6" fill="url(#g)"/>
<text x="16" y="22" text-anchor="middle" font-family="system-ui" font-weight="800" font-size="18" fill="white">M</text>
</svg>

After

Width:  |  Height:  |  Size: 446 B

+4
View File
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="192" height="192" viewBox="0 0 192 192">
<rect width="192" height="192" rx="32" fill="#0891b2"/>
<text x="96" y="108" font-family="system-ui, sans-serif" font-size="96" font-weight="bold" fill="white" text-anchor="middle">M</text>
</svg>

After

Width:  |  Height:  |  Size: 289 B

+4
View File
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512">
<rect width="512" height="512" rx="64" fill="#0891b2"/>
<text x="256" y="290" font-family="system-ui, sans-serif" font-size="256" font-weight="bold" fill="white" text-anchor="middle">M</text>
</svg>

After

Width:  |  Height:  |  Size: 291 B

+31
View File
@@ -0,0 +1,31 @@
{
"name": "MAOS IPFS Portal",
"short_name": "IPFS Portal",
"description": "Decentralized storage management for your IPFS node",
"start_url": "/",
"display": "standalone",
"background_color": "#0a0e17",
"theme_color": "#0891b2",
"orientation": "any",
"categories": ["utilities", "productivity"],
"icons": [
{
"src": "/icon-192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any maskable"
},
{
"src": "/icon-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any maskable"
},
{
"src": "/icon-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
]
}
+143
View File
@@ -0,0 +1,143 @@
/* ── IPFS Portal — Service Worker v2 ──
*
* Cache strategieën per route type:
* - Precache: app shell (alle pages)
* - Cache-first: static assets (fonts, images, CSS, JS)
* - Network-first: API calls (/_next/data, /api/*)
* - Stale-while-revalidate: navigatie requests
*/
const CACHE = 'ipfs-portal-v2';
const STATIC_CACHE = 'ipfs-portal-static-v2';
const DATA_CACHE = 'ipfs-portal-data-v2';
const PRECACHE_URLS = [
'/',
'/dashboard',
'/upload',
'/explorer',
'/pins',
'/history',
'/usage',
'/peers',
'/users',
'/ipns',
'/login',
'/settings',
'/profile',
];
/* ── Install: precache app shell ── */
self.addEventListener('install', (event) => {
event.waitUntil(
caches.open(CACHE).then((cache) => cache.addAll(PRECACHE_URLS))
);
self.skipWaiting();
});
/* ── Activate: clean old caches ── */
self.addEventListener('activate', (event) => {
event.waitUntil(
caches.keys().then((keys) =>
Promise.all(
keys
.filter((k) => k !== CACHE && k !== STATIC_CACHE && k !== DATA_CACHE)
.map((k) => caches.delete(k))
)
)
);
self.clients.claim();
});
/* ── Helper: is this a navigation request? ── */
function isNavigation(req) {
return req.mode === 'navigate';
}
function isStaticAsset(url) {
return /\.(png|jpg|jpeg|gif|svg|webp|ico|woff2?|ttf|eot|css|js|json)$/i.test(url.pathname);
}
function isAPIRequest(url) {
return url.pathname.startsWith('/api/') || url.pathname.startsWith('/_next/data/');
}
/* ── Fetch handler ── */
self.addEventListener('fetch', (event) => {
const { request } = event;
const url = new URL(request.url);
// Same-origin only
if (url.origin !== self.location.origin) return;
// 1. Static assets → cache-first
if (isStaticAsset(url)) {
event.respondWith(cacheFirst(request, STATIC_CACHE));
return;
}
// 2. API / Next.js data → network-first
if (isAPIRequest(url)) {
event.respondWith(networkFirst(request, DATA_CACHE));
return;
}
// 3. Navigation → stale-while-revalidate
if (isNavigation(request)) {
event.respondWith(staleWhileRevalidate(request, CACHE));
return;
}
// 4. All other requests → network-first with cache fallback
event.respondWith(networkFirst(request, CACHE));
});
/* ── Cache strategies ── */
async function cacheFirst(request, cacheName) {
const cached = await caches.match(request);
if (cached) return cached;
try {
const response = await fetch(request);
if (response.ok) {
const cache = await caches.open(cacheName);
cache.put(request, response.clone());
}
return response;
} catch {
return new Response('Offline', { status: 503 });
}
}
async function networkFirst(request, cacheName) {
try {
const response = await fetch(request);
if (response.ok) {
const cache = await caches.open(cacheName);
cache.put(request, response.clone());
}
return response;
} catch {
const cached = await caches.match(request);
if (cached) return cached;
return new Response('Offline', { status: 503 });
}
}
async function staleWhileRevalidate(request, cacheName) {
const cache = await caches.open(cacheName);
const cached = await cache.match(request);
const fetchPromise = fetch(request)
.then((response) => {
if (response.ok) cache.put(request, response.clone());
return response;
})
.catch(() => cached);
return cached || fetchPromise;
}