feat(web): add Progressive Web App (PWA) support (#25274)
129
web/public/_offline.html
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Dify - Offline</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 600px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
backdrop-filter: blur(10px);
|
||||
border-radius: 20px;
|
||||
padding: 40px;
|
||||
box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
margin: 0 auto 30px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 48px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 32px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 18px;
|
||||
line-height: 1.6;
|
||||
opacity: 0.9;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
button {
|
||||
background: white;
|
||||
color: #764ba2;
|
||||
border: none;
|
||||
padding: 15px 30px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
border-radius: 50px;
|
||||
cursor: pointer;
|
||||
transition: transform 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
button:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.container {
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="icon">
|
||||
⚡
|
||||
</div>
|
||||
<h1>You're Offline</h1>
|
||||
<p>
|
||||
It looks like you've lost your internet connection.
|
||||
Some features may not be available until you're back online.
|
||||
</p>
|
||||
<button onclick="window.location.reload()">
|
||||
Try Again
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Check for connection status changes
|
||||
window.addEventListener('online', function() {
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
// Periodically check if online
|
||||
setInterval(function() {
|
||||
fetch(window.location.origin, { method: 'HEAD' })
|
||||
.then(function() {
|
||||
window.location.reload();
|
||||
})
|
||||
.catch(function() {
|
||||
// Still offline
|
||||
});
|
||||
}, 5000);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
BIN
web/public/apple-touch-icon.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
11
web/public/browserconfig.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square70x70logo src="/icon-72x72.png"/>
|
||||
<square150x150logo src="/icon-152x152.png"/>
|
||||
<square310x310logo src="/icon-512x512.png"/>
|
||||
<TileColor>#1C64F2</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
||||
1
web/public/fallback-hxi5kegOl0PxtKhvDL_OX.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
(()=>{"use strict";self.fallback=async e=>"document"===e.destination?caches.match("/_offline.html",{ignoreSearch:!0}):Response.error()})();
|
||||
BIN
web/public/icon-128x128.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
web/public/icon-144x144.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
web/public/icon-152x152.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
web/public/icon-192x192.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
web/public/icon-256x256.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
web/public/icon-384x384.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
web/public/icon-512x512.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
web/public/icon-72x72.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
web/public/icon-96x96.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
58
web/public/manifest.json
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
"name": "Dify",
|
||||
"short_name": "Dify",
|
||||
"description": "Build Production Ready Agentic AI Solutions",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/icon-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "any"
|
||||
},
|
||||
{
|
||||
"src": "/icon-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
},
|
||||
{
|
||||
"src": "/icon-256x256.png",
|
||||
"sizes": "256x256",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/icon-384x384.png",
|
||||
"sizes": "384x384",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/icon-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#1C64F2",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone",
|
||||
"scope": "/",
|
||||
"start_url": "/",
|
||||
"orientation": "portrait-primary",
|
||||
"categories": ["productivity", "utilities", "developer"],
|
||||
"lang": "en-US",
|
||||
"dir": "ltr",
|
||||
"prefer_related_applications": false,
|
||||
"shortcuts": [
|
||||
{
|
||||
"name": "Apps",
|
||||
"short_name": "Apps",
|
||||
"url": "/apps",
|
||||
"icons": [{ "src": "/icon-96x96.png", "sizes": "96x96" }]
|
||||
},
|
||||
{
|
||||
"name": "Datasets",
|
||||
"short_name": "Datasets",
|
||||
"url": "/datasets",
|
||||
"icons": [{ "src": "/icon-96x96.png", "sizes": "96x96" }]
|
||||
}
|
||||
]
|
||||
}
|
||||