- Implemented main entry point for React application in `main.jsx`. - Created `Gallery` component for displaying images with infinite scroll and pull-to-refresh functionality. - Developed `ImageDetail` component for showing detailed information and actions for selected images. - Added `Settings` component for configuring API connection settings. - Integrated Vite for build and development with PWA support. - Implemented caching strategies for API responses and image previews using Workbox.
82 lines
2.0 KiB
JavaScript
82 lines
2.0 KiB
JavaScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import { VitePWA } from 'vite-plugin-pwa';
|
|
|
|
export default defineConfig({
|
|
root: '.',
|
|
build: {
|
|
outDir: 'build',
|
|
emptyOutDir: true,
|
|
},
|
|
plugins: [
|
|
react(),
|
|
VitePWA({
|
|
registerType: 'autoUpdate',
|
|
workbox: {
|
|
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2}'],
|
|
runtimeCaching: [
|
|
{
|
|
urlPattern: /^.*\/api\/v1\/images\?/,
|
|
handler: 'NetworkFirst',
|
|
options: {
|
|
cacheName: 'api-images-list',
|
|
expiration: {
|
|
maxEntries: 50,
|
|
maxAgeSeconds: 60 * 5,
|
|
},
|
|
networkTimeoutSeconds: 10,
|
|
},
|
|
},
|
|
{
|
|
urlPattern: /^.*\/api\/v1\/images\/\d+\/preview/,
|
|
handler: 'CacheFirst',
|
|
options: {
|
|
cacheName: 'image-previews',
|
|
expiration: {
|
|
maxEntries: 500,
|
|
maxAgeSeconds: 60 * 60 * 24,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
urlPattern: /^.*\/api\/v1\/(tags|films)/,
|
|
handler: 'NetworkFirst',
|
|
options: {
|
|
cacheName: 'api-metadata',
|
|
expiration: {
|
|
maxEntries: 20,
|
|
maxAgeSeconds: 60 * 10,
|
|
},
|
|
networkTimeoutSeconds: 10,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
manifest: {
|
|
name: 'darktable Gallery',
|
|
short_name: 'darktable',
|
|
description: 'darktable REST API web interface',
|
|
theme_color: '#0d0d0d',
|
|
background_color: '#0d0d0d',
|
|
display: 'standalone',
|
|
orientation: 'any',
|
|
start_url: '/',
|
|
icons: [
|
|
{
|
|
src: 'icon.svg',
|
|
sizes: 'any',
|
|
type: 'image/svg+xml',
|
|
purpose: 'any maskable',
|
|
},
|
|
],
|
|
},
|
|
devOptions: {
|
|
enabled: false,
|
|
},
|
|
}),
|
|
],
|
|
server: {
|
|
port: 5173,
|
|
},
|
|
});
|