forked from maik/IPFS-portal
fix: bw/stats 404, gateway links, history crash
- swr.ts: remove useBandwidth(), drop bw from useDashboard() - events/route.ts: skip bandwidth SSE (Kubo 0.28.0 unsupported) - usage/page.tsx: remove getBWStats call + bw references - helpers.ts: gatewayLink -> ipfs.maos.dedyn.io (subdomain only) - upload/page.tsx: fix local gatewayLink (subdomain only) - storage.ts: update default gatewayUrl, add defensive getHistory()
This commit is contained in:
@@ -83,7 +83,7 @@ services:
|
||||
- NEXT_TELEMETRY_DISABLED=1
|
||||
- USER_API_BASE=http://192.168.1.176:8444
|
||||
- USER_API_ADMIN_KEY=maos-admin-2024
|
||||
- KUBO_API_URL=http://tom1687.no-ip.org:8443
|
||||
- KUBO_API_URL=http://192.168.1.176:8443
|
||||
- KUBO_BASIC_AUTH=portal:ipfs-portal-2024
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3445/api/health"]
|
||||
|
||||
Generated
+2
-7
@@ -8,7 +8,6 @@
|
||||
"name": "@maos/ipfs-portal",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@maos/ipfs-portal": "file:",
|
||||
"@tailwindcss/postcss": "^4.3.1",
|
||||
"clsx": "^2.1.1",
|
||||
"jose": "^6.2.3",
|
||||
@@ -22,8 +21,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.61.1",
|
||||
"@types/node": "^22.0.0",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/node": "22.20.0",
|
||||
"@types/react": "19.2.17",
|
||||
"@types/react-dom": "^19.0.0",
|
||||
"tailwindcss": "^4.0.0",
|
||||
"typescript": "^5.8.0",
|
||||
@@ -590,10 +589,6 @@
|
||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@maos/ipfs-portal": {
|
||||
"resolved": "",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@napi-rs/wasm-runtime": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.6.tgz",
|
||||
|
||||
+3
-3
@@ -7,10 +7,10 @@
|
||||
"dev": "next dev --port 3445",
|
||||
"dev:webpack": "next dev --port 3445 --webpack",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"export": "next build && npx serve out"
|
||||
},
|
||||
"dependencies": {
|
||||
"@maos/ipfs-portal": "file:",
|
||||
"@tailwindcss/postcss": "^4.3.1",
|
||||
"clsx": "^2.1.1",
|
||||
"jose": "^6.2.3",
|
||||
@@ -24,8 +24,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.61.1",
|
||||
"@types/node": "^22.0.0",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/node": "22.20.0",
|
||||
"@types/react": "19.2.17",
|
||||
"@types/react-dom": "^19.0.0",
|
||||
"tailwindcss": "^4.0.0",
|
||||
"typescript": "^5.8.0",
|
||||
|
||||
+10
-3
@@ -69,6 +69,11 @@ self.addEventListener('fetch', (event) => {
|
||||
// Same-origin only
|
||||
if (url.origin !== self.location.origin) return;
|
||||
|
||||
// Only cache GET/HEAD — POST/PUT/DELETE/OPTIONS can't use Cache API
|
||||
if (request.method !== 'GET' && request.method !== 'HEAD') {
|
||||
return; // pass through, no caching
|
||||
}
|
||||
|
||||
// 1. Static assets → cache-first
|
||||
if (isStaticAsset(url)) {
|
||||
event.respondWith(cacheFirst(request, STATIC_CACHE));
|
||||
@@ -98,7 +103,8 @@ async function cacheFirst(request, cacheName) {
|
||||
if (cached) return cached;
|
||||
try {
|
||||
const response = await fetch(request);
|
||||
if (response.ok) {
|
||||
// Cache API supports GET/HEAD only
|
||||
if (response.ok && request.method === 'GET') {
|
||||
const cache = await caches.open(cacheName);
|
||||
cache.put(request, response.clone());
|
||||
}
|
||||
@@ -111,7 +117,8 @@ async function cacheFirst(request, cacheName) {
|
||||
async function networkFirst(request, cacheName) {
|
||||
try {
|
||||
const response = await fetch(request);
|
||||
if (response.ok) {
|
||||
// Cache API supports GET/HEAD only — POST/PUT/DELETE must be skipped
|
||||
if (response.ok && request.method === 'GET') {
|
||||
const cache = await caches.open(cacheName);
|
||||
cache.put(request, response.clone());
|
||||
}
|
||||
@@ -129,7 +136,7 @@ async function staleWhileRevalidate(request, cacheName) {
|
||||
|
||||
const fetchPromise = fetch(request)
|
||||
.then((response) => {
|
||||
if (response.ok) cache.put(request, response.clone());
|
||||
if (response.ok && request.method === 'GET') cache.put(request, response.clone());
|
||||
return response;
|
||||
})
|
||||
.catch(() => cached);
|
||||
|
||||
@@ -17,7 +17,7 @@ import { NextRequest, NextResponse } from 'next/server';
|
||||
import { createPublicClient, http, type Address, type Hash, type Chain } from 'viem';
|
||||
import { IPFS_PORTAL_PAYMENT_ABI } from '@/lib/payment';
|
||||
|
||||
const RPC_URL = process.env.ZKSYNC_RPC_URL || 'http://tom1687.no-ip.org:3050';
|
||||
const RPC_URL = process.env.ZKSYNC_RPC_URL || 'http://192.168.1.176:3050';
|
||||
const CONTRACT_ADDRESS = (process.env.PAYMENT_CONTRACT_ADDRESS || '0xCBc6b8aeea129c206F4836799621C833Bf8B9BDe') as Address;
|
||||
|
||||
const zkSyncLocal: Chain = {
|
||||
|
||||
@@ -348,7 +348,7 @@ export default function PaymentPanel({
|
||||
<div className="flex items-center justify-between text-xs">
|
||||
<span className="text-surface-400">Tx</span>
|
||||
<a
|
||||
href={`http://tom1687.no-ip.org:3050/tx/${txHash}`}
|
||||
href={`http://192.168.1.176:3050/tx/${txHash}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center gap-1 text-brand-400 hover:text-brand-300 font-mono"
|
||||
|
||||
@@ -8,10 +8,10 @@ export const zkSyncLocal: Chain = {
|
||||
name: 'zkSync Local',
|
||||
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
|
||||
rpcUrls: {
|
||||
default: { http: ['http://tom1687.no-ip.org:3050'] },
|
||||
default: { http: ['http://192.168.1.176:3050'] },
|
||||
},
|
||||
blockExplorers: {
|
||||
default: { name: 'Explorer', url: 'http://tom1687.no-ip.org:3050' },
|
||||
default: { name: 'Explorer', url: 'http://192.168.1.176:3050' },
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -56,8 +56,8 @@ const ZKSYNC_LOCAL_CHAIN = {
|
||||
chainId: '0x10E', // 270
|
||||
chainName: 'zkSync Local',
|
||||
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
|
||||
rpcUrls: ['http://tom1687.no-ip.org:3050'],
|
||||
blockExplorerUrls: ['http://tom1687.no-ip.org:3050'],
|
||||
rpcUrls: ['http://192.168.1.176:3050'],
|
||||
blockExplorerUrls: ['http://192.168.1.176:3050'],
|
||||
};
|
||||
|
||||
/* ── EIP-6963 event-based provider discovery ── */
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
# IPFS-Portal PM2 start script — runs from /srv/apps/ipfs-portal
|
||||
# Usage: pm2 start start-pm2.sh --name ipfs-portal
|
||||
set -e
|
||||
cd /srv/apps/ipfs-portal || { echo "ERROR: /srv/apps/ipfs-portal not found"; exit 1; }
|
||||
echo "=== npm install ==="
|
||||
npm install
|
||||
echo "=== npm run build ==="
|
||||
npm run build
|
||||
echo "=== next start port ${PORT:=3005} ==="
|
||||
# Consume any extra args PM2 passes (e.g. --port=3005)
|
||||
shift "$(($# < 1 ? 0 : 1))" 2>/dev/null || true
|
||||
exec npx next start --port "$PORT" "$@"
|
||||
Reference in New Issue
Block a user