response.headers['Cross-Origin-Opener-Policy'] = "same-origin"
return response
+@app.route("/manifest.json")
+def get_manifest():
+ return send_file("static/manifest.json", mimetype="application/json")
\ No newline at end of file
--- /dev/null
+{
+ "short_name": "Onyx Playground",
+ "name": "Onyx Playground - Try Onyx without Installing",
+ "icons": [
+ {
+ "src": "/playground/static/logo_256.png",
+ "type": "image/png",
+ "sizes": "256x256"
+ }
+ ],
+ "start_url": "/playground/?source=pwa",
+ "background_color": "#111",
+ "display": "standalone",
+ "scope": "/playground",
+ "theme_color": "#111",
+ "shortcuts": [],
+ "description": "Onyx Playground",
+ "screenshots": []
+}
\ No newline at end of file
--- /dev/null
+const cacheName = 'cache-v1';
+const precacheResources = [
+ '/playground',
+ '/playground/static/css/index.css',
+ '/playground/static/vendor/fontawesome/css/all.min.css',
+ '/playground/static/vendor/fontawesome/css/v4-shims.min.css',
+ '/playground/static/vendor/jquery/jquery.modal.min.css',
+ '/playground/static/src/resizer.js',
+ '/playground/static/src/storage.js',
+ '/playground/static/src/canvas.js',
+ '/playground/static/src/index.js',
+ '/playground/static/vendor/ace/ace.js',
+ '/playground/static/vendor/jquery/jquery.min.js',
+ '/playground/static/vendor/jquery/jquery.modal.min.js',
+];
+
+
+self.addEventListener('install', event => {
+ console.log("Service worker installed.");
+ event.waitUntil(
+ caches.open(cacheName)
+ .then(cache => {
+ return cache.addAll(precacheResources);
+ })
+ );
+});
+
+self.addEventListener("fetch", event => {
+ console.log('Fetch intercepted for:', event.request.url);
+ event.respondWith(caches.match(event.request)
+ .then(cachedResponse => {
+ if (cachedResponse) {
+ return cachedResponse;
+ }
+ return fetch(event.request);
+ })
+ );
+});
\ No newline at end of file
<html lang="en">
<head>
<title>Onyx compiler</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+ <link rel="manifest" href="/playground/manifest.json">
<link rel="stylesheet" href="{{ config['ENDPOINT'] + url_for('static', filename='css/index.css') }}" />
<link rel="stylesheet" href="{{ config['ENDPOINT'] + url_for('static', filename='vendor/fontawesome/css/all.min.css') }}" />